:root {
  --x: #ff5468; --o: #36b9ff;
  --ink: #f7f2ff; --mute: #b9b0d6;
  --glass: rgb(26 20 52 / .62); --line: rgb(255 255 255 / .12);
  --gold: #ffd166;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #140f2a; color: var(--ink); font: 16px/1.4 Outfit, system-ui, sans-serif; }
[hidden] { display: none !important; }

.bg { position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 52%, #4a3170 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 15% 10%, rgb(255 84 104 / .22), transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 95%, rgb(54 185 255 / .2), transparent 70%),
    linear-gradient(180deg, #1b1338, #0d0a1f); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; touch-action: none; display: block; }

/* ---------- úvod ---------- */
.home { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse at center, rgb(13 10 31 / .25), rgb(13 10 31 / .7)); }
.card { width: min(420px, 100%); background: var(--glass); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line); border-radius: 26px; padding: 26px 22px 22px; display: grid; gap: 12px;
  box-shadow: 0 30px 80px rgb(0 0 0 / .5), inset 0 1px 0 rgb(255 255 255 / .1); animation: rise .6s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.logo { font: 900 34px/1.1 Nunito, sans-serif; margin: 0 0 2px; text-align: center; letter-spacing: .5px; }
.logo b { background: linear-gradient(90deg, var(--gold), #ff9d5c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo .x { color: var(--x); text-shadow: 0 0 18px rgb(255 84 104 / .7); }
.logo .o { color: var(--o); text-shadow: 0 0 18px rgb(54 185 255 / .7); margin-right: 6px; }
.lead { margin: 0 0 6px; color: var(--mute); text-align: center; font-size: 15px; }
.lead b { color: var(--ink); }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--mute); }
input { font: inherit; color: var(--ink); background: rgb(0 0 0 / .3); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; width: 100%; min-width: 0; }
input:focus { border-color: rgb(255 209 102 / .6); box-shadow: 0 0 0 3px rgb(255 209 102 / .15); }

.btn { font: 600 16px Outfit, sans-serif; color: var(--ink); background: rgb(255 255 255 / .08); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform .12s, background .2s, box-shadow .2s; }
.btn:hover { background: rgb(255 255 255 / .14); }
.btn:active { transform: scale(.97); }
.btn small { font-weight: 400; opacity: .75; font-size: 13px; }
.btn.primary { background: linear-gradient(135deg, #ff6b7d, #ff8f5a 55%, #ffc95c); border: 0; color: #2a0f14; box-shadow: 0 8px 26px rgb(255 120 90 / .4); }
.btn.primary small { color: #3a1810; }
.btn.small { padding: 10px 14px; font-size: 15px; }
.pc-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.seg { display: flex; background: rgb(0 0 0 / .3); border: 1px solid var(--line); border-radius: 14px; padding: 3px; }
.seg button { font: 600 13px Outfit, sans-serif; color: var(--mute); background: none; border: 0; border-radius: 11px; padding: 0 10px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: rgb(255 255 255 / .14); color: var(--ink); }
.join { display: grid; gap: 6px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--mute); }
.row { display: flex; gap: 8px; }
#joinCode { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }

/* ---------- hra ---------- */
.hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.hud > * { pointer-events: auto; }
.top { display: flex; align-items: center; gap: 8px; }
.home-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--glass); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: 19px; cursor: pointer; backdrop-filter: blur(10px); }
.players { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.vs { color: var(--mute); font-weight: 700; }
.pl { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1 1 0; max-width: 220px; padding: 7px 11px; border-radius: 14px; background: var(--glass);
  border: 1px solid var(--line); backdrop-filter: blur(10px); transition: box-shadow .3s, border-color .3s, transform .3s; }
.pl.p1 { justify-content: flex-end; }
.pl .mk { font-style: normal; font-weight: 800; font-size: 18px; }
.p0 .mk { color: var(--x); } .p1 .mk { color: var(--o); }
.pl .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.p1 .nm { text-align: right; }
.pl .sc { font: 900 20px Nunito, sans-serif; }
.pl .dot { width: 7px; height: 7px; border-radius: 50%; background: #6b6488; flex: none; }
.pl .dot.on { background: #5fe39a; box-shadow: 0 0 8px #5fe39a; }
.pl .dot.gone { display: none; }
.pl.turn.p0 { border-color: var(--x); box-shadow: 0 0 22px rgb(255 84 104 / .45); transform: translateY(1px) scale(1.03); }
.pl.turn.p1 { border-color: var(--o); box-shadow: 0 0 22px rgb(54 185 255 / .45); transform: translateY(1px) scale(1.03); }

.status { text-align: center; margin-top: 12px; pointer-events: none; text-shadow: 0 2px 12px rgb(0 0 0 / .6); }
.status h2 { margin: 0; font: 800 23px/1.2 Nunito, sans-serif; }
.status p { margin: 3px 0 0; color: var(--mute); font-size: 14px; min-height: 1.2em; }
.status h2.pop { animation: pop .5s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

.invite { align-self: center; margin-top: auto; margin-bottom: auto; width: min(380px, 100%); display: grid; gap: 8px; text-align: center;
  background: var(--glass); border: 1px solid var(--line); border-radius: 22px; padding: 18px; backdrop-filter: blur(16px); animation: rise .5s; }
.invite .lbl { color: var(--mute); font-size: 13px; }
.invite b { font: 900 40px Nunito, sans-serif; letter-spacing: 8px; color: var(--gold); text-shadow: 0 0 24px rgb(255 209 102 / .4); }
.invite small { color: var(--mute); }

.bottom { margin-top: auto; display: grid; gap: 8px; justify-items: center; }
.over-row { display: flex; gap: 8px; animation: rise .4s; }
.over-row .btn { min-width: 150px; }
.opts { display: grid; gap: 8px; padding: 10px 12px; border-radius: 16px; background: rgb(0 0 0 / .18); border: 1px solid var(--line); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--mute); }
.opt .seg button { padding: 7px 10px; }
@media (max-width: 380px) { .opt { flex-direction: column; align-items: stretch; } .opt .seg button { flex: 1; } }
.reacts { display: flex; gap: 2px; padding: 4px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px);
  overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.reacts button { font-size: 22px; background: none; border: 0; padding: 4px 6px; cursor: pointer; border-radius: 10px; flex: none; }
.reacts button:active { transform: scale(1.3); }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 9; background: rgb(20 14 40 / .92); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; animation: rise .3s; max-width: calc(100% - 32px); text-align: center; }
.floaters { position: fixed; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.floaters span { position: absolute; bottom: 70px; font-size: 54px; animation: floatUp 2.4s ease-out forwards; }
@keyframes floatUp { 0% { transform: translateY(0) scale(.4); opacity: 0; } 15% { opacity: 1; transform: translateY(-30px) scale(1.2); } 100% { transform: translateY(-55vh) scale(1); opacity: 0; } }

@media (max-width: 420px) {
  .pl { padding: 6px 8px; gap: 5px; }
  .pl .nm { font-size: 13px; }
  .status h2 { font-size: 20px; }
}
