:root {
  color-scheme: light;
  /* Shadcn-inspired neutral palette + warm eye-care paper for Japanese passages */
  --bg-canvas: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --paper-bg: #faf7f0;
  --paper-border: #e9e1d2;
  --paper-notes-bg: #f3ede0;

  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #18181b;
  --primary-hover: #27272a;
  --accent: #0f766e;
  --accent-soft: #f0fdfa;
  --accent-border: #99f6e4;

  --amber-ink: #92400e;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;

  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.08);
  --shadow-float: 0 10px 30px -10px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.05);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --japanese: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", "Songti SC", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--ink);
  font: 15.5px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  width: min(50rem, calc(100% - 2rem));
  margin: 2rem auto 2.5rem;
  padding: clamp(1.35rem, 4vw, 2.5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* 5-Level Typography Hierarchy */
h1, h2, h3, p { margin-block: 0; }
p + p { margin-top: 0.6rem; }

.page-header {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.55rem, 4.2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.28;
  color: var(--ink);
  margin-top: 0.25rem;
}

.session-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-top: 0.65rem;
  padding: 0.3rem 0.7rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.section-heading { margin-bottom: 1.1rem; }
.section-heading h2,
h2 {
  font-size: 1.18rem;
  font-weight: 680;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.35;
}

.section-subtitle {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.65;
}

h3 { font-size: inherit; }
.muted { color: var(--muted); font-size: 0.88rem; }
.req-mark { color: var(--danger); font-weight: 650; }
.field-hint {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.79rem;
  line-height: 1.45;
  color: var(--muted);
}

/* Interactive Controls & Buttons */
button, input, select, textarea {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

input, select, textarea { padding: 0.45rem 0.68rem; }
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 560;
  font-size: 0.93rem;
  padding: 0.56rem 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
button.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-secondary);
}
button.secondary:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: #94a3b8;
  color: var(--ink);
}
button:disabled { opacity: 0.55; cursor: wait; }

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

input[aria-invalid=true],
select[aria-invalid=true],
textarea[aria-invalid=true] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

/* Global Status Banner */
#message {
  margin: 1rem 0 0;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: #115e59;
  font-size: 0.91rem;
  line-height: 1.55;
}
#message.error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

/* Welcome Page */
#welcome { margin-top: 1.4rem; }

.welcome-intro {
  padding: 1.2rem 1.3rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.welcome-lead {
  font-size: 1.06rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.5;
}

.welcome-desc {
  margin-top: 0.55rem;
  font-size: 0.94rem;
  color: var(--ink-secondary);
  line-height: 1.7;
}

.welcome-steps {
  margin: 0.95rem 0 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: var(--ink-secondary);
}
.welcome-steps li { padding-left: 0.2rem; }
.welcome-steps li::marker { color: var(--accent); font-weight: 700; }
.welcome-steps strong { color: var(--ink); font-weight: 620; }

.welcome-note {
  margin-top: 0.95rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-strong);
  font-size: 0.85rem;
  color: var(--muted);
}

#start-form {
  margin-top: 1.35rem;
  padding: 1.15rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
#start-form > label {
  display: block;
  font-size: 0.92rem;
  font-weight: 620;
  color: var(--ink);
}
.start-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}
#participant-code {
  flex: 1 1 16rem;
  max-width: 24rem;
  min-height: 2.65rem;
  letter-spacing: 0.04em;
  font-size: 0.98rem;
}
#start-button { min-height: 2.65rem; padding-inline: 1.35rem; }

/* Profile Page */
#profile-section { margin-top: 1.4rem; }

#profile-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  margin: 1rem 0;
  padding: 1rem 1.15rem 1.2rem;
}
#profile-form legend {
  padding: 0 0.5rem;
  font-size: 0.92rem;
  font-weight: 680;
  color: var(--ink);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem 1.25rem;
}
.profile-grid > label,
.profile-label {
  display: block;
  font-size: 0.89rem;
  font-weight: 550;
  color: var(--ink-secondary);
}
.profile-grid input,
.profile-grid select {
  min-width: 0;
  width: 100%;
  min-height: 2.5rem;
  font-weight: 400;
  color: var(--ink);
}
.profile-grid > label > input,
.profile-grid > label > select {
  display: block;
  margin-top: 0.35rem;
}
.profile-grid > label > .field-hint {
  margin-top: 0.3rem;
}
.profile-grid .full-width { grid-column: 1 / -1; }

.inline-fields {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.32rem;
}
.inline-fields label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 450;
  color: var(--ink-secondary);
}
.inline-fields input { width: 4.5rem; text-align: center; }

.profile-grid input:disabled {
  background: #f1f5f9;
  border-color: var(--border);
  color: var(--subtle);
  cursor: not-allowed;
}

/* Reading Test Guide Card */
#test { margin-top: 1.35rem; }

.test-guide-card {
  padding: 1.15rem 1.25rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.guide-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.guide-title {
  font-size: 1.02rem;
  font-weight: 680;
  color: var(--ink);
}

.guide-overview {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  line-height: 1.62;
}

.annotation-callout {
  margin-top: 0.85rem;
  padding: 0.78rem 0.95rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-left: 3.5px solid var(--accent);
  border-radius: var(--radius-sm);
}

.annotation-callout-main {
  font-size: 0.95rem;
  font-weight: 650;
  color: #115e59;
  line-height: 1.5;
}

.annotation-help {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #134e4a;
  line-height: 1.55;
}

.scale-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0 0;
}

.scale-card {
  padding: 0.65rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.scale-card dt {
  font-size: 0.83rem;
  font-weight: 660;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.scale-card dd {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  margin: 0;
  font-size: 0.81rem;
  color: var(--muted);
  line-height: 1.5;
}

.scale-card dd span { white-space: nowrap; }

.guide-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.8rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border-strong);
}

.status-pill {
  font-size: 0.81rem;
  color: var(--muted);
  line-height: 1.45;
}
.status-pill:empty { display: none; }

/* Progress Indicator (Sticky compact on narrow screens, right floating card on wide screens) */
.progress-indicator {
  position: sticky;
  top: 0.65rem;
  z-index: 14;
  margin-bottom: 1rem;
  padding: 0.75rem 0.95rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-title {
  font-size: 0.82rem;
  font-weight: 680;
  color: var(--ink);
  letter-spacing: 0.02em;
}

#progress-text {
  font-size: 0.8rem;
  font-weight: 620;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  display: block;
  width: 100%;
  height: 0.34rem;
  margin-top: 0.5rem;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.22s ease;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.32rem;
  margin-top: 0.58rem;
}

.progress-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 1.8rem;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.progress-dot:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: var(--ink);
}

.progress-dot.is-done {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.progress-dot.is-done:hover:not(:disabled) {
  background: #115e59;
  border-color: #115e59;
  color: #ffffff;
}

.progress-dot.has-reason::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d97706;
}
.progress-dot.is-done.has-reason::after {
  background: #fde68a;
}

.progress-footnote {
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.progress-indicator.is-complete {
  border-color: var(--accent-border);
  background: rgba(240, 253, 250, 0.96);
}
.progress-indicator.is-complete .progress-footnote {
  color: #115e59;
  font-weight: 560;
}

@media (min-width: 1260px) {
  .progress-indicator {
    position: fixed;
    top: 2rem;
    left: calc(50% + 25rem + 1.25rem);
    width: 12rem;
    margin: 0;
    padding: 0.9rem 0.85rem;
    z-index: 15;
  }

  .progress-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.65rem;
  }

  .progress-dot { height: 1.9rem; }
  .progress-footnote { margin-top: 0.6rem; }
}

/* Passages & Eye-Care Warm Paper Reading Zone */
.passage {
  margin-top: 1.65rem;
  padding: 1.3rem 1.35rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.passage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.9rem;
}

.passage-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  background: var(--primary);
  color: #ffffff;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 620;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.passage-mark-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.passage-mark-tools .muted { font-size: 0.81rem; }
.passage-mark-tools button {
  padding: 0.24rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
}

[lang=ja] {
  font-family: var(--japanese);
  font-size: 1.08rem;
  line-height: 2;
  overflow-wrap: break-word;
}

rt { font-size: 0.56em; font-weight: normal; }
.ruby-under ruby { ruby-position: after; ruby-position: under; }

.reading {
  padding: 1.25rem 1.4rem;
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-md);
  color: #1c1917;
  line-height: 2.08;
}

.reading .prose { text-indent: 1em; }
.reading .prose + .prose { margin-top: 0.75rem; }

.reading .source {
  margin-top: 0.95rem;
  text-align: end;
  color: #78716c;
  font-size: 0.82em;
  line-height: 1.55;
}

.reading .notes {
  margin-top: 0.9rem;
  padding: 0.65rem 0.85rem;
  background: var(--paper-notes-bg);
  border-top: 1px dashed #d6cab4;
  border-radius: var(--radius-sm);
  font-size: 0.84em;
  line-height: 1.7;
  color: #57534e;
}
.reading .notes p + p { margin-top: 0.2rem; }

/* Questions, Options & Rating Row */
.question {
  margin-top: 1.25rem;
  padding: 1rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.question.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
  background: #fcfffe;
}

.question-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: baseline;
  font-weight: 600;
  color: var(--ink);
}

.question-number {
  flex: none;
  font: 700 0.84rem/1.4 var(--sans);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 0.12rem 0.5rem;
}

.reason-badge {
  flex: none;
  font: 620 0.75rem/1.4 var(--sans);
  color: var(--amber-ink);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 999px;
  padding: 0.1rem 0.52rem;
}

.options {
  list-style: none;
  margin: 0.7rem 0 0.75rem;
  padding-left: 0;
  display: grid;
  gap: 0.42rem;
}

.answer-option {
  display: grid;
  grid-template-columns: 1.1rem 1.2rem minmax(0, 1fr);
  align-items: start;
  gap: 0.5rem;
  padding: 0.52rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.answer-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}
.answer-option.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.answer-option input[type=radio] {
  margin: 0.52em 0 0;
  width: 1rem;
  height: 1rem;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.option-number {
  user-select: none;
  color: var(--muted);
  font-weight: 600;
}
.option-text {
  min-width: 0;
  cursor: text;
  user-select: text;
}

.responses {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1.15rem;
  padding: 0.62rem 0.85rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.89rem;
  color: var(--ink-secondary);
}
.responses label {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-weight: 550;
}
.responses select {
  min-width: 3.3rem;
  padding: 0.3rem 0.5rem;
  font-weight: 400;
}
.responses input {
  width: 4.8rem;
  padding: 0.3rem 0.5rem;
  font-weight: 400;
}

.field-error {
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 500;
}
.responses .field-error { flex-basis: 100%; }

/* Reasons & Prior Exposure Stage */
#reasons {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.reason {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.reason label {
  display: block;
  font-size: 0.94rem;
  color: var(--ink);
}
.reason textarea {
  display: block;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.6rem 0.75rem;
  min-height: 4.6rem;
  resize: vertical;
  background: var(--surface);
}

.reason-context {
  margin: 0.55rem 0 0.6rem;
  padding: 0.58rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.reason-context p + p { margin-top: 0.3rem; }
.reason-selected-option { color: var(--ink); font-weight: 550; }

#prior-exposure-section {
  margin-top: 1.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}

.prior-overall-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  margin: 0.85rem 0 0;
  padding: 0.95rem 1.1rem 1.1rem;
}
.prior-overall-fieldset legend {
  padding: 0 0.45rem;
  font-size: 0.94rem;
  font-weight: 640;
  color: var(--ink);
}
.prior-overall-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.45rem;
}
.prior-radio-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.52rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  font-size: 0.92rem;
}
.prior-radio-card:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
  color: #115e59;
}
.prior-radio-card input[type=radio] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

#prior-passages-container { margin-top: 1rem; }
.prior-passages-help { margin-bottom: 0.65rem; }

.prior-passage-card {
  margin-top: 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}
.prior-passage-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}
.prior-passage-title {
  font-weight: 680;
  font-size: 0.88rem;
  color: var(--accent);
  flex: none;
}
.prior-passage-snippet { font-size: 0.93rem; color: var(--ink); }

.prior-passage-options { display: grid; gap: 0.35rem; margin-top: 0.45rem; }
.prior-passage-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
}
.prior-passage-option:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.prior-passage-option input[type=radio] {
  margin: 0.25em 0 0;
  width: 0.98rem;
  height: 0.98rem;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

/* Completion Page */
#complete { margin-top: 1.6rem; }

.complete-card {
  padding: 2rem clamp(1.2rem, 4vw, 2.2rem);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}

.complete-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.9rem;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-border);
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: 700;
}

.complete-card h2 { font-size: 1.32rem; margin-bottom: 0.5rem; }
.complete-lead { font-size: 0.96rem; font-weight: 560; color: var(--ink-secondary); }
.complete-thanks {
  max-width: 34rem;
  margin: 0.7rem auto 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.75;
}

.receipt-box {
  max-width: 28rem;
  margin: 1.35rem auto 0;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}
.receipt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 0.8rem;
}
.receipt-label { font-size: 0.83rem; color: var(--muted); }
#receipt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
#submitted-at { margin-top: 0.35rem; font-size: 0.82rem; }
.complete-card .actions { justify-content: center; margin-top: 1.4rem; }

/* Highlight Annotation Marks & Floating Toolbar */
.reader-mark {
  text-decoration: underline dotted;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

#annotation-toolbar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(46rem, calc(100vw - 1.5rem));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-float);
  padding: 0.75rem 0.95rem;
}

#selected-quote {
  max-height: 3.4rem;
  overflow: auto;
  font-size: 0.88rem;
  color: var(--ink-secondary);
  white-space: pre-wrap;
  margin-bottom: 0.58rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.annotation-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.annotation-colors button { padding: 0.32rem 0.62rem; font-size: 0.81rem; }
.annotation-colors [data-color] {
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid #ffffff;
  outline: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--swatch);
  padding: 0;
}
.custom-color {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.83rem;
  color: var(--ink-secondary);
}
.custom-color input { width: 2rem; height: 1.85rem; padding: 0; border: 0; background: transparent; }

body:has(#annotation-toolbar:not([hidden])) { padding-bottom: 8.5rem; }

/* Site Footer (ICP Filing) */
.site-footer {
  margin-top: 2.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted);
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 700px) {
  .scale-guide { grid-template-columns: 1fr; }
  .progress-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  main {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 1.15rem 1rem 1.75rem;
  }
  .profile-grid { grid-template-columns: 1fr; }
  .passage { padding: 1rem 0.9rem 1.1rem; }
  .reading { padding: 1rem 0.95rem; }
  .question { padding: 0.85rem 0.8rem; }
  .responses { font-size: 0.83rem; gap: 0.45rem 0.65rem; padding: 0.5rem 0.6rem; }
  .responses label { gap: 0.3rem; }
  .responses select { min-width: 2.7rem; }
  .responses input { width: 4.3rem; }
}

@media print {
  body { background: #ffffff; }
  main { width: 100%; border: 0; box-shadow: none; margin: 0; }
  button, .progress-indicator, #annotation-toolbar { display: none !important; }
  .question { break-inside: avoid; }
}
