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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #c8a96e;
  --danger: #c0392b;
  --sb-w: 240px;
}

body { background: var(--bg); color: var(--text); font-family: 'Georgia', serif; line-height: 1.7; margin-left: var(--sb-w); }
@media (max-width: 700px) { body { margin-left: 0; } }
#main { padding: 2rem 1rem 4rem; max-height: 100vh; overflow-y: auto; }
.container { max-width: 720px; margin: 0 auto; }
header { border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; margin-bottom: 2.5rem; }
header h1 { font-size: 1.5rem; font-weight: normal; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }
header p { margin-top: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.section-title { font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); margin-bottom: 1.25rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.field-group { margin-bottom: 1.75rem; }
label { display: block; font-size: 0.95rem; margin-bottom: 0.35rem; color: var(--text); }
label .hint { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; font-style: italic; }
input[type="text"], select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; color: var(--text); font-family: inherit; font-size: 0.92rem; padding: 0.65rem 0.75rem; transition: border-color 0.15s; }
input[type="text"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
select option { background: var(--surface); }
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
textarea.tall { min-height: 140px; }
textarea.short { min-height: 80px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .row-2 { grid-template-columns: 1fr; } }
.divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.question-number { display: inline-block; width: 1.6rem; height: 1.6rem; line-height: 1.6rem; text-align: center; background: var(--accent); color: var(--bg); font-size: 0.8rem; border-radius: 50%; margin-right: 0.5rem; vertical-align: middle; flex-shrink: 0; }
.question-label { display: flex; align-items: flex-start; gap: 0.1rem; margin-bottom: 0.35rem; }
.question-label span.text { font-size: 0.95rem; }
.question-label .hint { display: block; font-size: 0.82rem; color: var(--muted); font-style: italic; margin-top: 0.2rem; }
.error-banner { background: rgba(192,57,43,0.15); border: 1px solid var(--danger); border-radius: 3px; color: #e57368; padding: 0.75rem 1rem; margin-bottom: 1.5rem; font-size: 0.9rem; }
.submit-row { margin-top: 2.5rem; text-align: center; }
button[type="submit"] { background: var(--accent); border: none; border-radius: 3px; color: var(--bg); cursor: pointer; font-family: inherit; font-size: 0.95rem; letter-spacing: 0.1em; padding: 0.85rem 3rem; text-transform: uppercase; transition: opacity 0.15s; }
button[type="submit"]:hover { opacity: 0.85; }
.footer-note { margin-top: 1.25rem; color: var(--muted); font-size: 0.8rem; }
.context-note { color: var(--muted); font-size: 0.87rem; margin-bottom: 1.5rem; }

header .meta { margin-top: 0.4rem; color: var(--muted); font-size: 0.85rem; }
.synthesis-block { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0; padding: 1.75rem 2rem; font-size: 1.02rem; line-height: 1.85; white-space: pre-wrap; }
.non-neg-block { margin-top: 2rem; padding: 1.25rem 1.5rem; border: 1px solid var(--border); border-radius: 4px; }
.non-neg-block .label { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem; }
.non-neg-block .value { font-size: 1rem; color: var(--accent); }
.actions { margin-top: 2.5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.btn { border-radius: 3px; cursor: pointer; font-family: inherit; font-size: 0.88rem; letter-spacing: 0.08em; padding: 0.65rem 1.75rem; text-decoration: none; text-transform: uppercase; transition: opacity 0.15s; display: inline-block; }
.btn:hover { opacity: 0.8; }
.btn-primary { background: var(--accent); border: none; color: var(--bg); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.print-note { margin-top: 1rem; color: var(--muted); font-size: 0.8rem; }
.result-page .container { max-width: 680px; }
.thread-note { margin-top: 2rem; padding: 1.25rem 1.5rem; border: 1px solid var(--border); border-radius: 4px; }
.thread-note-title { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem; }
.thread-note-body { font-size: 0.88rem; color: var(--text); line-height: 1.7; }
.thread-note-footer { font-size: 0.88rem; color: var(--muted); margin-top: 0.75rem; font-style: italic; }
@media print {
  #sidebar, .actions, .print-note { display: none; }
  body { background: white; color: black; margin-left: 0; padding: 1rem; }
  #main { overflow: visible; padding: 0; }
  .synthesis-block { border-left-color: #999; background: #f9f9f9; color: black; }
  .non-neg-block { border-color: #ccc; }
  .non-neg-block .value { color: #333; }
}
