:root { --accent: #2563EB; --ink: #111827; --muted: #6B7280; --line: #E5E7EB; --chip: #F3F4F6; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #fff; color: var(--ink); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; font-weight: 400; -webkit-font-smoothing: antialiased; }
button, input, select { font-family: inherit; font-weight: 400; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 24px; }
.top { width: 100%; max-width: 720px; display: flex; align-items: center; justify-content: space-between; padding-bottom: 24px; }
.brand { font-family: 'Nunito', 'Inter', sans-serif; font-weight: 900; font-size: 26px; letter-spacing: -0.5px; color: var(--accent); line-height: 1; }

.main { width: 100%; max-width: 720px; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.stage { width: 100%; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 24px; background: #fff; overflow: hidden; }
.stage canvas { width: 100%; height: 100%; display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 32px; }
.chip { height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; display: inline-flex; align-items: center; background: var(--chip); color: #374151; border: 1px solid transparent; transition: background .15s, color .15s; }
.chip.on { background: var(--accent); color: #fff; }
.chip.none { background: #fff; color: var(--muted); border: 1px dashed #D1D5DB; }

.heard { margin: 0; text-align: center; font-size: 22px; line-height: 1.4; min-height: 62px; word-break: break-word; }
.heard.muted { color: var(--muted); }

.controls { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.btn { height: 56px; padding: 0 24px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: #374151; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; transition: box-shadow .15s, opacity .15s; }
.btn.primary { padding: 0 32px; border: none; background: var(--accent); color: #fff; font-weight: 500; }
.btn.primary.live { box-shadow: 0 0 0 6px rgba(37, 99, 235, .18); }
.btn.small { padding: 0; width: 56px; justify-content: center; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }

.type { width: 100%; max-width: 420px; }
.type input { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 999px; padding: 0 20px; font-size: 15px; color: var(--ink); background: #fff; }
.note { margin: 0; min-height: 20px; font-size: 14px; color: var(--muted); text-align: center; }
.foot { margin-top: 24px; font-size: 13px; color: var(--muted); text-align: center; }
.foot a { color: var(--accent); }

@media (max-width: 520px) {
  .app { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .top { padding-bottom: 16px; }
  .main { justify-content: flex-start; gap: 16px; }
  .stage { aspect-ratio: 1 / 1; border-radius: 20px; }
  .heard { font-size: 19px; min-height: 54px; }
  .row { flex-wrap: nowrap; width: 100%; gap: 10px; }
  .btn { height: 52px; padding: 0 18px; font-size: 15px; }
  .btn.primary { flex: 1; padding: 0 16px; justify-content: center; }
  .btn.small { width: 52px; padding: 0; flex: none; }
  .type input { font-size: 16px; }
  .foot { margin-top: 16px; }
}
.notice { margin: 16px 0 0; padding: 6px 14px; border-radius: 999px; background: #FEF3C7; color: #92400E; font-size: 13px; text-align: center; }

@media (max-width: 520px) and (max-height: 700px) {
  .stage { aspect-ratio: 4 / 3; }
}

.dd { position: relative; }
.ddbtn { height: 36px; padding: 0 12px 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: #374151; font: inherit; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.ddbtn:hover { background: #F9FAFB; }
.ddbtn svg { transition: transform .15s; } .ddbtn[aria-expanded="true"] svg { transform: rotate(180deg); }
.ddmenu { position: absolute; right: 0; top: 42px; min-width: 100%; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(17,24,39,.08); z-index: 10; white-space: nowrap; }
.ddmenu li { padding: 8px 12px; border-radius: 10px; font-size: 14px; color: #374151; cursor: pointer; }
.ddmenu li:hover { background: #F3F4F6; }
.ddmenu li[aria-selected="true"] { color: var(--accent); background: #EFF4FF; }

.foot { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.splash { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; align-items: center; justify-content: center; opacity: 1; transition: opacity .5s ease; }
.splash.out { opacity: 0; pointer-events: none; }
.brand.big { font-size: 48px; opacity: 0; transform: scale(.92); animation: pop .5s ease .05s forwards; }
@keyframes pop { to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .splash { display: none; } }

.foot .powered { display: inline-flex; align-items: center; gap: 9px; height: 34px; padding: 0 16px; border-radius: 999px; background: #0B0B0C; color: #C9CBD1; font-size: 13px; text-decoration: none; }
.foot .powered:hover { background: #1A1B1E; }
.powered img { height: 16px; width: auto; filter: brightness(0) invert(1); display: block; }

.foot .contrib { color: var(--muted); font-size: 13px; }
.foot .contrib:hover { color: var(--accent); }
