:root {
  color-scheme: dark;
  --light-color: #40c9ff;
  --light-alpha: 0;
  --viewport-width: 100vw;
  --viewport-height: 100dvh;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  height: calc(var(--viewport-height) + 180px);
  margin: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  background: #000;
  color: #f8fbff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

.screen-light-shell,
.light-field {
  position: fixed;
  inset: 0;
  width: var(--viewport-width);
  height: var(--viewport-height);
}

.screen-light-shell {
  overflow: hidden;
}

.screen-light-shell {
  pointer-events: auto;
}

.light-field {
  background: var(--light-color);
  opacity: var(--light-alpha);
  transition: background 140ms linear;
  will-change: opacity, background;
}

.screen-light-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: transparent;
}

.start-panel {
  position: fixed;
  z-index: 2;
  left: max(20px, env(safe-area-inset-left));
  right: max(20px, env(safe-area-inset-right));
  top: 50%;
  display: grid;
  gap: 14px;
  max-width: 520px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(4, 6, 10, 0.78);
  transform: translateY(-50%);
  backdrop-filter: blur(16px);
}

.start-panel.hidden {
  display: none;
}

.start-panel span {
  color: #38f3ff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.start-panel h1 {
  margin: 0;
  font-size: clamp(2rem, 10vw, 4rem);
  line-height: 0.95;
}

.start-panel p,
.start-panel small {
  margin: 0;
  color: rgba(248, 251, 255, 0.72);
  font-size: 1rem;
  line-height: 1.4;
}

.start-panel button {
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #69f0ae, #38f3ff);
  color: #061014;
  font-size: 1.06rem;
  font-weight: 900;
}

.status-panel {
  position: fixed;
  z-index: 1;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.42);
  color: rgba(248, 251, 255, 0.82);
  font-size: 0.86rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.status-panel.visible {
  opacity: 1;
  transform: translateY(0);
}

.status-panel strong,
.status-panel output {
  color: #fff;
  font-weight: 900;
}

.status-panel output {
  color: #38f3ff;
}

.preparation-panel {
  position: fixed;
  z-index: 3;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 42%, rgba(56, 243, 255, 0.2), transparent 34vw),
    rgba(0, 0, 0, 0.76);
  text-align: center;
}

.preparation-panel[hidden] {
  display: none;
}

.preparation-panel span {
  color: rgba(248, 251, 255, 0.78);
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preparation-panel strong {
  color: #fff;
  font-size: clamp(5rem, 26vw, 12rem);
  font-weight: 950;
  line-height: 0.9;
  text-shadow: 0 0 42px rgba(56, 243, 255, 0.42);
}

.preparation-panel small {
  max-width: 620px;
  color: rgba(248, 251, 255, 0.72);
  font-size: clamp(1rem, 4vw, 1.45rem);
  font-weight: 700;
  line-height: 1.35;
}

.fullscreen-restore {
  position: fixed;
  z-index: 4;
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: #f8fbff;
  color: #061014;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);
}

.fullscreen-restore[hidden] {
  display: none;
}

@media (orientation: landscape) {
  .start-panel {
    left: max(16px, env(safe-area-inset-left));
    right: auto;
    width: min(46vw, 430px);
    padding: 16px;
    gap: 10px;
  }

  .start-panel h1 {
    font-size: clamp(1.8rem, 6vw, 3rem);
  }

  .start-panel p,
  .start-panel small {
    font-size: 0.9rem;
  }

  .status-panel {
    left: max(12px, env(safe-area-inset-left));
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(42vw, 360px);
    padding: 9px 11px;
    background: rgba(0, 0, 0, 0.22);
    font-size: 0.78rem;
  }

  .fullscreen-restore {
    left: auto;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(42vw, 360px);
    min-height: 48px;
    font-size: 0.92rem;
  }
}
