:root {
  --bg: #1d1b3a;
  --panel: #2c2a55;
  --ink: #f5f3e7;
  --muted: #a9a6d6;
  --line: #0b0a1a;
  --accent: #ffd23f;
  --tile-ink: #14121f;
  --green: #5ee06a;
  --red: #ff5a5a;
  --orange: #ff9c3a;
  --yellow: #ffe45c;
  --white: #ffffff;
  --px: 4px;
  --font-title: 'Press Start 2P', 'Courier New', monospace;
  --font-body: 'VT323', 'Courier New', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  /* jemná pixelová mriežka */
  background-image:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 16px 16px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 24px;
  line-height: 1.2;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 32px 16px 48px; }

.title {
  font-family: var(--font-title);
  font-size: clamp(18px, 5.2vw, 30px);
  line-height: 1.5;
  text-align: center;
  color: var(--accent);
  text-shadow: var(--px) var(--px) 0 var(--line);
  margin: 0 0 28px;
  text-wrap: balance;
}

/* spoločný „pixelový" rám */
.panel, .tab, button, input, textarea, select, .guess, .items li {
  border: var(--px) solid var(--line);
  border-radius: 0;
  box-shadow: var(--px) var(--px) 0 var(--line);
}

.tabs { display: flex; gap: 12px; margin-bottom: 16px; }
.tab { flex: 1; }

/* Tlačidlá sú vo VT323: Press Start 2P nemá čitateľné veľké Ý a Á. */
button, .btn {
  font-family: var(--font-body);
  font-size: 28px;
  line-height: 1;
  padding: 10px 16px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
button:hover:not(:disabled) { filter: brightness(1.15); }
button:active:not(:disabled) { transform: translate(var(--px), var(--px)); box-shadow: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: var(--px) solid var(--accent);
  outline-offset: 2px;
}
.tab[aria-selected="true"], button.primary, #submit { background: var(--accent); color: var(--tile-ink); }

.panel { background: var(--panel); padding: 20px 16px; }
.hint { margin: 0 0 14px; color: var(--muted); }

.items { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; margin: 0 0 20px; }
.items li { background: var(--ink); color: var(--tile-ink); padding: 6px 12px; font-size: 28px; overflow-wrap: anywhere; }

form#form, .guess-form { display: flex; gap: 12px; }
input, textarea, select {
  font-family: var(--font-body);
  font-size: 26px;
  padding: 8px 12px;
  background: var(--white);
  color: var(--tile-ink);
  min-width: 0;
  width: 100%;
}
.guess-form input { flex: 1; }
.guess-form button { flex: none; }

.msg { min-height: 1.2em; margin: 14px 0 0; color: var(--ink); }
.msg.error { color: var(--red); }

.guesses { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.guess {
  display: flex; align-items: baseline; gap: 12px;
  padding: 8px 12px;
  color: var(--tile-ink);
  animation: pop .18s steps(3) both;
}
.g-text { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 28px; }
.g-label { font-size: 20px; opacity: .8; text-align: right; }
.g-score { font-family: var(--font-title); font-size: 12px; white-space: nowrap; }

.green { background: var(--green); }
.red { background: var(--red); }
.orange { background: var(--orange); }
.yellow { background: var(--yellow); }
.white { background: var(--white); }

@keyframes pop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .guess { animation: none; } }

.legend {
  list-style: none; padding: 0; margin: 32px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  color: var(--muted); font-size: 20px;
}
.legend li { display: flex; align-items: center; gap: 8px; }
.sw { width: 16px; height: 16px; border: 2px solid var(--line); display: inline-block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@media (max-width: 480px) {
  form#form, .guess-form { flex-direction: column; }
  .g-label { display: none; }
}

/* ---------- admin ---------- */
.admin .wrap { max-width: 860px; }
.admin h2 { font-family: var(--font-title); font-size: 14px; margin: 28px 0 14px; color: var(--accent); }
.admin label { display: block; margin: 12px 0 4px; color: var(--muted); }
.admin textarea { min-height: 120px; resize: vertical; }
.admin .row { display: flex; gap: 12px; flex-wrap: wrap; }
.admin .row > div { flex: 1; min-width: 180px; }
.admin .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.admin .topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin a { color: var(--accent); }
.admin .flash { padding: 8px 12px; margin: 0 0 16px; border: var(--px) solid var(--line); color: var(--tile-ink); }
.admin .flash.ok { background: var(--green); }
.admin .flash.err { background: var(--red); }
.admin .tablewrap { overflow-x: auto; }
.admin table { width: 100%; border-collapse: collapse; background: var(--panel); border: var(--px) solid var(--line); }
.admin th, .admin td { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line); vertical-align: top; }
.admin th { color: var(--muted); font-weight: normal; }
.admin td form { display: inline; }
.admin td button { padding: 4px 10px; font-size: 22px; }
.admin tr.now td { background: rgba(255, 210, 63, .12); }
.admin button.danger { background: var(--red); color: var(--tile-ink); }

/* ---------- prihlásenie a história ---------- */
[hidden] { display: none !important; }

.authbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; color: var(--muted); font-size: 22px;
}
.authbar .who { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.authbar button { font-size: 22px; padding: 6px 12px; }

.tabs { flex-wrap: wrap; }
.tab { min-width: 140px; }

.history { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.hrow {
  border: var(--px) solid var(--line);
  box-shadow: var(--px) var(--px) 0 var(--line);
  padding: 10px 12px;
  color: var(--tile-ink);
}
.h-when { font-size: 20px; opacity: .8; }
.h-items { font-size: 28px; overflow-wrap: anywhere; }
.h-result, .h-answer { font-size: 22px; }
.h-answer { overflow-wrap: anywhere; }

.admin .status { background: var(--panel); border: var(--px) solid var(--line); padding: 10px 14px; margin-top: 20px; }
.admin .status summary { cursor: pointer; }
.admin .status ul { list-style: none; padding: 0; margin: 12px 0; }
.admin .status li { margin: 4px 0; overflow-wrap: anywhere; }
.admin .status li.ok { color: var(--green); }
.admin .status li.bad { color: var(--red); }

/* ---------- viac hádaniek na deň ---------- */
.cards { display: grid; gap: 24px; }
.cards:empty { display: none; }
#info { margin-bottom: 0; }
#info:not([hidden]) + .cards:not(:empty) { margin-top: 20px; }
#info .hint { margin: 0; }
.card.solved { border-color: var(--green); }
.card .guesses { margin-top: 16px; }

/* ---------- účet, skóre, archív, priatelia ---------- */
.rowbtns { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.rowbtns input { flex: 1; min-width: 160px; width: auto; }
button.small { font-size: 22px; padding: 6px 12px; }
button.danger { background: var(--red); color: var(--tile-ink); }

.loginpanel, .me { margin-bottom: 16px; }
.loginpanel .msg:empty { display: none; }
.emailform { margin-top: 16px; }
.emailform label, .nickform label { display: block; margin: 0 0 4px; color: var(--muted); }
.emailform input { margin-bottom: 12px; }
.emailform .msg, .nickform .msg { margin-top: 10px; }
.nickform { margin-bottom: 16px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stats:empty { display: none; }
.stat { background: var(--bg); border: var(--px) solid var(--line); padding: 8px 10px; text-align: center; min-width: 0; }
.stat-name { color: var(--muted); font-size: 20px; }
.stat-score { font-family: var(--font-title); font-size: 20px; color: var(--accent); margin: 8px 0 4px; }
.stat-sub { color: var(--muted); font-size: 18px; }
.stat-rank { font-size: 20px; margin-top: 4px; overflow-wrap: anywhere; white-space: pre-line; }
.stat-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 18px; }

.cardtop { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.history li { list-style: none; }
button.hrow { display: grid; gap: 2px; width: 100%; text-align: left; line-height: 1.2; }
button.hrow.todo { background: var(--panel); color: var(--ink); }
.hrow .h-when { font-size: 20px; opacity: .8; }

.invite { margin-top: 20px; }
.invite input { margin-bottom: 12px; font-size: 20px; }
.scopes { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0 12px; }
.board { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.brow {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: var(--px) solid var(--line); box-shadow: var(--px) var(--px) 0 var(--line);
  padding: 6px 12px;
}
.brow.me { background: var(--accent); color: var(--tile-ink); }
.b-place { min-width: 2.2em; }
.b-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.b-score { white-space: nowrap; }

@media (max-width: 480px) {
  .stats { gap: 8px; }
  .stat { padding: 6px 4px; }
  .stat-score { font-size: 16px; margin: 6px 0 4px; }
  .stat-sub { display: none; }
  .stat-name, .stat-rank { font-size: 18px; }
}

/* ---------- denné hádanky jedna po druhej ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.pager .p-count { font-family: var(--font-title); font-size: 14px; color: var(--muted); min-width: 4em; text-align: center; }
.locked-note { color: var(--muted); font-size: 20px; margin: 12px 0 0; }
button.hrow.locked { background: var(--panel); color: var(--muted); }
.card .question { font-family: var(--font-body); font-weight: normal; font-size: 30px; color: var(--ink); margin: 0 0 14px; overflow-wrap: anywhere; }
.info-action { margin-top: 14px; }

/* ---------- zdieľanie ---------- */
.sharebar { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin: -12px 0 12px; }
.sharepanel { margin-bottom: 16px; }
.sharepanel .msg:empty { display: none; }
.resultshare { margin-top: 14px; }
.resultshare .rowbtns { margin-top: 12px; }
.resultshare .share-hint { margin: 12px 0 0; font-size: 20px; }
.resultshare .msg:empty { display: none; }
.items.sentence li { line-height: 1.15; }

/* Veľký nápis so skóre po tipe – zmenší sa na miesto tipu v zozname */
.scorefx {
  position: fixed; left: 50%; top: 45%; z-index: 50;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 22px 30px; max-width: calc(100vw - 32px);
  color: var(--tile-ink); text-align: center;
  border: 6px solid #0b0a1a; box-shadow: 10px 10px 0 #0b0a1a;
  pointer-events: none;
}
.fx-label { font-family: var(--font-title); font-size: clamp(18px, 5vw, 34px); line-height: 1.4; }
.fx-score { font-family: var(--font-title); font-size: clamp(28px, 9vw, 64px); }
.confetto { position: fixed; top: 0; width: 12px; height: 12px; z-index: 49; pointer-events: none; }

/* Počet pokusov nad zoznamom tipov */
.g-count { margin: 20px 0 0; font-size: 22px; color: var(--muted); }
.g-count strong { font-family: var(--font-title); font-size: 14px; color: var(--ink); margin-left: 6px; }
.card .g-count + .guesses { margin-top: 10px; }

/* Admin: výsledok skúšky hodnotenia */
.scoring-check { margin-top: 14px; overflow-x: auto; }
.scoring-check table { border-collapse: collapse; width: 100%; font-size: 20px; }
.scoring-check th, .scoring-check td { text-align: left; padding: 4px 8px; border-bottom: 2px solid var(--line); vertical-align: top; }
.scoring-check .bad { color: var(--red); }

/* Okno „Ďalšia otázka" */
.modal-back {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(11, 10, 26, .7);
}
.modal { width: min(440px, 100%); margin: 0; }
.modal-title { font-family: var(--font-title); font-size: 18px; color: var(--accent); margin: 0 0 14px; line-height: 1.5; }
.modal p { font-size: 24px; margin: 0 0 18px; }

/* Pätička a stránka Ochrana súkromia */
.foot { margin: 32px 0 8px; text-align: center; font-size: 20px; }
.foot a, .privacy a { color: var(--muted); }
.privacy h2 { font-family: var(--font-title); font-size: 14px; line-height: 1.6; color: var(--accent); margin: 28px 0 10px; }
.privacy p, .privacy li { font-size: 22px; line-height: 1.35; }
.privacy ul { padding-left: 22px; }
.privacy .missing { color: var(--red); }

/* Lišta so súhlasom s analytikou */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 70;
  max-width: 720px; margin: 0 auto;
}
.consent p { margin: 0 0 14px; font-size: 22px; }
.consent a { color: var(--accent); }
