/* Gesture Synth — local instrument styles */
.first-screen { align-content: start; }

:root {
  --bg: #100e0c;
  --bg-raise: #1c1814;
  --ink: #f6f0e6;
  --muted: #c9bfb0;
  --line: rgba(246, 240, 230, 0.16);
  --amber: #f0a14a;
  --teal: #5ee0d0;
  --stage: #090807;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

html { background: var(--bg); }

body {
  min-height: 100vh;
  font-family: "Segoe UI", "Avenir Next", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans CJK JP", "Noto Sans CJK KR", "WenQuanYi Micro Hei", "Droid Sans Fallback", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(1100px 420px at 50% -80px, rgba(240, 161, 74, 0.16), transparent 60%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(16, 14, 12, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.mark { display: block; flex: 0 0 auto; }

.lang-menu {
  position: relative;
  margin-left: auto;
  height: 32px;
}

.lang-menu summary {
  list-style: none;
  cursor: pointer;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.lang-menu summary::-webkit-details-marker { display: none; }

.lang-menu summary::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.75;
}

.lang-menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 148px;
  background: #221c17;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.lang-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.lang-menu a:hover,
.lang-menu a[aria-current="page"] {
  background: rgba(240, 161, 74, 0.16);
}

.first-screen {
  display: grid;
  align-content: start;
  grid-template-rows: auto auto auto auto;
  gap: 10px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 10px 16px 12px;
}

.first-screen h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.035em;
}

.stage {
  position: relative;
  min-height: 62vh;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(240, 161, 74, 0.4);
  background:
    radial-gradient(80% 70% at 50% 110%, rgba(240, 161, 74, 0.18), transparent 52%),
    radial-gradient(36% 42% at 50% 38%, rgba(94, 224, 208, 0.07), transparent 70%),
    var(--stage);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 40px rgba(0, 0, 0, 0.28);
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

.stage:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.viz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.reticle,
.halo {
  display: none;
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.reticle.is-on,
.halo.is-on { display: block; }

.reticle {
  width: 86px;
  height: 86px;
  margin-left: -43px;
  margin-top: -43px;
  border-radius: 50%;
  border: 1.5px solid rgba(94, 224, 208, 0.95);
  box-shadow: 0 0 0 8px rgba(94, 224, 208, 0.1), 0 0 28px rgba(94, 224, 208, 0.35);
}

.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  background: rgba(94, 224, 208, 0.9);
}

.reticle::before { left: 50%; top: 10px; bottom: 10px; width: 1px; }
.reticle::after { top: 50%; left: 10px; right: 10px; height: 1px; }

.halo {
  width: 168px;
  height: 168px;
  margin-left: -84px;
  margin-top: -84px;
  border-radius: 50%;
  border: 2px solid rgba(240, 161, 74, 0.85);
  transform: scale(var(--s, 0.45));
  opacity: var(--o, 0.45);
}

.hint {
  position: absolute;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  margin: 0;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
}

.hint[hidden] { display: none; }

.cam-msg {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 5;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #2a160f;
  color: #ffd7cc;
  border: 1px solid rgba(255, 120, 80, 0.5);
}

.cam-msg[hidden] { display: none; }

.zones {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(88px, 1fr);
  gap: 8px;
  padding: 10px;
}

.zones[hidden] { display: none; }

.zone {
  min-width: 0;
  min-height: 88px;
  border-radius: 12px;
  font-size: clamp(1.35rem, 2.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  cursor: pointer;
}

.zone:nth-child(odd) {
  background: #ffe14a;
  color: #14120c;
  border: 0;
}

.zone:nth-child(even) {
  background: #101010;
  color: #ffe14a;
  border: 3px solid #ffe14a;
}

.zone.is-active {
  outline: 4px solid #ffffff;
  outline-offset: -8px;
}

.readout {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 7px 12px 7px 14px;
  border-radius: 999px;
  background: rgba(8, 7, 6, 0.78);
  pointer-events: none;
}

.readout strong {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffd18a;
  font-variant-numeric: tabular-nums;
}

.readout span { color: var(--ink); font-variant-numeric: tabular-nums; }

.meter {
  display: inline-block;
  width: 72px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
}

.meter::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--level, 0) * 100%);
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.group { display: flex; flex-wrap: wrap; gap: 6px; }

.controls button {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

.controls button:hover { border-color: rgba(240, 161, 74, 0.75); }

.controls button[aria-pressed="true"] {
  background: var(--amber);
  color: #1a1208;
  border-color: transparent;
  font-weight: 700;
}

.controls button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

#camera.is-live {
  color: var(--teal);
  border-color: rgba(94, 224, 208, 0.8);
}

#record { min-width: 7.4rem; }

#record.is-recording {
  background: #ff5d3c;
  color: #1a0906;
  border-color: transparent;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.site-footer {
  margin: 0;
  height: 20px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--muted);
}

.guide {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.lede { font-size: 1.08rem; color: var(--ink); }

.map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 8px;
  padding: 0;
  list-style: none;
}

.map li {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.map b {
  display: block;
  margin-bottom: 4px;
  color: var(--amber);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.map span, .guide p, .guide li { color: var(--muted); }

.guide h2 {
  margin: 1.5em 0 0.35em;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
}

.guide h3 {
  margin: 1em 0 0.2em;
  font-size: 1.02rem;
  color: var(--ink);
}

.guide a { color: var(--amber); }

.guide ul.plain { padding-left: 1.15rem; }

.affiliate {
  margin-top: 28px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #17140f;
}

.affiliate h2 { margin-top: 0; }

.affiliate-disclosure {
  color: var(--ink);
  font-size: 1rem;
}

.affiliate ul { padding-left: 1.15rem; }

.noscript {
  margin-top: 16px;
  color: var(--ink);
}

.vh {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cam-sink {
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

.missing {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.missing h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
  white-space: normal;
}

.lang-links { padding-left: 1.1rem; }
.lang-links a { color: var(--amber); }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

::selection { background: #f0a14a; color: #1a1208; }

@media (min-width: 900px) {
  .zones {
    grid-template-columns: repeat(var(--zone-count, 8), minmax(0, 1fr));
    grid-template-rows: 1fr;
  }
  .zone { min-height: 0; height: 100%; }
}

@media (min-width: 1100px) {
  .first-screen h1 {
    white-space: nowrap;
    font-size: 1.7rem;
    line-height: 1.15;
  }
}

@media (min-width: 1100px) and (min-height: 760px) {
  .first-screen {
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 8px 22px 8px;
  }
  .stage { min-height: 0; }
}

@media (max-width: 720px) {
  .map { grid-template-columns: 1fr; }
  .site-footer { white-space: normal; height: auto; }
  .readout strong { font-size: 1.15rem; }
}

@media (pointer: coarse) {
  .controls button { height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .halo, .reticle, .meter::after { transition: none; }
}

.stage.zone-mode { cursor: pointer; background: #050505; border-color: #ffe14a; }
.stage.zone-mode .viz,
.stage.zone-mode .reticle,
.stage.zone-mode .halo,
.stage.zone-mode .hint { display: none !important; }
