/* Studio Penumbra: match the homepage's night palette and IBM Plex typography. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #070707;
  --raised: #101010;
  --ink: #ffffff;
  --copy: #b9b9b9;
  --muted: #a4a4a4;
  --accent: #c6c6c6;
  --line: rgba(255,255,255,.11);
  --line-strong: rgba(255,255,255,.22);
  --font: 'IBM Plex Sans KR','IBM Plex Sans',-apple-system,BlinkMacSystemFont,sans-serif;
  --font-latin: 'IBM Plex Sans','IBM Plex Sans KR',sans-serif;
  --font-mono: 'IBM Plex Mono','IBM Plex Sans KR',ui-monospace,monospace;
  font: 400 16px/1.6 var(--font);
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; touch-action: manipulation; }
button { border: 0; border-radius: 0; color: inherit; cursor: pointer; }
button, canvas, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible, a:focus-visible { outline: 2px solid #eee; outline-offset: 4px; }
button:disabled { cursor: default; opacity: .5; }
button { transition: color .16s, background-color .16s, border-color .16s; }
svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
button svg { width: 18px; height: 18px; flex: none; }
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 32px; border-bottom: 1px solid var(--line); background: var(--bg); z-index: 2; }
.brand { display: flex; gap: 16px; align-items: center; flex-shrink: 0; }
.brand-symbol { width: 32px; height: 32px; color: var(--accent); stroke-width: 1.2; }
.symbol-center { fill: var(--accent); stroke: 0; }
.eyebrow { margin: 0 0 4px; font-size: 12px; line-height: 1.6; color: var(--muted); font-weight: 400; }
.brand .eyebrow { font-family: var(--font-mono); letter-spacing: .02em; }
.brand h1 { font-size: 26px; line-height: 1.3; margin: 0; font-weight: 400; letter-spacing: -.02em; }
.brand-sub { display: inline-block; margin-left: 16px; font: 400 12px/1.4 var(--font-latin); color: var(--muted); vertical-align: middle; letter-spacing: 0; }
.lab-home { color: inherit; text-decoration: none; }
.lab-home:hover { color: var(--ink); }
.toolbar { display: flex; align-items: center; gap: 4px; }
.quiet-button { background: transparent; border: 1px solid transparent; min-height: 44px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 400; line-height: 1.4; color: var(--copy); white-space: nowrap; }
.quiet-button:hover { border-color: var(--line-strong); background: var(--raised); color: var(--ink); }
.quiet-button[aria-pressed=true] { color: var(--ink); background: var(--raised); border-color: var(--line-strong); }
.panel-button { border-color: var(--line-strong); margin-left: 4px; }
.language-control { display: flex; flex: none; border: 1px solid var(--line-strong); padding: 2px; gap: 2px; margin-right: 12px; }
.language-control button { min-width: 44px; min-height: 40px; padding: 6px 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 400; }
.language-control button:hover { background: var(--raised); color: var(--ink); }
.language-control button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.workspace { display: grid; grid-template-columns: minmax(0,1fr) 420px; min-height: 0; flex: 1; }
.play-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--bg); }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -4px; cursor: crosshair; }
.play-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 64px; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--bg); }
.desktop-instructions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.desktop-instructions>span { white-space: nowrap; }
kbd { display: inline-block; font: 400 11px/1.7 var(--font-mono); padding: 0 4px; margin-right: 4px; border: 1px solid var(--line-strong); color: var(--copy); background: var(--panel); }
/* Compact effect console: one action per tile, all groups stay expanded. */
.effect-panel { background: var(--panel); border-left: 1px solid var(--line); padding: 20px; overflow-y: auto; scrollbar-color: #555 transparent; scrollbar-width: thin; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-heading h2 { font-size: 24px; font-weight: 400; margin: 0; line-height: 1.3; }
.active-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.preset-controls { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-bottom: 20px; }
.preset-controls button, .auto-control { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px; font-size: 14px; color: var(--copy); background: transparent; border: 1px solid var(--line-strong); cursor: pointer; }
.preset-controls button:hover, .auto-control:hover { color: var(--ink); background: var(--raised); border-color: #777; }
.auto-control input, .reduced-control input { margin: 0; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.auto-control:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.effects { display: grid; gap: 16px; }
.effect-group { padding: 0; margin: 0; min-width: 0; border: 0; }
.effect-group legend { padding: 0; margin-bottom: 8px; color: var(--muted); font-size: 13px; line-height: 20px; }
.effect-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
.effect-group--audio .effect-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.effect-tile { display: flex; position: relative; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 12px; border: 1px solid #555; background: #161616; cursor: pointer; color: var(--ink); transition: background-color .15s,border-color .15s,color .15s; }
.effect-name { font-size: 14px; line-height: 20px; word-break: keep-all; }
.effect-tile input { margin: 0; flex: none; appearance: none; width: 16px; height: 16px; border: 1px solid #777; background: transparent; cursor: pointer; }
.effect-tile input:checked { border-color: var(--accent); background: var(--accent); }
.effect-tile input:checked:after { content: ''; display: block; width: 8px; height: 4px; margin: 3px 2px; border-left: 2px solid #111; border-bottom: 2px solid #111; transform: rotate(-45deg); }
.effect-tile.is-off { background: transparent; color: var(--muted); border-color: var(--line); }
.effect-tile:hover { border-color: #aaa; background: #202020; color: var(--ink); }
.effect-tile:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.effect-tile input:focus-visible { outline: none; }
.effect-group--audio .effect-tile { padding-inline: 8px; gap: 6px; }
.effect-info { border-top: 1px solid var(--line-strong); margin-top: 16px; padding-top: 12px; min-height: 80px; }
.effect-info>div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.effect-info strong { font-size: 14px; font-weight: 500; }
#effect-detail-term { color: var(--muted); font-size: 12px; }
.effect-info p { margin: 4px 0 0; color: var(--copy); font-size: 13px; line-height: 20px; word-break: keep-all; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.reduced-control { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width:901px) and (max-height:820px) {
  .effect-panel { padding: 16px 20px; }
  .panel-heading { margin-bottom: 12px; }
  .preset-controls { margin-bottom: 12px; }
  .effects { gap: 12px; }
  .effect-group legend { margin-bottom: 4px; }
  .effect-info { margin-top: 12px; min-height: 68px; }
  .panel-foot { margin-top: 8px; }
}
@media (max-width:900px) {
  .effect-panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 24px; }
  .effects { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; align-items: start; }
  .effect-group--audio .effect-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .preset-controls { max-width: 520px; }
}
@media (max-width:600px) {
  .effect-panel { padding: 20px 16px; }
  .effects { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .effect-group--audio .effect-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

.controls-hidden .workspace { grid-template-columns: minmax(0,1fr); }
.controls-hidden .effect-panel { display: none; }
.status-message { position: fixed; bottom: 80px; left: 50%; transform: translate(-50%,8px); padding: 12px 20px; border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); max-width: calc(100vw - 40px); font-size: 14px; text-align: center; opacity: 0; transition: opacity .16s,transform .16s; pointer-events: none; z-index: 9; }
.status-message.show { opacity: 1; transform: translate(-50%,0); }
.touch-controls,.mobile-instructions { display: none; }
html[lang=en] { --font: var(--font-latin); }
html[lang=en] .brand-sub { display: none; }
@media (min-width:901px) and (max-height:850px) {
  .topbar { min-height: 80px; padding-block: 12px; }
}
@media (max-width:1180px) {
  .brand-sub { display: none; }
  .topbar { padding-inline: 24px; gap: 16px; }
  .quiet-button { padding: 10px 8px; }
  .workspace { grid-template-columns: minmax(0,1fr) 380px; }
  .desktop-instructions { gap: 8px 12px; }
  .play-footer { padding-inline: 20px; }
}
@media (max-width:900px) {
  .app { height: auto; min-height: 100dvh; overflow: visible; }
  .topbar { min-height: 80px; padding: 16px 20px; gap: 12px; }
  .brand { gap: 12px; }
  .brand-symbol { width: 28px; height: 28px; }
  .brand h1 { font-size: 24px; }
  .quiet-button { width: 40px; padding: 8px; }
  .quiet-button span { display: none; }
  .workspace { display: flex; flex-direction: column; min-height: 0; }
  .play-area { height: 65vh; height: 65dvh; min-height: 420px; max-height: 720px; flex: none; }
  .stage { min-height: 320px; }
  .play-footer { min-height: 56px; padding: 12px 20px; gap: 12px; }
  .controls-hidden .play-area { height: calc(100dvh - 80px); max-height: none; }
  .status-message { bottom: 24px; }
}
@media (pointer:coarse) {
  .touch-controls { display: flex; position: absolute; bottom: 20px; left: 20px; right: 20px; justify-content: space-between; align-items: flex-end; pointer-events: none; }
  .touch-controls button { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; background: #101010e8; color: var(--ink); border: 1px solid #777; }
  .touch-controls button:active { background: #444; }
  .dpad { width: 140px; height: 92px; display: grid; grid-template-columns: repeat(3,44px); grid-template-rows: 44px 44px; gap: 4px; }
  .dpad button { display: grid; place-items: center; }
  .dpad [data-move=up] { grid-column: 2; grid-row: 1; }
  .dpad [data-move=left] { grid-column: 1; grid-row: 2; }
  .dpad [data-move=down] { grid-column: 2; grid-row: 2; }
  .dpad [data-move=right] { grid-column: 3; grid-row: 2; }
  .dpad svg { width: 20px; height: 20px; }
  .touch-attacks { display: flex; gap: 8px; align-items: flex-end; }
  .touch-attacks button { border-radius: 50%; width: 56px; height: 56px; font-size: 13px; font-weight: 500; }
  .touch-attacks #touch-fire { width: 68px; height: 68px; background: #eeeeee; color: var(--bg); border-color: var(--ink); }
  .touch-attacks #touch-fire:active { background: #aaa; }
  .desktop-instructions { display: none; }
  .mobile-instructions { display: block; font-size: 13px; line-height: 1.6; color: var(--muted); margin: 0; }
}
@media (max-width:600px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .brand { flex: 1; }
  .toolbar { justify-content: flex-end; }
  .brand .eyebrow { font-size: 11px; }
  .language-control { margin-right: 4px; }
  .language-control button { min-width: 36px; }
  .controls-hidden .play-area { height: calc(100dvh - 132px); min-height: 400px; }
}
@media (max-width:520px) {
  .topbar { padding: 12px 16px; }
  .topbar .brand { flex-basis: 100%; }
  .topbar .toolbar { width: 100%; justify-content: flex-start; }
  .language-control { margin-right: auto; }
  .brand h1 { font-size: 24px; }
  .brand-symbol { width: 28px; height: 28px; }
  .toolbar { gap: 0; }
  .quiet-button { width: 40px; }
  .play-area { height: 61dvh; min-height: 400px; }
  .play-footer { padding: 12px 16px; }
  .touch-controls { bottom: 16px; left: 16px; right: 16px; }
}
@media (prefers-reduced-motion:reduce) { *,*:before,*:after { transition: none!important; } }

@media(max-width:900px){.quiet-button,.language-control button{min-width:44px;min-height:44px}.toolbar{flex-wrap:wrap;gap:4px}}
