/* Party — obrazovka (TV/notebook) + ovladač (telefon). Bez externích fontů a obrázků. */

:root {
  --bg: #0b0820;
  --bg-2: #140f33;
  --panel: rgba(255, 255, 255, .05);
  --panel-hi: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .12);
  --text: #f1eeff;
  --muted: #a29cc4;
  --accent: #3fe0e0;
  --accent-2: #b967ff;
  --live: #45d67a;
  --bad: #ff5a6e;
  --me: #b967ff;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 20% -10%, #2a1a66 0%, transparent 60%),
              radial-gradient(900px 600px at 100% 110%, #0f3a4a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

.kicker { margin: 0; color: var(--muted); letter-spacing: .3em; text-transform: uppercase; font-size: 13px; }
.logo {
  margin: 4px 0 8px;
  font-weight: 900;
  letter-spacing: .08em;
  font-size: clamp(44px, 9vw, 96px);
  line-height: 1;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), #ff5fa8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0 auto; color: var(--muted); max-width: 34em; font-size: 17px; line-height: 1.5; }
.back { display: inline-block; margin-top: 28px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }

/* ---------- výběr role ---------- */
.pick {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 16px; overflow-y: auto;
}
.pick-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 18px; margin-top: 32px; }
@media (max-width: 560px) { .pick-btns { grid-template-columns: 1fr; width: 100%; max-width: 340px; } }
.choice {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 18px; border-radius: 22px;
  background: var(--panel); border: 2px solid var(--line);
  transition: transform .12s, border-color .12s, background .12s;
}
.choice:hover, .choice:focus-visible { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-hi); outline: none; }
.choice-ico { font-size: 54px; line-height: 1.1; }
.choice b { font-size: 24px; }
.choice small { color: var(--muted); font-size: 15px; }

/* ---------- obrazovka ---------- */
.screen { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.lobby {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: minmax(280px, 30%) 1fr; gap: clamp(18px, 3vw, 48px);
  padding: clamp(18px, 3.5vw, 56px);
  overflow-y: auto;
}
@media (max-width: 820px) { .lobby { grid-template-columns: 1fr; } }
.lb-join {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 28px; padding: 24px;
}
.lb-join .logo { font-size: clamp(40px, 5vw, 80px); }
.lb-step { margin: 10px 0; color: var(--muted); font-size: clamp(15px, 1.3vw, 22px); line-height: 1.4; }
.lb-step b { color: var(--text); }
.qr-box { background: #fff; border-radius: 18px; padding: 10px; line-height: 0; }
#qr { width: clamp(150px, 16vw, 300px); height: auto; image-rendering: pixelated; }
.room-code {
  margin: 4px 0 0; font-weight: 900; letter-spacing: .18em;
  font-size: clamp(54px, 7vw, 120px); line-height: 1; color: #fff;
  text-shadow: 0 0 30px rgba(185, 103, 255, .6);
}
.net-state { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.net-state.bad { color: var(--bad); }

.lb-main h2 { margin: 6px 0 14px; font-size: clamp(20px, 1.8vw, 30px); }
.lb-hint { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.slots { list-style: none; margin: 0 0 26px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.slot {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 18px; min-height: 84px;
  background: var(--panel); border: 2px dashed var(--line); color: var(--muted);
}
.slot.on { border-style: solid; border-color: var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 14%, transparent); }
.slot.off { opacity: .55; }
.slot-ball { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--c, #333); box-shadow: inset -6px -8px 0 rgba(0, 0, 0, .25), inset 6px 6px 0 rgba(255, 255, 255, .25); position: relative; }
.slot-tilt { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #fff; left: 18px; top: 18px; transition: transform .08s linear; }
.slot-name { font-weight: 800; font-size: clamp(16px, 1.4vw, 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-meta { font-size: 13px; color: var(--muted); }
.slot-crown { position: absolute; top: -12px; right: 10px; font-size: 22px; }

.game-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .game-list { grid-template-columns: 1fr; } }
.game {
  padding: 18px; border-radius: 20px; cursor: pointer;
  background: var(--panel); border: 3px solid transparent;
  transition: transform .12s, border-color .12s, background .12s;
}
.game:hover { background: var(--panel-hi); }
.game.sel { border-color: var(--accent); background: rgba(63, 224, 224, .1); transform: translateY(-3px); }
.game-ico { font-size: clamp(34px, 3vw, 54px); line-height: 1; }
.game h3 { margin: 8px 0 4px; font-size: clamp(19px, 1.6vw, 28px); }
.game p { margin: 0; color: var(--muted); font-size: clamp(14px, 1.05vw, 17px); line-height: 1.45; }
.game-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.game-tags span { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(255, 255, 255, .08); color: var(--text); }
.game-tags .coop { background: rgba(69, 214, 122, .2); }
.game-tags .vs { background: rgba(255, 90, 110, .2); }

.lb-actions { display: flex; align-items: center; gap: 20px; margin-top: 26px; flex-wrap: wrap; }
.btn-start {
  padding: 16px 38px; border: 0; border-radius: 16px;
  font-size: clamp(20px, 1.8vw, 30px); font-weight: 900;
  background: linear-gradient(90deg, var(--live), var(--accent)); color: #071510;
}
.btn-start:disabled { opacity: .4; cursor: default; }
.lobby-msg { margin: 0; color: var(--bad); font-size: 17px; font-weight: 600; }

.hud {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 14px; border-radius: 12px; background: rgba(0, 0, 0, .45); color: var(--muted); font-size: 15px;
}
.hud b { color: #fff; letter-spacing: .12em; }
.hud button { border: 0; background: rgba(255, 255, 255, .1); border-radius: 8px; width: 32px; height: 32px; }
.fs-btn {
  position: absolute; bottom: 12px; right: 12px; z-index: 5;
  width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: rgba(255, 255, 255, .08); color: var(--muted); font-size: 20px;
}

/* ---------- ovladač ---------- */
.ctl { position: fixed; inset: 0; overflow: hidden; }
.join {
  height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  max-width: 420px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  text-align: center;
}
.join .logo { font-size: 64px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-top: 16px; }
.field span { font-size: 14px; color: var(--muted); }
.field input {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line);
  background: rgba(0, 0, 0, .3); color: var(--text); font: inherit; font-size: 20px; outline: none;
  -webkit-user-select: text; user-select: text;
}
.field input:focus { border-color: var(--accent); }
.code-input { text-transform: uppercase; letter-spacing: .4em; font-weight: 900; text-align: center; font-size: 34px !important; }
.btn-join {
  margin-top: 22px; padding: 18px; border: 0; border-radius: 16px;
  font-size: 22px; font-weight: 900; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #0b0820;
}
.btn-join:disabled { opacity: .5; }
.join-err { min-height: 1.4em; color: var(--bad); font-weight: 600; margin: 14px 0 0; }
.join-note { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 6px 0 0; }

.pad {
  --c: var(--me);
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: radial-gradient(600px 400px at 50% 0%, color-mix(in srgb, var(--c) 35%, transparent), transparent 70%), var(--bg);
  touch-action: none;
}
.pad-head { display: flex; align-items: center; gap: 10px; }
.pad-name { font-weight: 900; font-size: 20px; color: var(--c); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad-ping { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pad-leave { border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 6px 12px; font-size: 14px; color: var(--muted); }
.pad-offline { background: rgba(255, 90, 110, .2); color: #ffd0d6; padding: 8px 12px; border-radius: 10px; text-align: center; font-size: 15px; }

.pad-text { text-align: center; display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.pad-text b { font-size: clamp(24px, 7vw, 36px); line-height: 1.15; }
.pad-text span { color: var(--muted); font-size: 16px; line-height: 1.35; }

.pad-tilt { display: flex; align-items: center; justify-content: center; gap: 18px; }
.tilt-ring, .stick {
  position: relative; width: min(42vw, 180px); aspect-ratio: 1; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--c) 60%, transparent);
  background: radial-gradient(circle, rgba(255, 255, 255, .06) 0 18%, transparent 19%), rgba(0, 0, 0, .25);
}
.tilt-dot, .stick-knob {
  position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; margin: -15% 0 0 -15%;
  border-radius: 50%; background: var(--c); box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}
.stick { touch-action: none; }
.tilt-side { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.tilt-state { font-size: 13px; color: var(--muted); text-align: center; }
.btn-small { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-hi); font-size: 15px; font-weight: 600; }

.holster {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); font-size: 18px; font-weight: 700;
}
.holster.ok { border-color: var(--live); background: rgba(69, 214, 122, .15); }
.holster.up { border-color: #ffd23f; background: rgba(255, 210, 63, .15); }
.holster-ico { font-size: 30px; }

.pad-btns { flex: 1; display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 12px; min-height: 0; }
.pbtn {
  border: 0; border-radius: 22px; min-height: 90px;
  font-size: clamp(22px, 7vw, 34px); font-weight: 900; letter-spacing: .03em;
  background: color-mix(in srgb, var(--bc, var(--c)) 85%, #000);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--bc, var(--c)) 45%, #000);
  color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  touch-action: none;
  transition: transform .05s, box-shadow .05s;
}
.pbtn.big { grid-column: 1 / -1; min-height: 140px; font-size: clamp(30px, 10vw, 48px); }
.pbtn.down { transform: translateY(6px); box-shadow: 0 1px 0 color-mix(in srgb, var(--bc, var(--c)) 45%, #000); filter: brightness(1.15); }
.pbtn:disabled { opacity: .35; }
