/* =========================================================
   OPYEB ApplyHome Kit
   Obsidian panels, muted gold accent, mono labels.
   Dark is the default; html[data-theme="light"] switches to paper.
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: dark;

  --bg: #0b0b0d;
  --bg2: #101014;
  --panel: #121216;
  --panel2: #17171c;
  --panel3: #1d1d23;
  --line: rgba(255, 255, 255, .10);
  --line2: rgba(255, 255, 255, .20);
  --ink: #f5f2ea;
  --muted: #b6b0a4;
  --muted2: #9a9386;
  --accent: #e5b45c;
  --accent2: #f0c87e;
  --accent-dim: rgba(229, 180, 92, .14);
  --accent-line: rgba(229, 180, 92, .40);
  --on-accent: #191104;

  --ok: #79d39a;
  --ok-dim: rgba(121, 211, 154, .14);
  --warn: #f0c274;
  --warn-dim: rgba(240, 194, 116, .14);
  --bad: #ff9b8a;
  --bad-dim: rgba(255, 155, 138, .13);
  --info: #8fc3f5;
  --info-dim: rgba(143, 195, 245, .13);

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1140px;
  --shadow: 0 18px 40px -26px rgba(0, 0, 0, .95);

  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Segoe UI", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR",
          "Helvetica Neue", Arial, "Liberation Sans", "DejaVu Sans", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f6f3ec;
  --bg2: #fbf9f4;
  --panel: #ffffff;
  --panel2: #f4f0e7;
  --panel3: #ece6da;
  --line: rgba(26, 20, 11, .12);
  --line2: rgba(26, 20, 11, .26);
  --ink: #171310;
  --muted: #554d40;
  --muted2: #6b6154;
  --accent: #8a5a10;
  --accent2: #6d4708;
  --accent-dim: rgba(150, 102, 26, .12);
  --accent-line: rgba(150, 102, 26, .45);
  --on-accent: #fffaf0;

  --ok: #16653a;
  --ok-dim: rgba(22, 101, 58, .10);
  --warn: #7a4f00;
  --warn-dim: rgba(122, 79, 0, .10);
  --bad: #9c2119;
  --bad-dim: rgba(156, 33, 25, .08);
  --info: #1b5480;
  --info-dim: rgba(27, 84, 128, .08);

  --shadow: 0 18px 40px -30px rgba(50, 38, 18, .40);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 60% at 50% -20%, rgba(229, 180, 92, .09), transparent 62%),
    radial-gradient(70% 45% at 100% 4%, rgba(229, 180, 92, .05), transparent 58%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

html[lang="ko"] body { word-break: keep-all; }
main { flex: 1 0 auto; width: 100%; }

h1, h2, h3, h4 { margin: 0; line-height: 1.28; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.skip {
  position: absolute; left: 12px; top: -80px; z-index: 90;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent-line);
  background: var(--panel); color: var(--ink);
  font-size: 13px; font-weight: 700;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.3);
}
.header-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 62px; padding-top: 8px; padding-bottom: 8px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 0; font-size: 12px; letter-spacing: .16em;
}
.brand-mark { display: block; width: 28px; height: 28px; flex: none; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-mark .sym-light { display: none; }
:root[data-theme="light"] .brand-mark .sym-dark { display: none; }
:root[data-theme="light"] .brand-mark .sym-light { display: block; }
.brand-name {
  display: block; font-size: 15px; font-weight: 800; letter-spacing: .01em;
  line-height: 1.1; white-space: nowrap;
}
.brand-name .org {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .12em; color: var(--accent); margin-left: 6px;
}
.brand-sub {
  display: block; margin-top: 2px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  color: var(--muted2); white-space: nowrap;
}

.header-tools { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.langs {
  display: inline-flex; align-items: center; gap: 2px;
  height: 34px; padding: 3px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel);
}
.langs a {
  display: grid; place-items: center; height: 26px; padding: 0 8px;
  border-radius: 7px; font-family: var(--mono);
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--muted2);
}
.langs a:hover { color: var(--ink); }
.langs a[aria-current="page"] { color: var(--accent); background: var(--accent-dim); }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--muted); cursor: pointer;
  transition: color .16s ease, border-color .16s ease, transform .12s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .i-moon { display: none; }
:root[data-theme="light"] .icon-btn .i-sun { display: none; }
:root[data-theme="light"] .icon-btn .i-moon { display: block; }

/* ---------- tabs ---------- */
.tabs {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2) 70%, transparent);
}
.tabs-in {
  display: flex; gap: 4px; overflow-x: auto;
  padding: 8px 20px; max-width: var(--maxw); margin: 0 auto;
  scrollbar-width: none;
}
.tabs-in::-webkit-scrollbar { display: none; }
.tabs-in a {
  flex: none; padding: 7px 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 650; color: var(--muted);
  border: 1px solid transparent; white-space: nowrap;
}
.tabs-in a:hover { color: var(--ink); background: var(--panel2); }
.tabs-in a[aria-current="true"] {
  color: var(--accent); background: var(--accent-dim); border-color: var(--accent-line);
}

/* ---------- hero ---------- */
.hero { padding-top: 38px; padding-bottom: 26px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: ""; width: 18px; height: 1px; background: var(--accent-line);
}
.hero h1 { font-size: clamp(28px, 4.4vw, 46px); font-weight: 800; }
.hero .lead {
  margin-top: 14px; max-width: 60ch;
  font-size: clamp(15px, 1.6vw, 18px); color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.chip b { color: var(--ink); font-weight: 700; }
.basis-strip {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted2);
}
.basis-strip b {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  color: var(--muted); margin-right: 6px; text-transform: uppercase;
}

/* ---------- sections ---------- */
.section { padding: 34px 0; border-top: 1px solid var(--line); }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 18px; margin-bottom: 18px; }
.sec-head h2 { font-size: clamp(20px, 2.6vw, 28px); font-weight: 800; }
.sec-head p { max-width: 66ch; margin-top: 8px; color: var(--muted); font-size: 14.5px; }
.date-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); font-family: var(--mono);
  font-size: 11px; letter-spacing: .06em; color: var(--muted);
  white-space: nowrap;
}
.date-badge span { color: var(--muted2); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin-bottom: 12px; }
.card-head h3 { font-size: 16.5px; font-weight: 750; }
.card-head .hint { font-size: 12.5px; color: var(--muted2); }

/* ---------- forms ---------- */
.form-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
}
fieldset.group {
  min-width: 0; margin: 0 0 14px; padding: 12px 14px 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg2);
}
fieldset.group legend {
  padding: 0 7px; margin-left: -3px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.field { min-width: 0; }
.field.wide { grid-column: span 2; }
.field label, .field .lbl {
  display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 700;
  color: var(--muted);
}
.field .unit { font-weight: 500; color: var(--muted2); }
.field input[type="number"],
.field input[type="date"],
.field input[type="text"],
.field select {
  width: 100%; height: 42px; padding: 0 11px;
  border: 1px solid var(--line2); border-radius: var(--radius-sm);
  background: var(--bg2); color: var(--ink);
  font-size: 14.5px; font-variant-numeric: tabular-nums;
  appearance: none;
}
.field select {
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field .tip { margin-top: 5px; font-size: 11.5px; color: var(--muted2); line-height: 1.45; }
.check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  padding: 9px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg2);
  cursor: pointer; min-height: 42px;
}
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 17px; height: 17px; flex: none;
  border: 1.5px solid var(--line2); border-radius: 5px;
  background: var(--panel3); cursor: pointer;
  display: inline-grid; place-content: center;
  transition: background .14s ease, border-color .14s ease;
}
input[type="checkbox"]::after {
  content: ""; width: 9px; height: 5px;
  border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent);
  transform: rotate(-45deg) scale(0); transform-origin: center;
  transition: transform .12s ease;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field input:disabled, .field select:disabled, .field input[readonly] {
  opacity: .5; cursor: not-allowed;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 750; cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.small { min-height: 34px; padding: 0 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.status-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin-top: 14px; padding: 10px 12px;
  border: 1px dashed var(--line2); border-radius: var(--radius-sm);
  background: var(--bg2); font-size: 12.5px; color: var(--muted);
}
.status-line b { color: var(--ink); }
.status-line .spacer { flex: 1 1 auto; }

/* ---------- diagnosis results ---------- */
.result-top {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 16px;
}
.stat {
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg2);
}
.stat .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; color: var(--muted2); text-transform: uppercase; }
.stat .v { margin-top: 4px; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }

.verdicts { display: grid; gap: 10px; }
.verdict {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg2); overflow: hidden;
}
.verdict > summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 12px 14px; cursor: pointer; list-style: none;
}
.verdict > summary::-webkit-details-marker { display: none; }
.verdict > summary .name { font-size: 15px; font-weight: 750; }
.verdict > summary .law { font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; color: var(--muted2); }
.verdict > summary .grow { flex: 1 1 auto; }
.verdict .body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { color: var(--ok); background: var(--ok-dim); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn { color: var(--warn); background: var(--warn-dim); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.bad { color: var(--bad); background: var(--bad-dim); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.badge.info { color: var(--info); background: var(--info-dim); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.badge.plain { color: var(--muted); background: var(--panel2); border-color: var(--line); }

.reason-list { display: grid; gap: 8px; margin-top: 10px; }
.reason { display: grid; grid-template-columns: 18px 1fr; gap: 8px; font-size: 13.5px; }
.reason .mark { font-weight: 800; line-height: 1.5; text-align: center; }
.reason.ok .mark { color: var(--ok); }
.reason.bad .mark { color: var(--bad); }
.reason.warn .mark { color: var(--warn); }
.reason .txt { color: var(--muted); }
.reason .txt b { color: var(--ink); font-weight: 700; }
.reason .txt em { font-style: normal; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

.note-box {
  margin-top: 12px; padding: 11px 13px;
  border-left: 3px solid var(--accent-line); border-radius: 0 8px 8px 0;
  background: var(--accent-dim); font-size: 13px; color: var(--ink);
}
.note-box b { color: var(--accent); }

.empty {
  padding: 26px 16px; text-align: center; color: var(--muted2); font-size: 14px;
  border: 1px dashed var(--line2); border-radius: var(--radius-sm);
}

/* ---------- score ---------- */
.score-wrap { display: grid; gap: 18px; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: start; }
.score-total {
  padding: 20px; border: 1px solid var(--accent-line); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--accent-dim), transparent 70%), var(--bg2);
  text-align: center;
}
.score-total .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.score-total .num {
  font-size: 62px; font-weight: 850; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums; margin: 8px 0 2px;
}
.score-total .num small { font-size: 22px; color: var(--muted); font-weight: 700; }
.score-total .sub { font-size: 12.5px; color: var(--muted); }
.bars { display: grid; gap: 12px; margin-top: 18px; text-align: left; }
.bar-row .bl { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.bar-row .bl b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bar { height: 7px; margin-top: 5px; border-radius: 999px; background: var(--panel3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar-row:nth-child(2) > .bar > i { background: var(--info); }
.bar-row:nth-child(3) > .bar > i { background: var(--ok); }

.points-panel { min-width: 0; }
.subgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.subcard { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg2); }
.subcard h4 { font-size: 13.5px; font-weight: 750; margin-bottom: 4px; }
.subcard .big { font-size: 26px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.subcard .big small { font-size: 12px; color: var(--muted); font-weight: 600; }
.subcard p { margin-top: 6px; font-size: 12px; color: var(--muted2); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 420px; }
caption { caption-side: top; text-align: left; padding: 10px 12px 4px; font-size: 12px; color: var(--muted2); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--panel2); letter-spacing: .02em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
td b { font-weight: 750; }

/* ---------- calendar ---------- */
.cal-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.cal-tools .field { min-width: 150px; }
.cal-tools .field select { height: 38px; }
.cal-tools .spacer { flex: 1 1 auto; }

.ann-list { display: grid; gap: 10px; }
.ann {
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg2);
}
.ann-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ann-head .nm { font-size: 15.5px; font-weight: 780; }
.ann-head .loc { font-size: 12.5px; color: var(--muted2); }
.ann-head .grow { flex: 1 1 auto; }
.ann .dday {
  font-family: var(--mono); font-size: 12px; font-weight: 800; letter-spacing: .02em;
  padding: 4px 9px; border-radius: 7px; white-space: nowrap;
}
.dday.hot { color: var(--on-accent); background: var(--accent); }
.dday.soon { color: var(--warn); background: var(--warn-dim); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.dday.later { color: var(--muted); background: var(--panel2); border: 1px solid var(--line); }
.dday.done { color: var(--muted2); background: transparent; border: 1px dashed var(--line2); }

.phase-grid {
  display: grid; gap: 6px; margin-top: 10px;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}
.phase {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); font-size: 12px;
}
.phase .pk { display: block; font-size: 10.5px; color: var(--muted2); letter-spacing: .04em; }
.phase .pv { font-weight: 700; font-variant-numeric: tabular-nums; }
.phase.now { border-color: var(--accent-line); background: var(--accent-dim); }
.phase.past { opacity: .62; }

.ann-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; font-size: 12px; color: var(--muted2); }
.ann-foot .sel { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 600; }
.ann-foot input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------- guide / policy ---------- */
.prose { max-width: 74ch; }
.prose h2 { font-size: clamp(20px, 2.4vw, 26px); margin-bottom: 12px; }
.prose h3 { font-size: 16px; margin: 22px 0 8px; }
.prose p { margin: 10px 0; color: var(--muted); font-size: 14.5px; }
.prose p strong, .prose li strong { color: var(--ink); }
.prose ul { margin: 10px 0 10px 2px; display: grid; gap: 7px; }
.prose li { position: relative; padding-left: 15px; color: var(--muted); font-size: 14px; }
.prose li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.prose a { color: var(--accent); border-bottom: 1px solid var(--accent-line); }
.prose code {
  font-family: var(--mono); font-size: 12.5px; padding: 1px 5px;
  border: 1px solid var(--line); border-radius: 5px; background: var(--panel2);
}

details.faq { border-top: 1px solid var(--line); }
details.faq:last-child { border-bottom: 1px solid var(--line); }
details.faq summary {
  display: flex; align-items: center; gap: 10px; padding: 13px 2px;
  font-size: 14.5px; font-weight: 700; cursor: pointer; list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; margin-left: auto; color: var(--accent); font-weight: 800; font-size: 17px; }
details.faq[open] summary::after { content: "−"; }
details.faq p { padding: 0 2px 14px; font-size: 14px; color: var(--muted); }

.policy { max-width: 78ch; }
.policy h1 { font-size: clamp(24px, 3.4vw, 34px); margin-bottom: 6px; }
.policy .updated { font-family: var(--mono); font-size: 11.5px; color: var(--muted2); letter-spacing: .04em; }
.policy h2 { font-size: 17px; margin: 26px 0 8px; }
.policy p, .policy li { font-size: 14.5px; color: var(--muted); }
.policy p + p { margin-top: 8px; }
.policy ul { margin: 8px 0 0 2px; display: grid; gap: 6px; }
.policy li { position: relative; padding-left: 14px; }
.policy li::before { content: ""; position: absolute; left: 0; top: .62em; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.policy a { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 40px; padding: 30px 0 34px;
  border-top: 1px solid var(--line); background: var(--bg2);
}
.foot-in { display: flex; flex-wrap: wrap; gap: 18px 40px; justify-content: space-between; align-items: flex-start; }
.foot-brand { min-width: 0; max-width: 46ch; }
.foot-brand .brand { font-size: 11px; }
.foot-line { margin-top: 10px; font-size: 12.5px; color: var(--muted2); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--muted); }
.foot-links a { border-bottom: 1px solid transparent; }
.foot-links a:hover { color: var(--ink); border-bottom-color: var(--line2); }
.foot-bottom {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted2);
}
.foot-bottom .mono { font-family: var(--mono); letter-spacing: .04em; }

/* ---------- misc ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.center-cta { margin-top: 18px; }
.inline-links { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.inline-links a { color: var(--accent); }

@media (max-width: 860px) {
  .score-wrap { grid-template-columns: minmax(0, 1fr); }
  .field.wide { grid-column: span 1; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  fieldset.group { padding: 10px 11px 2px; }
  .wrap { padding: 0 15px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 14px; }
  .brand-mark { width: 24px; height: 24px; }
  .hero { padding-top: 26px; padding-bottom: 18px; }
  .section { padding: 26px 0; }
  .card { padding: 15px; border-radius: 14px; }
  .score-total .num { font-size: 52px; }
  .tabs-in { padding: 7px 15px; }
  .basis-strip { gap: 6px 14px; font-size: 11.5px; }
  .phase-grid { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
  table { min-width: 380px; }
}

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

@media print {
  .site-header, .tabs, .actions, .cal-tools, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #bbb; }
}

/* =========================================================
   MediaKit — tool components
   ========================================================= */
.mk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; padding-bottom: 8px; }
.mk-main { min-width: 0; display: grid; gap: 14px; }
.mk-side { min-width: 0; display: grid; gap: 14px; position: sticky; top: 82px; }
.mk-main .card + .card { margin-top: 0; }

.hero h1 em { font-style: normal; color: var(--accent); }
.lede-sm { margin: 2px 0 14px; font-size: 13.8px; color: var(--muted); }
.inline-note { font-size: 12.5px; color: var(--muted2); }
.tip { margin-top: 10px; font-size: 12px; color: var(--muted2); line-height: 1.55; }
.hint { font-size: 12.5px; color: var(--muted2); }

/* drop / picker */
.drop { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.drop.drag { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.picker {
  flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px dashed var(--line2); border-radius: var(--radius);
  background: var(--bg2); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.picker:hover, .picker:focus-within { border-color: var(--accent); background: var(--accent-dim); }
.picker-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; border: 1px solid var(--accent-line); background: var(--accent-dim); color: var(--accent);
}
.picker-text { display: grid; gap: 2px; min-width: 0; }
.picker-text b { font-size: 14.5px; font-weight: 750; }
.picker-text span { font-size: 12px; color: var(--muted2); overflow-wrap: anywhere; }
.drop-sm .picker { padding: 11px 13px; }
.demo-btn { align-self: center; }

/* file info */
.fileinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0 0; }
.fileinfo > div { min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.fileinfo dt { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted2); }
.fileinfo dd { margin: 3px 0 0; font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }

/* waveform */
.wave-wrap { margin-top: 14px; }
#wave { width: 100%; height: 118px; border: 1px solid var(--line); border-radius: 10px; display: block; }
.wave-axis {
  display: flex; justify-content: space-between; margin-top: 5px;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted2);
}

/* ranges */
.rangegrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.rangegrid .field { display: grid; gap: 7px; }
input[type="range"] {
  width: 100%; height: 26px; margin: 0; accent-color: var(--accent); cursor: pointer;
  background: transparent;
}
input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }
input[type="number"] { font-variant-numeric: tabular-nums; }
textarea {
  width: 100%; margin-top: 12px; padding: 11px 12px; resize: vertical; min-height: 132px;
  border: 1px solid var(--line2); border-radius: var(--radius-sm);
  background: var(--bg2); color: var(--ink);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* results */
.result { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg2); }
.result.ok { border-color: var(--accent-line); }
.result.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.result.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.result-head b { font-size: 15px; font-weight: 780; }
.result-head .badge { margin-left: auto; }
.result .actions { margin-top: 12px; }
.kvlist { display: grid; gap: 6px; margin: 12px 0 0; }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; font-size: 13px; }
.kv dt { color: var(--muted2); font-size: 12px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* frames */
.snap-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); margin-top: 14px; }
.snap-preview { min-width: 0; }
#videoPrev { width: 100%; max-height: 260px; border-radius: 10px; background: #000; display: block; }
.snap-empty {
  display: grid; place-items: center; min-height: 180px; padding: 16px; text-align: center;
  border: 1px dashed var(--line2); border-radius: 10px; color: var(--muted2); font-size: 12.5px;
}
.snap-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.snap-ctrl input[type="range"] { flex: 1 1 160px; }
.snap-batch { min-width: 0; }
.snap-batch .form-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.snap-batch .field input, .snap-batch .field select { height: 38px; font-size: 13.5px; }
.frames { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 16px; }
.frame { margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.frame img { width: 100%; border-radius: 6px; background: #000; aspect-ratio: 16/9; object-fit: contain; }
.frame figcaption { display: flex; justify-content: space-between; gap: 6px; margin: 6px 0; font-size: 11.5px; color: var(--muted2); }
.frame figcaption b { color: var(--ink); font-family: var(--mono); font-size: 11px; }
.frame .btn { width: 100%; }

/* m3u8 */
.uri { overflow-wrap: anywhere; word-break: break-all; font-size: 11.5px; color: var(--muted); }
.mono { font-family: var(--mono); }
table .mono.uri { min-width: 0; }

/* image compare */
.img-compare { display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 12px; }
.img-compare figure { margin: 0; }
.img-compare img { width: 100%; max-height: 200px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); }
.img-compare figcaption { margin-top: 5px; font-size: 11.5px; color: var(--muted2); text-align: center; }
.img-compare .kvlist { margin-top: 0; }

/* side */
.side-card .card-head { margin-bottom: 8px; }
.side-card h2 { font-size: 14px; }
.side-file { font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
.side-mini { display: grid; gap: 6px; margin: 10px 0 0; }
.side-mini > div { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.side-mini dt { color: var(--muted2); }
.side-mini dd { margin: 0; font-variant-numeric: tabular-nums; }
.no-list { display: grid; gap: 7px; margin-top: 4px; }
.no-list li { position: relative; padding-left: 15px; font-size: 12.8px; color: var(--muted); }
.no-list li::before { content: "×"; position: absolute; left: 0; top: -.05em; color: var(--bad); font-weight: 800; }
.link-arrow { font-size: 13px; color: var(--accent); border-bottom: 1px solid var(--accent-line); }

/* how / steps */
.steps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.step { position: relative; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.step .sn { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--accent); }
.step h3 { margin: 6px 0 6px; font-size: 15px; }
.step p { font-size: 13px; color: var(--muted); }
.step code, .prose code { font-family: var(--mono); font-size: 11.5px; padding: 1px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel2); }
.sub-h { font-size: 17px; margin: 24px 0 10px; }
.faq-list { border-top: 1px solid var(--line); }
.faq-list details:last-child { border-bottom: 1px solid var(--line); }
.privacy-strip {
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
}
.privacy-strip div { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.privacy-strip b { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted2); }
.privacy-strip span { display: block; margin-top: 3px; font-size: 12.8px; color: var(--ink); }
.footnote { margin-top: 18px; font-size: 11.8px; color: var(--muted2); line-height: 1.6; }
.footnote a { color: var(--accent); }

/* english page cards */
.doc-page { max-width: 1000px; padding-bottom: 10px; }
.caps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 4px 0 20px; }
.cap { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.cap .cn { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--accent); }
.cap h3 { margin: 5px 0 6px; font-size: 15px; }
.cap p { font-size: 13px; color: var(--muted); }
.limit-list { display: grid; gap: 10px; margin-top: 4px; }
.limit-list li { position: relative; padding: 10px 12px 10px 30px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); font-size: 13.2px; color: var(--muted); }
.limit-list li::before { content: "!"; position: absolute; left: 12px; top: 9px; width: 15px; height: 15px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--warn); color: var(--warn); font-size: 10px; font-weight: 800; }
.limit-list b { color: var(--ink); }
.prose { max-width: 74ch; font-size: 14.3px; color: var(--muted); }
.cta-box { margin-top: 18px; padding: 16px; border: 1px solid var(--accent-line); border-radius: var(--radius); background: var(--accent-dim); }
.cta-box p { font-size: 13px; color: var(--ink); margin-bottom: 10px; }
.doc-page .card + .card { margin-top: 14px; }

@media (max-width: 980px) {
  .mk-layout { grid-template-columns: minmax(0, 1fr); }
  .mk-side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .snap-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .picker { flex: 1 1 100%; padding: 12px; }
  #wave { height: 96px; }
  .kv { grid-template-columns: 88px minmax(0, 1fr); }
  .img-compare { grid-template-columns: minmax(0, 1fr); }
  .frames { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .result-head .badge { margin-left: 0; }
}

/* hidden attribute must always win over component display rules */
[hidden] { display: none !important; }

/* policy-page links must not recolour buttons */
.policy a.btn, .prose a.btn, .cta-box a.btn { color: var(--on-accent); border-bottom: 0; }
.policy a.btn.ghost, .prose a.btn.ghost { color: var(--ink); }

/* grid/flex children must be allowed to shrink below their content width */
.mk-layout > *, .mk-main > *, .mk-side > *, .card { min-width: 0; }
.tablewrap { max-width: 100%; }
