/* 송년회 예측판 — OMR 답안지 / 성적표 (DESIGN.md direction B). Local fonts only. */
:root {
  --paper: #fffdf6;
  --desk: #ece8dd;
  --ink: #1e1c19;
  --muted: #5e584e;
  --rule: #c4411f;
  --rule-l: #f3d6cb;
  --stamp: #a8361a;
  --ok: #1d5fa8;
  --field: #ffffff;
  --sans: -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --mono: ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--desk); color: var(--ink);
  font-family: var(--sans); font-size: .9375rem; line-height: 1.5;
  word-break: keep-all; overflow-wrap: break-word;
}
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* masthead */
.mast { max-width: 1180px; margin: 0 auto; padding: 8px 12px 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
h1 { font-family: 'Noto Serif KR', 'AppleMyungjo', 'Nanum Myeongjo', serif; font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); margin: 0; line-height: 1.2; }
.brand { white-space: nowrap; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.mast nav { display: flex; flex-wrap: wrap; gap: 4px; }
.navlink { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 8px; color: var(--ink); white-space: nowrap; }

/* layout: one column, two sheet columns from 960px (Configure left, Monitor right) */
.wrap { max-width: 1180px; margin: 0 auto; padding: 12px 12px 48px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.span { grid-column: 1 / -1; }
@media (min-width: 600px) { .wrap, .mast { padding-left: 16px; padding-right: 16px; } }
@media (min-width: 960px) {
  .wrap { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; }
  .wrap.result .board { grid-column: 2; grid-row: 1; }
  .wrap.result .side { grid-column: 1; grid-row: 1; }
}

/* sheet */
.sheet { background: var(--paper); border: 1.5px solid var(--rule); box-shadow: 2px 2px 0 var(--rule-l); min-width: 0; }
/* header box wraps under the title on very narrow / zoomed screens instead of squeezing it */
.hd { display: flex; flex-wrap: wrap; border-bottom: 1.5px solid var(--rule); }
.hd h2 { font-family: 'Noto Serif KR', 'AppleMyungjo', 'Nanum Myeongjo', serif; font-size: clamp(1.125rem, 1rem + .6vw, 1.375rem); margin: 0; padding: 8px 12px; line-height: 1.3; flex: 1 1 9em; min-width: 0; }
.no { flex: none; margin-left: auto; border-left: 1.5px solid var(--rule); padding: 6px 8px; color: var(--stamp); font-size: .75rem; line-height: 1.3; text-align: center; min-width: 76px; }
.no b { display: block; font-size: 1.0625rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-bottom: 1.5px solid var(--rule); }
.meta > div { padding: 6px 12px; border-right: 1px solid var(--rule-l); min-width: 0; }
.lab, .meta label, .meta small { display: block; font-size: .75rem; color: var(--stamp); letter-spacing: .08em; font-weight: 600; }
.row { display: grid; grid-template-columns: 34px minmax(0, 1fr); border-bottom: 1px solid var(--rule-l); }
.row .n { background: var(--rule-l); color: var(--stamp); font-weight: 700; text-align: center; padding-top: 10px; font-variant-numeric: tabular-nums; }
.row .b { padding: 8px 12px 12px; min-width: 0; }
.qt { font-size: 1rem; font-weight: 600; margin: 0; }
.qt small, .hint { font-weight: 400; color: var(--muted); font-size: .75rem; }
.pad { padding: 12px; }
.foot { padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.foot > .linkblock, .foot > .cardblock, .foot > .note { width: 100%; }

/* controls */
input, select { font: inherit; color: var(--ink); min-height: 44px; min-width: 44px; width: 100%; background: var(--field); border: 1px solid var(--muted); padding: 0 8px; border-radius: 0; }
textarea { font: .8125rem/1.5 var(--mono); color: var(--ink); width: 100%; min-height: 110px; background: var(--field); border: 1px solid var(--rule); padding: 8px; border-radius: 0; }
.btn { font: inherit; font-weight: 700; min-height: 44px; min-width: 44px; padding: 8px 14px; border: 1.5px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); cursor: pointer; white-space: nowrap; flex: none; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.pri { background: var(--ink); color: var(--paper); }
.btn:disabled { border-style: dashed; color: var(--muted); background: var(--paper); cursor: not-allowed; }
.btn.sm { font-weight: 600; padding: 4px 10px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.opt { display: flex; gap: 6px; margin-top: 6px; }
.opt input { flex: 1; }

/* R1 OMR bubbles */
.bub { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; }
/* bubbles are option labels (≤12 chars), not command buttons: they may wrap between words at 200% zoom */
.bb { font: inherit; color: var(--ink); background: none; border: 0; border-radius: 0; min-height: 44px; min-width: 44px; max-width: 100%; padding: 0 8px 0 4px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-align: left; }
.bb i { width: 22px; height: 30px; border: 1.5px solid var(--rule); border-radius: 50%; display: inline-block; flex: none; }
.bb[aria-pressed="true"] i { background: var(--ink); border-color: var(--ink); }
.bb[aria-pressed="true"] { font-weight: 700; }
.bb:disabled { cursor: default; }
.marked { display: flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 4px; font-weight: 700; }
.marked i { width: 22px; height: 30px; border-radius: 50%; display: inline-block; background: var(--ink); border: 1.5px solid var(--ink); flex: none; }

/* links, notes, states */
.linkblock, .cardblock { width: 100%; }
.link { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 4px; }
.link input.mono { flex: 1 1 160px; min-width: 0; font: .8125rem var(--mono); border: 1px dashed var(--rule); }
.note { font-size: .75rem; color: var(--muted); margin: 4px 0 0; }
.fail { font-size: .8125rem; color: var(--stamp); font-weight: 600; margin: 4px 0 0; }
.pf { font-size: .8125rem; color: var(--muted); margin: 6px 0 0; }
.err-inline { color: var(--stamp); font-size: .8125rem; margin: 4px 0 0; }
.err { background: var(--paper); border: 1.5px solid var(--rule); padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.err p { margin: 0; }
.err b { color: var(--stamp); }
.empty { padding: 12px; color: var(--muted); }
.empty p { margin: 0; }
h3.sec { font-size: .8125rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.perq { margin: 0; padding: 0 0 0 1.25em; }
.perq li { margin: 2px 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* R4 matrix: scroll inside a labelled region, sticky 석차 + 닉네임 */
.mx { overflow-x: auto; max-width: 100%; position: relative; }
.mx table { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; min-width: 100%; }
.mx caption { text-align: left; padding: 8px 12px 4px; font-weight: 600; color: var(--muted); font-size: .75rem; }
.mx th, .mx td { border-bottom: 1px solid var(--rule-l); padding: 6px 8px; text-align: left; white-space: nowrap; background: var(--paper); }
.mx thead th { font-size: .6875rem; letter-spacing: .08em; color: var(--stamp); font-weight: 600; }
.mx .rk { position: sticky; left: 0; z-index: 1; width: 44px; min-width: 44px; font-size: 1.125rem; font-weight: 800; text-align: center; }
.mx thead .rk { font-size: .6875rem; font-weight: 600; }
.mx .nm { position: sticky; left: 44px; z-index: 1; min-width: 72px; border-right: 1px solid var(--rule-l); font-weight: 600; }
.mx .q, .mx .c { min-width: 36px; text-align: center; }
.mx .c { font-size: 1.375rem; font-weight: 800; line-height: 1; }
.mx .o { color: var(--ok); }
.mx .x { color: var(--stamp); }
.mx .v { color: var(--muted); }
.mx .sc { font-weight: 700; }

/* card preview */
.preview img { display: block; width: 100%; max-width: 270px; height: auto; border: 1.5px solid var(--rule); margin-top: 8px; }

/* footer */
.site-foot { max-width: 1180px; margin: 0 auto; padding: 0 12px 24px; color: var(--muted); font-size: .75rem; }
.doc { padding: 12px; }
.doc ul, .doc ol, ol.doc { padding-left: 1.25em; margin: 0; }
ol.doc { padding: 12px 12px 0 2em; }
.doc h2 { margin-top: 0; }
.doc h3 { font-size: 1rem; margin: 16px 0 4px; }
.doc a { color: var(--ink); }

@media (prefers-reduced-motion: no-preference) {
  .bb i { transition: background-color 120ms, border-color 120ms; }
  .btn { transition: background-color 120ms, color 120ms; }
}
