:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: rgba(12, 18, 28, 0.82);
  --panel-strong: rgba(15, 24, 38, 0.96);
  --line: rgba(123, 211, 255, 0.2);
  --line-strong: rgba(123, 211, 255, 0.42);
  --text: #e9f5ff;
  --muted: #98a9ba;
  --cyan: #4de9ff;
  --violet: #a978ff;
  --red: #ff496d;
  --gold: #ffd166;
  --green: #65ffb6;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(77, 233, 255, 0.16), transparent 34rem),
    radial-gradient(circle at 84% 6%, rgba(255, 73, 109, 0.13), transparent 28rem),
    linear-gradient(180deg, #08101b 0%, var(--bg) 44%, #030409 100%);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(123, 211, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 211, 255, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.2));
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select,
input {
  font: inherit;
}

.site-header,
main,
.site-footer {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 20px;
}

.brand {
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-shadow: 0 0 18px rgba(77, 233, 255, 0.62);
}

.topbar-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-links a,
.trust-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 22px 0 22px;
}

.eyebrow,
.kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  max-width: 980px;
  font-size: clamp(2.6rem, 6vw, 4.9rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow:
    0 0 22px rgba(77, 233, 255, 0.32),
    0 0 60px rgba(169, 120, 255, 0.24);
}

h1 small {
  display: block;
  margin-top: 0.2em;
  color: #bdeeff;
  font-size: 0.34em;
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 0 18px rgba(77, 233, 255, 0.34);
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: #c7d7e6;
  font-size: clamp(0.98rem, 1.7vw, 1.16rem);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.lead span,
.split-copy span {
  display: block;
}

.lead span + span,
.split-copy span + span {
  margin-top: 0.14em;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.stage-shell,
.side-panel,
.info-grid article,
.formula-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stage-shell {
  overflow: hidden;
}

.stage-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(77, 233, 255, 0.08), rgba(169, 120, 255, 0.05));
}

.stage-toolbar h2,
.info-grid h2,
.formula-section h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.toolbar-controls {
  display: grid;
  min-width: 230px;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

select {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: #08111d;
  min-width: 0;
}

.canvas-wrap {
  position: relative;
  min-height: 420px;
  background: #02050b;
}

.canvas-wrap::before,
.canvas-wrap::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
}

.canvas-wrap::before {
  border: 1px solid rgba(233, 245, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(77, 233, 255, 0.08),
    inset 0 0 72px rgba(77, 233, 255, 0.08),
    inset 0 -42px 80px rgba(0, 0, 0, 0.55);
}

.canvas-wrap::after {
  background:
    linear-gradient(112deg, transparent 0%, rgba(255, 255, 255, 0.055) 36%, transparent 43%),
    radial-gradient(circle at 50% 50%, transparent 42%, rgba(2, 5, 11, 0.38) 100%);
  mix-blend-mode: screen;
  opacity: 0.58;
}

canvas {
  display: block;
  width: 100%;
  height: clamp(430px, 42vw, 560px);
  cursor: crosshair;
}

.specimen-tag {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 4px;
  padding: 6px 10px;
  color: rgba(255, 245, 200, 0.76);
  background: rgba(2, 5, 11, 0.66);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  pointer-events: none;
}

.specimen-tag-top {
  top: 14px;
}

.specimen-tag-bottom {
  bottom: 14px;
}

.hud-corner {
  position: absolute;
  top: 14px;
  z-index: 3;
  border: 1px solid rgba(77, 233, 255, 0.26);
  border-radius: 4px;
  padding: 7px 9px;
  color: rgba(233, 245, 255, 0.7);
  background: rgba(2, 5, 11, 0.62);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hud-corner-left {
  left: 14px;
}

.hud-corner-right {
  right: 14px;
}

.side-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.panel-block {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-block:last-child {
  border-bottom: 0;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

button {
  min-height: 48px;
  border: 1px solid rgba(77, 233, 255, 0.35);
  border-radius: 6px;
  padding: 7px 10px;
  color: #eaffff;
  background:
    linear-gradient(180deg, rgba(77, 233, 255, 0.14), rgba(77, 233, 255, 0.04)),
    #07101b;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

button[data-ja]::after {
  content: attr(data-ja);
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}

button:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(77, 233, 255, 0.24);
  transform: translateY(-1px);
}

button:nth-child(2),
button:nth-child(6) {
  border-color: rgba(255, 73, 109, 0.42);
}

button:nth-child(7) {
  border-color: rgba(101, 255, 182, 0.42);
}

.range-row,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.range-row strong {
  color: var(--cyan);
  font-size: 0.86rem;
}

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

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
}

.status-panel dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.status-panel div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(123, 211, 255, 0.12);
}

.status-panel dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.status-panel dd {
  margin: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.wonder-panel {
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.1), rgba(77, 233, 255, 0.06)),
    rgba(7, 16, 27, 0.7);
}

.wonder-panel h3 {
  margin: 0 0 10px;
  color: #fff5c8;
  font-size: 1rem;
  line-height: 1.35;
}

.wonder-panel p:not(.kicker) {
  margin: 0;
  color: #d4e6f4;
  font-size: 0.92rem;
  line-height: 1.65;
}

.mission-panel {
  background:
    linear-gradient(135deg, rgba(101, 255, 182, 0.1), rgba(169, 120, 255, 0.08)),
    rgba(7, 16, 27, 0.7);
}

.mission-panel h3 {
  margin: 0 0 10px;
  color: #d9ffe9;
  font-size: 1rem;
  line-height: 1.35;
}

.mission-panel p:not(.kicker) {
  margin: 0;
  color: #d4e6f4;
  font-size: 0.9rem;
  line-height: 1.6;
}

.mission-meter {
  height: 9px;
  margin: 14px 0 9px;
  border: 1px solid rgba(101, 255, 182, 0.28);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(2, 5, 11, 0.72);
}

.mission-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--gold));
  box-shadow: 0 0 18px rgba(101, 255, 182, 0.5);
  transition: width 220ms ease;
}

.mission-state {
  color: var(--green) !important;
  font-weight: 800;
}

.badge-panel {
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.12), rgba(255, 73, 109, 0.08)),
    rgba(7, 16, 27, 0.72);
}

.badge-display {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid rgba(255, 209, 102, 0.38);
  border-radius: 999px;
  padding: 8px 13px;
  color: #fff5c8;
  background: rgba(255, 209, 102, 0.08);
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.13);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.badge-display.is-awarded {
  border-color: rgba(101, 255, 182, 0.55);
  color: #d9ffe9;
  background: rgba(101, 255, 182, 0.1);
  box-shadow: 0 0 26px rgba(101, 255, 182, 0.22);
}

.badge-panel p:not(.kicker) {
  margin: 12px 0 0;
  color: #d4e6f4;
  font-size: 0.9rem;
  line-height: 1.6;
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 160px;
  margin: 0;
  padding-left: 18px;
  overflow: auto;
  color: #c7d7e6;
  font-size: 0.82rem;
  line-height: 1.45;
}

.observe-guide {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: var(--radius);
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.08), rgba(77, 233, 255, 0.05)),
    rgba(12, 18, 28, 0.78);
  box-shadow: var(--shadow);
}

.observe-guide h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.5;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-steps li {
  min-height: 116px;
  border: 1px solid rgba(123, 211, 255, 0.18);
  border-radius: 6px;
  padding: 13px;
  background: rgba(2, 5, 11, 0.42);
}

.guide-steps strong,
.guide-steps span {
  display: block;
}

.guide-steps strong {
  color: #fff5c8;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.guide-steps span {
  margin-top: 8px;
  color: #bed0df;
  font-size: 0.86rem;
  line-height: 1.55;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.info-grid article,
.formula-section {
  padding: 24px;
}

.info-grid p:not(.kicker),
.formula-section p {
  color: #bed0df;
  line-height: 1.75;
}

.formula-section {
  margin-top: 18px;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

code {
  display: block;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 6px;
  padding: 13px;
  overflow-wrap: anywhere;
  color: #fff5c8;
  background: rgba(255, 209, 102, 0.06);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.5;
}

.site-footer {
  padding: 30px 0 42px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.site-footer a {
  color: var(--cyan);
  font-weight: 800;
}

@media (max-width: 1120px) {
  .hero,
  .workspace,
  .observe-guide,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .trust-strip,
  .topbar-links {
    justify-content: flex-start;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 32px, 1440px);
  }

  .topbar,
  .stage-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hero {
    padding-top: 32px;
  }

  .lead,
  .trust-strip span,
  .stage-toolbar h2,
  .wonder-panel p:not(.kicker),
  .mission-panel p:not(.kicker),
  .guide-steps span {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .lead span {
    width: min(100%, 34ch);
  }

  .split-copy span {
    width: min(100%, 30ch);
  }

  .trust-strip {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .toolbar-controls {
    min-width: 0;
  }

  h1 {
    font-size: clamp(2.15rem, 11.5vw, 3.55rem);
    line-height: 0.98;
  }

  h1 small {
    font-size: 0.38em;
  }

  .side-panel,
  .formula-grid {
    grid-template-columns: 1fr;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .hud-corner {
    display: none;
  }

  .specimen-tag {
    left: 12px;
    right: 12px;
    transform: none;
    text-align: center;
  }

  .specimen-tag-top {
    top: 10px;
  }

  .specimen-tag-bottom {
    bottom: 10px;
  }

  .guide-steps {
    grid-template-columns: 1fr;
  }
}

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

  button {
    transition: none;
  }
}
