/* X GAME — Tetris */
.hra-tetris { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.hra-tetris .hlavicka { padding-top: 6px; padding-bottom: 4px; }
.hra-tetris .pruh-hracu { padding-bottom: 4px; }
.hra-tetris .ph { padding: 3px 9px; }
.hra-tetris .plocha { flex: 1; min-height: 0; padding: 2px 8px calc(6px + var(--safe-b)); display: flex; flex-direction: column; }

.tt {
  --tt-cell: 26px; --tt-bok: 70px; --tt-tl: 56px;
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px;
  touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.tt [hidden] { display: none !important; }

/* soupeři */
.tt-souperi { display: flex; justify-content: center; gap: 6px; flex: none; }
.tt-mini { position: relative; display: grid; justify-items: center; gap: 1px; }
.tt-mini canvas { display: block; border-radius: 3px; box-shadow: 0 0 0 1px #2c3150, 0 0 10px #3f7bff22; }
.tt-mini-jm { font-size: 10px; font-weight: 800; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 12px; }
.tt-mini-s { font-size: 9px; color: var(--muted); line-height: 10px; }
.tt-mini em { display: none; position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 22px; filter: drop-shadow(0 2px 3px #000); }
.tt-mini.ko canvas { opacity: .55; filter: grayscale(1); }
.tt-mini.ko em { display: block; }
.tt-mini.ko .tt-mini-jm { color: var(--muted); text-decoration: line-through; }

/* deska */
.tt-hlavni { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; gap: 6px; touch-action: none; }
.tt-meter {
  position: relative; align-self: center; width: 8px; height: calc(var(--tt-cell) * 20); border-radius: 4px;
  background: #151827; box-shadow: inset 0 0 0 1px #262a40; overflow: hidden; flex: none;
}
.tt-meter i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(#ff8a8a, #ff2d4b); transition: height .18s ease; border-radius: 4px; }
.tt-meter.plno { box-shadow: inset 0 0 0 1px #ff3b5c88, 0 0 12px #ff3b5c66; }
.tt-meter.hodne i { animation: tt-blik .4s ease-in-out infinite alternate; }
.tt-meter.tep { animation: tt-tep .35s ease; }
@keyframes tt-blik { to { filter: brightness(1.6); } }
@keyframes tt-tep { 40% { transform: scaleX(1.8); } }

.tt-deska-obal {
  position: relative; flex: none; border-radius: 6px; padding: 0;
  box-shadow: 0 0 0 2px #2b3156, 0 0 0 3px #0b0d18, 0 0 24px #3f7bff40, 0 12px 30px #000a;
}
.tt-deska { display: block; border-radius: 6px; }

/* bok: hold, další, statistiky */
.tt-bok { width: var(--tt-bok); flex: none; display: flex; flex-direction: column; gap: 6px; align-self: center; height: calc(var(--tt-cell) * 20); }
.tt-box { background: #10121f; border: 1px solid #262a40; border-radius: 10px; padding: 4px 3px 3px; display: grid; justify-items: center; gap: 2px; }
.tt-box b, .tt-st span { font-size: 10px; font-weight: 900; letter-spacing: .12em; color: #8d93b8; }
.tt-box canvas { display: block; }
.tt-st { display: grid; gap: 0; padding: 0 3px; }
.tt-st b { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-st-rek b { color: var(--accent); font-size: 14px; }
.tt-bok-tl { margin-top: auto; display: flex; gap: 6px; }
.tt-mini-tl { width: 32px; height: 32px; border-radius: 10px; border: 1px solid #262a40; background: #151827; color: #fff; font-size: 15px; padding: 0; }

/* tlačítka */
.tt-tlacitka { flex: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.tt-tlacitka button {
  height: var(--tt-tl); min-height: 44px; border: 0; border-radius: 14px; padding: 0;
  background: linear-gradient(#262a40, #1a1d2e); color: #e8eaff; font-size: 22px; font-weight: 900;
  box-shadow: 0 3px 0 #0c0e18, inset 0 1px 0 #ffffff14; touch-action: none;
  transition: transform .05s ease, background .05s ease;
}
.tt-tlacitka button.stisk { transform: translateY(2px); box-shadow: 0 1px 0 #0c0e18; background: linear-gradient(#3a4062, #262a40); }
.tt-tlacitka [data-a="tvrde"] { color: var(--accent); }
.tt-tlacitka .tt-tl-hold { font-size: 13px; letter-spacing: .06em; }

/* overlay */
.tt-ov {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center;
  pointer-events: none; border-radius: 6px; padding: 10px;
}
.tt-ov.pauza, .tt-ov.ko, .tt-ov.konec { background: #05060ccc; backdrop-filter: blur(2px); }
.tt-ov.pauza { pointer-events: auto; }
.tt-ov-h { font-size: 30px; font-weight: 900; letter-spacing: .04em; color: #fff; text-shadow: 0 0 18px #3f7bff; }
.tt-ov-h.zlato { color: var(--accent); text-shadow: 0 0 22px #ffcc0099; animation: tt-pulz 0.8s ease-in-out infinite alternate; }
.tt-ov-h.cerv { color: #ff5470; text-shadow: 0 0 18px #ff3b5c99; }
.tt-ov-skore { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--accent); }
.tt-ov-p { color: #c3c7e6; font-weight: 700; font-size: 14px; }
.tt-ov-rek { margin-top: 4px; padding: 5px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 900; letter-spacing: .05em; animation: tt-pulz .6s ease-in-out infinite alternate; }
@keyframes tt-pulz { to { transform: scale(1.08); } }
.tt-poradi { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; min-width: 190px; }
.tt-poradi li { display: grid; grid-template-columns: 26px 1fr auto; gap: 6px; align-items: center; background: #151827; border-radius: 9px; padding: 5px 9px; font-size: 14px; text-align: left; }
.tt-poradi li.ja { box-shadow: inset 0 0 0 1px var(--accent); }
.tt-poradi li:first-child span { color: var(--accent); }
.tt-poradi b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-poradi i { font-style: normal; font-variant-numeric: tabular-nums; color: #c3c7e6; font-weight: 700; }
.tt-odpocet { font-size: 110px; font-weight: 900; color: #fff; text-shadow: 0 0 30px #3f7bff, 0 6px 0 #0008; animation: tt-odp 1s ease-out infinite; }
.tt-odpocet.start { font-size: 54px; color: var(--accent); text-shadow: 0 0 30px #ffcc0099; animation: tt-pulz .35s ease-in-out infinite alternate; }
@keyframes tt-odp { from { transform: scale(1.5); opacity: 0; } 25% { transform: scale(1); opacity: 1; } to { opacity: .2; transform: scale(.85); } }

/* vyskakovací texty */
.tt-popup { position: absolute; left: 0; right: 0; top: 30%; display: grid; justify-items: center; gap: 4px; pointer-events: none; }
.tt-pop { font-weight: 900; font-size: 18px; color: #fff; text-shadow: 0 2px 0 #0009, 0 0 14px #3f7bff; animation: tt-pop 1.4s ease-out both; letter-spacing: .04em; }
.tt-pop.tetris {
  font-size: 46px; color: #fff; letter-spacing: .02em;
  background: linear-gradient(90deg, #27e0f0, #ffd21f, #ff4757, #b45cff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px #27e0f0aa) drop-shadow(0 3px 0 #000);
  text-shadow: none;
}
.tt-pop.tspin { color: #d9a8ff; text-shadow: 0 0 14px #b45cff; }
.tt-pop.b2b { color: var(--accent); font-size: 15px; }
.tt-pop.combo { color: #7cf3a0; font-size: 16px; }
.tt-pop.level { color: #27e0f0; font-size: 22px; }
.tt-pop.utok { color: #ff7088; font-size: 15px; }
@keyframes tt-pop { 0% { opacity: 0; transform: scale(.4); } 14% { opacity: 1; transform: scale(1.15); } 24% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-36px); } }

@media (prefers-reduced-motion: reduce) { .tt-odpocet, .tt-pop { animation: none !important; } }

/* pauza celé místnosti (bitva) — deska i soupeři zakrytí, ať nikdo neplánuje */
.tt-ov.pauza-mp { background: #070812; pointer-events: auto; gap: 10px; }
.tt-ov.pauza-mp .tt-ov-p b { color: var(--accent); }
.tt-pokracuj {
  margin-top: 8px; min-height: 54px; padding: 0 28px; border: 0; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); font-size: 18px; font-weight: 900; box-shadow: 0 4px 0 #b38f00;
}
.tt-pokracuj:active { transform: translateY(2px); box-shadow: 0 2px 0 #b38f00; }
.tt.tt-pauza-mp .tt-mini canvas { visibility: hidden; }
.tt.tt-pauza-mp .tt-mini { background: #10121f; border-radius: 4px; }
.tt.tt-pauza-mp .tt-mini::after { content: "⏸"; position: absolute; top: 30%; left: 50%; transform: translateX(-50%); font-size: 16px; color: #8d93b8; }
.tt.tt-pauza-mp .tt-hold, .tt.tt-pauza-mp .tt-next { visibility: hidden; }
