/* X GAME — společný vzhled. Hry si přidávají vlastní styly v /xgame/hry/*.css */
:root {
  --bg: #0f0f14;
  --panel: #1a1a23;
  --panel2: #23232f;
  --line: #2f2f3d;
  --text: #f3f3f6;
  --muted: #9b9bb0;
  --accent: #ffcc00;
  --accent-ink: #1a1400;
  --red: #ff3b5c;
  --ok: #2bd47d;
  --blue: #3aa0ff;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
#app { min-height: 100%; max-width: 560px; margin: 0 auto; padding-top: var(--safe-t); }

/* ---------- logo ---------- */
.logo-x {
  display: inline-grid; place-items: center;
  font-weight: 900; font-size: 64px; line-height: 1; width: 1.25em; height: 1.25em;
  color: var(--accent-ink); background: var(--accent); border-radius: 22%;
  transform: rotate(-6deg); box-shadow: 0 6px 0 #b38f00;
  font-family: "Arial Black", Impact, system-ui, sans-serif;
}
.logo-x.mini { font-size: 18px; box-shadow: 0 2px 0 #b38f00; vertical-align: -3px; margin-right: 2px; }
.logo-game { font-weight: 900; font-size: 44px; letter-spacing: .12em; margin-left: 14px; font-family: "Arial Black", Impact, system-ui, sans-serif; }
.nacitam { min-height: 90vh; display: grid; place-content: center; text-align: center; gap: 16px; color: var(--muted); }

/* ---------- tlačítka ---------- */
.tl {
  display: block; width: 100%; min-height: 54px; padding: 12px 18px;
  border: 0; border-radius: var(--r); font-weight: 800; font-size: 17px; letter-spacing: .01em;
  transition: transform .08s, filter .15s, opacity .15s;
}
.tl:active:not(:disabled) { transform: translateY(2px) scale(.99); }
.tl:disabled { opacity: .45; }
.tl-hlavni { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 #b38f00; }
.tl-hlavni:active:not(:disabled) { box-shadow: 0 2px 0 #b38f00; }
.tl-druhy { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.tl-cerveny { background: var(--red); color: #fff; }
.tl-text { background: none; color: var(--muted); font-weight: 600; min-height: 44px; }
.tl.velke { min-height: 62px; font-size: 19px; }
.tl-ikona { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 18px; }
.tl-odejit { min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font-weight: 800; font-size: 14px; }
.tl-odejit:active { transform: translateY(1px); }
.tl-pozvat-pratele { margin-top: 18px; background: linear-gradient(135deg, #3aa0ff, #7a5cff); color: #fff; box-shadow: 0 4px 0 #2b4fa8; letter-spacing: .04em; }
.tl-mini { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 700; color: var(--red); }

/* ---------- úvod ---------- */
.uvod { padding: 32px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.znak { display: flex; align-items: center; justify-content: center; margin: 20px 0 0; }
.podtitul { text-align: center; color: var(--muted); margin: 4px 0 18px; font-weight: 600; }
.pole { display: grid; gap: 6px; }
.pole span { color: var(--muted); font-size: 14px; font-weight: 600; padding-left: 4px; }
.pole input, .vstup-kod {
  width: 100%; min-height: 54px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 18px; font-weight: 700;
  outline: none;
}
.pole input:focus, .vstup-kod:focus { border-color: var(--accent); }
.nebo { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 6px 0; }
.nebo::before, .nebo::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.radek-kod { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.radek-kod .tl { width: auto; }
.vstup-kod { text-align: center; letter-spacing: .4em; text-transform: uppercase; font-size: 24px; font-family: ui-monospace, Menlo, monospace; }
.vstup-kod::placeholder { letter-spacing: .2em; font-size: 18px; color: #55556a; }
.pozvanka { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-align: center; }
.pz-kod { font: 900 40px/1 ui-monospace, Menlo, monospace; letter-spacing: .25em; color: var(--accent); }
.pz-info { color: var(--muted); margin-top: 8px; }
.varuj { color: var(--red); font-weight: 700; }
.instalace { margin-top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; color: var(--muted); }
.instalace summary { font-weight: 700; color: var(--text); cursor: pointer; }
.instalace ol { padding-left: 20px; margin: 10px 0 6px; }
.instalace li { margin: 4px 0; }
.instalace .tl { margin-top: 12px; }
.instalace .ik { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.mala { font-size: 13px; margin: 6px 0 0; }

/* ---------- hlavička ---------- */
.cekarna .hlavicka { grid-template-columns: auto 1fr auto; }
.hlavicka { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: 10px 14px; }
.hl-nazev { text-align: center; font-weight: 900; font-size: 18px; letter-spacing: .04em; }
.hl-kod { font: 700 13px ui-monospace, Menlo, monospace; color: var(--muted); text-align: right; }

/* ---------- čekárna ---------- */
.cekarna { padding: 0 0 calc(110px + var(--safe-b)); }
.cekarna > :not(.hlavicka):not(.spodni-lista) { margin-left: 16px; margin-right: 16px; }
.karta-kod { background: linear-gradient(160deg, #262634, #1a1a23); border: 1px solid var(--line); border-radius: 20px; padding: 18px; text-align: center; }
.kk-popis { color: var(--muted); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.kod-velky { font: 900 56px/1.1 ui-monospace, Menlo, monospace; letter-spacing: .22em; color: var(--accent); margin: 4px 0 14px; padding-left: .22em; }
.nadpis { font-size: 14px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 22px 0 8px 20px !important; }
.pocet { background: var(--panel2); border-radius: 99px; padding: 1px 8px; margin-left: 6px; color: var(--text); }
.hraci { list-style: none; padding: 0; display: grid; gap: 6px; }
.hraci li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-height: 52px; }
.hraci li.off { opacity: .55; }
.hraci .hj { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hraci em { color: var(--muted); font-style: normal; font-weight: 500; }
.tecka { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px #2bd47d33; flex: none; }
li.off .tecka { background: #666; box-shadow: none; }
.stitek { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: #ffcc0022; color: var(--accent); border-radius: 6px; padding: 3px 6px; }
.vyber-hry { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hra-dlazdice {
  display: grid; justify-items: start; gap: 2px; padding: 14px; text-align: left;
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px; min-height: 96px;
}
.hra-dlazdice:disabled { opacity: 1; }
.hra-dlazdice.zvolena { border-color: var(--accent); background: #2a2614; }
.hd-ikona { font-size: 26px; line-height: 1.1; }
.hd-nazev { font-weight: 800; font-size: 16px; }
.hd-pocet { color: var(--muted); font-size: 13px; }
.popis-hry { color: var(--muted); font-size: 14px; margin-top: 10px !important; }
.nastaveni { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px !important; font-weight: 600; font-size: 14px; }
.segment { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.segment button { border: 0; background: none; padding: 8px 12px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.segment button.akt { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.spodni-lista, .konec-lista {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(transparent, var(--bg) 30%);
  max-width: 560px; margin: 0 auto;
}
.konec-lista { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; background: var(--bg); border-top: 1px solid var(--line); }
.konec-lista[hidden] { display: none; }
.konec-lista .cekani { grid-column: 1 / -1; }
.cekani { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 600; min-height: 54px; text-align: center; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: toc 0.9s linear infinite; flex: none; }
@keyframes toc { to { transform: rotate(360deg); } }

/* ---------- hra ---------- */
.hra { min-height: 100vh; display: flex; flex-direction: column; }
.pruh-hracu { display: flex; gap: 6px; overflow-x: auto; padding: 0 14px 8px; scrollbar-width: none; }
.pruh-hracu::-webkit-scrollbar { display: none; }
.ph { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; padding: 6px 10px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); min-width: 64px; max-width: 110px; }
.ph.tah { border-color: var(--accent); box-shadow: 0 0 0 3px #ffcc0030; }
.ph.ja .ph-jm { color: var(--accent); }
.ph.off { opacity: .5; }
.ph-jm { font-weight: 800; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-s { font-size: 12px; color: var(--muted); }
.ph-vyhodit { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; line-height: 22px; padding: 0; }
.plocha { flex: 1; padding: 6px 14px calc(96px + var(--safe-b)); position: relative; }
.prazdno { color: var(--muted); text-align: center; margin-top: 40px; }
.hlaska { text-align: center; font-weight: 800; font-size: 17px; margin: 8px 0; min-height: 24px; }
.hlaska.moje { color: var(--accent); }

/* ---------- toast, dialog, offline ---------- */
#toast {
  position: fixed; left: 50%; top: calc(12px + var(--safe-t)); transform: translate(-50%, calc(-100% - 40px - var(--safe-t)));
  background: #2b2b38; color: var(--text); padding: 12px 18px; border-radius: 14px; font-weight: 700;
  box-shadow: 0 10px 30px #0009; z-index: 50; max-width: calc(100% - 32px); text-align: center;
  transition: transform .25s ease, opacity .25s ease, visibility 0s linear .25s; pointer-events: none;
  opacity: 0; visibility: hidden;
}
#toast.vidim { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .25s ease, opacity .15s ease, visibility 0s; }
#toast.chyba { background: #4a1622; color: #ffd5dc; }
#dialog { position: fixed; inset: 0; background: #000b; z-index: 40; display: grid; place-items: center; padding: 20px; }
#dialog[hidden] { display: none; }
.dlg { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px; width: 100%; max-width: 380px; }
.dlg p { font-size: 18px; font-weight: 700; margin: 0 0 18px; text-align: center; }
.dlg-tl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dlg.menu { display: grid; gap: 10px; }
body.offline::after {
  content: "Spojení vypadlo — připojuji znovu…"; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--red); color: #fff; font-weight: 800; text-align: center; padding: 10px 10px calc(10px + var(--safe-b));
}

@media (min-width: 600px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
