:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee9;
  --surface: #ffffff;
  --surface-muted: #f6f8fb;
  --accent: #275dad;
  --accent-dark: #1e4784;
  --accent-soft: #eaf1fd;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #eef2f7;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.7;
}

button, input { font: inherit; }
button { cursor: pointer; }

.page-shell { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 28px; }
.site-header { margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1.3; }
h2 { margin: 0 0 18px; font-size: clamp(1.1rem, 2vw, 1.35rem); line-height: 1.55; }

.card { padding: clamp(22px, 4vw, 42px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 30px rgba(22, 35, 58, .06); }
.view.hidden { display: none; }
.plain-list { padding-left: 1.35rem; color: #344054; }
.plain-list li + li { margin-top: 7px; }
.consent-row { display: flex; gap: 10px; align-items: flex-start; margin: 28px 0 22px; font-weight: 700; }
.consent-row input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--accent); }
.primary-button { width: 100%; min-height: 50px; padding: 10px 18px; color: white; background: var(--accent); border: 0; border-radius: 9px; font-weight: 700; }
.primary-button:hover:not(:disabled) { background: var(--accent-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }
.small-note, .question-meta, .feedback { color: var(--muted); font-size: .88rem; }
.small-note { margin: 14px 0 0; }
.info-block { margin-top: 18px; padding: 16px 18px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 10px; }
.info-block h3 { margin: 0 0 6px; font-size: 1rem; }
.info-block .plain-list { margin: 0; }

.status-region { min-height: 0; margin-bottom: 16px; }
.status-message { padding: 12px 16px; color: var(--danger); background: #fff4f2; border: 1px solid #f4c7c2; border-radius: 9px; }
.question-error { margin: 14px 0 0; }
.question-error:empty { display: none; }
.section-heading, .progress-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; font-size: .82rem; font-weight: 700; }
.practice-view .badge { min-height: 36px; padding: 4px 16px; font-size: 1.15rem; }
.progress-track { height: 7px; margin: 12px 0 28px; overflow: hidden; background: #e8ecf2; border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; transition: width .2s ease; }
.question-meta { margin: 0 0 10px; }
.image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 3vw, 30px); margin: 22px 0 28px; }
figure { margin: 0; }
.stimulus-card, .practice-grid figure { overflow: hidden; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 10px; }
.stimulus-card img, .practice-grid img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #edf0f4; }
.stimulus-card figcaption { padding: 7px; text-align: center; font-weight: 700; }
fieldset { padding: 0; border: 0; }
legend { margin-bottom: 10px; font-weight: 700; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.choice { display: flex; min-height: 52px; align-items: center; justify-content: center; padding: 8px 10px; color: #344054; background: #fff; border: 2px solid var(--line); border-radius: 9px; text-align: center; font-weight: 700; cursor: pointer; }
.choice:has(input:checked) { color: var(--accent-dark); background: var(--accent-soft); border-color: var(--accent); }
.choice:focus-visible { outline: 3px solid rgba(39, 93, 173, .35); outline-offset: 2px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
#next-button { margin-top: 22px; }
.practice-choices button { min-height: 48px; padding: 8px; color: #344054; background: #fff; border: 2px solid var(--line); border-radius: 9px; font-weight: 700; }
.practice-choices button:hover { color: var(--accent-dark); border-color: var(--accent); }
.practice-choices button.is-selected { color: var(--accent-dark); background: var(--accent-soft); border-color: var(--accent); }
.practice-choices button:focus-visible { outline: 3px solid rgba(39, 93, 173, .35); outline-offset: 2px; }
.feedback { min-height: 24px; margin-bottom: 0; }
.keyboard-note { margin: 14px 0 0; color: var(--muted); font-size: .86rem; text-align: center; }
.complete-mark { display: grid; width: 58px; height: 58px; place-items: center; margin-bottom: 16px; color: white; background: #16845b; border-radius: 50%; font-size: 2rem; }
.admin-shell { width: min(1420px, calc(100% - 32px)); }
.admin-shell .card { margin-bottom: 20px; }
.admin-auth-form { display: grid; gap: 10px; max-width: 540px; }
.admin-auth-form label { font-weight: 700; }
.admin-auth-form input { min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.admin-message { min-height: 24px; margin: 12px 0 0; color: var(--muted); }
.admin-message.is-error { color: var(--danger); }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-toolbar .small-note { margin: 0; }
.admin-toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.secondary-button { min-height: 40px; padding: 7px 13px; color: var(--accent-dark); background: var(--surface); border: 1px solid var(--accent); border-radius: 8px; font-weight: 700; }
.secondary-button:hover { background: var(--accent-soft); }
.summary-grid, .metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.summary-card, .metric-card { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.summary-label, .metric-card span { display: block; color: var(--muted); font-size: .88rem; }
.summary-value { display: block; margin-top: 4px; color: var(--accent-dark); font-size: 1.65rem; line-height: 1.2; }
.admin-card { overflow: hidden; }
.admin-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.admin-section-heading h2 { margin-bottom: 4px; }
.admin-section-heading .small-note { margin: 0; }
.admin-total { margin: 0; color: var(--accent-dark); font-weight: 700; white-space: nowrap; }
.matrix-container { display: flex; justify-content: center; margin: 20px 0 26px; overflow-x: auto; }
.matrix-table { min-width: 430px; border-collapse: collapse; border: 1px solid #cbd5e1; }
.matrix-table th, .matrix-table td { width: 84px; height: 68px; border: 1px solid #cbd5e1; text-align: center; }
.matrix-table .matrix-axis { color: #fff; background: #245987; font-weight: 700; }
.matrix-table tr:first-child .matrix-axis:first-child { color: var(--ink); background: #f1f5f9; }
.matrix-value { background: #f8fafc; }
.matrix-hh { background: #e8f8ef; color: #08743d; }
.matrix-hl, .matrix-lh { background: #fff8e8; color: #9a4d00; }
.matrix-ll { background: #fff0f0; color: #a6192e; }
.matrix-code, .matrix-count { display: block; }
.matrix-code { font-size: 1.15rem; font-weight: 800; line-height: 1.2; }
.matrix-count { margin-top: 3px; color: #475467; font-size: .9rem; }
.metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; }
.view-metric-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); max-width: 520px; margin-bottom: 0; }
.metric-card strong { display: block; margin-top: 4px; color: var(--accent-dark); font-size: 1.25rem; }
.metric-value-cell { min-width: 82px; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
.session-table { width: 100%; min-width: 1900px; border-collapse: collapse; font-size: .82rem; }
.session-table th, .session-table td { padding: 8px 7px; border: 1px solid var(--line); text-align: center; white-space: nowrap; }
.session-table thead th { color: #fff; background: #245987; }
.session-table thead .code-header { color: var(--ink); background: #f1f5f9; font-size: .78rem; }
.session-table tbody tr:nth-child(even) { background: #fafbfc; }
.session-table .session-id-cell { max-width: 200px; overflow: hidden; text-align: left; text-overflow: ellipsis; }
.session-table .count-cell { min-width: 38px; font-variant-numeric: tabular-nums; }
.status-completed { color: #08743d; font-weight: 700; }
.status-in-progress { color: #9a4d00; font-weight: 700; }
.empty-message { color: var(--muted); text-align: center; }
@media (max-width: 680px) {
  .page-shell { width: min(100% - 20px, 560px); padding-top: 24px; }
  .image-grid { gap: 8px; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { width: min(100% - 20px, 560px); }
  .admin-toolbar, .admin-section-heading { align-items: stretch; flex-direction: column; }
  .admin-toolbar-actions { justify-content: flex-start; }
  .summary-grid, .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-metric-grid { max-width: none; }
  .metric-grid .metric-card:last-child { grid-column: 1 / -1; }
}
