/* ECHO CHAMBER — private arcade voice effects */

@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P Fallback"; src: local("Courier New"); size-adjust: 166.64%; ascent-override: 60%; descent-override: 0%; line-gap-override: 0%; }

:root {
  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;

  --control-line: #5e5e80;
  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --body: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
  --space-gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(69, 240, 255, 0.05), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(69, 240, 255, 0.3); }
[hidden] { display: none !important; }
.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(60px); }
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.15);
}
a { color: var(--cyan); }

.site-header {
  padding: 26px var(--space-gutter) 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.lab-link {
  align-self: flex-start;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--dim);
  text-decoration: none;
  padding: 6px 2px;
  transition: color 0.15s, text-shadow 0.15s;
}
.lab-link:hover { color: var(--cyan); text-shadow: var(--glow-cyan); }
.level {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--gold);
}
.wordmark {
  margin: 6px 0 4px;
  font-family: var(--pixel);
  font-size: clamp(21px, 4.4vw, 34px);
  letter-spacing: 3px;
  color: var(--text);
  text-shadow: 0 0 16px rgba(69, 240, 255, 0.55), 3px 3px 0 var(--magenta);
}
.tagline {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
}
.cursor { color: var(--cyan); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px var(--space-gutter) 72px;
  display: grid;
  gap: 16px;
}
.recorder, .rack, .export-panel {
  background: linear-gradient(180deg, var(--surface), rgba(18, 18, 29, 0.55));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(16px, 4vw, 24px);
  display: grid;
  gap: 16px;
}
.panel-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: space-between;
}
.panel-title {
  margin: 0;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(69, 240, 255, 0.4);
}
.status-text { margin: 8px 0 0; color: var(--dim); font-size: 13px; }
.privacy-badge {
  width: fit-content;
  border: 1px solid rgba(65, 255, 139, 0.45);
  border-radius: 999px;
  color: var(--green);
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}
.record-core {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: center;
}
.record-btn {
  width: min(168px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border: 2px solid var(--red);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 85, 96, 0.22), var(--surface-2) 62%);
  color: var(--text);
  font-family: var(--pixel);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 0 26px rgba(255, 85, 96, 0.2);
}
.record-btn.is-recording {
  color: #05050d;
  background: var(--red);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 12px rgba(255, 85, 96, 0.08), 0 0 34px rgba(255, 85, 96, 0.42); }
}
.time-box {
  display: grid;
  justify-items: center;
  gap: 4px;
  font-family: var(--mono);
}
#elapsed { color: var(--gold); font-size: clamp(28px, 9vw, 52px); line-height: 1; }
#maxTime { color: var(--dim); font-size: 12px; letter-spacing: 1px; }
.level-meter {
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}
.level-meter span {
  display: block;
  width: 0%;
  height: 100%;
  min-height: 22px;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--red));
  transition: width 0.08s linear;
}
.denied-panel {
  border: 1px solid rgba(255, 85, 96, 0.55);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 85, 96, 0.06);
}
.denied-panel h3 {
  margin: 0 0 8px;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--red);
}
.denied-panel p, .note, .privacy-note { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.5; }
.wave-panel {
  display: grid;
  gap: 8px;
}
canvas {
  width: 100%;
  height: 190px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: crosshair;
}
.transport, .export-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s var(--ease-out), border-color 0.12s, box-shadow 0.12s, color 0.12s;
}
.btn:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(69, 240, 255, 0.22);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #05050d; }
.btn-primary:hover { box-shadow: 0 0 18px rgba(69, 240, 255, 0.5); }
.btn-big { font-family: var(--pixel); font-size: 10px; padding: 14px 16px; }
.btn[aria-pressed="false"] { color: var(--dim); }
.effect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.effect-chip {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--pixel);
  font-size: 9px;
  line-height: 1.35;
  cursor: pointer;
}
.effect-chip svg {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  fill: var(--gold);
}
.effect-chip:hover, .effect-chip.is-active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(69, 240, 255, 0.28);
}
.effect-chip.is-active { color: var(--cyan); }
.size-readout {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 13px;
}
.toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s var(--ease-out) both;
}
.toast-info { border-left-color: var(--cyan); }
.toast-success { border-left-color: var(--green); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px var(--space-gutter);
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
.site-footer a { color: var(--cyan); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-shadow: var(--glow-cyan); }

@media (min-width: 640px) {
  .record-core { grid-template-columns: 180px minmax(0, 1fr); }
  .level-meter { grid-column: 1 / -1; }
  .transport { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .effect-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .export-grid { grid-template-columns: minmax(0, 1fr) 150px; align-items: center; }
}
@media (min-width: 768px) {
  .panel-head { flex-direction: row; align-items: start; }
}
@media (min-width: 1024px) {
  main { grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); align-items: start; }
  .recorder { grid-row: span 2; }
}
@media (max-width: 480px) {
  .wordmark { letter-spacing: 1px; }
  .effect-chip { font-size: 8px; }
  canvas { height: 150px; }
}
@media (pointer: coarse) {
  .btn, .effect-chip { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .cursor, .record-btn.is-recording { animation: none; }
  .level-meter span { transition: none; }
}
