:root {
  color-scheme: light;
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color: #25291f;
  background: #e7e2d5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #e7e2d5; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(55, 103, 66, .35);
  outline-offset: 2px;
}

.lab-shell { min-height: 100vh; display: grid; grid-template-columns: 330px minmax(0, 1fr); }
.control-panel {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 27px 24px 36px;
  overflow-y: auto;
  background: #f8f5ec;
  border-right: 1px solid #d4cebe;
  box-shadow: 8px 0 30px rgba(55, 47, 29, .07);
}
.lab-brand > a { color: #65705f; text-decoration: none; font-size: 12px; font-weight: 700; }
.eyebrow { margin: 20px 0 5px; color: #8e5e38; font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.lab-brand h1 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 28px; letter-spacing: -.04em; }
.lab-brand > p:last-child { margin: 10px 0 0; color: #6e7068; font-size: 12px; line-height: 1.65; }

.control-section { margin-top: 27px; padding-top: 23px; border-top: 1px solid #ded8c9; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.section-heading h2 { margin: 0; font-size: 12px; letter-spacing: -.01em; }
.section-heading span { color: #8a8c84; font-size: 10px; }
.section-heading button { padding: 0; border: 0; background: none; color: #6d745f; font-size: 10px; text-decoration: underline; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.type-button {
  min-height: 55px;
  padding: 9px 10px;
  text-align: left;
  border: 1px solid #ddd7c8;
  border-radius: 10px;
  background: #fffdf8;
  color: #464a42;
  transition: .15s ease;
}
.type-button:hover { border-color: #9fac92; transform: translateY(-1px); }
.type-button small { display: block; margin-bottom: 3px; color: #99998e; font-size: 8px; letter-spacing: .08em; }
.type-button b { font-size: 11px; }
.type-button.is-active { border-color: #496b4e; background: #496b4e; color: white; box-shadow: 0 5px 12px rgba(45, 84, 52, .18); }
.type-button.is-active small { color: #d8e2d5; }
.selection-help { min-height: 35px; margin: 9px 2px 0; color: #787a73; font-size: 10px; line-height: 1.55; }

.sample-list { display: grid; gap: 6px; }
.sample-item { display: grid; grid-template-columns: 1fr auto; align-items: stretch; border: 1px solid #ded8ca; border-radius: 10px; background: #fffdf8; overflow: hidden; }
.sample-item.is-active { border-color: #9c7450; box-shadow: inset 3px 0 #9c7450; }
.sample-select { min-width: 0; display: flex; gap: 8px; align-items: center; padding: 9px; border: 0; background: transparent; text-align: left; color: #4d504a; }
.sample-select > small { color: #aaa69c; font-size: 8px; font-weight: 800; }
.sample-select > span { min-width: 0; display: grid; gap: 2px; }
.sample-select b, .sample-select em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-select b { font-size: 10px; }
.sample-select em { color: #888a83; font-size: 9px; font-style: normal; }
.sample-edit { padding: 0 9px; border: 0; border-left: 1px solid #ebe6da; background: transparent; color: #777d6d; font-size: 9px; }
.sample-edit:hover { background: #f0ede3; }

.select-label { display: block; margin-bottom: 5px; color: #777b72; font-size: 9px; font-weight: 700; }
#viewport-select { width: 100%; padding: 9px 30px 9px 10px; border: 1px solid #d6d1c4; border-radius: 9px; background: #fffdf8; color: #444840; font-size: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 12px; }
.switch-row > span { display: grid; gap: 2px; }
.switch-row b { font-size: 10px; }
.switch-row small { color: #8c8d86; font-size: 9px; }
.switch-row input { width: 33px; height: 18px; accent-color: #496b4e; }
.button { border: 0; border-radius: 10px; font-weight: 800; }
.button--reset { width: 100%; margin-top: 22px; padding: 12px; border: 1px solid #c6c1b4; background: transparent; color: #4d5448; font-size: 11px; }
.storage-note { margin: 12px 5px 0; color: #8a8b85; font-size: 9px; line-height: 1.6; }
.storage-note b { color: #8a5e3d; }

.preview-workspace { min-width: 0; min-height: 100vh; display: grid; grid-template-rows: 56px minmax(0, 1fr); background: #e7e2d5; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid #d0cabb; background: rgba(244, 240, 230, .78); backdrop-filter: blur(8px); }
.preview-toolbar > div { display: flex; gap: 8px; align-items: baseline; }
.preview-toolbar span { font-size: 11px; font-weight: 800; }
.preview-toolbar small { color: #7b7d75; font-size: 9px; }
.device-stage { min-width: 0; display: grid; place-items: center; padding: 48px; overflow: auto; background-image: radial-gradient(rgba(73, 80, 64, .12) 1px, transparent 1px); background-size: 18px 18px; }
.device { position: relative; flex: 0 0 auto; width: var(--device-width); height: var(--device-height); max-width: none; border-radius: 3px; background: #141712; box-shadow: 0 24px 60px rgba(51, 43, 27, .18); transition: width .2s ease, height .2s ease; container-type: size; }
.device--framed { padding: 11px; border-radius: 26px; box-shadow: 0 30px 70px rgba(41, 35, 22, .24), inset 0 0 0 1px #34372e; }
.device__camera { display: none; }
.device--framed .device__camera { position: absolute; z-index: 2; top: 5px; left: 50%; display: block; width: 36px; height: 3px; transform: translateX(-50%); border-radius: 5px; background: #55594c; }
.preview-screen { width: 100%; height: 100%; overflow: hidden; border-radius: inherit; background: #f6f2e9; }
.device--framed .preview-screen { border-radius: 17px; }

.question-card { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; color: #263026; background: #f6f2e9; }
.question-card__header { min-height: 58px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 28px; border-bottom: 1px solid #e0dacb; background: #fbf9f3; }
.question-card__header a { color: #3d6644; text-decoration: none; font-family: Georgia, "Noto Serif KR", serif; font-size: 15px; font-weight: 800; }
.question-card__header span { color: #6f746c; font-size: 11px; font-weight: 700; }
.question-card__header button { justify-self: end; width: 30px; height: 30px; border: 1px solid #d8d4c9; border-radius: 50%; background: white; color: #5c6657; }
.question-card__body { min-height: 0; display: flex; flex-direction: column; gap: 18px; padding: 32px clamp(26px, 6cqw, 62px) 24px; overflow: auto; }
.question-heading { text-align: center; }
.question-heading p { margin: 0 0 5px; color: #9b704c; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.question-heading h1 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(18px, 3.1cqw, 25px); letter-spacing: -.035em; }
.question-heading small { display: block; margin-top: 7px; color: #92948c; font-size: 9px; }
.question-content { display: flex; flex: 1 0 auto; flex-direction: column; justify-content: center; gap: 17px; min-height: 0; }
.scripture-text, .reference-prompt, .blank-prompt { margin: 0; text-align: center; }
.scripture-text { padding: 12px 4px; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(15px, 2.6cqw, 21px); line-height: 1.75; word-break: keep-all; }
.reference-prompt { color: #365b3d; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(27px, 5cqw, 40px); font-weight: 800; }
.reference-prompt--small { font-size: clamp(20px, 3.5cqw, 29px); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.choice { min-width: 0; min-height: 54px; display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 5px; padding: 9px 12px 9px 8px; border: 1px solid #d8d4c8; border-radius: 12px; background: #fff; color: #3a4037; text-align: left; line-height: 1.45; }
.choice:hover:not(:disabled) { border-color: #7f9b80; background: #f7faf5; }
.choice:disabled { cursor: default; opacity: .65; }
.choice.is-selected { border-color: #9c7758; box-shadow: inset 0 0 0 1px #9c7758; }
.choice.is-correct { border-color: #4f7957; background: #eaf3e8; opacity: 1; }
.choice__number { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; background: #f0ede5; color: #73766d; font-size: 9px; font-weight: 900; }
.choices--passage .choice { min-height: 72px; font-size: clamp(10px, 1.6cqw, 13px); }

.ox-statement { padding: 20px; border: 1px solid #d9d4c7; border-radius: 16px; background: white; text-align: center; }
.ox-statement b { color: #3f6947; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(20px, 3.5cqw, 28px); }
.ox-statement p { margin: 14px 0 0; font-size: clamp(13px, 2.1cqw, 17px); line-height: 1.75; word-break: keep-all; }
.ox-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.ox-button { position: relative; min-height: 88px; display: grid; place-items: center; align-content: center; gap: 0; border: 1px solid #d7d4ca; border-radius: 16px; background: white; }
.ox-button kbd { position: absolute; top: 8px; left: 9px; color: #aaa99f; font-size: 8px; }
.ox-button b { font-family: Georgia, serif; font-size: 32px; }
.ox-button span { color: #777b72; font-size: 9px; }
.ox-button--yes b { color: #4f7657; }
.ox-button--no b { color: #a05d50; }

.chunk-target { min-height: 84px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 6px; padding: 12px; border: 1px dashed #aeb6a8; border-radius: 13px; background: #eef1e9; }
.chunk-target > span { color: #858b80; font-size: 10px; }
.chunk-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.chunk { position: relative; padding: 9px 11px 9px 26px; border: 1px solid #d4d0c4; border-radius: 9px; background: white; color: #3f443d; font-size: 11px; line-height: 1.4; }
.chunk small { position: absolute; top: 7px; left: 8px; color: #999b93; font-size: 8px; }
.chunk--selected { border-color: #7d987d; background: #fff; }
.submit-answer { min-height: 40px; padding: 9px 17px; border: 0; border-radius: 10px; background: #496b4e; color: white; font-size: 11px; font-weight: 800; }
.submit-answer:disabled { cursor: default; opacity: .4; }

.blank-prompt { padding: 18px; border-radius: 13px; background: #fff; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(14px, 2.2cqw, 18px); line-height: 1.8; }
.answer-form { display: grid; gap: 8px; }
.answer-form label { color: #73776e; font-size: 10px; }
.answer-form input, .answer-form textarea { width: 100%; border: 1px solid #cbc8bd; border-radius: 11px; background: white; color: #2e352d; }
.answer-form input { height: 45px; padding: 0 13px; }
.answer-form textarea { min-height: 120px; padding: 13px; resize: vertical; line-height: 1.65; }
.answer-form--recall { flex: 1; }
.answer-form--recall textarea { flex: 1; }
.initial-hint { padding: 13px 17px; border-radius: 12px; background: #e9eee5; }
.initial-hint span { color: #727b6d; font-size: 9px; font-weight: 800; }
.initial-hint p { margin: 6px 0 0; color: #53624f; font-family: Georgia, "Noto Serif KR", serif; line-height: 1.75; word-break: keep-all; }
.form-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.form-submit-row small { color: #96978f; font-size: 8px; }
kbd { padding: 1px 4px; border: 1px solid #d6d2c8; border-radius: 4px; background: #faf8f2; font: inherit; }

.feedback { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; }
.feedback > div { display: flex; justify-content: space-between; align-items: center; }
.feedback b { font-size: 12px; }
.feedback strong { font-size: 11px; }
.feedback small { font-size: 9px; }
.feedback p { margin: 2px 0; font-size: 10px; line-height: 1.55; }
.feedback p span { display: block; opacity: .7; font-size: 8px; font-weight: 800; }
.feedback--correct { background: #dfeede; color: #355c3b; }
.feedback--wrong { background: #f2dfd9; color: #7c483e; }
.mini-button { justify-self: end; padding: 5px 8px; border: 1px solid currentColor; border-radius: 7px; background: transparent; color: inherit; font-size: 8px; font-weight: 800; }
.question-card__footer { min-height: 35px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-top: 1px solid #e3ded3; color: #999b94; font-size: 8px; }
.question-card__footer b { color: #9b704c; letter-spacing: .12em; }

.sample-editor { width: min(620px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 18px; color: #30362e; background: #fbf9f3; box-shadow: 0 30px 80px rgba(36, 31, 20, .28); }
.sample-editor::backdrop { background: rgba(40, 38, 31, .52); backdrop-filter: blur(3px); }
.sample-editor form { display: grid; gap: 15px; padding: 25px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-heading .eyebrow { margin: 0 0 5px; }
.dialog-heading h2 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 23px; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #ece9df; color: #64685f; font-size: 20px; }
.sample-editor label { display: grid; gap: 6px; }
.sample-editor label span { color: #6c7168; font-size: 10px; font-weight: 800; }
.sample-editor input, .sample-editor textarea { width: 100%; padding: 10px 11px; border: 1px solid #d4d0c5; border-radius: 9px; background: white; color: #2e342d; }
.sample-editor textarea { resize: vertical; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-error { min-height: 16px; margin: 0; color: #a5493c; font-size: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .button { padding: 10px 15px; }
.button--quiet { border: 1px solid #d0ccc1; background: transparent; color: #686c64; }
.button--primary { background: #496b4e; color: white; }

@container (max-width: 450px) {
  .question-card__header { min-height: 47px; padding: 0 17px; }
  .question-card__header a { font-size: 12px; }
  .question-card__header span { font-size: 9px; }
  .question-card__header button { width: 26px; height: 26px; }
  .question-card__body { gap: 12px; padding: 19px 17px 15px; }
  .question-heading p { font-size: 8px; }
  .question-heading small { margin-top: 4px; font-size: 7px; }
  .question-content { gap: 11px; justify-content: flex-start; }
  .scripture-text { padding: 6px 0; font-size: 13px; line-height: 1.6; }
  .reference-prompt { font-size: 26px; }
  .reference-prompt--small { font-size: 19px; }
  .choices { grid-template-columns: 1fr; gap: 6px; }
  .choice { min-height: 42px; padding: 6px 8px; font-size: 10px; }
  .choices--passage .choice { min-height: 51px; font-size: 9px; line-height: 1.35; }
  .ox-statement { padding: 13px; }
  .ox-statement b { font-size: 19px; }
  .ox-statement p { margin-top: 8px; font-size: 11px; line-height: 1.55; }
  .ox-button { min-height: 69px; }
  .ox-button b { font-size: 25px; }
  .chunk-target { min-height: 61px; padding: 8px; }
  .chunk { padding: 7px 8px 7px 22px; font-size: 9px; }
  .blank-prompt { padding: 11px; font-size: 11px; line-height: 1.55; }
  .answer-form textarea { min-height: 106px; }
  .initial-hint { padding: 9px 11px; font-size: 10px; }
  .feedback { padding: 9px 10px; }
  .question-card__footer { min-height: 29px; padding: 0 17px; }
}

@media (max-width: 920px) {
  .lab-shell { display: block; }
  .control-panel { min-height: auto; padding: 22px; border-right: 0; border-bottom: 1px solid #d4cebe; }
  .lab-brand > p:last-child { max-width: 560px; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
  .lab-brand, .control-section:first-of-type, .button--reset, .storage-note { grid-column: 1 / -1; }
  .control-section { margin-top: 20px; padding-top: 18px; }
  .preview-workspace { min-height: 800px; }
  .device-stage { place-items: start center; padding: 35px 20px; }
}

@media (max-width: 620px) {
  .control-panel { display: block; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .preview-toolbar { padding: 0 14px; }
  .preview-toolbar > div { display: grid; gap: 1px; }
  .preview-workspace { min-height: 700px; }
  .device-stage { justify-content: start; padding: 25px 14px; }
  .form-row { grid-template-columns: 1fr; }
}

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