:root {
  color-scheme: dark;
  --bg: #0f1b2c;
  --surface: #1a2b44;
  --line: #31486a;
  --text: #f1f5fa;
  --muted: #a9bbd3;
  --chalk: #8fe3ff;
  --warn: #ffc857;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0 auto; max-width: 480px; padding: 0 16px env(safe-area-inset-bottom);
  background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  word-break: keep-all; overflow-wrap: anywhere;
}
section, section > * { min-width: 0; }
h1 { margin: 0; font-size: 1.15rem; }
h2 { margin: 18px 0 8px; font-size: 1rem; }
p { margin: 8px 0; }
.bar { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.hint { color: var(--muted); font-size: 0.9rem; }

button, .file {
  min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; touch-action: manipulation;
}
button:disabled { opacity: 0.4; cursor: default; }
button:focus-visible, .file:focus-within { outline: 3px solid var(--chalk); outline-offset: 2px; }
button[aria-pressed="true"], button[aria-selected="true"] { background: var(--chalk); border-color: var(--chalk); color: #072033; }
.primary { background: var(--chalk); border-color: var(--chalk); color: #072033; font-size: 1.1rem; }
.ghost { min-height: 40px; padding: 4px 12px; background: none; }
.wide { width: 100%; }
.attention { border: 2px solid var(--warn); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1 1 0; min-width: 0; }
.segment { margin-top: 8px; }

.file { display: flex; justify-content: center; align-items: center; min-height: 64px; margin-top: 12px; }
.file.primary { min-height: 120px; font-size: 1.3rem; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }

canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 8px; }
canvas.drag { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.notice { margin: 0 0 8px; padding: 8px 12px; border: 2px solid var(--warn); border-radius: 10px; color: #ffe3a6; font-size: 0.92rem; }
.notice p { margin: 2px 0; }
.error { color: #ffb4a8; font-weight: 600; }

/* 화면 아래에 붙는 주 동작 */
.actions { position: sticky; bottom: 0; padding: 10px 0 12px; background: var(--bg); }
.actions > * + * { margin-top: 8px; }
.actions p { margin: 0 0 8px; font-size: 0.92rem; }

.progress { height: 10px; overflow: hidden; border-radius: 5px; background: var(--surface); }
.progress > div { width: 0; height: 100%; background: var(--chalk); transition: width 0.2s; }
.working { display: flex; align-items: center; gap: 10px; }
.working > div:first-child { flex: 1 1 0; min-width: 0; }
.working p { margin: 0 0 6px; font-size: 0.92rem; }

.tabs { margin-bottom: 8px; }
.views { margin: 8px 0; }
.views button { min-height: 40px; }
.guide { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.guide figure { margin: 0; padding: 8px 6px; min-width: 0; background: var(--surface); border-radius: 12px; text-align: center; }
.guide figcaption { margin-top: 2px; }
.guide strong { display: block; font-size: 1.15rem; line-height: 1.35; }
.guide span { color: var(--muted); font-size: 0.82rem; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 0; }
.facts div { display: flex; justify-content: center; align-items: baseline; gap: 10px; min-width: 0; padding: 6px; background: var(--surface); border-radius: 12px; }
.facts dt { color: var(--muted); font-size: 0.85rem; }
.facts dd { margin: 0; font-weight: 700; font-size: 1.15rem; }
.facts dd.hard { color: var(--warn); }
.disclaimer { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
