:where(.lab-main > :not(#quiz-comments)) {
  color-scheme: light;
  --navy-950: #0a1830;
  --navy-800: #18345c;
  --navy-700: #274b7d;
  --ink: #14223a;
  --muted: #617087;
  --line: #d9e1ec;
  --surface: #ffffff;
  --canvas: #f3f6fa;
  --accent: #c9472f;
  --accent-dark: #a82f1f;
  --correct: #157347;
  --correct-bg: #e7f6ef;
  --wrong: #a12e25;
  --wrong-bg: #fff0ee;
  --focus: #156fd1;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

:where(.lab-main > :not(#quiz-comments)), :where(.lab-main > :not(#quiz-comments)) * { box-sizing: border-box; }
:where(.lab-main > :not(#quiz-comments)) :is(button, input, textarea, select) { font: inherit; }
:where(.lab-main > :not(#quiz-comments)) a { color: inherit; }
:where(.lab-main > :not(#quiz-comments)) [hidden] { display: none !important; }

.site-header { background: var(--navy-950); color: white; border-bottom: 4px solid var(--accent); }
.header-inner { width: min(calc(100% - 2rem), 760px); min-height: 64px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: white; text-decoration: none; font-size: 1.1rem; font-weight: 800; letter-spacing: .03em; }
.brand-mark { display: grid; place-items: center; width: 2rem; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.55); font-family: Georgia, "Yu Mincho", serif; }
.header-link { color: white; font-size: .9rem; font-weight: 700; text-underline-offset: .25rem; }

.game-shell { width: min(calc(100% - 2rem), 760px); margin: clamp(1.5rem, 4vw, 3rem) auto; }
.quiz-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(1.25rem, 4vw, 2.5rem); box-shadow: 0 18px 50px rgba(21, 42, 75, .09); }
.quiz-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--accent) 0 28%, var(--navy-700) 28% 100%); }
.progress-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 1rem; margin-bottom: clamp(1.8rem, 5vw, 3rem); }
.eyebrow { margin: 0; color: var(--navy-700); font-weight: 800; letter-spacing: .08em; font-size: .92rem; }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: #e8edf4; }
.progress-track span { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.question-block { margin-bottom: 1.5rem; }
.status-chip { display: inline-flex; margin-bottom: .65rem; padding: .2rem .6rem; color: var(--navy-700); background: #eaf0f7; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.lab-main h1, .quiz-card h2 { margin: 0 0 .75rem; color: var(--navy-950); font-size: clamp(1.45rem, 4.5vw, 2.1rem); line-height: 1.45; letter-spacing: .01em; overflow-wrap: anywhere; }
.author { margin: 0; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.answer-list { display: grid; gap: .8rem; }
.answer-button { position: relative; width: 100%; min-height: 58px; padding: .85rem 1rem; color: var(--ink); background: white; border: 1.5px solid #cbd6e4; border-radius: 10px; text-align: left; font-weight: 700; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; overflow-wrap: anywhere; }
.answer-button:hover:not(:disabled) { border-color: var(--navy-700); background: #f7faff; transform: translateY(-1px); }
.answer-button:disabled { cursor: default; opacity: 1; padding-right: 8.2rem; }
.answer-button[data-result]::after { content: attr(data-result); position: absolute; top: 50%; right: .8rem; max-width: 7rem; transform: translateY(-50%); font-size: .75rem; line-height: 1.25; text-align: right; }
.answer-button.is-correct { border-color: var(--correct); color: #0f5a38; background: var(--correct-bg); }
.answer-button.is-wrong { border-color: var(--wrong); color: #7f241d; background: var(--wrong-bg); }
.feedback-panel { margin-top: 1.5rem; padding: 1rem 1.1rem; background: #f5f8fc; border-left: 4px solid var(--navy-700); border-radius: 0 8px 8px 0; }
.feedback-panel p { margin: .35rem 0; overflow-wrap: anywhere; }
.feedback-label { color: var(--navy-950); font-size: 1.2rem; font-weight: 900; }
.correct-answer { color: var(--navy-800); }
.notice { margin: 0 0 1rem; padding: 1rem; color: var(--navy-800); background: #e8eff8; border: 1px solid #ccd9e9; border-radius: 10px; overflow-wrap: anywhere; }
.notice.is-error, .inline-error { color: #84261f; background: var(--wrong-bg); border-color: #e5b5ae; }
.notice-action { margin-top: .75rem; }
.inline-error { margin: .75rem 0 0; padding: .65rem .75rem; border: 1px solid #e5b5ae; border-radius: 7px; font-size: .9rem; overflow-wrap: anywhere; }
.primary-button, .secondary-button, .choice-button, .danger-button, .text-button { min-height: 48px; padding: .65rem 1rem; border-radius: 8px; font-weight: 800; cursor: pointer; }
.primary-button { color: white; background: var(--navy-800); border: 1px solid var(--navy-800); }
.primary-button:hover:not(:disabled) { background: var(--navy-950); }
.secondary-button, .choice-button { color: var(--navy-800); background: white; border: 1.5px solid #b9c7d9; }
.secondary-button:hover:not(:disabled), .choice-button:hover:not(:disabled) { background: #edf3fa; border-color: var(--navy-700); }
.danger-button { color: #84261f; background: white; border: 1.5px solid #d99a92; }
.danger-button:hover:not(:disabled) { background: var(--wrong-bg); }
.text-button { min-height: 44px; color: var(--navy-700); background: transparent; border: 0; text-decoration: underline; text-underline-offset: .2rem; }
:where(.lab-main > :not(#quiz-comments)) button:disabled { cursor: not-allowed; opacity: .62; }
.button-link { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: .65rem 1rem; border-radius: 8px; color: white; background: var(--navy-800); text-decoration: none; font-weight: 800; }
.full-button { width: 100%; }

:where(.lab-main > :not(#quiz-comments)) :is(select, input, textarea) { width: 100%; color: var(--ink); background: white; border: 1.5px solid #b9c7d9; border-radius: 8px; padding: .7rem .75rem; }
:where(.lab-main > :not(#quiz-comments)) textarea { resize: vertical; min-height: 6rem; line-height: 1.65; }
.next-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.next-row p { margin: 0; color: var(--muted); font-size: .88rem; }
.game-shell > #question-request { margin-top: 1rem; }

.result-card { text-align: center; }
.score-line { display: flex; align-items: baseline; justify-content: center; gap: .35rem; margin: 2rem 0 0; }
.score-line strong { color: var(--accent-dark); font-family: Georgia, "Yu Mincho", serif; font-size: clamp(3.5rem, 13vw, 6rem); line-height: 1; }
.score-line span { color: var(--navy-800); font-size: 1.15rem; font-weight: 800; }
.accuracy { margin: .7rem 0 2rem; color: var(--muted); }
.accuracy strong { color: var(--navy-950); font-size: 1.25rem; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.form-shell { max-width: 760px; }
.lead { margin: -.25rem 0 1.8rem; color: var(--muted); }
.form-field { margin-bottom: 1.25rem; }
.form-field label { display: block; margin-bottom: .4rem; color: var(--navy-950); font-weight: 800; }
.optional { color: var(--muted); font-size: .82rem; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.answer-correct-field { padding: 1rem; background: var(--correct-bg); border: 1px solid #b8decf; border-radius: 10px; }
.field-error { min-height: 1.25em; margin: .3rem 0 0; color: var(--wrong); font-size: .82rem; }
.preview-list { margin: 1.5rem 0; }
.preview-list > div { padding: 1rem 0; border-top: 1px solid var(--line); }
.preview-list > div:last-child { border-bottom: 1px solid var(--line); }
.preview-list dt { margin-bottom: .25rem; color: var(--muted); font-size: .82rem; font-weight: 800; }
.preview-list dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-list ol { margin: 0; padding-left: 1.4rem; }
.preview-list li:first-child { color: var(--correct); font-weight: 800; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: .8rem; }
.success-card { text-align: center; }
.success-icon { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem; border-radius: 50%; color: white; background: var(--correct); font-size: 1.6rem; font-weight: 900; }
.success-card .button-link { margin-top: 1.2rem; }

.header-context { font-size: .9rem; font-weight: 800; }
.admin-shell { width: min(calc(100% - 2rem), 1100px); margin: clamp(1.5rem, 4vw, 3rem) auto; }
.admin-login { width: min(100%, 520px); margin-inline: auto; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.admin-heading h1 { margin-bottom: 0; }
.admin-toolbar { display: grid; grid-template-columns: auto minmax(220px, 360px); align-items: center; gap: .75rem; margin-bottom: 1rem; padding: 1rem; background: white; border: 1px solid var(--line); border-radius: 10px; }
.admin-toolbar label { font-weight: 800; }
.admin-list { display: grid; gap: 1rem; }
.admin-card { padding: 1.2rem; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(21,42,75,.05); }
.admin-card-top { display: flex; justify-content: space-between; gap: 1rem; }
.admin-card h2, .admin-card h3 { margin: .45rem 0 0; color: var(--navy-950); font-size: 1.1rem; overflow-wrap: anywhere; }
.question-id, .admin-meta { color: var(--muted); font-size: .82rem; }
.admin-meta { overflow-wrap: anywhere; }
.status-label { display: inline-flex; padding: .18rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 900; }
.status-pending { color: #6c4600; background: #fff2c9; }
.status-approved { color: #0f5a38; background: var(--correct-bg); }
.status-suspended { color: #84261f; background: var(--wrong-bg); }
.status-rejected { color: #4e5663; background: #e8ebef; }
.admin-card details { margin-top: .8rem; border-top: 1px solid var(--line); }
.admin-card summary { padding: .8rem 0; color: var(--navy-700); font-weight: 800; cursor: pointer; }
.admin-details { padding: .2rem 0 .8rem; }
.admin-details p { margin: .35rem 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.admin-actions { display: grid; grid-template-columns: minmax(150px, 1fr) auto auto minmax(130px, 1fr); align-items: center; gap: .6rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.admin-action-feedback { color: var(--muted); font-size: .82rem; }
:where(.lab-main > :not(#quiz-comments)) :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

@media (max-width: 520px) {
  .header-inner, .game-shell { width: min(calc(100% - 2rem), 760px); }
  .header-inner { flex-wrap: wrap; justify-content: flex-start; gap: .25rem 1rem; padding-block: .5rem; }
  .header-link { display: inline-flex; min-height: 44px; align-items: center; }
  .game-shell { margin-top: 1rem; }
  .quiz-card { border-radius: 13px; padding: 1.15rem; }
  .progress-row { grid-template-columns: 1fr; gap: .55rem; margin-bottom: 1.6rem; }
  .answer-button { min-height: 60px; }
  .answer-button:disabled { padding-right: 6.6rem; }
  .answer-button[data-result]::after { max-width: 5.8rem; }
  .result-actions, .confirm-actions, .form-grid { grid-template-columns: 1fr; }
  .bad-reason { grid-template-columns: 1fr; }
  .next-row { align-items: stretch; flex-direction: column; }
  .next-row .primary-button { width: 100%; }
  .admin-shell { width: min(calc(100% - 1rem), 1100px); margin-top: 1rem; }
  .admin-heading { align-items: flex-start; }
  .admin-toolbar { grid-template-columns: 1fr; }
  .admin-card { padding: 1rem; }
  .admin-card-top { align-items: flex-start; }
  .admin-actions { grid-template-columns: 1fr 1fr; }
  .admin-actions select, .admin-action-feedback { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  :where(.lab-main > :not(#quiz-comments)) *, :where(.lab-main > :not(#quiz-comments)) *::before, :where(.lab-main > :not(#quiz-comments)) *::after { scroll-behavior: auto !important; transition: none !important; }
}
