:root {
  color-scheme: dark;
  --bg: #091012;
  --panel: #111a1d;
  --panel-2: #172326;
  --line: #2b3c42;
  --text: #eef7f2;
  --muted: #9fb0aa;
  --mint: #42d7a3;
  --amber: #f3b44b;
  --rose: #e86f83;
  --blue: #75b8ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 16% 8%, rgba(66, 215, 163, 0.18), transparent 30%),
    linear-gradient(150deg, #091012 0%, #101417 56%, #141312 100%);
  color: var(--text);
  font-family: Consolas, "Noto Sans KR", Arial, sans-serif;
}

button,
a,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.quizShell {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.appBrand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.appIcon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(66, 215, 163, 0.62);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(66, 215, 163, 0.26), rgba(117, 184, 255, 0.16)),
    #0d171a;
  color: var(--mint);
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.appTagline {
  margin-top: 8px;
  color: #c9d8d2;
  font-size: 14px;
  line-height: 1.45;
}

.identityStatement {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.identityTags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.identityTags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(66, 215, 163, 0.36);
  border-radius: 6px;
  background: rgba(66, 215, 163, 0.1);
  padding: 0 9px;
  color: #c9fff0;
  font-size: 12px;
  font-weight: 900;
}

.appStatus {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.appStatus span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(117, 184, 255, 0.32);
  border-radius: 999px;
  background: rgba(117, 184, 255, 0.08);
  padding: 0 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.appStatus button {
  min-width: 70px;
  border-color: rgba(66, 215, 163, 0.48);
  background: rgba(66, 215, 163, 0.14);
  color: var(--mint);
  font-size: 13px;
  font-weight: 800;
}

#refreshAppButton {
  border-color: rgba(117, 184, 255, 0.45);
  background: rgba(117, 184, 255, 0.12);
  color: #cfe6ff;
}

.appStatus button:disabled {
  opacity: 0.64;
  cursor: wait;
}

.languageSwitch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(117, 184, 255, 0.24);
  border-radius: 6px;
  background: rgba(8, 14, 17, 0.48);
}

.languageSwitch button {
  min-width: 64px;
  min-height: 28px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.languageSwitch button.active {
  border-color: rgba(66, 215, 163, 0.54);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 6vw, 58px);
  line-height: 1;
}

nav {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

nav a,
button {
  min-height: 38px;
  border: 1px solid #38505a;
  border-radius: 6px;
  background: #162226;
  color: var(--text);
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 0 12px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 700;
}

.statusPanel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.statusPanel div,
.notePanel,
.noteEditor,
.quizCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 26, 29, 0.88);
}

.statusPanel div {
  min-height: 76px;
  min-width: 0;
  padding: 13px 14px;
}

.statusPanel span,
.questionMeta {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.statusPanel strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
  line-height: 1.28;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.quizShell[data-room="card"] #categoryLabel,
.quizShell[data-room="choice"] #categoryLabel {
  font-size: 16px;
  line-height: 1.32;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.modeBar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 14px;
}

.appFooter {
  margin-top: 22px;
  padding: 16px 2px 4px;
  border-top: 1px solid rgba(143, 174, 181, 0.18);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.appFooter p {
  margin: 2px 0;
}

.homePanel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.homeIntro,
.homeSelector,
.roomHeader {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 26, 29, 0.88);
}

.homeIntro {
  padding: 18px;
}

.homeIntro p {
  margin-bottom: 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
}

.homeIntro h2 {
  font-size: clamp(24px, 4vw, 38px);
}

.homeSelector {
  display: grid;
  gap: 12px;
  padding: 15px;
}

.homeSelector strong {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.homeSectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.homeSectionHead button {
  flex: 0 0 auto;
  min-height: 28px;
  min-width: 58px;
  padding: 0 10px;
  border-color: rgba(117, 184, 255, 0.34);
  background: rgba(117, 184, 255, 0.08);
  color: #cfe6ff;
  font-size: 12px;
  font-weight: 800;
}

.homeSectionHead button[hidden] {
  display: none;
}

.homeGroupBar,
.homeCategoryBar,
.homeChapterBar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.homeChapterBar .chapterButton {
  border-color: rgba(243, 180, 75, 0.38);
  background: rgba(243, 180, 75, 0.07);
  color: #ffd88c;
}

.homeChapterBar .chapterButton.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.18);
  color: var(--mint);
}

.homeActionCenter {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(243, 180, 75, 0.38);
  border-radius: 8px;
  background: rgba(243, 180, 75, 0.06);
  padding: 12px;
}

.homeActionHead strong {
  margin-bottom: 4px;
  color: #ffd88c;
}

.homeActionHead span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.bookPrintCenter,
.bookDataCenter {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(117, 184, 255, 0.34);
  border-radius: 8px;
  background: rgba(117, 184, 255, 0.07);
  padding: 12px;
}

.bookDataCenter {
  border-color: rgba(243, 180, 75, 0.38);
  background: rgba(243, 180, 75, 0.07);
}

.bookPrintCenter span,
.bookDataCenter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.bookPrintControls,
.bookDataControls {
  display: grid;
  gap: 8px;
}

.bookPrintControls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bookDataControls {
  grid-template-columns: 1fr;
}

.bookDataRow {
  display: grid;
  grid-template-columns: minmax(92px, 0.5fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
}

.bookDataRow label {
  color: #ffd88c;
  font-size: 12px;
  font-weight: 800;
}

.bookDataRow.importOnly {
  grid-template-columns: minmax(92px, 0.5fr) minmax(180px, 1fr) minmax(180px, 1fr);
}

.bookDataRow.importOnly span {
  grid-column: 1 / 3;
  color: var(--muted);
}

.bookPrintControls button,
.bookDataControls button {
  min-height: 40px;
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
  font-weight: 800;
}

.bookDataCenter .formMessage {
  margin: 0;
}

.materialTool {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(117, 184, 255, 0.34);
  border-radius: 8px;
  background: rgba(117, 184, 255, 0.07);
  padding: 16px;
}

.materialTool .formTitle strong {
  color: #8fc7ff;
}

.materialToolActions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.materialToolActions button {
  min-height: 40px;
}

.materialTool textarea {
  min-height: 170px;
}

.editorScopeField {
  display: none !important;
}

.materialHint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.bookPrintOutput {
  display: none;
}

.homeAddActions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.homeAddActions button {
  min-height: 42px;
  border-style: dashed;
  border-color: rgba(243, 180, 75, 0.45);
  background: rgba(243, 180, 75, 0.08);
  color: #ffd88c;
  font-size: 13px;
  font-weight: 800;
}

.homeAddActions button:last-child {
  border-color: rgba(159, 176, 170, 0.35);
  background: rgba(17, 26, 29, 0.72);
  color: var(--muted);
}

.homeManagePanel {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(232, 111, 131, 0.36);
  border-radius: 8px;
  background: rgba(232, 111, 131, 0.07);
  padding: 12px;
}

.homeManagePanel[hidden] {
  display: none;
}

.homeManagePanel strong {
  margin: 0;
  color: #ffb4c0;
}

.homeManagePanel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.homeManagePanel div,
.homeRenameActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.homeRenameActions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.homeManagePanel button {
  border-color: rgba(232, 111, 131, 0.48);
  background: rgba(232, 111, 131, 0.1);
  color: #ffb4c0;
  font-weight: 800;
}

.roomCards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.roomCard {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  padding: 16px;
  text-align: left;
}

.roomCard span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.roomCard strong {
  font-size: 19px;
}

.roomCard small {
  color: var(--muted);
  line-height: 1.45;
}

.roomCard.note {
  border-color: rgba(243, 180, 75, 0.52);
  background: rgba(243, 180, 75, 0.1);
}

.roomCard.card {
  border-color: rgba(66, 215, 163, 0.5);
  background: rgba(66, 215, 163, 0.1);
}

.roomCard.choice {
  border-color: rgba(232, 111, 131, 0.5);
  background: rgba(232, 111, 131, 0.1);
}

.roomHeader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
}

.roomHeaderMain {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.roomHeaderText {
  min-width: 0;
}

.roomHeader[hidden],
.homePanel[hidden],
.modeBar[hidden] {
  display: none;
}

.roomHeader button {
  flex: 0 0 auto;
  min-height: 34px;
  color: var(--muted);
}

.roomHeader span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.roomHeader strong {
  color: var(--mint);
  font-size: 20px;
}

.roomSwitchNav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-self: start;
}

.roomSwitchButton {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(159, 176, 170, 0.28);
  background: rgba(17, 26, 29, 0.8);
  color: var(--muted);
  font-weight: 800;
}

.roomSwitchButton.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.18);
  color: var(--mint);
}

.chapterNav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chapterNav[hidden] {
  display: none;
}

.chapterButton {
  min-height: 32px;
  padding: 0 11px;
  border-color: rgba(159, 176, 170, 0.28);
  background: rgba(17, 26, 29, 0.72);
  color: rgba(159, 176, 170, 0.72);
  font-size: 13px;
  font-weight: 800;
  opacity: 0.72;
}

.chapterButton.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
  opacity: 1;
}

.modeButton {
  min-height: 46px;
  font-size: 16px;
  font-weight: 900;
}

.modeButton.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.18);
  color: var(--mint);
}

.panelView {
  display: none;
}

.panelView.active {
  display: block;
}

.quizShell[data-screen="room"] .selectorPanel {
  display: none;
}

.quizShell[data-room="note"] .statusPanel,
.quizShell[data-room="note"] .typeBar,
.quizShell[data-room="note"] .reviewBar,
.quizShell[data-room="note"] .quizCard {
  display: none;
}

.quizShell[data-room="card"] .notePanel,
.quizShell[data-room="choice"] .notePanel,
.quizShell[data-room="card"] .typeBar,
.quizShell[data-room="choice"] .typeBar {
  display: none;
}

.quizShell[data-room="note"] .editorHead,
.quizShell[data-room="note"] .categoryManager,
.quizShell[data-room="note"] .entryGrid,
.quizShell[data-room="card"] .noteEditor,
.quizShell[data-room="card"] .choiceForm,
.quizShell[data-room="choice"] .noteEditor,
.quizShell[data-room="choice"] .cardForm {
  display: none;
}

.quizShell[data-room="card"] .entryGrid,
.quizShell[data-room="choice"] .entryGrid {
  grid-template-columns: 1fr;
}

.quizShell[data-room="card"] .categoryManager,
.quizShell[data-room="choice"] .categoryManager {
  display: none;
}

.selectorPanel {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.selectorPanel strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.groupBar,
.categoryBar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.typeBar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 14px;
}

.reviewBar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
}

.groupButton,
.categoryButton,
.typeButton,
.reviewButton {
  padding: 0 10px;
  border-color: rgba(159, 176, 170, 0.28);
  background: rgba(17, 26, 29, 0.72);
  color: rgba(159, 176, 170, 0.72);
  font-weight: 700;
  opacity: 0.72;
}

.groupButton.active,
.categoryButton.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
  opacity: 1;
}

.typeButton {
  border-color: rgba(159, 176, 170, 0.28);
  background: rgba(17, 26, 29, 0.72);
  color: rgba(159, 176, 170, 0.72);
}

.typeButton.active {
  border-color: var(--rose);
  background: rgba(232, 111, 131, 0.2);
  color: #ffd5dc;
  opacity: 1;
}

.reviewButton {
  border-color: rgba(159, 176, 170, 0.28);
  background: rgba(17, 26, 29, 0.72);
  color: rgba(159, 176, 170, 0.72);
}

.reviewButton.active {
  border-color: var(--blue);
  background: rgba(117, 184, 255, 0.18);
  color: #cfe6ff;
  opacity: 1;
}

.quizCard {
  position: relative;
  min-height: 430px;
  padding: 20px;
  overflow: hidden;
}

.pillScene {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 132px;
  height: 92px;
  opacity: 0.9;
}

.capsule,
.tablet {
  position: absolute;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.capsule {
  width: 64px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rose) 0 50%, #f9f0d0 50% 100%);
}

.tablet {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eff7ff;
}

.tablet::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 16px;
  border-top: 2px solid rgba(29, 55, 67, 0.35);
}

.capA {
  left: 0;
  top: 8px;
  transform: rotate(-18deg);
}

.capB {
  right: 0;
  bottom: 8px;
  background: linear-gradient(90deg, var(--blue) 0 50%, #fff6d8 50% 100%);
  transform: rotate(18deg);
}

.tabA {
  right: 22px;
  top: 0;
}

.tabB {
  left: 28px;
  bottom: 0;
  background: #f7e5a1;
}

.questionMeta {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
  color: var(--amber);
  font-weight: 700;
}

.quizCard h2 {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  min-height: 68px;
  padding-right: 132px;
  font-size: clamp(19px, 3.4vw, 30px);
  line-height: 1.32;
}

.resultMark {
  position: absolute;
  top: 96px;
  right: 40px;
  z-index: 2;
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border: 3px solid currentColor;
  border-radius: 50%;
  background: rgba(9, 16, 18, 0.78);
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
}

.resultMark[hidden] {
  display: none;
}

.resultMark.correct {
  color: var(--mint);
}

.resultMark.wrong {
  color: var(--rose);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.choiceButton {
  justify-content: flex-start;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
}

.choiceButton.correct {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.18);
  color: #bffce4;
}

.choiceButton.wrong {
  border-color: var(--rose);
  background: rgba(232, 111, 131, 0.14);
  color: #ffd6de;
}

.choiceButton:disabled {
  cursor: default;
}

.questionBodyBlocks {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  font-size: 0.62em;
  line-height: 1.6;
}

.questionBodyText {
  color: var(--text);
}

.questionBodyImage {
  max-width: min(100%, 720px);
  border-radius: 6px;
  overflow: hidden;
}

.questionBodyImage img {
  display: block;
  width: 100%;
  height: auto;
}

.flashAnswer {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.flashAnswerBox {
  min-height: 78px;
  border: 1px dashed rgba(66, 215, 163, 0.48);
  border-radius: 8px;
  background: rgba(66, 215, 163, 0.08);
  padding: 15px;
  color: #c7ffe9;
  font-size: clamp(17px, 3vw, 24px);
  line-height: 1.42;
}

.flashRevealButton {
  width: 100%;
  min-height: 52px;
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
  font-weight: 700;
}

.memoryButtons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.memoryButton {
  min-height: 56px;
  font-size: 19px;
  font-weight: 900;
}

.memoryButton.known {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
}

.memoryButton.unsure {
  border-color: var(--rose);
  background: rgba(232, 111, 131, 0.14);
  color: #ffacba;
}

.emptyQuiz {
  margin-top: 22px;
  border: 1px dashed rgba(243, 180, 75, 0.5);
  border-radius: 8px;
  background: rgba(243, 180, 75, 0.08);
  padding: 18px;
  color: #ffe1a1;
  line-height: 1.55;
}

.explain {
  margin-top: 16px;
  border-left: 3px solid var(--amber);
  padding: 11px 13px;
  background: rgba(243, 180, 75, 0.1);
  color: #ffe1a1;
  line-height: 1.55;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.actions button:first-child {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
  font-weight: 700;
}

.actions button:nth-child(2) {
  border-color: var(--rose);
  background: rgba(232, 111, 131, 0.12);
  color: #ffb4c0;
  font-weight: 700;
}

.actions button:last-child {
  color: var(--muted);
}

.notePanel {
  margin: 14px 0;
  padding: 15px;
  line-height: 1.55;
}

.noteHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.noteHead span {
  display: block;
  margin-bottom: 5px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
}

.noteHead strong {
  color: var(--mint);
  font-size: 17px;
}

.noteHead button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.noteActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.printRangeControls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}

.printRangeControls select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(9, 19, 23, 0.92);
  color: var(--text);
  font-weight: 800;
  width: 82px;
  padding: 0 8px;
}

.noteActions #printNoteButton {
  border-color: rgba(66, 215, 163, 0.45);
  background: rgba(66, 215, 163, 0.12);
  color: var(--mint);
  font-weight: 800;
}

.noteBody {
  position: relative;
  display: grid;
  gap: 10px;
  margin-top: 13px;
  color: #d8e8e2;
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-line;
}

.quizShell[data-room="note"] .noteBody {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 1018px,
    rgba(245, 174, 74, 0.2) 1018px,
    rgba(245, 174, 74, 0.2) 1020px,
    transparent 1020px,
    transparent 1040px
  );
}

.noteBody[hidden] {
  display: none;
}

.noteBody p {
  margin: 0;
}

.notePage {
  position: relative;
  display: grid;
  gap: 10px;
  background: transparent;
  padding: 2px 0 10px;
}

.notePageInkTarget {
  position: relative;
  display: grid;
  gap: 10px;
}

.pageInkButton {
  justify-self: end;
  min-height: 30px;
  padding: 0 11px;
  border-color: rgba(66, 215, 163, 0.4);
  background: rgba(66, 215, 163, 0.12);
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
  position: relative;
  z-index: 5;
}

.inkViewOverlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.notePage strong {
  color: var(--amber);
  font-size: 12px;
}

.formulaExampleBlock {
  display: grid;
  gap: 7px;
  break-inside: avoid;
  border-left: 3px solid rgba(245, 174, 74, 0.72);
  border-radius: 6px;
  background: rgba(245, 174, 74, 0.08);
  padding: 10px 12px;
}

.formulaExampleBlock strong {
  color: #ffd38c;
  font-size: 13px;
}

.formulaExampleBlock p {
  margin: 0;
}

.formulaExampleBlock .mathFormula {
  font-size: 1.12em;
}

.noteCallout {
  display: grid;
  gap: 7px;
  break-inside: avoid;
  border-left: 3px solid rgba(66, 215, 163, 0.72);
  border-radius: 7px;
  background: rgba(66, 215, 163, 0.08);
  padding: 12px 14px;
}

.noteCallout strong {
  color: var(--mint);
  font-size: 13px;
}

.noteCallout p {
  margin: 0;
}

.noteCallout-주의,
.noteCallout-오답 {
  border-left-color: rgba(255, 122, 151, 0.78);
  background: rgba(255, 122, 151, 0.09);
}

.noteCallout-주의 strong,
.noteCallout-오답 strong {
  color: #ff9eb5;
}

.noteCallout-암기,
.noteCallout-풀이 {
  border-left-color: rgba(245, 174, 74, 0.76);
  background: rgba(245, 174, 74, 0.09);
}

.noteCallout-암기 strong,
.noteCallout-풀이 strong {
  color: var(--amber);
}

.noteTable {
  width: 100%;
  border-collapse: collapse;
  break-inside: avoid;
  overflow-wrap: anywhere;
  font-size: 0.95em;
}

.noteTable th,
.noteTable td {
  border: 1px solid rgba(159, 176, 170, 0.28);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.noteTable th {
  background: rgba(66, 215, 163, 0.12);
  color: var(--mint);
}

.noteBody hr {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(159, 176, 170, 0.28);
  margin: 8px 0;
}

.notePageTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.notePageTab {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(159, 176, 170, 0.28);
  background: rgba(17, 26, 29, 0.72);
  color: rgba(216, 232, 226, 0.76);
  font-size: 13px;
  font-weight: 900;
}

.notePageTab.active {
  border-color: var(--amber);
  background: rgba(245, 174, 74, 0.16);
  color: var(--amber);
}

.noteStyleBar {
  display: flex;
  justify-content: flex-start;
  margin: 0 0 10px;
}

.noteStyleBar label {
  width: min(260px, 100%);
}

.mathToolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.mathToolbarGroup {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(159, 176, 170, 0.2);
  border-radius: 8px;
  background: rgba(10, 22, 24, 0.5);
  padding: 6px;
}

.mathToolbarLabel {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mathToolbar button {
  min-height: 30px;
  padding: 0 10px;
  border-color: rgba(245, 174, 74, 0.38);
  background: rgba(245, 174, 74, 0.1);
  color: #ffd38c;
  font-size: 12px;
  font-weight: 900;
}

.fieldJustInserted {
  animation: fieldPulse 650ms ease-out;
}

@keyframes fieldPulse {
  0% {
    box-shadow: 0 0 0 3px rgba(245, 174, 74, 0.34);
  }
  100% {
    box-shadow: none;
  }
}

.entryMathToolbar {
  grid-column: 1 / -1;
  margin: 2px 0 0;
}

.mathFormula {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 2px;
  border-radius: 6px;
  background: rgba(245, 174, 74, 0.12);
  padding: 2px 6px;
  color: #ffe0a8;
  font-family: Cambria, "Times New Roman", serif;
  font-size: 1.05em;
  white-space: nowrap;
}

.inlineCode {
  display: inline-block;
  border: 1px solid rgba(245, 174, 74, 0.3);
  border-radius: 5px;
  background: rgba(245, 174, 74, 0.12);
  padding: 1px 6px;
  color: #ffd38c;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.94em;
  white-space: nowrap;
}

.mathFrac {
  display: inline-grid;
  grid-template-rows: auto auto;
  place-items: center;
  line-height: 1.05;
  vertical-align: middle;
}

.mathFrac > .mathFracTop {
  border-bottom: 1px solid currentColor;
  padding: 0 4px 1px;
}

.mathFrac > .mathFracBottom {
  padding: 1px 4px 0;
}

.mathRoot,
.mathOp {
  font-weight: 700;
}

.mathRootBody {
  display: inline-block;
  border-top: 1px solid currentColor;
  margin-left: 1px;
  padding: 0 2px;
}

.noteImageStage {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  border: 1px dashed rgba(66, 215, 163, 0.34);
  border-radius: 8px;
  background: rgba(8, 18, 20, 0.62);
}

.noteImageBoard {
  position: relative;
  min-height: 0;
  overflow: visible;
  margin-top: 10px;
  border: 0;
  background: transparent;
}

.noteImageBoard .noteImageItem {
  position: absolute;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.noteImageBoard .noteImageItem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.noteImageStage {
  grid-column: 1 / -1;
  min-height: 320px;
  touch-action: none;
}

.noteImageStage[hidden] {
  display: none;
}

.noteImageStage:focus {
  outline: 2px solid rgba(66, 215, 163, 0.42);
  outline-offset: 2px;
}

.noteImageTools {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.noteImageTools strong {
  flex: 0 0 100%;
  color: var(--amber);
  font-size: 13px;
}

.noteImageTools span {
  color: var(--muted);
  font-size: 12px;
}

.noteImageItem {
  position: absolute;
  overflow: hidden;
  border: 1px solid rgba(159, 176, 170, 0.42);
  border-radius: 6px;
  background: rgba(17, 26, 29, 0.82);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
  cursor: grab;
  user-select: none;
}

.noteImageItem.selected {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(245, 174, 74, 0.24), 0 14px 30px rgba(0, 0, 0, 0.34);
}

.noteImageItem img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.noteImageStage .noteImageItem img {
  height: 100%;
}

.presentationPanel[hidden] {
  display: none;
}

.presentationPanel {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: grid;
  background: rgba(6, 12, 14, 0.98);
  color: var(--text);
}

.presentationShell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.presentationToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 18, 20, 0.96);
  padding: 12px 16px;
}

.presentationTitle {
  min-width: 190px;
}

.presentationTitle span {
  display: block;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.presentationTitle strong {
  display: block;
  margin-top: 4px;
  color: var(--mint);
  font-size: clamp(18px, 2.7vw, 28px);
  line-height: 1.15;
}

.presentationControls,
.presentationInkRow,
.presentationPresetGroup {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.presentationControls {
  justify-content: flex-end;
}

.presentationCounter {
  min-width: 78px;
  border: 1px solid rgba(117, 184, 255, 0.34);
  border-radius: 8px;
  background: rgba(117, 184, 255, 0.12);
  padding: 8px 10px;
  color: #d9ecff;
  text-align: center;
  font-weight: 900;
}

.presentationInkTools {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid rgba(43, 60, 66, 0.8);
  background: rgba(13, 23, 26, 0.96);
  padding: 10px 16px;
}

.presentationInkTools[hidden] {
  display: none;
}

.presentationInkTools label {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 26, 29, 0.82);
  padding: 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.presentationInkTools input[type="color"] {
  width: 36px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  padding: 0;
}

.presentationRangeLabel {
  min-width: min(260px, 100%);
}

.presentationRangeLabel input[type="range"] {
  width: 150px;
}

.presentationRangeLabel span {
  min-width: 44px;
  color: var(--mint);
  text-align: right;
}

.presentationColorPreset {
  position: relative;
  min-width: 54px;
  padding-left: 30px;
}

.presentationColorPreset::before {
  content: "";
  position: absolute;
  left: 9px;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(238, 247, 242, 0.5);
  border-radius: 50%;
  background: var(--preset-color);
}

.presentationColorPreset.active,
.presentationSizePreset.active,
.presentationOpacityPreset.active,
#presentationPenButton.active,
#presentationEraserButton.active,
#presentationInkButton.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.18);
  color: var(--mint);
}

.presentationStageWrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.presentationStage {
  height: 100%;
  overflow: auto;
  display: grid;
  align-content: center;
  padding: clamp(24px, 5vw, 68px);
}

.presentationSlide {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 24px;
  font-size: calc(var(--presentation-scale, 1) * 1rem);
}

.presentationSlideMeta {
  color: var(--amber);
  font-size: calc(var(--presentation-scale, 1) * 0.95rem);
  font-weight: 900;
}

.presentationNoteBody {
  font-size: calc(var(--presentation-scale, 1) * clamp(1.35rem, 3.3vw, 2.5rem));
  line-height: 1.62;
}

.presentationQuestion {
  max-width: 1040px;
  font-size: calc(var(--presentation-scale, 1) * clamp(2rem, 5vw, 4rem));
  line-height: 1.25;
}

.presentationChoices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.presentationChoice {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17, 26, 29, 0.78);
  padding: 18px;
  font-size: calc(var(--presentation-scale, 1) * clamp(1.1rem, 2.4vw, 1.8rem));
  line-height: 1.45;
}

.presentationChoice span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(117, 184, 255, 0.18);
  color: #d9ecff;
  font-weight: 900;
}

.presentationChoice.correct {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.18);
}

.presentationAnswer,
.presentationExplain {
  border: 1px solid rgba(66, 215, 163, 0.35);
  border-radius: 10px;
  background: rgba(66, 215, 163, 0.1);
  padding: 20px;
  font-size: calc(var(--presentation-scale, 1) * clamp(1.25rem, 3vw, 2.2rem));
  line-height: 1.5;
}

.presentationExplain {
  border-color: rgba(245, 174, 74, 0.36);
  background: rgba(245, 174, 74, 0.09);
}

.presentationEmpty {
  display: grid;
  place-items: center;
  min-height: 50vh;
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 900;
  text-align: center;
}

.presentationCanvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: none;
  user-select: none;
}

.presentationCanvas.active {
  cursor: crosshair;
  pointer-events: auto;
}

.presentationPanel .lessonBlocks,
.presentationPanel .questionBodyBlocks {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  font-size: 0.72em;
}

.presentationPanel img {
  max-width: 100%;
  height: auto;
}

.presentationPanel .noteImageBoard {
  position: relative;
  min-height: 0;
}

.presentationPanel .noteImageFrame {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  display: inline-block;
  margin: 12px 12px 0 0;
  vertical-align: top;
}

.presentationPanel .noteImageFrame img {
  display: block;
  width: 100%;
  height: auto;
}

body.presentationOpen {
  overflow: hidden;
}

.inkPanel[hidden] {
  display: none;
}

.inkPanel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #061011;
  color: var(--text);
}

body.inkOpen {
  overflow: hidden;
}

.inkToolbar {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid rgba(159, 176, 170, 0.22);
  background: rgba(9, 19, 21, 0.96);
  padding: 10px 14px;
}

.inkToolbar strong {
  color: var(--mint);
  font-size: 16px;
}

.inkToolGroup {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inkToolGroup button,
.inkToolGroup label {
  min-height: 36px;
  border: 1px solid rgba(159, 176, 170, 0.35);
  border-radius: 7px;
  background: rgba(17, 26, 29, 0.9);
  padding: 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.inkToolGroup button.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
}

.inkToolGroup label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.inkToolGroup label span {
  min-width: 34px;
  border-radius: 5px;
  background: rgba(245, 174, 74, 0.14);
  padding: 2px 6px;
  color: #ffd38c;
  text-align: center;
  font-size: 12px;
}

.inkColorLabel input {
  width: 34px;
  height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
}

.inkSizeLabel input {
  width: 96px;
}

.inkOpacityLabel input {
  width: 96px;
}

#inkStatus {
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.inkStageWrap {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.inkStage {
  position: relative;
  width: min(980px, 100%);
  min-height: 0;
  margin: 0 auto;
  border: 1px solid rgba(159, 176, 170, 0.28);
  border-radius: 8px;
  background: #0b1719;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
}

.inkSource {
  position: relative;
  z-index: 1;
  padding: 0;
}

.inkPreviewPage {
  min-height: 0;
  color: #d8e8e2;
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-line;
}

#inkCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.scratchPad {
  width: min(980px, 100%);
  margin: 12px auto 0;
  border: 1px solid rgba(159, 176, 170, 0.28);
  border-radius: 8px;
  background: #0b1719;
  overflow: hidden;
}

.scratchHead {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(159, 176, 170, 0.18);
  padding: 10px 12px;
}

.scratchHead strong {
  color: var(--amber);
  font-size: 14px;
}

.scratchHead span {
  flex: 1 1 220px;
  color: rgba(216, 232, 226, 0.72);
  font-size: 12px;
}

.scratchHead button {
  min-height: 32px;
  padding: 0 10px;
  border-color: rgba(245, 174, 74, 0.34);
  background: rgba(245, 174, 74, 0.1);
  color: #ffd38c;
  font-size: 12px;
  font-weight: 900;
}

#scratchCanvas {
  display: block;
  width: 100%;
  height: 320px;
  background:
    linear-gradient(rgba(216, 232, 226, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 232, 226, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: crosshair;
  touch-action: none;
}

.drawPanel[hidden] {
  display: none;
}

.drawPanel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(4, 9, 10, 0.78);
  padding: 14px;
}

.drawDialog {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  width: min(860px, 100%);
  height: min(720px, calc(100svh - 28px));
  border: 1px solid rgba(159, 176, 170, 0.32);
  border-radius: 10px;
  background: #0b1719;
  padding: 14px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.44);
}

.drawHead {
  display: grid;
  gap: 4px;
}

.drawHead strong {
  color: var(--mint);
  font-size: 18px;
}

.drawHead span {
  color: rgba(216, 232, 226, 0.72);
  font-size: 12px;
}

.drawTools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.drawTools label,
.drawTools button {
  min-height: 34px;
  border: 1px solid rgba(159, 176, 170, 0.35);
  border-radius: 7px;
  background: rgba(17, 26, 29, 0.9);
  padding: 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.drawTools label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.drawTools label:nth-of-type(1) {
  order: 2;
}

.drawTools label:nth-of-type(2) {
  order: 3;
  min-width: 250px;
}

.drawTools label:nth-of-type(3) {
  order: 4;
  min-width: 250px;
}

.drawModeBreak,
.drawToolBreak {
  order: 20;
  flex-basis: 100%;
  width: 100%;
  height: 0;
  min-width: 100%;
}

.drawModeBreak {
  order: 4;
}

#drawPenButton {
  order: 1;
}

#drawLineButton {
  order: 5;
}

#drawArrowButton {
  order: 6;
}

#drawRectButton {
  order: 7;
}

#drawEllipseButton {
  order: 8;
}

#drawTextButton {
  order: 9;
}

#drawSelectButton {
  order: 10;
}

#drawGridButton {
  order: 11;
}

#drawEraserButton {
  order: 30;
}

#drawUndoButton {
  order: 31;
}

#clearDrawButton {
  order: 32;
}

#saveFullImageButton {
  order: 33;
}

#saveDrawButton {
  order: 34;
}

#closeDrawButton {
  order: 35;
}

.drawTools input[type="color"] {
  width: 34px;
  height: 24px;
  border: 1px solid rgba(159, 176, 170, 0.42);
  border-radius: 5px;
  background: transparent;
  padding: 2px;
}

.drawTools input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.drawTools input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 3px;
}

.drawTools input[type="range"] {
  width: 160px;
}

.drawTools span {
  min-width: 42px;
  color: var(--mint);
  font-size: 12px;
  text-align: right;
}

.drawTools button.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.18);
  color: var(--mint);
}

.drawTools button:nth-last-child(2) {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
}

.drawCanvasWrap {
  position: relative;
  min-height: 0;
}

#drawCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(66, 215, 163, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(rgba(216, 232, 226, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 232, 226, 0.06) 1px, transparent 1px),
    rgba(8, 18, 20, 0.72);
  background-size: 24px 24px;
  cursor: crosshair;
  touch-action: none;
}

#drawCanvas.eraserActive {
  cursor: cell;
}

#drawCanvas.selectActive {
  cursor: move;
}

#drawCanvas.textActive {
  cursor: text;
}

#drawCanvas.gridOff {
  background: rgba(8, 18, 20, 0.72);
}

.cropSelection {
  position: absolute;
  z-index: 3;
  border: 2px dashed var(--amber);
  background: rgba(245, 174, 74, 0.12);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.12);
}

.cropSelection.drawSelectionActive {
  border-style: solid;
  border-color: var(--mint);
  background-color: rgba(66, 215, 163, 0.12);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.cropSelection.drawSelectionActive::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--amber);
}

.noteImageResize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  border-top: 2px solid var(--amber);
  border-left: 2px solid var(--amber);
  background: rgba(245, 174, 74, 0.22);
  cursor: nwse-resize;
}

.noteImageEmpty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.editorPanel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 26, 29, 0.88);
  padding: 16px;
}

.noteEditor {
  display: grid;
  grid-template-columns: minmax(180px, 0.32fr) minmax(0, 0.68fr);
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
}

.editorHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.editorHead strong {
  color: var(--mint);
}

.editorHead p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#customCount {
  flex: 0 0 auto;
  border: 1px solid rgba(66, 215, 163, 0.42);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 700;
}

.categoryManager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.entryGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.entryForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 10px;
  border: 1px solid rgba(117, 184, 255, 0.24);
  border-radius: 8px;
  background: rgba(13, 23, 26, 0.7);
  padding: 14px;
}

.cardForm {
  border-color: rgba(232, 111, 131, 0.32);
  background: rgba(232, 111, 131, 0.06);
}

.formTitle {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
}

.formTitle strong {
  color: var(--mint);
}

.cardForm .formTitle strong {
  color: #ffb4c0;
}

.formTitle span {
  color: var(--muted);
  font-size: 12px;
}

.categoryManager label,
.noteEditor label,
.entryForm label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.choiceBodyBuilder {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(245, 174, 74, 0.28);
  border-radius: 8px;
  background: rgba(245, 174, 74, 0.06);
  padding: 12px;
}

.choiceBodyHead {
  display: grid;
  gap: 4px;
}

.choiceBodyHead strong {
  color: var(--amber);
  font-size: 14px;
}

.choiceBodyHead span,
.choiceBodyEmpty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.choiceBodyBlocks {
  display: grid;
  gap: 10px;
}

.choiceBodyBlock {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(159, 176, 170, 0.22);
  border-radius: 7px;
  background: rgba(8, 18, 20, 0.56);
  padding: 10px;
}

.choiceBodyBlockHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.choiceBodyBlockHeader strong {
  color: var(--text);
  font-size: 13px;
}

.choiceBodyImageEditor {
  max-width: 100%;
}

.choiceBodyImageEditor img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.choiceBodyBlock input[type="range"] {
  width: min(100%, 360px);
}

.choiceBodyActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.chapterItemManager {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(159, 176, 170, 0.22);
  border-radius: 8px;
  background: rgba(8, 18, 20, 0.42);
  padding: 12px;
}

.chapterItemHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chapterItemHead strong {
  color: var(--text);
  font-size: 14px;
}

.chapterItemHead span,
.chapterItemEmpty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.chapterItemList {
  display: grid;
  gap: 7px;
}

.chapterItemButton {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 44px;
  text-align: left;
}

.chapterItemButton span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(245, 174, 74, 0.15);
  color: var(--amber);
  font-size: 12px;
}

.chapterItemButton strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapterItemButton.active {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.13);
}

.wideField,
.editorActions,
.categoryActions,
.formMessage {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #38505a;
  border-radius: 6px;
  background: #0d171a;
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.notePage[data-font="sans"],
#noteText[data-font="sans"] {
  font-family: "Noto Sans KR", Arial, sans-serif;
}

.notePage[data-font="serif"],
#noteText[data-font="serif"] {
  font-family: "Noto Serif KR", Batang, "Times New Roman", serif;
}

.notePage[data-font="mono"],
#noteText[data-font="mono"] {
  font-family: Consolas, "Courier New", monospace;
}

.notePage[data-font="round"],
#noteText[data-font="round"] {
  font-family: "Malgun Gothic", "Noto Sans KR", Arial, sans-serif;
  letter-spacing: 0;
}

.editorActions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.singleAction {
  grid-template-columns: 1fr;
}

.categoryActions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.editorActions button:first-child {
  border-color: var(--mint);
  background: rgba(66, 215, 163, 0.16);
  color: var(--mint);
  font-weight: 700;
}

.editorActions button:nth-child(2) {
  border-color: var(--blue);
  background: rgba(117, 184, 255, 0.12);
  color: #cfe6ff;
  font-weight: 700;
}

.categoryActions button:first-child {
  border-color: var(--blue);
  background: rgba(117, 184, 255, 0.14);
  color: #cfe6ff;
  font-weight: 700;
}

.editorActions button:last-child,
.categoryActions button:last-child {
  color: var(--muted);
}

.formMessage {
  min-height: 20px;
  color: var(--amber);
  font-size: 13px;
}

@media (max-width: 720px) {
  .quizShell {
    width: min(460px, calc(100vw - 18px));
    padding-top: 16px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .appBrand {
    align-items: flex-start;
  }

  .appIcon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 26px;
  }

  .appStatus {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .appStatus span,
  .appStatus button,
  .languageSwitch {
    width: 100%;
    min-width: 0;
  }

  .languageSwitch {
    grid-column: 1 / -1;
  }

  nav {
    width: 100%;
  }

  nav a {
    flex: 1;
  }

  .statusPanel {
    grid-template-columns: 1fr;
  }

  .statusPanel div:first-child {
    grid-column: auto;
  }

  .categoryBar,
  .groupBar,
  .homeGroupBar,
  .homeCategoryBar,
  .homeChapterBar,
  .homeAddActions,
  .bookPrintControls,
  .bookDataControls,
  .bookDataRow,
  .bookDataRow.importOnly,
  .materialToolActions,
  .homeManagePanel div,
  .homeRenameActions,
  .roomCards,
  .typeBar,
  .reviewBar,
  .choices,
  .actions,
  .categoryManager,
  .noteEditor,
  .entryGrid,
  .entryForm,
  .editorActions,
  .categoryActions,
  .choiceBodyActions {
    grid-template-columns: 1fr;
  }

  .mathToolbarGroup {
    width: 100%;
  }

  .modeBar,
  .bookPrintControls,
  .bookDataControls,
  .bookDataRow,
  .materialToolActions,
  .typeBar,
  .reviewBar,
  .actions,
  .editorActions,
  .categoryActions,
  .homeAddActions,
  .homeRenameActions {
    gap: 8px;
  }

  .modeBar > *,
  .statusPanel > *,
  .typeBar > *,
  .reviewBar > *,
  .actions > *,
  .editorActions > *,
  .categoryActions > *,
  .bookPrintControls > *,
  .bookDataControls > *,
  .bookDataRow > *,
  .bookDataRow.importOnly > *,
  .materialToolActions > *,
  .homeAddActions > *,
  .homeRenameActions > *,
  .homeGroupBar > *,
  .homeCategoryBar > *,
  .homeChapterBar > *,
  .groupBar > *,
  .categoryBar > * {
    min-width: 0;
    width: 100%;
  }

  .bookDataRow.importOnly span {
    grid-column: auto;
  }

  .bookDataControls button {
    min-height: 42px;
  }

  .selectorPanel,
  .homeSelector,
  .homeActionCenter,
  .bookPrintCenter,
  .bookDataCenter,
  .roomHeader,
  .notePanel,
  .noteEditor,
  .quizCard,
  .entryForm {
    overflow: hidden;
  }

  .roomHeader {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .roomHeaderText {
    min-width: 0;
  }

  .roomSwitchNav {
    justify-content: flex-start;
  }

  .editorHead {
    display: grid;
  }

  .quizCard {
    min-height: 520px;
    padding: 18px;
  }

  .pillScene {
    position: relative;
    top: auto;
    right: auto;
    margin-left: auto;
    margin-bottom: 8px;
  }

  .quizCard h2 {
    min-height: 0;
    padding-right: 0;
  }

  .resultMark {
    position: static;
    width: 72px;
    height: 72px;
    margin: 14px 0 0 auto;
    font-size: 44px;
  }

  .presentationToolbar {
    display: grid;
    align-items: stretch;
  }

  .presentationControls,
  .presentationInkRow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .presentationControls button,
  .presentationCounter,
  .presentationInkRow > *,
  .presentationPresetGroup {
    width: 100%;
  }

  .presentationCounter,
  .presentationPresetGroup {
    grid-column: 1 / -1;
  }

  .presentationPresetGroup {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .presentationStage {
    align-content: start;
    padding: 18px;
  }

  .presentationChoices {
    grid-template-columns: 1fr;
  }

  .presentationRangeLabel input[type="range"] {
    width: 100%;
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  body {
    background: #fff;
    color: #111;
  }

  body * {
    visibility: hidden;
  }

  .conceptNote,
  .conceptNote * {
    visibility: visible;
  }

  .conceptNote {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    margin: 0;
    border: 0;
    background: #fff;
    box-shadow: none;
    color: #111;
    padding: 0;
  }

  .noteActions {
    display: none;
  }

  .noteHead {
    border-bottom: 1px solid #bbb;
    margin-bottom: 10mm;
    padding-bottom: 4mm;
  }

  .noteHead span {
    color: #555;
  }

  .noteHead strong {
    color: #111;
    font-size: 18pt;
  }

  .noteBody {
    display: block;
    background-image: none;
    color: #111;
    font-size: 11pt;
    line-height: 1.55;
    white-space: pre-line;
  }

  .pageInkButton,
  .inkPanel {
    display: none !important;
  }

  .notePage {
    border: 0;
    border-radius: 0;
    background: #fff;
    padding: 0;
    margin: 0 0 5mm;
  }

  .notePage.printExcluded {
    display: none !important;
  }

  .noteBody p,
  .formulaExampleBlock,
  .noteImageBoard,
  .noteImageItem {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .notePage strong,
  .mathFormula {
    color: #111;
  }

  .mathFormula {
    background: transparent;
    border: 1px solid #ddd;
  }

  .formulaExampleBlock {
    border-left: 3px solid #777;
    background: #f7f7f7;
    padding: 4mm;
  }

  .formulaExampleBlock strong {
    color: #111;
  }

  .noteCallout {
    border-left: 3px solid #777;
    background: #f7f7f7;
    padding: 4mm;
  }

  .noteCallout strong {
    color: #111;
  }

  .noteTable th,
  .noteTable td {
    border-color: #bbb;
  }

  .noteTable th {
    background: #f2f2f2;
    color: #111;
  }

  .noteImageBoard {
    display: block;
    overflow: visible;
    margin: 3mm 0 5mm;
  }

  .noteImageItem {
    display: block;
    max-width: 100%;
    max-height: 225mm;
    margin: 0 0 5mm;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .noteImageItem img {
    max-height: 225mm;
    object-fit: contain;
  }

  body.printingBookCenter .conceptNote,
  body.printingBookCenter .conceptNote * {
    visibility: hidden;
  }

  body.printingBookCenter .bookPrintOutput,
  body.printingBookCenter .bookPrintOutput * {
    visibility: visible;
  }

  body.printingBookCenter .bookPrintOutput {
    display: block;
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    margin: 0;
    color: #111;
    background: #fff;
    font-size: 11pt;
    line-height: 1.55;
  }

  .bookPrintTitle {
    border-bottom: 1px solid #bbb;
    margin-bottom: 8mm;
    padding-bottom: 4mm;
  }

  .bookPrintTitle p {
    margin: 0 0 2mm;
    color: #555;
    font-size: 9pt;
  }

  .bookPrintTitle h1 {
    margin: 0 0 2mm;
    color: #111;
    font-size: 20pt;
  }

  .bookPrintTitle span {
    color: #555;
    font-size: 9pt;
  }

  .printChapter {
    break-after: auto;
    margin-bottom: 8mm;
  }

  .printChapter h2 {
    margin: 0 0 5mm;
    color: #111;
    font-size: 16pt;
  }

  .printEmptyBlock {
    border: 1px dashed #999;
    border-radius: 3mm;
    padding: 8mm;
    color: #333;
    background: #fafafa;
  }

  .printEmptyBlock strong {
    display: block;
    margin-bottom: 3mm;
    font-size: 14pt;
  }

  .printEmptyBlock p {
    margin: 0;
    color: #555;
  }

  .printQuestionBlock,
  .printPageBlock,
  .printImageBlock,
  .printAnswerBlock {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .printBookSection {
    margin: 0 0 7mm;
    break-inside: auto;
    page-break-inside: auto;
  }

  .printBookSection h3 {
    margin: 0 0 3mm;
    color: #111;
    font-size: 13pt;
  }

  .printNoteSection {
    font-family: "Noto Sans KR", Arial, sans-serif;
  }

  .printNoteSection h3 {
    border-bottom: 2px solid #111;
    padding-bottom: 2mm;
    letter-spacing: 0;
  }

  .printNotePage {
    border: 0;
    margin-bottom: 6mm;
    padding: 0 0 5mm;
    line-height: 1.72;
  }

  .printNotePage + .printNotePage {
    border-top: 1px solid #ddd;
    padding-top: 5mm;
  }

  .printNotePage .formulaExampleBlock {
    border-left-color: #555;
    background: #f6f6f6;
  }

  .printNoteImageBlock {
    margin: 4mm 0 6mm;
  }

  .printCardSection h3 {
    border-bottom: 2px solid #111;
    padding-bottom: 2mm;
  }

  .printCardGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6mm;
    break-inside: auto;
    page-break-inside: auto;
  }

  .printFlashCard {
    break-inside: avoid;
    page-break-inside: avoid;
    min-height: 46mm;
    border: 1.4px solid #222;
    border-radius: 3mm;
    padding: 4mm;
    background: #fff;
  }

  .printFlashCard h4 {
    margin: 0 0 3mm;
    color: #555;
    font-size: 9pt;
    text-transform: uppercase;
  }

  .printCardFace {
    border-top: 1px dashed #aaa;
    padding-top: 3mm;
    margin-top: 3mm;
  }

  .printCardFace:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
  }

  .printCardFace strong {
    display: inline-block;
    margin-bottom: 2mm;
    border: 1px solid #999;
    border-radius: 999px;
    padding: 0.5mm 2mm;
    color: #333;
    font-size: 8pt;
  }

  .printCardFront {
    font-weight: 700;
  }

  .printCardBack {
    color: #222;
  }

  .printChoiceSection {
    counter-reset: choiceQuestion;
  }

  .printChoiceSection h3 {
    border-bottom: 2px solid #111;
    padding-bottom: 2mm;
  }

  .printChoiceQuestion {
    counter-increment: choiceQuestion;
    border: 1px solid #d2d2d2;
    border-radius: 2mm;
    margin-bottom: 6mm;
    padding: 4mm;
  }

  .printChoiceQuestion h4 {
    display: inline-block;
    margin: 0 0 3mm;
    border: 1px solid #111;
    border-radius: 999px;
    padding: 0.5mm 3mm;
    color: #111;
    font-size: 10pt;
  }

  .printChoiceQuestion .printTextBlock {
    margin: 2mm 0;
  }

  .printChoiceList {
    display: grid;
    gap: 2mm;
    margin: 4mm 0 0;
    padding: 0;
    list-style: none;
    counter-reset: choiceOption;
  }

  .printChoiceList li {
    counter-increment: choiceOption;
    position: relative;
    min-height: 9mm;
    border: 1px solid #ddd;
    border-radius: 2mm;
    padding: 2mm 3mm 2mm 10mm;
  }

  .printChoiceList li::before {
    content: counter(choiceOption);
    position: absolute;
    left: 3mm;
    top: 2mm;
    display: grid;
    place-items: center;
    width: 5mm;
    height: 5mm;
    border: 1px solid #111;
    border-radius: 50%;
    font-size: 8pt;
    font-weight: 700;
  }

  .printChoiceAnswer {
    border-left: 4px solid #111;
    background: #f2f2f2;
  }

  .printQuestionBlock,
  .printPageBlock {
    border-bottom: 1px solid #ddd;
    margin-bottom: 5mm;
    padding-bottom: 4mm;
  }

  .printQuestionBlock h4 {
    margin: 0 0 3mm;
    color: #333;
    font-size: 11pt;
  }

  .printAnswerBlock {
    border-left: 3px solid #777;
    margin-top: 3mm;
    padding: 2mm 3mm;
    background: #f7f7f7;
  }

  .printChoiceList {
    margin: 4mm 0 0;
    padding: 0;
  }

  .printChoiceQuestion h4 {
    display: inline-block;
    margin: 0 0 3mm;
    border: 1px solid #111;
    border-radius: 999px;
    padding: 0.5mm 3mm;
    color: #111;
    font-size: 10pt;
  }

  .printChoiceList {
    display: grid;
    gap: 2mm;
    list-style: none;
    counter-reset: choiceOption;
  }

  .printChoiceList li {
    counter-increment: choiceOption;
    position: relative;
    min-height: 9mm;
    border: 1px solid #ddd;
    border-radius: 2mm;
    padding: 2mm 3mm 2mm 10mm;
  }

  .printChoiceList li::before {
    content: counter(choiceOption);
    position: absolute;
    left: 3mm;
    top: 2mm;
    display: grid;
    place-items: center;
    width: 5mm;
    height: 5mm;
    border: 1px solid #111;
    border-radius: 50%;
    font-size: 8pt;
    font-weight: 700;
  }

  .printImageBlock {
    max-width: 100%;
    margin: 3mm 0;
  }

  .printImageBlock img {
    display: block;
    width: 100%;
    max-height: 180mm;
    object-fit: contain;
  }
}
