:root {
  --bg: #0e0e10;
  --panel: #1a1a1d;
  --line: #2c2c31;
  --text: #f2f2f5;
  --muted: #9a9aa4;
  --accent: #4f8cff;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

/* ---------------------------------------------------------- layout */

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

header {
  flex: 0 0 auto;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.who { font-weight: 600; }
.counter { color: var(--muted); font-variant-numeric: tabular-nums; }

.bar {
  margin-top: 8px;
  height: 6px;
  border-radius: 3px;
  background: #2c2c31;
  overflow: hidden;
}

.bar > div {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .25s ease;
}

.stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: #000;
  touch-action: pan-y;
}

.stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.stage .nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22%;
  max-width: 120px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.55);
  font-size: 30px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stage .nav:hover { background: rgba(255,255,255,.05); }
.stage .nav.prev { left: 0; }
.stage .nav.next { right: 0; }
.stage .nav:disabled { opacity: .2; cursor: default; }
.stage .nav:disabled:hover { background: transparent; }

footer {
  flex: 0 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------- buttons */

.cats {
  display: grid;
  /* 150px kuszob: telefonon 2x2, szelesebb kepernyon egy sorban mind a negy. */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.cat {
  min-height: 58px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #26262b;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: transform .08s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}

.cat:active { transform: scale(.96); }
.cat .hk { font-size: 10px; color: var(--muted); font-weight: 500; }
.cat.on { color: #fff; }
.cat.on .hk { color: rgba(255,255,255,.75); }

.tools {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.tools button {
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.tools button:hover { color: var(--text); border-color: #444; }

/* ---------------------------------------------------------- misc */

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 20;
}
.toast.show { opacity: 1; }

.center-msg {
  max-width: 460px;
  margin: 12vh auto;
  padding: 28px 24px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.center-msg h1 { font-size: 20px; margin: 0 0 10px; }
.center-msg p { color: var(--muted); line-height: 1.55; margin: 0; font-size: 14px; }

.done-panel { text-align: center; padding: 20px; }
.done-panel h2 { margin: 0 0 6px; font-size: 18px; }
.done-panel p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* ---------------------------------------------------------- admin */

.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.admin-wrap h1 { font-size: 20px; margin: 0 0 4px; }
.admin-wrap .sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

.cards { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 120px;
}
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--bg); cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(255,255,255,.03); }
.tbl-scroll { overflow-x: auto; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.mini { width: 54px; height: 36px; object-fit: cover; border-radius: 5px; display: block; background: #000; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar a, .toolbar button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.toolbar a:hover, .toolbar button:hover { border-color: #4a4a52; }

@media (max-width: 560px) {
  .cat { min-height: 52px; font-size: 13px; }
  .stage .nav { font-size: 24px; }
}
