:root {
  --ink: #e8e8f0;
  --dim: #7a7a92;
  --hot: #ff4ba8;
  --cool: #4be0ff;
  --gold: #e0b83c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #05050a;
  color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

#app { position: fixed; inset: 0; }

.scene { position: absolute; inset: 0; display: none; }
.scene.is-active { display: flex; align-items: center; justify-content: center; }

/* --- parallax pozadie ------------------------------------------------------ */

.parallax { position: absolute; inset: -6%; overflow: hidden; }

.layer {
  position: absolute;
  inset: 0;
  will-change: transform;
  transition: transform 120ms ease-out;
}

.layer--sky {
  background:
    linear-gradient(#05050f 0%, #16093a 45%, #3d0b46 62%, #7a1050 76%, #12071e 77%, #12071e 100%);
}

.layer--stars {
  background-image:
    radial-gradient(1px 1px at 10% 12%, #fff, transparent),
    radial-gradient(1px 1px at 25% 28%, #cfe, transparent),
    radial-gradient(1px 1px at 42% 8%,  #fff, transparent),
    radial-gradient(1px 1px at 58% 22%, #fdd, transparent),
    radial-gradient(1px 1px at 71% 14%, #fff, transparent),
    radial-gradient(1px 1px at 85% 30%, #cfe, transparent),
    radial-gradient(1px 1px at 92% 6%,  #fff, transparent),
    radial-gradient(1px 1px at 16% 36%, #fff, transparent);
  opacity: .8;
  animation: twinkle 4s steps(2) infinite;
}

@keyframes twinkle { 50% { opacity: .45; } }

/* Slnko sedí na horizonte, nie pod tlačidlami — inak sa cez neho nedá čítať. */
.layer--sun {
  background:
    radial-gradient(circle at 50% 80%, #ffd06a 0 60px, #ff8a3c 61px 96px, transparent 97px);
  filter: drop-shadow(0 0 46px rgba(255,90,44,.75));
  -webkit-mask-image: repeating-linear-gradient(to bottom, #000 0 9px, transparent 9px 14px);
  mask-image: repeating-linear-gradient(to bottom, #000 0 9px, transparent 9px 14px);
}

/* Perspektívna mriežka — synthwave horizont. */
.layer--grid {
  top: 80%;
  background-image:
    repeating-linear-gradient(to right, rgba(75,224,255,.5) 0 2px, transparent 2px 72px),
    repeating-linear-gradient(to bottom, rgba(255,75,168,.4) 0 2px, transparent 2px 44px);
  transform-origin: 50% 0;
  animation: grid-scroll 3.4s linear infinite;
  opacity: .5;
}

@keyframes grid-scroll { to { background-position: 0 44px, 0 44px; } }

/* Nepravidelná silueta mesta — pravidelný raster vyzeral ako čiarový kód. */
.layer--skyline {
  top: 66%; height: 15%;
  background: linear-gradient(to top, #150826 0 100%);
  -webkit-mask-image: repeating-linear-gradient(to right,
    #000 0 34px, transparent 34px 47px,
    #000 47px 61px, transparent 61px 70px,
    #000 70px 118px, transparent 118px 131px,
    #000 131px 149px, transparent 149px 167px);
  mask-image: repeating-linear-gradient(to right,
    #000 0 34px, transparent 34px 47px,
    #000 47px 61px, transparent 61px 70px,
    #000 70px 118px, transparent 118px 131px,
    #000 131px 149px, transparent 149px 167px);
}

/* Opar nad horizontom — dodá hĺbku bez ďalších prvkov na prekresľovanie. */
.layer--tanks {
  top: 74%; height: 10%;
  background: linear-gradient(to top, rgba(255,90,44,.22), transparent);
}

/* Stmavený stred, aby logo aj tlačidlá držali kontrast nad grafikou. */
.layer--vignette {
  background: radial-gradient(ellipse 70% 55% at 50% 42%, rgba(5,5,12,.78), transparent 70%);
}

/* --- obsah ----------------------------------------------------------------- */

/*
 * Menu je mriežka: hore logo, v strede tlačidlá, dole pás s ovládaním.
 * Predtým bol hint absolútne umiestnený a na nižších obrazovkách skončil
 * priamo na slnku, kde sa nedal prečítať.
 */
#menu.is-active {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: start;
}

.menu__content {
  position: relative;
  grid-row: 1;
  align-self: center;
  text-align: center;
  padding: 24px 32px 0;
}

.logo {
  margin: 0;
  font-size: clamp(48px, 11vw, 132px);
  letter-spacing: .12em;
  font-weight: 700;
  color: #fff;
  text-shadow:
    0 3px 0 #b8b8c8, 0 6px 0 #6a6a80,
    0 8px 0 var(--hot), 0 10px 24px rgba(255,75,168,.7);
}

.logo__badge {
  display: inline-block;
  margin-left: .18em;
  padding: .06em .22em;
  font-size: .34em;
  vertical-align: super;
  color: #12071e;
  background: var(--gold);
  text-shadow: none;
  transform: rotate(-6deg);
}

.tagline {
  margin: 8px 0 38px;
  color: var(--cool);
  letter-spacing: .38em;
  text-transform: uppercase;
  font-size: 15px;
}

.menu__list { display: flex; flex-direction: column; gap: 14px; align-items: center; }

.menu__item {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: baseline;
  gap: 4px 10px;
  width: min(460px, 86vw);
  padding: 14px 22px;
  font: inherit;
  font-size: 18px;
  text-align: left;
  letter-spacing: .1em;
  color: var(--ink);
  /* Nepriehľadnejšie pozadie — tlačidlá stoja nad jasným slnkom. */
  background: rgba(8,5,16,.88);
  border: 2px solid #3a2a58;
  cursor: pointer;
  transition: transform .1s, border-color .1s, box-shadow .1s;
}

.menu__item em {
  grid-column: 2;
  color: #a6a6bd;
  font-style: normal;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: none;
}

.menu__item--quiet { padding: 13px 22px; font-size: 15px; }

.menu__key { color: var(--hot); text-align: center; }

.menu__item:hover:not(:disabled),
.menu__item:focus-visible:not(:disabled) {
  border-color: var(--hot);
  box-shadow: 0 0 0 2px rgba(255,75,168,.25), 0 0 24px rgba(255,75,168,.35);
  transform: translateY(-2px);
  outline: none;
}

.menu__item:disabled { opacity: .4; cursor: not-allowed; }

/* Pás s ovládaním má vlastný riadok mriežky, takže nikdy neleží na grafike. */
.menu__foot {
  position: relative;
  grid-row: 2;
  padding: 12px 20px 10px;
  background: linear-gradient(rgba(5,5,12,0), rgba(5,5,12,.92) 40%);
  backdrop-filter: blur(2px);
}

.menu__keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 26px;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--dim);
}
.menu__keys b { color: var(--gold); font-weight: 700; }

/* --- výber mapy ------------------------------------------------------------ */

#mapselect { background: linear-gradient(#05050f, #12071e); overflow-y: auto; align-items: flex-start; }

.maplist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 12px;
  margin: 22px 0 26px;
}

.mapcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: rgba(8,5,16,.86);
  border: 2px solid #2a1f42;
  cursor: pointer;
  transition: border-color .1s, transform .1s;
}
.mapcard b { font-size: 19px; letter-spacing: .08em; }
.mapcard span { font-size: 14px; color: #a6a6bd; line-height: 1.55; }
.mapcard em { font-size: 12px; font-style: normal; color: #6f6790; letter-spacing: .04em; }
.mapcard:hover { border-color: var(--cool); transform: translateY(-2px); }
.mapcard.is-active { border-color: var(--gold); }
.mapcard.is-active b { color: var(--gold); }

/* Varianta je otázka na dva kliky — dve karty vedľa seba, nie mriežka na päť. */
.maplist--variants { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 22px; }

.ms-head {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .22em;
  color: #6f6790;
}

.ms-seedwrap { display: flex; gap: 8px; align-items: center; }
/*
 * .menu__item je mriežka s úzkym prvým stĺpcom pre číslo klávesy. Dlhší nápis
 * („POKRAČOVAŤ DO LOBBY") sa doň nevošiel a vytiekol mimo rámu.
 * Tu žiadne číslo nie je, takže z toho spravíme obyčajné vycentrované tlačidlo.
 */
.ms-start {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 260px;
  padding: 16px 28px;
  font-size: 17px;
  text-align: center;
  white-space: nowrap;
}

/* --- nastavenia ------------------------------------------------------------ */

#settings { background: linear-gradient(#05050f, #12071e); overflow-y: auto; align-items: flex-start; }

.settings {
  position: relative;
  width: min(720px, 94vw);
  margin: 4vh auto;
  padding: 28px;
  text-align: center;
}

.settings__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 420px;
  margin: 0 auto 12px;
  padding: 14px 18px;
  font-size: 16px;
  background: rgba(10,6,20,.6);
  border: 1px solid #2a1f42;
}

.settings__row label { color: var(--ink); letter-spacing: .04em; font-size: 16px; }

.settings__text {
  width: 180px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--gold);
  background: rgba(0,0,0,.4);
  border: 1px solid #3a2a58;
}
.settings__text:focus { outline: none; border-color: var(--cool); }

.settings__row input[type="checkbox"] {
  width: 20px; height: 20px;
  accent-color: #ff4ba8;
  cursor: pointer;
}

.settings__head {
  margin: 34px 0 6px;
  font-size: 17px;
  letter-spacing: .3em;
  color: var(--cool);
}
.settings__hint { margin: 0 0 18px; font-size: 14px; color: #a6a6bd; }
.settings__meta { margin: 8px 0 0; font-size: 14px; color: #a6a6bd; }

.keys { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.keys__col { flex: 1 1 260px; max-width: 320px; }
.keys__title { margin: 0 0 10px; font-size: 15px; letter-spacing: .18em; }
.keys__title--p1 { color: var(--gold); }
.keys__title--p2 { color: #48b058; }

.keys__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 5px;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  color: #a6a6bd;
  background: rgba(10,6,20,.6);
  border: 1px solid #2a1f42;
  cursor: pointer;
}
.keys__row b { color: var(--ink); font-weight: 700; }
.keys__row:hover { border-color: var(--cool); }
.keys__row.is-listening { border-color: var(--hot); }
.keys__row.is-listening b { color: var(--hot); }

.settings__actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; }

/* --- lobby ----------------------------------------------------------------- */

#lobby { background: linear-gradient(#05050f, #12071e); }

.lobby { position: relative; text-align: center; padding: 32px; min-width: min(520px, 92vw); }

/*
 * Vrstvený tieň robil z nadpisu dvojobraz — pri veľkom prestrkaní písmen
 * to vyzeralo ako preložené riadky. Stačí jemná žiara.
 */
.lobby__title {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  letter-spacing: .14em;
  color: #fff;
  text-shadow: 0 0 26px rgba(255, 75, 168, .55);
}

.lobby__sub { margin: 12px 0 30px; font-size: 15px; color: var(--dim); }

.lobby__mode { margin-bottom: 22px; }
.lobby__mapname {
  margin: 8px 0 0;
  font-size: 15px;
  letter-spacing: .16em;
  color: var(--gold);
}

.lobby__actions { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.lobby__join { display: flex; gap: 10px; width: min(420px, 80vw); }
.lobby__join .menu__item { min-width: 0; flex: 1; }

.lobby__input {
  width: 150px;
  padding: 16px 14px;
  font: inherit;
  font-size: 20px;
  letter-spacing: .3em;
  text-align: center;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(10,6,20,.72);
  border: 2px solid #3a2a58;
}
.lobby__input:focus { outline: none; border-color: var(--cool); }

.lobby__room { margin-top: 30px; }
.lobby__label { margin: 0; font-size: 13px; letter-spacing: .22em; color: #a6a6bd; }
.lobby__code {
  margin: 6px 0 14px;
  font-size: 46px;
  letter-spacing: .34em;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(224,184,60,.5);
}

.lobby__copy, .lobby__back {
  font: inherit;
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--ink);
  background: none;
  border: 1px solid #3a2a58;
  padding: 12px 20px;
  cursor: pointer;
}
.lobby__copy:hover, .lobby__back:hover { border-color: var(--cool); color: var(--cool); }

.lobby__status { min-height: 22px; margin: 26px 0 18px; font-size: 16px; color: #a6a6bd; }
.lobby__status.is-ok { color: #58e07a; }
.lobby__status.is-error { color: var(--hot); }

/* Verzia bola predtým absolútne pri spodnom okraji a orezávala sa. */
.version {
  margin: 8px 0 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: .18em;
  color: #4c4463;
}

/* --- CRT ------------------------------------------------------------------- */

.crt {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .layer { transition: none; animation: none !important; }
}

/* --- dotykové zariadenie ---------------------------------------------------- */

.menu__touchnote { display: none; }

/* Na dotyku má zmysel iba online — splitscreen na jednej klávesnici tam nie je. */
body.is-touch .menu__item--desktop,
body.is-touch .menu__keys--desktop { display: none; }

body.is-touch .menu__touchnote {
  display: block;
  margin: 0 0 6px;
  text-align: center;
  font-size: 12px;
  color: var(--cool);
  letter-spacing: .08em;
}

body.is-touch .settings__row,
body.is-touch .mapcard,
body.is-touch .menu__item { min-height: 52px; }

/* --- kampaň ----------------------------------------------------------------- */

#campaign { background: linear-gradient(#05050f, #12071e); overflow-y: auto; align-items: flex-start; }

.garage {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin: 20px 0 10px;
  padding: 14px;
  background: rgba(8,5,16,.7);
  border: 2px solid #2a1f42;
}
.garage__item { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.garage__item span { font-size: 12px; letter-spacing: .16em; color: #a6a6bd; }
.garage__item b { font-size: 34px; color: var(--gold); }

.lvl {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 15px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: rgba(8,5,16,.86);
  border: 2px solid #2a1f42;
  cursor: pointer;
}
.lvl b { font-size: 19px; letter-spacing: .06em; }
.lvl span { font-size: 14px; color: #a6a6bd; }
.lvl em { font-size: 12px; font-style: normal; color: #6f6790; letter-spacing: .08em; text-transform: uppercase; }
.lvl:hover:not(:disabled) { border-color: var(--cool); }
.lvl.is-next { border-color: var(--gold); }
.lvl.is-next b { color: var(--gold); }
.lvl.is-locked { opacity: .35; cursor: not-allowed; }

/* --- obtiažnosť ------------------------------------------------------------- */

.diffrow { display: flex; gap: 8px; flex-wrap: wrap; }
.diffbtn {
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #a6a6bd;
  background: rgba(10,6,20,.7);
  border: 2px solid #2a1f42;
  cursor: pointer;
}
.diffbtn.is-active { color: var(--gold); border-color: var(--gold); }
