:root {
  --bg: #0b1424;
  --bg-2: #111d33;
  --panel: #15233d;
  --line: #24365a;
  --text: #eef3fb;
  --muted: #93a4c3;
  --accent: #38bdf8;
  --gold: #fbbf24;
  --red: #e11d48;
  --fb: #1877f2;

  --team-a: #1e3a8a;
  --team-a-2: #2a4fb8;
  --team-a-text: #ffffff;
  --team-b: #ffffff;
  --team-b-2: #e9eef6;
  --team-b-text: #0f172a;
  --team-b-accent: #dc2626;

  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #1c3160 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, sans-serif;
  min-height: 100vh;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; max-width: 1280px; margin: 0 auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font: 800 26px/1 "Barlow Condensed", sans-serif; letter-spacing: .08em;
}
.puck { width: 26px; height: 12px; border-radius: 50%; background: #0a0a0a; box-shadow: 0 3px 0 #333, 0 0 0 2px #444 inset; }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account .who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 9px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: #3a5288; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04121f; }
.btn.danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.fb { background: var(--fb); border-color: var(--fb); color: #fff; padding: 12px 18px; font-size: 15px; }
.btn.fb:hover { background: #166fe0; }
.btn.small { padding: 6px 10px; font-size: 13px; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  object-fit: cover; background: #334155; color: #fff;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
}

/* ---------- Layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px 48px; }

.games { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; scrollbar-width: thin; }
.game-chip {
  flex: none; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 13px;
}
.game-chip[aria-current="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.game-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.game-head h1 { font: 800 clamp(28px, 4vw, 40px)/1 "Barlow Condensed", sans-serif; margin: 0 0 6px; letter-spacing: .02em; text-transform: uppercase; }
.meta { margin: 0; color: var(--muted); }
.my-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.my-status b { color: var(--text); }

.team-row { display: flex; justify-content: space-between; gap: 12px; margin: 0 4px 8px; }
.team-row.bottom { margin: 8px 4px 0; }
.team-label {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 20px/1 "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase;
}
.team-label::before { content: ""; width: 14px; height: 14px; border-radius: 4px; }
.team-label.a::before { background: var(--team-a-2); }
.team-label.b::before { background: var(--team-b); box-shadow: inset 0 -3px 0 var(--team-b-accent); }
.team-label .count { font: 600 13px/1 Inter, sans-serif; color: var(--muted); letter-spacing: 0; text-transform: none; }
.only-v { display: none; }

.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 14px auto 0; max-width: 640px; }

/* ---------- Rink ---------- */
.rink {
  position: relative; width: 100%; aspect-ratio: 2 / 1;
  container-type: inline-size;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.45));
}
.rink > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.pos {
  position: absolute; transform: translate(-50%, -50%);
  width: clamp(104px, 14cqw, 172px);
  border-radius: var(--radius); padding: 6px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .28);
}
.pos.team-A { background: linear-gradient(180deg, var(--team-a-2), var(--team-a)); color: var(--team-a-text); }
.pos.team-B { background: linear-gradient(180deg, var(--team-b), var(--team-b-2)); color: var(--team-b-text); border-top: 3px solid var(--team-b-accent); }
.pos-head {
  display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 5px;
  font: 800 16px/1 "Barlow Condensed", sans-serif; letter-spacing: .06em;
}
.pos-head small { font: 500 10.5px/1 Inter, sans-serif; opacity: .7; letter-spacing: 0; }

.slot {
  display: flex; align-items: center; gap: 6px; width: 100%;
  min-height: 34px; padding: 3px 6px 3px 3px; margin-top: 4px;
  border-radius: 8px; border: 1px solid transparent; text-align: left;
  font-size: 12.5px; font-weight: 600; color: inherit;
}
.slot .ln { flex: none; width: 16px; text-align: center; font: 700 12px/1 "Barlow Condensed", sans-serif; opacity: .6; }
.slot .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .avatar { width: 24px; height: 24px; font-size: 10px; }

.team-A .slot { background: rgba(255,255,255,.12); }
.team-B .slot { background: rgba(15,23,42,.06); }
.slot.free { background: transparent; border: 1.5px dashed currentColor; opacity: .75; font-weight: 500; }
.slot.free:hover { opacity: 1; background: rgba(56,189,248,.18); border-style: solid; border-color: var(--accent); }
.slot.free .plus { width: 24px; height: 24px; display: grid; place-items: center; font-size: 16px; font-weight: 700; flex: none; }
.slot.taken { cursor: default; }
.slot.taken.can-edit { cursor: pointer; }
.slot.mine { outline: 2px solid var(--gold); outline-offset: 1px; background: rgba(251,191,36,.22); cursor: pointer; }
.slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.slot.busy { opacity: .5; pointer-events: none; }

/* ---------- Admin ---------- */
.admin { margin-top: 36px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.admin h2 { margin: 0 0 12px; font: 700 20px/1 "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.new-game { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; margin-bottom: 14px; }
.new-game label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.new-game input {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; color-scheme: dark;
}

.empty { text-align: center; padding: 60px 0; color: var(--muted); }
.empty h1 { color: var(--text); font: 700 28px/1.1 "Barlow Condensed", sans-serif; }

.footer { text-align: center; padding: 0 16px 28px; font-size: 13px; }
.footer a, .fineprint a { color: var(--muted); }
.fineprint { font-size: 12px; color: var(--muted); margin: 0 !important; }

/* ---------- Modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(3, 8, 20, .7); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: min(380px, 100%); display: grid; gap: 12px; text-align: center; }
.modal-card h2 { margin: 0; font: 800 28px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
.modal-card p { margin: 0 0 6px; color: var(--muted); }
.dev-login { display: flex; gap: 8px; }
.dev-login input { flex: 1; min-width: 0; font: inherit; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0;
  background: #0f172a; color: #fff; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px;
  transition: .2s; pointer-events: none; z-index: 30; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--red); }

/* ---------- Mobil: plocha na výšku ---------- */
@media (max-width: 760px) {
  .rink { aspect-ratio: 1 / 2; max-width: 520px; margin: 0 auto; }
  .team-row { max-width: 520px; margin-left: auto; margin-right: auto; justify-content: center; }
  .only-h { display: none; }
  .only-v { display: flex; }
  .pos { width: clamp(96px, 30cqw, 150px); padding: 5px; }
  .pos-head small { display: none; }
  .slot { font-size: 12px; min-height: 30px; gap: 4px; }
  .slot .avatar, .slot.free .plus { width: 20px; height: 20px; }
  .slot .ln { width: 12px; }
  .account .who span { display: none; }
}
