/* manabun: paper and ink, with a red seal for the one thing to press. Shared by
   index.html (the translator) and inspect.html (the detection inspector). */
:root {
  color-scheme: light dark;
  --paper: #f6f3ec; --surface: #fffdf8; --ink: #1b1a17; --muted: #5f594d; --line: #ddd5c4;
  --seal: #b8321a; --on-seal: #fff; --indigo: #2a4a7f;
  --ok: #1e6b45; --warn: #8a5300; --err: #b3261e;
  --panel: #2a4a7f; --text: #b8321a;   /* box colors in the inspector */
  --radius: 10px; --gap: 16px;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141311; --surface: #1d1b18; --ink: #efe9dc; --muted: #ada594; --line: #38342d;
    --seal: #ff7a5c; --on-seal: #141311; --indigo: #9db8ea;
    --ok: #6fcf97; --warn: #f2b65a; --err: #ff8a7a;
    --panel: #9db8ea; --text: #ff7a5c;
  }
}
/* lettering face for the translated pages (typeset.js): Project Noonnu's own webfont
   release of 눈누 기초고딕 (CORS-enabled, so pages lettered with it can be read back) */
@font-face {
  font-family: "Noonnu Basic Gothic"; font-weight: 400; font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noon-2410@1.0/NoonnuBasicGothicRegular.woff2") format("woff2");
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--font); word-break: keep-all; overflow-wrap: break-word; }
a { color: var(--indigo); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { top: 12px; }

/* ---- top bar ---------------------------------------------------------------- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; margin-right: auto; }
.seal { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; background: var(--seal); color: var(--on-seal);
        font: 700 20px/1 "Hiragino Mincho ProN", "Yu Mincho", serif; transform: rotate(-4deg); flex: none; }
.brand b { font-size: 21px; font-weight: 800; letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; letter-spacing: 0; margin-top: -2px; }
.gpu { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gpu-state { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.gpu-state[data-state="waking"] .dot { background: var(--warn); }
.gpu-state[data-state="ready"] .dot { background: var(--ok); }
.gpu-state[data-state="error"] .dot { background: var(--err); }
.gpu-state[data-state="ready"] { color: var(--ok); }
.gpu-state[data-state="error"] { color: var(--err); }

/* ---- layout --------------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 24px; max-width: 1280px; margin: 0 auto; padding: 24px 20px 64px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; padding: 16px 16px 48px; gap: 20px; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
@media (min-width: 861px) { .panel.sticky { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; } }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h2 { font-size: 17px; font-weight: 800; }
.step { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; }
form > .step:first-child { margin-top: 0; }
.step span { color: var(--seal); font-weight: 800; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }

/* ---- controls --------------------------------------------------------------------- */
input, select, button { font: inherit; color: var(--ink); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14.5px; }
input[type=password], input[type=text], input[type=url], input[type=number], select {
  width: 100%; min-height: 44px; padding: 9px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
input[aria-invalid=true] { border-color: var(--err); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--seal); flex: none; }
.check small { display: block; color: var(--muted); font-size: 13px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { width: 100%; margin-top: 20px; background: var(--seal); border-color: var(--seal); color: var(--on-seal); font-size: 17px; font-weight: 800; min-height: 52px; }
.primary:hover:not(:disabled) { filter: brightness(1.06); border-color: var(--seal); }
button[aria-pressed=true] { border-color: var(--ok); color: var(--ok); }
.drop { position: relative; display: grid; place-items: center; text-align: center; gap: 4px; min-height: 132px; padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius);
        background: var(--paper); cursor: pointer; transition: border-color .15s, background-color .15s; }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--seal); }
.drop:focus-within { outline: 3px solid var(--indigo); outline-offset: 2px; }
button[aria-pressed=true]::before { content: "●"; font-size: 10px; }
.drop b { font-size: 16px; }
.drop span { color: var(--muted); font-size: 13.5px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.picked { margin: 10px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---- progress ------------------------------------------------------------------------ */
.stages { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; counter-reset: stage; }
.stages li { counter-increment: stage; border-top: 4px solid var(--line); padding-top: 6px; font-size: 13px; color: var(--muted); }
.stages li::before { content: counter(stage) " "; font-weight: 800; font-variant-numeric: tabular-nums; }
.stages li[data-state=active] { border-color: var(--warn); color: var(--ink); font-weight: 700; }
.stages li[data-state=done] { border-color: var(--ok); color: var(--ink); }
.stages li[data-state=skipped] { border-style: dashed; }
.stages li[data-state=failed] { border-color: var(--err); color: var(--err); }
@media (prefers-reduced-motion: no-preference) {
  .stages li[data-state=active] { animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 50% { border-color: transparent; } }
}
.status { margin: 12px 0 0; font-size: 15px; min-height: 1.55em; }
.ok { color: var(--ok); } .err { color: var(--err); } .warn { color: var(--warn); } .muted { color: var(--muted); }

/* ---- reader --------------------------------------------------------------------------- */
.reader-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 14px; }
.reader-head h2 { margin-right: auto; }
.views { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.views label { position: relative; }
.views input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.views span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 14px; font-size: 14.5px; font-weight: 600; color: var(--muted); }
.views label + label span { border-left: 1px solid var(--line); }
.views input:checked + span { background: var(--ink); color: var(--paper); }
.views input:focus-visible + span { outline: 3px solid var(--indigo); outline-offset: -3px; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.pages { display: grid; gap: 28px; }
.page { margin: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.page-head h3 { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.file { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.badge { font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.sheet { display: block; width: 100%; max-width: 760px; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 1px 0 var(--line); }
.page details { margin-top: 8px; max-width: 760px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; min-height: 32px; display: flex; align-items: center; }
.lines { margin: 6px 0 0; padding-left: 24px; font-size: 14.5px; }
.lines li { margin: 0 0 8px; }
.ja { display: block; color: var(--muted); }
.ko { display: block; }

/* ---- developer tools ------------------------------------------------------------------- */
.dev { max-width: 1280px; margin: 0 auto 48px; padding: 0 20px; }
.dev summary { font-weight: 700; }
.dev-body { display: grid; gap: 16px; margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0; }
.stats div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.stats dt { font-size: 12.5px; color: var(--muted); }
.stats dd { margin: 0; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meta { color: var(--muted); font-size: 13px; }
pre { margin: 0; max-height: 320px; overflow: auto; font-size: 12px; background: var(--paper); padding: 10px; border-radius: 6px; border: 1px solid var(--line); }

/* sign-in panel */
.gate h2 { margin: 0 0 6px; font-size: 20px; }
.gate h3 { margin: 20px 0 6px; font-size: 16px; }
.gate .primary { margin-top: 14px; }
.gate #gateMsg:empty { display: none; }
.layout:has(> #gate:not([hidden])) { grid-template-columns: minmax(0, 460px); justify-content: center; }
