/* TRON Grid — styl. Neonová mřížka, systémové fonty, žádné externí zdroje. */

:root {
  --bg: #04070d;
  --panel: rgba(10, 20, 30, 0.72);
  --line: rgba(90, 220, 255, 0.18);
  --line-hot: rgba(90, 220, 255, 0.45);
  --text: #dcf2ff;
  --muted: #6f8ba0;
  --neon: #22e8ff;
  --neon-2: #a06bff;
  --go: #7cff3d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
body {
  background:
    radial-gradient(1200px 700px at 50% -12%, rgba(34, 232, 255, 0.10) 0%, rgba(4, 7, 13, 0) 70%),
    repeating-linear-gradient(0deg, rgba(90, 220, 255, 0.035) 0 1px, rgba(0, 0, 0, 0) 1px 44px),
    repeating-linear-gradient(90deg, rgba(90, 220, 255, 0.035) 0 1px, rgba(0, 0, 0, 0) 1px 44px),
    var(--bg);
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- stav spojení ---------------- */
.conn {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(4, 7, 13, .92), rgba(4, 7, 13, 0));
  pointer-events: none;
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.is-on  .conn-dot { background: var(--go); box-shadow: 0 0 8px var(--go); }
.conn.is-on  { color: #9fd6b4; }
.conn.is-wait .conn-dot { background: #ffcf4d; }
.conn.is-off .conn-dot { background: #ff5b5b; }
.conn.is-off { color: #ffb3b3; }
.conn-ping { margin-left: auto; }

/* ---------------- lobby ---------------- */
.lobby { max-width: 1080px; margin: 0 auto; padding: 46px 20px 60px; }
.lb-head { text-align: center; margin-bottom: 28px; }
.kicker {
  margin: 0 0 6px;
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .28em; text-transform: uppercase; color: var(--muted);
}
.logo {
  margin: 0 0 10px;
  font-size: clamp(30px, 7vw, 54px);
  font-weight: 800;
  letter-spacing: .06em;
  background: linear-gradient(180deg, #eaffff 0%, var(--neon) 62%, var(--neon-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo .dot { color: var(--neon-2); -webkit-text-fill-color: var(--neon-2); }
.tagline { margin: 0 auto 8px; max-width: 620px; color: #a8c4d6; }
.room { margin: 0; font-size: 13px; color: var(--muted); }

.lb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.panel {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--neon);
}
.panel-help ul { margin: 0; padding-left: 18px; color: #a8c4d6; }
.panel-help li { margin-bottom: 7px; }
.panel-help b { color: var(--text); }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; margin-bottom: 6px;
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
input[type="text"] {
  width: 100%; padding: 10px 12px;
  font: 15px/1.2 inherit; color: var(--text);
  background: rgba(4, 10, 16, .8);
  border: 1px solid var(--line);
  border-radius: 9px;
}
input[type="text"]:focus { outline: none; border-color: var(--neon); }

.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 34px; height: 34px; padding: 0;
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 9px;
  cursor: pointer;
  position: relative;
}
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
.swatch:disabled { cursor: not-allowed; opacity: .32; }
.swatch:disabled::after {
  content: ''; position: absolute; inset: 40% 12% auto;
  height: 2px; background: #fff; transform: rotate(-45deg);
}

.btn {
  padding: 10px 16px;
  font: 600 14px/1 inherit; color: var(--text);
  background: rgba(20, 40, 55, .9);
  border: 1px solid var(--line-hot);
  border-radius: 9px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--neon); background: rgba(28, 56, 74, .95); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-primary { background: rgba(34, 232, 255, .16); border-color: var(--neon); color: #dffaff; }
.btn-go { width: 100%; margin-top: 4px; background: rgba(124, 255, 61, .16); border-color: var(--go); color: #e6ffd9; }
.btn-mini { padding: 5px 9px; font-size: 11px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.players { list-style: none; margin: 0 0 14px; padding: 0; min-height: 44px; }
.players li {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(90, 220, 255, .08);
}
.players li:last-child { border-bottom: none; }
.p-chip { flex: none; width: 12px; height: 12px; border-radius: 3px; }
.p-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-score { font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.players .empty { color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px;
  font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  background: rgba(4, 10, 16, .7);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.chip.sel { color: #04070d; background: var(--neon); border-color: var(--neon); }
.info { margin: 10px 0 0; font-size: 13px; color: var(--muted); min-height: 20px; }

/* ---------------- hra ---------------- */
.game { position: fixed; inset: 0; overflow: hidden; background: #04070d; }
.canvas-wrap { position: absolute; inset: 0; }
#canvas { display: block; width: 100%; height: 100%; }

.hud {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 22px 14px 10px;
  background: linear-gradient(180deg, rgba(4, 7, 13, .85), rgba(4, 7, 13, 0));
  pointer-events: none;
}
.hud button { pointer-events: auto; }
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 6px; }
.hud-right { align-items: flex-end; }
.hud-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.hud-chip {
  padding: 3px 8px;
  font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em;
  color: var(--muted);
  background: rgba(8, 18, 26, .75);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.hud-chip b { color: var(--text); }
.hud-scores { display: flex; flex-wrap: wrap; gap: 6px; }
.s-card {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 9px 4px 7px;
  font: 600 12px/1.3 inherit;
  background: rgba(8, 18, 26, .8);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 6px;
}
.s-card.out { opacity: .4; }
.s-card.me { box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.s-card .nm { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-card .sc { font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.hud-time { font: 700 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }

.boost { display: flex; align-items: center; gap: 7px; }
.boost-label {
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .14em; color: var(--muted);
}
.boost-label.ready { color: var(--go); text-shadow: 0 0 8px rgba(124, 255, 61, .6); }
.boost-bar {
  width: 92px; height: 7px;
  background: rgba(8, 18, 26, .9);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.boost-fill { height: 100%; width: 100%; background: var(--go); transition: width .1s linear; }
.boost-fill.cooling { background: #ffcf4d; }

.controls-help {
  position: absolute; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 20; text-align: center;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  pointer-events: none;
}
.controls-help b { color: var(--neon); }

.overlay {
  position: absolute; inset: 0;
  z-index: 30;
  display: grid; place-items: center;
  pointer-events: none;
}
.overlay-box {
  padding: 22px 34px;
  text-align: center;
  background: rgba(4, 10, 16, .82);
  border: 1px solid var(--line-hot);
  border-radius: 16px;
  backdrop-filter: blur(4px);
}
.overlay-title {
  font-size: clamp(26px, 6vw, 46px);
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--text);
  text-shadow: 0 0 22px rgba(34, 232, 255, .5);
}
.overlay-sub { margin-top: 6px; font-size: 14px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 26px;
  z-index: 60;
  transform: translateX(-50%);
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text);
  background: rgba(10, 22, 32, .95);
  border: 1px solid var(--line-hot);
  border-radius: 9px;
}

/* ---------------- dotykové ovládání (rozvržení; obecné styly v /shared/touch.css) --- */
.tbtn.is-down { background: rgba(34, 232, 255, .34); border-color: rgba(34, 232, 255, .85); }
body.touch-on .hud { padding: 20px 10px 6px; font-size: 12px; }
.rotate-icon { color: var(--neon); }

.tbtn-turn { width: 116px; height: 96px; font-size: 36px; border-radius: 20px; }
.tbtn-boost {
  width: 116px; height: 52px;
  font: 700 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .12em;
  color: #04070d;
  background: rgba(124, 255, 61, .88);
  border-color: rgba(255, 255, 255, .3);
}
.tbtn-boost.is-down { background: #c8ff9c; border-color: #fff; transform: scale(.96); }

@media (max-height: 430px), (max-width: 700px) {
  .tbtn-turn { width: 104px; height: 84px; font-size: 32px; }
  .tbtn-boost { width: 104px; height: 46px; font-size: 13px; }
  .touch-label { display: none; }
}

@media (max-width: 760px) {
  .lobby { padding: 40px 14px 40px; }
  .lb-grid { grid-template-columns: 1fr; }
}
