:root {
  --ink: #041018;
  --sea: #0a2a3a;
  --cyan: #5eead4;
  --mint: #7dd3fc;
  --amber: #fbbf24;
  --violet: #c4b5fd;
  --paper: #e8f4f8;
  --panel: rgba(6, 24, 36, 0.92);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--paper);
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, #123548 0%, transparent 55%),
    linear-gradient(180deg, #020810 0%, var(--ink) 45%, #00060c 100%);
  line-height: 1.55;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(94, 234, 212, 0.15);
}

.masthead a {
  color: var(--mint);
  text-decoration: none;
  font-size: 0.92rem;
}

.masthead a:focus-visible,
button:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

#sound {
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: rgba(10, 42, 58, 0.8);
  color: var(--paper);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  font: inherit;
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.intro {
  text-align: center;
  margin-bottom: 1.2rem;
}

.eyebrow {
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--mint);
  margin: 0 0 0.35rem;
}

.intro h1 {
  margin: 0;
  font-size: clamp(1.85rem, 6vw, 2.6rem);
  font-weight: 800;
}

.intro h1 span {
  color: var(--cyan);
}

.intro > p:last-child {
  margin: 0.5rem 0 0;
  opacity: 0.88;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 1.25rem;
  align-items: start;
}

.game-column {
  display: grid;
  gap: 0.75rem;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.hud strong.pulse-ok {
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(94, 234, 212, 0.65);
  animation: hud-ok 0.55s ease-out;
}

.hud strong.pulse-miss {
  color: #fca5a5;
  text-shadow: 0 0 10px rgba(248, 113, 113, 0.55);
  animation: hud-miss 0.55s ease-out;
}

@keyframes hud-ok {
  0%,
  100% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.14);
  }
}

@keyframes hud-miss {
  0%,
  100% {
    transform: scale(1);
  }
  20%,
  40%,
  60% {
    transform: scale(1.08);
  }
}

.hud div {
  background: var(--panel);
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 0.65rem;
  padding: 0.45rem 0.55rem;
}

.hud span {
  display: block;
  opacity: 0.7;
  margin-bottom: 0.15rem;
}

.hud strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.lumina-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  background: rgba(4, 16, 24, 0.85);
  border: 1px solid rgba(196, 181, 253, 0.25);
  border-radius: 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.lumina-dots {
  display: flex;
  gap: 0.35rem;
  flex: 1;
}

.lumina-dots i {
  display: block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.5);
  background: rgba(10, 42, 58, 0.9);
  transition: background 0.2s, box-shadow 0.2s;
}

.lumina-dots i.on {
  background: radial-gradient(circle at 30% 30%, #fff, var(--cyan) 45%, #0e7490);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.65);
}

#lumina-label {
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
  text-align: right;
}

.game-shell {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.22);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  touch-action: none;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  background: #020810;
  cursor: crosshair;
}

.zone-tag {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(4, 16, 24, 0.72);
  border: 1px solid rgba(94, 234, 212, 0.35);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.zone-tag.show {
  opacity: 1;
}

.start-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.55rem;
  padding: 1.2rem;
  text-align: center;
  background: linear-gradient(180deg, rgba(2, 8, 16, 0.55), rgba(2, 8, 16, 0.88));
}

.start-panel[hidden] {
  display: none !important;
}

.start-burapi {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.start-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--mint);
}

.start-panel h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.35;
}

.start-panel p {
  margin: 0;
  max-width: 18rem;
  font-size: 0.92rem;
  opacity: 0.9;
}

#start,
.share {
  margin-top: 0.35rem;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.35rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#start {
  background: linear-gradient(135deg, #22d3ee, #0891b2);
  color: #042028;
}

.share {
  background: rgba(15, 23, 42, 0.9);
  color: var(--paper);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.live {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 0.55rem;
  margin: 0;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  background: rgba(4, 16, 24, 0.72);
  border-radius: 0.5rem;
  pointer-events: none;
}

.discoveries {
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid rgba(94, 234, 212, 0.15);
  border-radius: 0.85rem;
}

.disc-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--mint);
}

.discoveries h2 {
  margin: 0.15rem 0 0.55rem;
  font-size: 1.05rem;
}

#disc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

#disc-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: 0.55rem;
  background: rgba(2, 8, 16, 0.65);
  border: 1px dashed rgba(125, 211, 252, 0.25);
  font-size: 0.88rem;
}

#disc-list li.found {
  border-style: solid;
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(8, 47, 73, 0.55);
}

#disc-list li.locked em {
  opacity: 0.55;
  font-style: normal;
  font-size: 0.78rem;
}

.mission {
  padding: 1rem 1.1rem 1.2rem;
  background: var(--panel);
  border: 1px solid rgba(94, 234, 212, 0.18);
  border-radius: 1rem;
}

.mission-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--mint);
}

.mission h2 {
  margin: 0.2rem 0 0.75rem;
  font-size: 1.15rem;
}

.mission ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.mission li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
}

.mission li span {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: rgba(94, 234, 212, 0.15);
  font-size: 0.72rem;
  color: var(--cyan);
}

.mission li strong {
  display: block;
  margin-bottom: 0.15rem;
}

.mission li p {
  margin: 0;
  font-size: 0.86rem;
  opacity: 0.88;
}

.keyboard {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  opacity: 0.8;
}

.records {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 1rem 0 0.65rem;
  font-size: 0.82rem;
}

.records dt {
  opacity: 0.65;
  font-size: 0.72rem;
}

.records dd {
  margin: 0.1rem 0 0;
  font-weight: 700;
}

.reset {
  width: 100%;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: transparent;
  color: #fecaca;
  border-radius: 0.55rem;
  padding: 0.45rem;
  font: inherit;
  cursor: pointer;
}

.save-note {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  opacity: 0.72;
}

footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  font-size: 0.82rem;
  opacity: 0.65;
}

body.capture .capture-hide {
  display: none !important;
}

body.capture main {
  padding: 0;
  width: 100%;
  max-width: none;
}

body.capture .intro,
body.capture .discoveries,
body.capture .masthead a {
  display: none;
}

body.capture .masthead {
  justify-content: flex-end;
  border: none;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  background: transparent;
}

body.capture .game-layout {
  grid-template-columns: 1fr;
  gap: 0;
}

body.capture .hud,
body.capture .lumina-bar {
  position: absolute;
  z-index: 4;
  left: 0.65rem;
  right: 0.65rem;
  pointer-events: none;
}

body.capture .hud {
  top: 0.55rem;
  grid-template-columns: repeat(2, 1fr);
}

body.capture .lumina-bar {
  top: 4.6rem;
}

body.capture .game-shell {
  border: none;
  border-radius: 0;
  min-height: 100dvh;
  box-shadow: none;
}

body.capture #game {
  min-height: 100dvh;
  object-fit: cover;
}

body.capture .live {
  bottom: max(0.55rem, env(safe-area-inset-bottom));
}

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .hud {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .zone-tag,
  .lumina-dots i {
    transition: none;
  }

  .hud strong.pulse-ok,
  .hud strong.pulse-miss {
    animation: none;
  }
}
