:root {
  color-scheme: dark;
  font-family: Inter, Avenir Next, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: #01131e;
  --orange: #ff6a14;
  --orange-bright: #ff902f;
  --cyan: #25d1ff;
  --cyan-soft: #9cecff;
  --ink: #031722;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 12%, rgba(30, 144, 184, 0.24), transparent 43%),
    radial-gradient(circle at 50% 105%, rgba(0, 49, 78, 0.7), transparent 45%),
    #01131e;
}

body {
  display: grid;
  place-items: center;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.app {
  position: relative;
  isolation: isolate;
  width: min(100vw, 480px);
  height: 100svh;
  max-height: 920px;
  overflow: hidden;
  border-radius: clamp(0px, 4.8vw, 30px);
  background: #052f43;
  box-shadow:
    0 38px 115px rgba(0, 0, 0, 0.68),
    0 0 0 1px rgba(103, 225, 255, 0.12);
  touch-action: none;
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.surface-light,
.depth-haze,
.screen-grain,
.edge-shade,
.screen-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.surface-light {
  z-index: 2;
  opacity: 0.75;
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse 68% 42% at 82% -5%, rgba(205, 255, 255, 0.20), transparent 72%),
    linear-gradient(112deg, transparent 0 52%, rgba(204, 252, 255, 0.034) 56%, transparent 66%);
}

.depth-haze {
  z-index: 2;
  background:
    linear-gradient(to bottom, rgba(1, 14, 24, 0.04), transparent 22%, transparent 72%, rgba(0, 14, 24, 0.18)),
    radial-gradient(ellipse at 50% 56%, transparent 38%, rgba(0, 13, 22, 0.15) 100%);
}

.screen-grain {
  z-index: 3;
  opacity: 0.052;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.52'/%3E%3C/svg%3E");
}

.edge-shade {
  z-index: 4;
  background:
    linear-gradient(to bottom, rgba(0, 8, 16, 0.34), transparent 17%, transparent 77%, rgba(0, 8, 16, 0.42)),
    radial-gradient(ellipse at center, transparent 48%, rgba(0, 7, 13, 0.27) 100%);
}

.screen-frame {
  z-index: 30;
  border: 1px solid rgba(117, 235, 255, 0.19);
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.045),
    inset 0 0 36px rgba(0, 21, 35, 0.28);
}

.hud {
  position: absolute;
  z-index: 12;
  top: max(12px, env(safe-area-inset-top));
  left: 20px;
  right: 20px;
  transition:
    opacity 300ms ease,
    transform 480ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 320ms ease;
}

.hud.is-hidden {
  opacity: 0;
  transform: translateY(-22px) scale(0.98);
  filter: blur(3px);
  pointer-events: none;
}

.hud__topline {
  height: 48px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.round-button {
  position: relative;
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  isolation: isolate;
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.44), transparent 30%),
    linear-gradient(145deg, #ff9b3a, #ff6317 62%, #dc410a);
  box-shadow:
    0 0 0 3px rgba(255, 117, 28, 0.44),
    0 0 0 5px rgba(255, 255, 255, 0.36),
    0 6px 18px rgba(0, 0, 0, 0.38),
    0 0 22px rgba(255, 105, 20, 0.27),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -5px 10px rgba(130, 28, 0, 0.18);
  transition: transform 180ms ease, filter 180ms ease;
}

.round-button::after {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: inherit;
}

.round-button:hover {
  filter: brightness(1.08) saturate(1.06);
  transform: translateY(-1px);
}

.round-button:active {
  transform: translateY(1px) scale(0.98);
}

.round-button:focus-visible,
.continue-button:focus-visible,
.replay-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.92);
  outline-offset: 4px;
}

.menu-lines {
  width: 20px;
  height: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.menu-lines i {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.74);
  white-space: nowrap;
}

.brand-lockup__globe {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
}

.brand-lockup__name {
  overflow: hidden;
  font-size: clamp(6.7px, 1.8vw, 8.6px);
  font-weight: 850;
  letter-spacing: 0.025em;
  text-overflow: clip;
}

.brand-lockup__name--wide {
  letter-spacing: 0.19em;
}

.brand-lockup__divider {
  width: 1px;
  height: 17px;
  margin: 0 1px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.76), transparent);
}

.sound-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-button__speaker {
  fill: #fff;
  stroke: none;
}

.sound-button[aria-pressed="false"] .sound-button__wave {
  opacity: 0.22;
}

.progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 9px;
}

.progress__segment {
  position: relative;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(213, 248, 255, 0.46);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.progress__segment::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, #ff5d0a, #ff8b22);
  box-shadow: 0 0 8px rgba(255, 93, 10, 0.66);
  transition: transform 760ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress__segment--done::after,
.progress__segment--active::after {
  transform: scaleX(1);
}

.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
}

.chapter-label {
  color: rgba(255, 255, 255, 0.98);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.quality-label {
  opacity: 0;
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel {
  position: absolute;
  z-index: 9;
  inset: 0;
  pointer-events: none;
}

.panel--first {
  opacity: 1;
  transition: opacity 360ms ease, filter 360ms ease;
}

.panel--first.is-hidden {
  opacity: 0;
  filter: blur(3px);
}

.stat-copy {
  position: absolute;
  left: 12.2%;
  top: 30.2%;
  max-width: 84%;
  color: #fff;
  text-shadow:
    0 3px 15px rgba(0, 0, 0, 0.52),
    0 1px 1px rgba(0, 0, 0, 0.45);
  transform: translateZ(0);
}

.stat-copy__number,
.stat-copy__accent {
  font-size: clamp(42px, 11.4vw, 58px);
  line-height: 0.91;
  font-weight: 950;
  letter-spacing: -0.055em;
}

.stat-copy__number {
  filter: drop-shadow(0 5px 12px rgba(0, 17, 29, 0.42));
}

.stat-copy__accent {
  margin-top: 5px;
  color: var(--orange);
  font-size: clamp(31px, 8.4vw, 43px);
  letter-spacing: -0.035em;
  text-shadow:
    0 3px 12px rgba(65, 16, 0, 0.48),
    0 0 18px rgba(255, 104, 20, 0.14);
}

.stat-copy__body {
  position: relative;
  margin-top: 13px;
  padding-left: 17px;
  font-size: clamp(22px, 6.2vw, 31px);
  line-height: 0.93;
  font-weight: 820;
  letter-spacing: -0.025em;
}

.stat-copy__body::before {
  content: "";
  position: absolute;
  left: 0;
  top: -2px;
  bottom: -2px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #ff8a2a, #ff5a0a);
  box-shadow: 0 0 11px rgba(255, 100, 18, 0.42);
}

.continue-button {
  position: absolute;
  left: 7.5%;
  right: 7.5%;
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 13px));
  height: 66px;
  padding: 0 12px 0 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  color: #fff;
  font-size: 17px;
  font-weight: 860;
  letter-spacing: -0.015em;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background:
    radial-gradient(circle at 25% 0, rgba(123, 230, 255, 0.34), transparent 38%),
    linear-gradient(180deg, rgba(18, 167, 224, 0.98), rgba(4, 99, 161, 0.98));
  box-shadow:
    0 0 0 4px rgba(18, 199, 255, 0.48),
    0 0 25px rgba(0, 178, 255, 0.36),
    inset 0 2px 0 rgba(255, 255, 255, 0.50),
    inset 0 -10px 22px rgba(0, 35, 94, 0.25),
    0 14px 35px rgba(0, 25, 52, 0.56);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 210ms ease, filter 210ms ease, box-shadow 210ms ease, opacity 220ms ease;
}

.continue-button::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: inherit;
  pointer-events: none;
}

.continue-button__shine {
  position: absolute;
  top: -55%;
  left: -25%;
  width: 26%;
  height: 210%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.27), transparent);
  animation: buttonShine 4.4s ease-in-out infinite;
}

.continue-button:not(:disabled):hover {
  filter: brightness(1.10) saturate(1.05);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 4px rgba(18, 205, 255, 0.58),
    0 0 34px rgba(0, 192, 255, 0.46),
    inset 0 2px 0 rgba(255, 255, 255, 0.56),
    inset 0 -10px 22px rgba(0, 35, 94, 0.24),
    0 17px 40px rgba(0, 25, 52, 0.62);
}

.continue-button:active {
  transform: translateY(1px) scale(0.994);
}

.continue-button:disabled {
  opacity: 0.63;
  cursor: progress;
}

.continue-button__arrow {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(0, 113, 178, 0.52), rgba(0, 63, 124, 0.32));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 3px 12px rgba(0, 26, 54, 0.32);
}

.continue-button__arrow svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chapter-card {
  position: absolute;
  z-index: 22;
  inset: 0;
  padding: 0 11%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  pointer-events: none;
  will-change: opacity, transform;
}

.chapter-card__index {
  margin-bottom: 13px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.38em;
  text-shadow: 0 0 15px rgba(255, 97, 12, 0.36);
}

.chapter-card__index span {
  padding-left: 0.38em;
}

.chapter-card h1 {
  margin: 0;
  font-size: clamp(48px, 13vw, 67px);
  line-height: 0.82;
  letter-spacing: -0.058em;
  font-weight: 950;
  text-wrap: balance;
  text-shadow:
    0 5px 28px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(93, 222, 255, 0.08);
}

.chapter-card__line {
  width: 53px;
  height: 4px;
  margin: 23px 0 17px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5b0a, #ff922d);
  box-shadow: 0 0 12px rgba(255, 92, 10, 0.46);
  transform: scaleX(0.15);
  transform-origin: center;
}

.chapter-card p {
  max-width: 300px;
  margin: 0;
  color: rgba(236, 252, 255, 0.80);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 610;
  letter-spacing: 0.005em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.panel--lost {
  opacity: 0;
  transition: opacity 680ms ease;
}

.panel--lost.is-visible {
  opacity: 1;
}

.lost-copy {
  position: absolute;
  left: 8%;
  top: 18.5%;
  max-width: 300px;
  color: #fff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.52);
}

.lost-copy__title {
  font-size: clamp(27px, 7.5vw, 37px);
  line-height: 0.96;
  font-weight: 930;
  letter-spacing: -0.04em;
}

.lost-copy__support {
  margin-top: 10px;
  display: flex;
  align-items: stretch;
  gap: 11px;
}

.lost-copy__rule {
  width: 4px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(to bottom, #ff8b2d, #ff5a0b);
  box-shadow: 0 0 10px rgba(255, 92, 10, 0.35);
}

.lost-copy__body {
  max-width: 218px;
  font-size: 14px;
  line-height: 1.12;
  font-weight: 760;
}

.swipe-hint {
  position: absolute;
  left: 50%;
  bottom: max(42px, calc(env(safe-area-inset-bottom) + 30px));
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.94);
  text-align: center;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-shadow: 0 2px 9px rgba(0, 0, 0, 0.76);
}

.swipe-hint__chevrons {
  position: relative;
  width: 26px;
  height: 25px;
  margin: 0 auto 3px;
  animation: floatChevron 1.55s ease-in-out infinite;
}

.swipe-hint__chevrons i {
  position: absolute;
  left: 5px;
  width: 16px;
  height: 16px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  transform: rotate(45deg);
}

.swipe-hint__chevrons i:nth-child(1) { top: 7px; opacity: 0.55; }
.swipe-hint__chevrons i:nth-child(2) { top: 0; }

.replay-button {
  position: absolute;
  z-index: 2;
  right: 17px;
  bottom: max(19px, calc(env(safe-area-inset-bottom) + 8px));
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(0, 24, 39, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 9px;
  font-weight: 760;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.loading-error {
  position: absolute;
  z-index: 35;
  left: 20px;
  right: 20px;
  bottom: 105px;
  display: none;
  padding: 12px 14px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 13px;
  background: rgba(105, 20, 20, 0.84);
  backdrop-filter: blur(10px);
  font-size: 12px;
  line-height: 1.38;
}

.loading-error.is-visible {
  display: block;
}

@keyframes buttonShine {
  0%, 63% { left: -30%; opacity: 0; }
  70% { opacity: 1; }
  88% { left: 118%; opacity: 0.75; }
  100% { left: 118%; opacity: 0; }
}

@keyframes floatChevron {
  0%, 100% { transform: translateY(5px); opacity: 0.55; }
  50% { transform: translateY(-2px); opacity: 1; }
}

@media (max-height: 730px) {
  .hud { top: max(9px, env(safe-area-inset-top)); }
  .hud__topline { height: 42px; grid-template-columns: 42px minmax(0, 1fr) 42px; }
  .round-button { width: 39px; height: 39px; }
  .stat-copy { top: 27%; }
  .stat-copy__number { font-size: clamp(37px, 10.5vw, 50px); }
  .stat-copy__accent { font-size: clamp(27px, 7.8vw, 37px); }
  .stat-copy__body { font-size: clamp(19px, 5.5vw, 26px); }
  .continue-button { height: 57px; }
  .continue-button__arrow { width: 37px; height: 37px; }
  .lost-copy { top: 17%; }
}

@media (min-width: 700px) {
  .app {
    height: min(94vh, 920px);
    border-radius: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
