:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #080b20;
  color: #edf6ff;
  --cyan: #54eeff;
  --pink: #ff80c8;
  --muted: #a2acca;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 90% 0, #30214c99, transparent 50%), #080b20;
  min-height: 100dvh;
}

main {
  max-width: 760px;
  margin: auto;
  padding: max(20px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

header span {
  font-size: 12px;
  letter-spacing: 2px;
  font-weight: 800;
}

header small {
  display: block;
  font-size: 8px;
  color: var(--pink);
  letter-spacing: 4px;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

button, select, input {
  font: inherit;
}

button, select, input[type=number] {
  color: inherit;
  background: #13192f;
  border: 1px solid #4b5273;
  border-radius: 13px;
  padding: 12px;
}

button {
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

button:hover {
  border-color: var(--cyan);
  background: #202b45;
}

button:disabled {
  opacity: .35;
  cursor: default;
}

button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 30px 0 22px;
  isolation: isolate;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin: 26px 0 12px;
}

.eyebrow::before {
  content: '';
  flex: none;
  width: 26px;
  height: 1px;
  background: var(--cyan);
  opacity: .8;
}

#paused .eyebrow,
#result .eyebrow {
  justify-content: center;
}

h1 {
  font-size: clamp(42px, 9vw, 76px);
  line-height: 1;
  letter-spacing: -4px;
  margin: 20px 0;
}

.hero h1 {
  position: relative;
  text-shadow: 0 0 35px #54eeff44;
  animation: logo-glow 4s ease infinite;
}

.hero h1 span {
  background: linear-gradient(110deg, #54eeff, #c895ff, #ff80c8);
  background-clip: text;
  color: transparent;
}

.hero h1 i {
  font-size: 32px;
  color: var(--cyan);
  font-style: normal;
  margin-left: 8px;
}

.hero p {
  position: relative;
}

.orbit {
  position: absolute;
  z-index: -1;
  width: 230px;
  height: 230px;
  border: 1px solid #8d65ff66;
  border-radius: 50%;
  top: 12px;
  right: -85px;
  box-shadow: 0 0 65px #703af733, inset 0 0 65px #703af733;
  animation: orbit 10s ease-in-out infinite alternate;
}

.orbit::after {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid #54eeff33;
  border-radius: 50%;
}

.hero-line {
  display: flex;
  height: 25px;
  gap: 7px;
  margin-top: 26px;
  transform: skewX(-25deg);
}

.hero-line i {
  width: 44px;
  background: linear-gradient(0deg, #54eeff66, #54eeff11);
  border-top: 2px solid var(--cyan);
}

.hero-line i:nth-child(2) {
  opacity: .5;
}

.hero-line i:nth-child(3) {
  opacity: .2;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-label h2 {
  font-size: 15px;
  letter-spacing: -.3px;
}

.section-label > span {
  font-size: 11px;
  color: var(--muted);
}

.levels {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 2px 24px;
  scroll-snap-type: x proximity;
}

.levels button {
  min-width: 106px;
  padding: 16px 12px 12px;
  text-align: left;
  background: linear-gradient(145deg, #202743, #101329);
  scroll-snap-align: start;
}

.levels strong {
  display: block;
  font-size: 25px;
  font-weight: 300;
  margin-bottom: 12px;
}

.levels span {
  display: block;
  font-size: 11px;
  color: #bdc8e5;
}

.levels small {
  display: block;
  letter-spacing: 2px;
  color: #ffe09c;
  margin-top: 6px;
}

.levels .selected {
  border-color: var(--cyan);
  box-shadow: 0 0 18px #54eeff20, inset 0 0 18px #54eeff10;
}

.setup {
  border: 1px solid #303752;
  border-radius: 18px;
  padding: 18px;
  background: #11162c99;
}

summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

summary span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 0 18px;
  font-weight: 400;
}

.settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11px;
  color: #aebbd5;
  min-width: 0;
}

select {
  width: 100%;
  min-width: 0;
  padding: 11px 8px;
  font-size: 13px;
}

input[type=range] {
  accent-color: var(--cyan);
  width: 100%;
}

.file {
  margin-top: 18px;
  border: 1px dashed #484e70;
  padding: 12px;
  border-radius: 12px;
  overflow: hidden;
}

.file input {
  max-width: 100%;
  font-size: 11px;
}

.check {
  flex-direction: row;
  align-items: center;
  margin-top: 15px;
}

.primary {
  display: block;
  width: 100%;
  padding: 18px;
  margin: 20px 0;
  color: #061225;
  background: linear-gradient(105deg, #54eeff, #b3a1ff);
  border: 0;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 8px 30px #54eeff19;
}

.primary:hover {
  background: linear-gradient(105deg, #9cf4ff, #c9baff);
}

.hint {
  font-size: 11px;
  text-align: center;
  line-height: 1.8;
}

.account-box {
  margin-top: 25px;
  padding-top: 16px;
  border-top: 1px solid #303752;
}

#account, #leaders, #message, #renderStatus {
  font-size: 12px;
}

#message {
  color: #ffd477;
}

#play {
  position: relative;
  margin-top: 24px;
}

.hud {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.hud div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hud div:nth-child(2) {
  text-align: center;
}

.hud div:last-child {
  text-align: right;
}

.hud small {
  font-size: 8px;
  letter-spacing: 3px;
  color: var(--muted);
}

.hud span {
  display: block;
  font-size: 22px;
  font-weight: 700;
}

#combo {
  color: var(--cyan);
}

.energy {
  height: 3px;
  background: #242d49;
  margin: 15px 0 0;
}

#energy {
  display: block;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 10px #54eeff66;
}

.stage {
  position: relative;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
}

canvas {
  display: block;
  width: 100%;
  height: min(61dvh, 640px);
  touch-action: none;
}

#feedback, #countdown, #fever {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
  pointer-events: none;
}

#feedback {
  top: 42%;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 4px;
  text-shadow: 0 0 22px #54eeff99;
}

#feedback[data-grade=Miss] {
  color: #ff80ae;
}

#feedback[data-grade=Great] {
  color: #c895ff;
}

#feedback[data-grade=Good] {
  color: #ffd477;
}

#countdown {
  top: 30%;
  font-size: 80px;
  font-weight: 200;
  text-shadow: 0 0 25px var(--cyan);
}

#fever {
  top: 8%;
  font-size: 13px;
  font-weight: 800;
  color: #ffd477;
  letter-spacing: 7px;
}

#fever span {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  margin-top: 5px;
}

.fever-active .energy {
  filter: hue-rotate(120deg);
}

.hit-label {
  position: absolute;
  bottom: 8%;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 8px;
  color: #b5cde3;
  pointer-events: none;
}

#pads {
  display: flex;
  gap: 6px;
  touch-action: none;
  padding-top: 8px;
}

#pads button {
  flex: 1;
  min-width: 0;
  padding: 20px 0;
  border: 1px solid #39415b;
  border-bottom: 3px solid var(--lane);
  background: linear-gradient(0deg, #27324a, #11172a);
  user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
}

#pads button.active {
  background: var(--lane);
  color: #081225;
  box-shadow: 0 0 22px var(--lane);
}

.controls {
  display: flex;
  justify-content: space-between;
  margin: 15px 0;
}

.controls button {
  min-width: 100px;
  font-size: 12px;
}

#paused {
  position: absolute;
  inset: 50px 0 95px;
  background: #080b20e8;
  backdrop-filter: blur(12px);
  padding: 55px 25px;
  text-align: center;
  border-radius: 18px;
}

#paused h2 {
  font-size: 30px;
  font-weight: 300;
}

#result {
  text-align: center;
  padding: 28px 0;
}

#result h2 {
  font-size: 30px;
  font-weight: 300;
  letter-spacing: -1px;
}

#resultScore {
  font-variant-numeric: tabular-nums;
  font-weight: 300;
  margin: 30px 0;
}

#stars {
  color: #ffe09c;
  font-size: 38px;
  text-shadow: 0 0 22px #ffd47733;
}

#stars span {
  display: inline-block;
  margin: 0 3px;
}

.accuracy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 24px 0;
}

.accuracy strong {
  font-size: 27px;
  color: var(--cyan);
}

.accuracy span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 2px;
}

#details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  border: 1px solid #303752;
  border-radius: 16px;
  padding: 18px 8px;
}

#details div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#details strong {
  font-size: 23px;
  font-weight: 400;
}

#details span {
  font-size: 10px;
  color: var(--muted);
}

#best {
  color: #ffd477;
  font-size: 13px;
}

dialog {
  background: #10172c;
  border: 1px solid #586180;
  color: inherit;
  border-radius: 22px;
  max-width: min(92vw, 430px);
  padding: 25px;
}

dialog::backdrop {
  background: #000b;
  backdrop-filter: blur(6px);
}

dialog button {
  margin: 8px 0;
}

dialog label {
  margin: 12px 0;
}

[hidden] {
  display: none !important;
}

@keyframes logo-glow {
  50% {
    text-shadow: 0 0 45px #b78aff77;
  }
}

@keyframes orbit {
  to {
    transform: translateY(20px) scale(1.12);
  }
}

@media (max-width: 450px) {
  main {
    padding-left: 16px;
    padding-right: 16px;
  }
  header {
    font-size: 12px;
  }
  header span {
    font-size: 10px;
    letter-spacing: 1px;
  }
  header button {
    padding: 9px;
    font-size: 11px;
  }
  .hero h1 {
    font-size: 52px;
    letter-spacing: -3px;
  }
  .hero h1 i {
    font-size: 20px;
  }
  .setup {
    padding: 15px;
  }
  .settings {
    gap: 12px;
  }
  canvas {
    height: 57dvh;
  }
  #pads button {
    padding: 18px 0;
  }
  #stars {
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

body:has(#reduced:checked) .hero h1, body:has(#reduced:checked) .orbit {
  animation: none;
}

/* Spillet fylder skærmen: pause/afslut øverst, sporknapperne nederst ved tommelfingrene. */
main:has(#play:not([hidden])) > header {
  display: none;
}

#play:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 16px max(10px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: #080b20;
  overflow: hidden;
}

#play .controls {
  margin: 8px 0 10px;
}

#play .controls button {
  min-width: 84px;
  padding: 8px 12px;
}

#play .stage {
  flex: 1;
  min-height: 0;
}

#play canvas {
  position: absolute;
  inset: 0;
  height: 100%;
}

#play #pads button {
  min-height: 92px;
  padding: 0;
  font-size: 18px;
}

/* Langt tryk må ikke markere tekst eller åbne iOS' forstørrelse. */
#play,
#play * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Flat lanes reach the edges; the controls remain above the touch surface. */
#play[data-view=flat] { padding-left: 0; padding-right: 0; }
#play[data-view=flat] .controls { padding: 0 12px; }
#play[data-view=flat] #pads { display: none; }
#play[data-view=flat] .stage { border-radius: 0; }
#play[data-view=flat] .hit-label { display: none; }
#play[data-view=flat] .hud {
  margin: 0 auto;
  width: min(94%, 380px);
  padding: 12px 20px;
  border: 1px solid #54eeff55;
  border-radius: 40px;
  background: #15223b;
  box-shadow: 0 0 18px #54eeff22;
}
