/* Czółko XSUS — oprawa */
:root {
  --bg1: #3b8bff; --bg2: #1652e6; --bg3: #0a2a9c; --ink: #0d1b5c; --navy: #13206e;
  --gold1: #fff3b0; --gold2: #ffd23f; --gold3: #ff8a00;
  --yes: #22c55e; --no: #ef4444; --idk: #94a3b8;
  --card: #ffffff; --muted: #64748b; --glass: rgba(255,255,255,.12); --glass2: rgba(255,255,255,.2);
  --r: 22px; --tw: 320px; --side: 340px;
  --ff-d: "Lilita One", "Arial Black", system-ui, sans-serif;
  --ff: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--ff); font-weight: 700; color: #fff; overflow: hidden;
  background: radial-gradient(120% 90% at 50% -10%, var(--bg1) 0%, var(--bg2) 45%, var(--bg3) 100%) fixed, var(--bg2);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- niebo z gwiazdkami ---------- */
#sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#sky::before {
  content: ""; position: absolute; inset: -20%;
  background: conic-gradient(from 0deg at 50% 40%, transparent 0 8%, rgba(255,255,255,.05) 9% 12%, transparent 13% 22%, rgba(255,255,255,.04) 23% 27%, transparent 28% 40%, rgba(255,255,255,.05) 41% 44%, transparent 45% 58%, rgba(255,255,255,.04) 59% 63%, transparent 64% 78%, rgba(255,255,255,.05) 79% 82%, transparent 83%);
  animation: spin 120s linear infinite;
}
#sky .tw { position: absolute; color: #cfe3ff; font-size: var(--s, 12px); opacity: .0; animation: twinkle var(--d, 4s) ease-in-out var(--dl, 0s) infinite; text-shadow: 0 0 8px #9cc4ff; }
@keyframes twinkle { 0%,100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: .9; transform: scale(1) rotate(45deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

.screen { position: relative; z-index: 1; display: none; height: 100%; }
body[data-screen="home"] #home { display: flex; }
body[data-screen="room"] #room { display: grid; }

/* ---------- logo ---------- */
.logo { position: relative; display: inline-flex; flex-direction: column; align-items: center; line-height: .82; user-select: none; }
.logo-main, .logo-sub { position: relative; font-family: var(--ff-d); letter-spacing: .02em; }
.logo-main { font-size: var(--ls, 110px); transform: rotate(-3deg); }
.logo-sub { font-size: calc(var(--ls, 110px) * .62); transform: rotate(-3deg) translateY(-.04em); }
/* warstwa 1: gruby granatowy obrys (::before), warstwa 2: złoty gradient (span) */
.logo-main::before, .logo-sub::before {
  content: attr(data-text); position: absolute; inset: 0; z-index: 0; color: var(--navy);
  -webkit-text-stroke: calc(var(--ls, 110px) * .13) var(--navy);
  text-shadow: 0 calc(var(--ls, 110px) * .08) 0 var(--navy), 0 calc(var(--ls, 110px) * .12) 18px rgba(0,0,30,.45);
}
.logo-main > span, .logo-sub > span {
  position: relative; z-index: 1; display: block;
  background: linear-gradient(180deg, #fffdf0 0%, var(--gold1) 16%, var(--gold2) 44%, var(--gold3) 78%, #ff5e00 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 -2px 0 rgba(255,255,255,.35));
}
.logo-sub > span { background: linear-gradient(180deg, #fff 0%, #ffe9a6 30%, #ff9b2e 80%, #ff6a00 100%); -webkit-background-clip: text; background-clip: text; }
.logo .st { position: absolute; font-style: normal; color: #fff6c8; text-shadow: 0 0 12px #ffd23f, 0 3px 0 var(--navy); animation: starPop 2.6s ease-in-out infinite; font-family: var(--ff-d); }
.logo .st1 { left: -8%; top: 4%; font-size: calc(var(--ls) * .38); }
.logo .st2 { right: -6%; top: -6%; font-size: calc(var(--ls) * .3); animation-delay: .6s; }
.logo .st3 { right: -12%; top: 48%; font-size: calc(var(--ls) * .26); animation-delay: 1.2s; }
.logo .st4 { left: 10%; bottom: -8%; font-size: calc(var(--ls) * .22); animation-delay: 1.7s; }
.logo .st5 { left: 46%; top: -18%; font-size: calc(var(--ls) * .2); animation-delay: .3s; }
@keyframes starPop { 0%,100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.3) rotate(20deg); } }
.logo-xl { --ls: clamp(64px, 12vw, 132px); margin: 4px 0 18px; animation: logoIn .9s cubic-bezier(.2,1.6,.4,1) both; }
.logo-sm { --ls: 34px; }
.logo-sm .logo-main::before, .logo-sm .logo-sub::before { -webkit-text-stroke-width: 6px; }
@keyframes logoIn { from { transform: scale(.3) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- przyciski ---------- */
.btn {
  --b: #2563eb; --bd: #1e3a8a;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 16px; font-family: var(--ff-d); font-size: 20px; letter-spacing: .02em; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--b) 75%, #fff) 0%, var(--b) 55%);
  box-shadow: 0 5px 0 var(--bd), 0 10px 18px rgba(0,0,40,.35); text-shadow: 0 2px 0 rgba(0,0,0,.25);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active, .btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 var(--bd), 0 4px 8px rgba(0,0,40,.3); }
.btn:disabled { filter: grayscale(.7) brightness(.85); cursor: not-allowed; transform: none; }
.btn-gold { --b: #ffb000; --bd: #b45309; color: #4a2300; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.btn-blue { --b: #3b82f6; --bd: #1e3a8a; }
.btn-green { --b: #22c55e; --bd: #166534; }
.btn-red { --b: #ef4444; --bd: #991b1b; }
.btn-gray { --b: #64748b; --bd: #334155; }
.btn-purple { --b: #8b5cf6; --bd: #4c1d95; }
.btn-big { width: 100%; font-size: 26px; padding: 16px; }
.btn-discord { --b: #5865f2; --bd: #3c45a5; text-decoration: none; font-size: 21px; }
.dc-ico { width: 28px; height: 22px; flex: none; background: #fff; -webkit-mask: url('/discord.svg') center / contain no-repeat; mask: url('/discord.svg') center / contain no-repeat; }
.btn-sm { font-size: 15px; padding: 8px 12px; border-radius: 12px; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; background: var(--glass); font-size: 20px; display: grid; place-items: center; transition: background .15s, transform .1s; }
.icon-btn:hover { background: var(--glass2); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.off { opacity: .55; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 6px; border-radius: 999px; background: var(--glass); font-weight: 800; }
.chip-btn:hover { background: var(--glass2); }
.code-chip { padding: 0 14px; letter-spacing: .08em; }
.code-chip b { font-family: var(--ff-d); font-size: 20px; font-weight: 400; }
.pill { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 999px; background: #0f2f8f; box-shadow: inset 0 0 0 2px rgba(255,255,255,.12); font-weight: 900; font-size: 16px; }
.pill-ghost { background: var(--glass); }
.only-mobile { display: none; }

/* ---------- inputy ---------- */
input, textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 3px solid #dbe4ff; background: #fff; color: var(--ink); font-weight: 800; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59,130,246,.25); }
input::placeholder, textarea::placeholder { color: #9aa7c7; }
.lbl { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px 2px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- ekran główny ---------- */
#home { flex-direction: column; align-items: center; overflow-y: auto; padding: 14px 16px 40px; }
.home-top { width: 100%; max-width: 1180px; display: flex; justify-content: flex-end; gap: 8px; }
.mini-ava { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: #fff3; overflow: hidden; flex: none; }
.mini-ava img { width: 100%; height: 100%; object-fit: cover; }
.home-grid { width: 100%; max-width: 1180px; display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 20px; align-items: start; }
.card { background: var(--card); color: var(--ink); border-radius: var(--r); padding: 22px; box-shadow: 0 8px 0 rgba(10,30,120,.5), 0 24px 40px rgba(0,0,40,.35); animation: rise .6s cubic-bezier(.2,1.3,.4,1) both; }
.card:nth-child(2) { animation-delay: .08s; } .card:nth-child(3) { animation-delay: .16s; }
.card h3 { margin: 0 0 12px; font-family: var(--ff-d); font-weight: 400; font-size: 26px; color: var(--navy); }
@keyframes rise { from { transform: translateY(40px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.join-card { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 14px; }
.how-card { grid-column: 1; grid-row: 1; }
.lb-card { grid-column: 3; grid-row: 1; }
.me-row { display: flex; gap: 14px; align-items: center; }
.me-fields { flex: 1; }
.ava-pick { position: relative; width: 84px; height: 84px; flex: none; border-radius: 26px; display: grid; place-items: center; font-size: 46px; overflow: hidden; box-shadow: 0 5px 0 rgba(0,0,0,.2); transition: transform .15s; }
.ava-pick img { width: 100%; height: 100%; object-fit: cover; }
.ava-pick::after { content: "✏️"; position: absolute; right: 4px; bottom: 4px; font-size: 16px; background: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; box-shadow: 0 2px 6px #0003; }
.ava-pick:hover { transform: rotate(-4deg) scale(1.05); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: #e5eaf7; }
.join-row { display: flex; gap: 10px; }
.join-row input { font-family: var(--ff-d); font-weight: 400; font-size: 26px; text-align: center; letter-spacing: .25em; text-transform: uppercase; }
.join-row .btn { flex: none; }
.hint { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.how { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 15px; }
.how b { color: var(--navy); }
.t-yes { color: #fff; background: var(--yes); padding: 0 6px; border-radius: 6px; }
.t-no { color: #fff; background: var(--no); padding: 0 6px; border-radius: 6px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.modes div { background: #eef3ff; border-radius: 14px; padding: 10px; display: grid; font-size: 14px; }
.modes span { color: var(--muted); font-size: 13px; }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 360px; overflow: auto; }
.lb li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: #f3f6ff; font-size: 15px; }
.lb li:nth-child(1) { background: linear-gradient(90deg, #fff3b0, #fff); }
.lb li:nth-child(2) { background: linear-gradient(90deg, #e7ecf5, #fff); }
.lb li:nth-child(3) { background: linear-gradient(90deg, #ffe0c2, #fff); }
.lb .pos { font-family: var(--ff-d); width: 26px; text-align: center; color: var(--navy); }
.lb .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .pts { font-family: var(--ff-d); color: var(--navy); }
.lb .mini-ava { width: 30px; height: 30px; }

/* ---------- pokój ---------- */
#room {
  grid-template-columns: minmax(0, 1fr) var(--side); grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "q side" "stage side" "dock side";
  height: 100%; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); gap: 10px 14px;
}
.topbar { grid-area: top; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 64px; }
.tb-left, .tb-right { display: flex; gap: 8px; align-items: center; }
.tb-right { justify-content: flex-end; }
.tb-center { display: flex; justify-content: center; padding-top: 6px; }

.timer { position: relative; width: 52px; height: 52px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 5; }
.tr-bg { stroke: rgba(255,255,255,.18); fill: #0f2f8f !important; }
.tr-fg { stroke: var(--gold2); stroke-linecap: round; stroke-dasharray: 119.4; transition: stroke .3s; }
.timer b { position: relative; font-family: var(--ff-d); font-weight: 400; font-size: 20px; }
.timer.hurry .tr-fg { stroke: #ff4d4d; }
.timer.hurry { animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }

.qbar { grid-area: q; display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; border-radius: 18px; background: rgba(8,26,110,.55); box-shadow: inset 0 0 0 2px rgba(255,255,255,.1); min-height: 52px; backdrop-filter: blur(6px); }
.qbar.flash { animation: qflash .6s ease; }
@keyframes qflash { 0% { background: rgba(255,210,63,.6); transform: scale(1.02); } 100% { background: rgba(8,26,110,.55); } }
.q-no { font-family: var(--ff-d); background: var(--gold2); color: #4a2300; border-radius: 12px; padding: 6px 10px; font-size: 18px; }
.q-text { flex: 1; font-size: 18px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-text.empty { color: #b9c8ff; font-weight: 700; font-style: italic; }
.q-tally { display: flex; gap: 6px; }
.tl { padding: 6px 10px; border-radius: 12px; font-size: 14px; font-weight: 900; }
.tl b { font-family: var(--ff-d); font-weight: 400; font-size: 18px; margin-left: 2px; }
.tl-yes { background: var(--yes); } .tl-no { background: var(--no); } .tl-idk { background: #475569; }
.tl.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.25); } }

/* ---------- kafelki graczy ---------- */
.stage { grid-area: stage; position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 22px 18px; width: 100%; height: 100%; padding: 18px 4px 6px; }
.tile { --c: #22d3ee; position: relative; width: var(--tw); transition: width .45s cubic-bezier(.3,1.3,.5,1), filter .3s; animation: tileIn .55s cubic-bezier(.2,1.5,.4,1) both; }
.tile.big { width: calc(var(--tw) * 1.42); z-index: 2; }
@keyframes tileIn { from { transform: scale(.4) translateY(30px); opacity: 0; } }
.tile .frame {
  position: relative; aspect-ratio: 16 / 10.5; border-radius: 20px; overflow: hidden; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 55%, #0b1d6e), #0b1d6e 70%);
  box-shadow: 0 0 0 5px var(--c), 0 0 0 8px rgba(255,255,255,.9), 0 12px 28px rgba(0,0,40,.45);
  transition: box-shadow .3s;
}
.tile.big .frame { box-shadow: 0 0 0 6px var(--c), 0 0 0 10px #fff, 0 0 40px 8px color-mix(in srgb, var(--c) 70%, transparent), 0 18px 40px rgba(0,0,40,.5); animation: glow 1.6s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 0 6px var(--c), 0 0 0 10px #fff, 0 0 70px 18px color-mix(in srgb, var(--c) 80%, transparent), 0 18px 40px rgba(0,0,40,.5); } }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; background: #000; }
.tile.me video { transform: scaleX(-1); }
.tile.has-video video { opacity: 1; }
.tile .ava { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .3s; }
.tile.has-video .ava { opacity: 0; }
.tile .ava-in { width: 46%; aspect-ratio: 1; border-radius: 30%; display: grid; place-items: center; font-size: calc(var(--tw) * .2); overflow: hidden; background: rgba(255,255,255,.18); box-shadow: 0 8px 0 rgba(0,0,0,.18); animation: bob 3s ease-in-out infinite; }
.tile.big .ava-in { font-size: calc(var(--tw) * .28); }
.tile .ava-in img { width: 100%; height: 100%; object-fit: cover; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.tile .score {
  position: absolute; top: 10px; right: 10px; min-width: 64px; padding: 6px 10px 4px; border-radius: 16px; background: #fff; color: var(--ink); text-align: center; line-height: 1;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
}
.tile .score b { display: block; font-family: var(--ff-d); font-weight: 400; font-size: 30px; }
.tile .score small { font-size: 12px; color: var(--muted); font-weight: 800; }
.tile .score.bump { animation: scoreBump .6s cubic-bezier(.2,2,.4,1); }
@keyframes scoreBump { 30% { transform: scale(1.4) rotate(-6deg); background: var(--gold2); } }
.tile .plate {
  position: relative; margin: -22px auto 0; width: 78%; padding: 10px 14px; border-radius: 16px; background: #fff; color: var(--ink); text-align: center;
  font-family: var(--ff); font-weight: 900; font-size: clamp(14px, calc(var(--tw) * .065), 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 5px 0 rgba(10,30,120,.35), 0 10px 18px rgba(0,0,40,.3); z-index: 3;
}
.tile.big .plate { font-size: clamp(16px, calc(var(--tw) * .08), 28px); }
.tile .plate .crown { margin-right: 4px; }
.tile .tag {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%); z-index: 4; padding: 6px 18px; border-radius: 14px; background: #fff; color: var(--ink);
  font-weight: 900; font-size: 17px; box-shadow: 0 4px 0 rgba(10,30,120,.35); white-space: nowrap; animation: tagIn .5s cubic-bezier(.2,1.8,.4,1) both;
}
@keyframes tagIn { from { transform: translateX(-50%) scale(0) rotate(-20deg); } }
.tile.big .word { top: 30px; }
.tile .word {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%) rotate(-2deg); max-width: 70%; z-index: 2;
  padding: 8px 16px; background: linear-gradient(180deg, #fff9c4, #ffe86b); color: #3b2a00; border-radius: 6px 6px 14px 14px;
  font-family: var(--ff-d); font-size: clamp(16px, calc(var(--tw) * .075), 30px); line-height: 1.05; text-align: center;
  box-shadow: 0 6px 14px rgba(0,0,0,.35); animation: stickIn .6s cubic-bezier(.2,1.6,.4,1) both;
}
.tile .word::before { content: ""; position: absolute; top: -8px; left: 50%; width: 48px; height: 16px; transform: translateX(-50%) rotate(3deg); background: rgba(255,255,255,.55); border-radius: 3px; }
.tile .word.hidden-me { background: linear-gradient(180deg, #e0e7ff, #a5b4fc); color: var(--navy); }
.tile .word.solved { background: linear-gradient(180deg, #bbf7d0, #4ade80); color: #053b1b; }
@keyframes stickIn { from { transform: translateX(-50%) translateY(-40px) rotate(-30deg) scale(.4); opacity: 0; } }
.tile .bubble {
  position: absolute; left: 12px; bottom: 30px; z-index: 3; padding: 8px 14px; border-radius: 16px 16px 16px 4px; font-family: var(--ff-d); font-size: clamp(16px, calc(var(--tw) * .07), 28px);
  box-shadow: 0 5px 0 rgba(0,0,0,.25); transform-origin: bottom left; animation: bubbleIn .45s cubic-bezier(.2,2,.4,1) both;
}
.tile .bubble.tak { background: var(--yes); } .tile .bubble.nie { background: var(--no); } .tile .bubble.nie_wiem { background: #64748b; }
@keyframes bubbleIn { from { transform: scale(0) rotate(-25deg); } }
.tile .off { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,15,60,.72); font-weight: 900; z-index: 5; text-align: center; padding: 10px; }
.tile.disc { filter: grayscale(.8); }
.tile.solved-tile .frame::after { content: "✔"; position: absolute; left: 12px; top: 10px; width: 40px; height: 40px; border-radius: 50%; background: var(--yes); display: grid; place-items: center; font-size: 22px; z-index: 3; box-shadow: 0 3px 0 #0003; }
.tile .tmenu { position: absolute; left: 10px; top: 10px; z-index: 6; width: 34px; height: 34px; border-radius: 12px; background: rgba(0,0,0,.4); font-size: 18px; opacity: 0; transition: opacity .15s; }
.tile:hover .tmenu, .tile .tmenu:focus { opacity: 1; }
.tile.shake { animation: shake .5s ease; }
@keyframes shake { 20%,60% { transform: translateX(-10px) rotate(-1deg); } 40%,80% { transform: translateX(10px) rotate(1deg); } }
.tile .float { position: absolute; left: 50%; top: 40%; z-index: 8; font-family: var(--ff-d); font-size: 36px; color: var(--gold2); text-shadow: 0 3px 0 var(--navy); pointer-events: none; animation: floatUp 1.6s ease-out forwards; }
@keyframes floatUp { from { transform: translate(-50%, 0) scale(.5); opacity: 0; } 15% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); } to { transform: translate(-50%, -110px) scale(1); opacity: 0; } }
.react { position: fixed; z-index: 60; font-size: 40px; pointer-events: none; animation: reactUp 2.2s ease-out forwards; }
@keyframes reactUp { 0% { transform: translateY(0) scale(.3); opacity: 0; } 15% { transform: translateY(-20px) scale(1.3); opacity: 1; } 100% { transform: translate(var(--dx, 0), -220px) scale(1) rotate(var(--rot, 0deg)); opacity: 0; } }

/* ---------- panel boczny ---------- */
.side { grid-area: side; min-height: 0; display: flex; flex-direction: column; }
.panel { flex: 1; min-height: 0; overflow-y: auto; background: rgba(255,255,255,.96); color: var(--ink); border-radius: var(--r); padding: 18px; box-shadow: 0 8px 0 rgba(10,30,120,.45), 0 20px 36px rgba(0,0,40,.3); }
body[data-phase="lobby"] #notesPanel, body:not([data-phase="lobby"]) #lobbyPanel { display: none; }
.panel h3 { margin: 0 0 10px; font-family: var(--ff-d); font-weight: 400; font-size: 24px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.panel h4 { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.panel .ro-note { font-size: 13px; color: var(--muted); background: #f1f5ff; border-radius: 10px; padding: 8px 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { padding: 10px; border-radius: 14px; background: #eef3ff; color: var(--ink); text-align: left; border: 3px solid transparent; transition: all .15s; }
.seg button b { display: block; font-size: 16px; }
.seg button span { font-size: 12px; color: var(--muted); font-weight: 700; }
.seg button.on { border-color: #3b82f6; background: #dbeafe; transform: translateY(-2px); box-shadow: 0 4px 0 #93c5fd; }
.seg button:disabled { cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 11px; border-radius: 999px; background: #eef3ff; color: var(--ink); font-size: 14px; border: 2px solid transparent; transition: all .12s; }
.chips button small { color: var(--muted); font-weight: 700; margin-left: 2px; }
.chips button.on { background: #3b82f6; color: #fff; border-color: #1d4ed8; }
.chips button.on small { color: #dbeafe; }
.chips button:disabled { cursor: default; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper b { font-family: var(--ff-d); font-weight: 400; font-size: 28px; min-width: 40px; text-align: center; }
.stepper button { width: 38px; height: 38px; border-radius: 12px; background: #eef3ff; font-size: 22px; color: var(--ink); font-weight: 900; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.panel textarea { min-height: 70px; resize: vertical; font-weight: 700; font-size: 14px; }
.start-wrap { position: sticky; bottom: -18px; margin: 16px -18px -18px; padding: 14px 18px 18px; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 30%); }
.wait-host { text-align: center; color: var(--muted); padding: 10px; font-weight: 800; }
.wait-host .dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* notatnik */
.notes-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.notes-tabs button { flex: 1; padding: 8px; border-radius: 12px; background: #eef3ff; color: var(--ink); font-size: 14px; }
.notes-tabs button.on { background: var(--navy); color: #fff; }
.qlog { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qlog li { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; padding: 10px; border-radius: 14px; background: #f3f6ff; border-left: 6px solid #cbd5e1; animation: rise .4s ease both; }
.qlog li.v-tak { border-left-color: var(--yes); background: #ecfdf3; }
.qlog li.v-nie { border-left-color: var(--no); background: #fef2f2; }
.qlog li.cur { outline: 3px dashed #93c5fd; }
.qlog .n { font-family: var(--ff-d); color: var(--navy); font-size: 18px; }
.qlog .tx { font-weight: 800; font-size: 14px; }
.qlog .tx.empty { color: var(--muted); font-style: italic; font-weight: 700; }
.qlog .ta { grid-column: 2; display: flex; gap: 6px; font-size: 12px; }
.qlog .ta span { padding: 2px 8px; border-radius: 8px; color: #fff; font-weight: 900; }
.qlog .ta .y { background: var(--yes); } .qlog .ta .n2 { background: var(--no); } .qlog .ta .i { background: #64748b; }
.qlog-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 14px; background: #f8faff; border-radius: 14px; }
.mynotes { margin-top: 14px; }
.mynotes textarea { min-height: 120px; background: repeating-linear-gradient(180deg, #fffef5 0 27px, #e8eefc 27px 28px); border-color: #fde68a; line-height: 28px; padding-top: 0; }

/* ---------- dok (przyciski gry) ---------- */
.dock { grid-area: dock; display: flex; flex-direction: column; gap: 16px; align-items: center; min-width: 0; }
.guess-box input { min-width: 0; }
.dock:empty { display: none; }
.dock-row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; width: 100%; }
.ans { min-width: 150px; font-size: 30px; padding: 14px 26px; border-radius: 20px; }
.ans.sel { outline: 5px solid #fff; outline-offset: 3px; transform: translateY(2px) scale(1.04); }
.ans-idk { min-width: 100px; font-size: 22px; }
.react-bar { display: flex; gap: 4px; background: var(--glass); border-radius: 999px; padding: 4px 8px; }
.react-bar button { font-size: 24px; width: 40px; height: 40px; border-radius: 50%; transition: transform .1s; }
.react-bar button:hover { transform: scale(1.25) rotate(-8deg); background: var(--glass2); }
.guess-box { display: flex; gap: 8px; width: min(720px, 100%); }
.guess-box input { font-size: 18px; }
.dock-note { font-size: 15px; color: #dbe6ff; font-weight: 800; text-align: center; }
.dock-note b { color: var(--gold2); }
.confirm-btn { position: relative; margin-top: 6px; }
.confirm-btn .votes { position: absolute; top: -10px; right: -10px; background: #fff; color: var(--ink); border-radius: 999px; padding: 2px 8px; font-family: var(--ff); font-weight: 900; font-size: 13px; box-shadow: 0 2px 6px #0004; }

/* ---------- nakładki ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, rgba(20,60,200,.55), rgba(3,10,50,.85)); backdrop-filter: blur(4px); animation: fadeIn .25s ease both; padding: 16px; }
.overlay.soft { background: rgba(3,10,50,.35); backdrop-filter: none; pointer-events: none; }
@keyframes fadeIn { from { opacity: 0; } }
.ov-box { text-align: center; max-width: 760px; width: 100%; }
.ov-title { font-family: var(--ff-d); font-size: clamp(40px, 8vw, 88px); line-height: 1; color: #fff; text-shadow: 0 6px 0 var(--navy), 0 12px 30px rgba(0,0,0,.4); animation: slam .6s cubic-bezier(.2,1.8,.4,1) both; }
.ov-title.gold { color: var(--gold2); }
.ov-sub { margin-top: 12px; font-size: clamp(16px, 2.6vw, 24px); font-weight: 900; color: #dbe6ff; animation: rise .5s .15s both; }
@keyframes slam { from { transform: scale(2.6) rotate(-8deg); opacity: 0; } }
.flip { perspective: 1200px; width: min(460px, 86vw); aspect-ratio: 1.6; margin: 26px auto 0; }
.flip-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: flipCard 1.1s .35s cubic-bezier(.3,1.4,.5,1) both; }
.flip.noflip .flip-in { animation: wobble 2s ease-in-out infinite; }
@keyframes flipCard { from { transform: rotateY(180deg) scale(.6); } to { transform: rotateY(0) scale(1); } }
@keyframes wobble { 50% { transform: rotate(-3deg) scale(1.03); } }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 26px; display: grid; place-items: center; padding: 20px; font-family: var(--ff-d); font-size: clamp(30px, 6vw, 58px); line-height: 1.05;
  background: linear-gradient(160deg, #fff9c4, #ffd23f 70%, #ffb000); color: #3b2a00; box-shadow: 0 10px 0 #b45309, 0 30px 60px rgba(0,0,0,.45); }
.flip-face.back { transform: rotateY(180deg); background: linear-gradient(160deg, #6ea8ff, #2563eb); color: #fff; font-size: 90px; box-shadow: 0 10px 0 #1e3a8a, 0 30px 60px rgba(0,0,0,.45); }
.flip-face.q { background: linear-gradient(160deg, #a5b4fc, #4f46e5); color: #fff; font-size: 110px; box-shadow: 0 10px 0 #312e81, 0 30px 60px rgba(0,0,0,.45); }
.ov-word { display: inline-block; margin-top: 18px; padding: 14px 30px; border-radius: 20px; background: linear-gradient(180deg, #fff9c4, #ffd23f); color: #3b2a00; font-family: var(--ff-d); font-size: clamp(30px, 6vw, 56px); box-shadow: 0 8px 0 #b45309; animation: slam .6s .25s cubic-bezier(.2,1.8,.4,1) both; }
.ov-pts { margin-top: 16px; font-family: var(--ff-d); font-size: 48px; color: var(--gold2); text-shadow: 0 4px 0 var(--navy); animation: slam .6s .5s cubic-bezier(.2,1.8,.4,1) both; }
.ov-ava { width: 120px; height: 120px; margin: 0 auto 10px; border-radius: 36px; display: grid; place-items: center; font-size: 70px; overflow: hidden; box-shadow: 0 0 0 6px #fff, 0 10px 30px rgba(0,0,0,.4); animation: slam .5s cubic-bezier(.2,1.8,.4,1) both; }
.ov-ava img { width: 100%; height: 100%; object-fit: cover; }
.ov-progress { height: 8px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; margin: 22px auto 0; width: min(360px, 80%); }
.ov-progress i { display: block; height: 100%; background: var(--gold2); animation: prog linear forwards; transform-origin: left; }
@keyframes prog { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.rank { list-style: none; margin: 24px auto 0; padding: 0; display: grid; gap: 10px; width: min(560px, 100%); }
.rank li { display: grid; grid-template-columns: 40px 48px 1fr auto; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 5px 0 rgba(10,30,120,.4); animation: rankIn .5s cubic-bezier(.2,1.4,.4,1) both; position: relative; overflow: hidden; }
.rank li .bar { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(255,210,63,.35), rgba(255,210,63,.05)); transform-origin: left; animation: barGrow 1.2s .3s cubic-bezier(.2,1,.3,1) both; }
@keyframes barGrow { from { transform: scaleX(0); } }
.rank li > *:not(.bar) { position: relative; }
.rank .pos { font-family: var(--ff-d); font-size: 26px; color: var(--navy); text-align: center; }
.rank .mini-ava { width: 46px; height: 46px; border-radius: 14px; font-size: 26px; }
.rank .nm { font-weight: 900; font-size: 18px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .sc { font-family: var(--ff-d); font-size: 26px; color: var(--navy); }
.rank .sc small { font-family: var(--ff); font-size: 13px; color: #16a34a; margin-left: 6px; font-weight: 900; }
@keyframes rankIn { from { transform: translateX(-60px); opacity: 0; } }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin-top: 30px; }
.pod { display: flex; flex-direction: column; align-items: center; width: min(190px, 30vw); }
.pod .ov-ava { width: 96px; height: 96px; font-size: 54px; border-radius: 30px; }
.pod .nm { font-weight: 900; font-size: 18px; margin-bottom: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .blk { width: 100%; border-radius: 18px 18px 0 0; display: grid; place-items: start center; padding-top: 12px; font-family: var(--ff-d); font-size: 46px; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.25); animation: podUp .9s cubic-bezier(.2,1.3,.4,1) both; transform-origin: bottom; }
.pod .blk small { display: block; font-size: 20px; }
.pod.p1 .blk { height: 200px; background: linear-gradient(180deg, #ffe066, #f59e0b); animation-delay: .9s; }
.pod.p2 .blk { height: 150px; background: linear-gradient(180deg, #e2e8f0, #94a3b8); animation-delay: .5s; }
.pod.p3 .blk { height: 110px; background: linear-gradient(180deg, #fdba74, #c2410c); animation-delay: .2s; }
.pod.p1 .ov-ava { animation-delay: 1.3s; width: 120px; height: 120px; } .pod.p2 .ov-ava { animation-delay: .9s; } .pod.p3 .ov-ava { animation-delay: .6s; }
.pod.p1 .crownbig { font-size: 50px; animation: slam .6s 1.5s cubic-bezier(.2,1.8,.4,1) both, bob 2s 2s ease-in-out infinite; }
@keyframes podUp { from { transform: scaleY(0); } }
.ov-actions { display: flex; gap: 12px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

.splash { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; pointer-events: none; }
.splash .sp { font-family: var(--ff-d); font-size: clamp(60px, 14vw, 170px); color: var(--gold2); text-shadow: 0 8px 0 var(--navy), 0 0 60px rgba(255,210,63,.6); animation: splashIn 1.6s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes splashIn { 0% { transform: scale(3) rotate(-10deg); opacity: 0; } 25% { transform: scale(1) rotate(-4deg); opacity: 1; } 75% { transform: scale(1.05) rotate(-4deg); opacity: 1; } 100% { transform: scale(.6) translateY(-80px); opacity: 0; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(3,10,50,.7); backdrop-filter: blur(5px); padding: 16px; animation: fadeIn .2s both; }
.mbox { position: relative; width: min(480px, 100%); max-height: 92vh; overflow: auto; background: #fff; color: var(--ink); border-radius: 26px; padding: 24px; box-shadow: 0 10px 0 rgba(10,30,120,.5), 0 30px 60px rgba(0,0,0,.4); animation: rise .35s cubic-bezier(.2,1.4,.4,1) both; }
.mbox h2 { margin: 0 0 14px; font-family: var(--ff-d); font-weight: 400; font-size: 30px; color: var(--navy); }
.mclose { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 12px; background: #eef3ff; font-size: 18px; }
.tabs { display: flex; gap: 6px; background: #eef3ff; padding: 5px; border-radius: 16px; margin-bottom: 16px; }
.tabs button { flex: 1; padding: 10px; border-radius: 12px; font-weight: 900; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--navy); box-shadow: 0 3px 0 #c7d2fe; }
.form { display: grid; gap: 12px; }
.err { color: #dc2626; font-weight: 800; font-size: 14px; min-height: 1em; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; font-size: 24px; border-radius: 12px; background: #f1f5ff; transition: transform .1s; }
.emoji-grid button:hover { transform: scale(1.15); }
.emoji-grid button.on { background: #dbeafe; outline: 3px solid #3b82f6; }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors button { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); }
.colors button.on { outline: 4px solid var(--navy); outline-offset: 2px; }
.ava-preview { width: 140px; height: 140px; margin: 0 auto 6px; border-radius: 40px; display: grid; place-items: center; font-size: 80px; overflow: hidden; box-shadow: 0 6px 0 rgba(0,0,0,.15); }
.ava-preview img { width: 100%; height: 100%; object-fit: cover; }
.crop { position: relative; width: 260px; height: 260px; margin: 0 auto; border-radius: 30px; overflow: hidden; background: #0b1d6e; touch-action: none; cursor: grab; }
.crop canvas { width: 100%; height: 100%; display: block; }
.crop::after { content: ""; position: absolute; inset: 0; border-radius: 30px; box-shadow: inset 0 0 0 4px #fff; pointer-events: none; }
input[type=range] { padding: 0; border: 0; accent-color: #3b82f6; box-shadow: none; background: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stats div { background: #f1f5ff; border-radius: 14px; padding: 10px; text-align: center; }
.stats b { display: block; font-family: var(--ff-d); font-weight: 400; font-size: 26px; color: var(--navy); }
.stats span { font-size: 12px; color: var(--muted); }
.upload-lock { background: #fff7ed; color: #9a3412; border-radius: 14px; padding: 10px 12px; font-size: 14px; }

/* ---------- toasty ---------- */
.toasts { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: #fff; color: var(--ink); padding: 10px 18px; border-radius: 16px; font-weight: 900; box-shadow: 0 5px 0 rgba(10,30,120,.4), 0 10px 20px rgba(0,0,0,.25); animation: toastIn .35s cubic-bezier(.2,1.6,.4,1) both; max-width: 90vw; }
.toast.bad { background: #fee2e2; color: #991b1b; }
.toast.good { background: #dcfce7; color: #14532d; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { transform: translateY(-30px) scale(.8); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }

.reconnect { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: #fff; color: var(--ink); border-radius: 999px; padding: 12px 20px; font-weight: 900; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #c7d2fe; border-top-color: #2563eb; animation: spin .8s linear infinite; }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- mobile ---------- */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .join-card { grid-column: 1 / -1; grid-row: 1; max-width: 520px; width: 100%; justify-self: center; }
  .how-card { grid-column: 1; grid-row: 2; } .lb-card { grid-column: 2; grid-row: 2; }
}
@media (max-width: 900px) {
  :root { --side: 0px; }
  #room { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "q" "stage" "dock"; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .pill { height: 32px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
  .timer { width: 42px; height: 42px; } .timer b { font-size: 16px; }
  #btnSound2 { display: none; }
  .dock { gap: 8px; }
  .dock-note { font-size: 13px; }
  .guess-box { gap: 6px; }
  .guess-box input { font-size: 15px; padding: 10px; }
  .guess-box .btn { font-size: 15px; padding: 10px 12px; border-radius: 12px; white-space: nowrap; }
  .lg { display: none; }
  .confirm-btn { font-size: 17px; padding: 10px 14px; }
  .only-mobile { display: grid; }
  .side { position: fixed; inset: auto 0 0 0; z-index: 30; max-height: 72vh; transform: translateY(105%); transition: transform .3s cubic-bezier(.2,1,.3,1); padding: 0 8px 8px; }
  body.side-open .side { transform: none; }
  .panel { border-radius: 24px 24px 18px 18px; }
  .topbar { grid-template-columns: auto 1fr; min-height: 48px; }
  .tb-center { display: none; }
  .tb-right { gap: 4px; }
  .tb-left { min-width: 0; }
  .icon-btn { width: 38px; height: 38px; font-size: 18px; }
  .code-chip { height: 38px; padding: 0 10px; }
  #modePill { display: none; }
  .tiles { gap: 14px 10px; padding-top: 14px; }
  .tile .tag { font-size: 14px; padding: 4px 12px; top: -12px; }
  .tile .score { min-width: 44px; padding: 4px 6px 3px; top: 6px; right: 6px; border-radius: 12px; }
  .tile .score b { font-size: 20px; } .tile .score small { font-size: 10px; }
  .tile .plate { padding: 6px 8px; margin-top: -16px; border-radius: 12px; }
  .ans { min-width: 0; flex: 1; font-size: 24px; padding: 12px; }
  .ans-idk { flex: .6; font-size: 18px; }
  .q-text { font-size: 15px; white-space: normal; }
  .q-tally .tl { padding: 4px 7px; font-size: 12px; } .q-tally .tl b { font-size: 15px; }
  .react-bar button { width: 34px; height: 34px; font-size: 20px; }
}
@media (max-width: 600px) {
  .home-grid { grid-template-columns: 1fr; }
  .how-card, .lb-card { grid-column: 1; grid-row: auto; }
  .card { padding: 18px; }
  .podium { gap: 6px; } .pod .blk { font-size: 30px; }
  .pod.p1 .blk { height: 150px; } .pod.p2 .blk { height: 110px; } .pod.p3 .blk { height: 80px; }
  .pod .ov-ava, .pod.p1 .ov-ava { width: 70px; height: 70px; font-size: 40px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
