/* SMO Arena Fighter — UI styl (agent F).
   Bez externích fontů, obrázků a knihoven. Ladí s rozcestníkem /style.css. */

:root {
  --bg:        #0a0d12;
  --bg-2:      #0e131b;
  --panel:     #131a24;
  --panel-2:   #18212d;
  --line:      #24303f;
  --line-hi:   #35455a;
  --text:      #dbe4ef;
  --muted:     #7d8da3;
  --accent:    #9b6bff;   /* violet — barva SMO karty na rozcestníku */
  --accent-2:  #35e0d6;   /* tyrkys */
  --danger:    #ff5b5b;
  --warn:      #ffd23f;
  --ok:        #45d67a;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(1100px 700px at 50% -10%, #1a1730 0%, rgba(26,23,48,0) 70%),
    radial-gradient(800px 520px at 100% 100%, rgba(53,224,214,.07), rgba(0,0,0,0) 70%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.014) 0 1px, rgba(0,0,0,0) 1px 3px),
    var(--bg);
}

.hidden { display: none !important; }

.screen { min-height: 100%; }

/* ---------------- stav spojení ---------------- */
.conn-bar {
  position: fixed;
  top: 10px; right: 12px;
  z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10,13,18,.84);
  backdrop-filter: blur(4px);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .03em;
  color: var(--muted);
  pointer-events: none;
  max-width: 62vw;
}
.conn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-dot {
  flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 8px currentColor;
}
.conn-bar.is-on   .conn-dot { background: var(--ok);     color: var(--ok); }
.conn-bar.is-off  .conn-dot { background: var(--danger); color: var(--danger); }
.conn-bar.is-wait .conn-dot { background: var(--warn);   color: var(--warn); }

/* ---------------- LOBBY ---------------- */
.lobby { padding: 26px 18px 40px; display: flex; justify-content: center; }
.lobby-wrap { width: 100%; max-width: 940px; }

.lobby-head {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.back-link {
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 11px; font-size: 13px;
  transition: .15s;
}
.back-link:hover { color: var(--text); border-color: var(--accent); }

.logo {
  margin: 0; flex: 1;
  font-family: var(--mono);
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 22px rgba(155,107,255,.3);
  white-space: nowrap;
}
.logo span { color: var(--accent); }

.room-tag {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 8px; padding: 5px 10px;
}
.room-tag b { color: var(--accent-2); font-weight: 600; }

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 760px) { .panels { grid-template-columns: 1fr; } }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
}
.panel-title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 12px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.panel-title.mt { margin-top: 20px; }
.count { color: var(--accent-2); font-weight: 600; letter-spacing: .06em; }

.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 12px; color: var(--muted); letter-spacing: .04em;
}
.field-hint { color: #5f6d82; }

.text-input {
  width: 100%;
  padding: 11px 13px;
  background: #0b1017;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  outline: none;
  transition: .15s;
}
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155,107,255,.16); }

/* barvy */
.color-picker { display: flex; flex-wrap: wrap; gap: 9px; }
.color-swatch {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 11px;
  border: 2px solid rgba(255,255,255,.14);
  background: #222;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
  padding: 0;
}
.color-swatch:hover:not([disabled]) { transform: translateY(-2px); }
.color-swatch.sel {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.18), 0 0 16px currentColor;
}
.color-swatch[disabled] {
  cursor: not-allowed;
  opacity: .3;
  filter: grayscale(.6);
}
.color-swatch[disabled]::after {
  content: "×";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: rgba(255,255,255,.85);
}

/* tlačítka */
.btn {
  font-family: var(--mono);
  font-size: 13px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: .15s;
}
.btn:hover:not([disabled]) { border-color: var(--accent); color: #fff; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #6b46c1, #4c2f96);
  border-color: #8259e0; color: #f1e9ff;
}
.btn-primary:hover:not([disabled]) { background: linear-gradient(180deg, #7b53d8, #5a37ad); }

.btn-ghost { background: transparent; }
.btn-ghost:hover:not([disabled]) { border-color: var(--danger); color: #ffd9d9; }

.btn-start {
  width: 100%; margin-top: 14px;
  padding: 14px;
  font-size: 14px;
  background: linear-gradient(180deg, #12655f, #0d4a48);
  border-color: #1c8b83; color: #e2fffb;
}
.btn-start:hover:not([disabled]) { background: linear-gradient(180deg, #16807a, #10605c); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.lobby-info {
  margin: 14px 0 0;
  font-size: 12.5px; line-height: 1.5;
  color: var(--muted);
  min-height: 1.5em;
}
.lobby-info.warn { color: var(--warn); }
.lobby-info.err  { color: var(--danger); }

/* seznam hráčů */
.player-list { list-style: none; margin: 0; padding: 0; min-height: 60px; }
.player-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  margin-bottom: 7px;
  background: #0d131b;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 9px;
  font-size: 14px;
}
.player-list li.me { background: #141026; border-color: #3b2f66; }
.player-list .dot { flex: none; width: 12px; height: 12px; border-radius: 4px; }
.player-list .p-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list .p-you {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--accent); border: 1px solid rgba(155,107,255,.45);
  border-radius: 5px; padding: 1px 5px;
}
.player-list .p-slot { font-family: var(--mono); font-size: 11px; color: #5f6d82; }
.player-list .empty { justify-content: center; color: var(--muted); font-size: 13px; border-left-color: var(--line); }

/* volba životů */
.lives-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.lives-opt {
  flex: 1; min-width: 54px;
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  padding: 10px 0;
  background: #0d131b; color: var(--muted);
  border: 1px solid var(--line); border-radius: 9px;
  cursor: pointer; transition: .15s;
}
.lives-opt:hover:not([disabled]) { color: var(--text); border-color: var(--accent-2); }
.lives-opt.on {
  background: linear-gradient(180deg, #24404a, #172b33);
  color: #fff; border-color: var(--accent-2);
  box-shadow: 0 0 14px rgba(53,224,214,.18);
}
.lives-opt[disabled] { opacity: .45; cursor: not-allowed; }

/* nápověda */
.how-to {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(19,26,36,.6);
}
.how-to h3 {
  margin: 0 0 10px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.how-to ul { margin: 0; padding-left: 18px; columns: 2; column-gap: 26px; }
@media (max-width: 700px) { .how-to ul { columns: 1; } }
.how-to li { font-size: 13px; color: #aab8ca; margin-bottom: 6px; break-inside: avoid; }
.how-to b { color: var(--accent-2); font-family: var(--mono); }

/* ---------------- HRA ---------------- */
.game {
  position: fixed; inset: 0;
  overflow: hidden;
  background: #06090d;
}
.canvas-wrap { position: absolute; inset: 0; }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

.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: 10px 14px;
  background: linear-gradient(180deg, rgba(6,9,13,.85), rgba(6,9,13,0));
  pointer-events: none;
}
.hud .btn { pointer-events: auto; }

/* karty hráčů: barva, jméno, srdíčka, zátěž v % */
.hud-players { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.p-card {
  min-width: 132px;
  padding: 6px 9px;
  background: rgba(13,19,27,.82);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 9px;
}
.p-card.me { border-color: var(--line-hi); box-shadow: 0 0 0 1px rgba(255,255,255,.06) inset; }
.p-card.is-out { opacity: .7; }
.p-card.is-dead { opacity: .35; filter: grayscale(.7); }

.p-top { display: flex; align-items: center; gap: 6px; }
.p-top .nm {
  flex: 1; min-width: 0;
  font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.p-lives { font-family: var(--mono); font-size: 12px; color: var(--danger); letter-spacing: .02em; white-space: nowrap; }
.p-lives.none { color: #5f6d82; }

.p-load { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.p-bar {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.09);
  overflow: hidden;
}
.p-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--accent-2);
  transition: width .12s linear, background-color .2s linear;
}
.p-dmg {
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  color: #cfd8e6;
  min-width: 4.5ch; text-align: right;
}

.hud-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  margin-right: 132px;
}
@media (max-width: 700px) { .hud-right { margin-right: 0; margin-top: 30px; } }

.hud-chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  color: var(--muted);
  background: rgba(19,26,36,.75);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 7px;
  max-width: 40vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hud-chip.ping { color: #6ec9c3; }

.btn-mini {
  padding: 5px 9px; font-size: 10.5px; letter-spacing: .08em;
  background: rgba(19,26,36,.85);
}

.controls-help {
  position: absolute; bottom: 8px; left: 0; right: 0;
  z-index: 20;
  text-align: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  color: #64748b;
  pointer-events: none;
  padding: 0 10px;
}
.controls-help b { color: #93a4bb; }

.overlay {
  position: absolute; inset: 0;
  z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,7,10,.5);
  pointer-events: none;
}
.overlay-box { text-align: center; padding: 20px 30px; }
.overlay-title {
  font-family: var(--mono);
  font-size: clamp(34px, 9vw, 84px);
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 0 34px rgba(155,107,255,.4), 0 6px 24px rgba(0,0,0,.8);
  word-break: break-word;
}
.overlay-sub {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: clamp(12px, 2.4vw, 16px);
  letter-spacing: .1em;
  color: #9fb0c6;
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: 90vw;
  padding: 11px 17px;
  background: #2a1417;
  border: 1px solid #74323a;
  border-radius: 10px;
  color: #ffd9dc;
  font-size: 13px;
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   SMO Arena Fighter — rozvržení dotykových tlačítek
   (obecné styly jsou v /shared/touch.css)
   ========================================================================== */
.tbtn.is-down {
  background: rgba(155,107,255,.36);
  border-color: rgba(155,107,255,.8);
}
body.touch-on .hud { padding: 6px 10px; font-size: 12px; }
.rotate-icon { color: #9b6bff; }

.move-row, .act-row { display: flex; gap: 10px; }
.tbtn-move { width: 74px; height: 62px; font-size: 26px; }
.tbtn-drop {
  width: 158px; height: 44px;
  font: 600 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .1em;
}
.tbtn-jump, .tbtn-grenade {
  width: 84px; height: 56px;
  font: 700 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .08em;
}
.tbtn-jump { background: rgba(53,224,214,.82); color: #08090f; border-color: rgba(255,255,255,.28); }
.tbtn-jump.is-down { background: #7ff2ea; border-color: #fff; }
.tbtn-grenade { background: rgba(255,180,60,.82); color: #08090f; border-color: rgba(255,255,255,.28); }
.tbtn-grenade.is-down { background: #ffd08a; border-color: #fff; }
.tbtn-shoot {
  width: 178px; height: 64px;
  font: 700 17px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .12em;
  color: #08090f;
  background: rgba(255,91,176,.9);
  border-color: rgba(255,255,255,.28);
}
.tbtn-shoot.is-down { background: #ff9ccd; border-color: #fff; transform: scale(.96); }

@media (max-height: 430px), (max-width: 700px) {
  .tbtn-move { width: 64px; height: 54px; font-size: 22px; }
  .tbtn-drop { width: 138px; height: 38px; font-size: 11px; }
  .tbtn-jump, .tbtn-grenade { width: 74px; height: 48px; font-size: 11px; }
  .tbtn-shoot { width: 158px; height: 56px; font-size: 15px; }
  .touch-label { display: none; }
}

/* odznak aktivní odměny z bedny v HUD */
.p-buff {
  flex: none;
  margin-left: 6px;
  padding: 1px 6px;
  font: 700 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 5px;
  white-space: nowrap;
}
