: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;
}

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

.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;
}

.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;
  padding: 13px 14px;
}

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

.statusPanel strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
}

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

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

.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;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.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 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.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: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
}

.roomHeader > div {
  flex: 1 1 auto;
  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;
}

.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: -4px 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;
}

.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 {
  display: grid;
  gap: 10px;
  background: transparent;
  padding: 2px 0 10px;
}

.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;
}

.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: 7px;
  margin: 0 0 10px;
}

.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 span:first-child {
  border-bottom: 1px solid currentColor;
  padding: 0 4px 1px;
}

.mathFrac span:last-child {
  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;
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: visible;
  margin-top: 4px;
  border: 0;
  background: transparent;
}

.noteImageBoard .noteImageItem {
  position: relative;
  left: auto !important;
  top: auto !important;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.noteImageBoard .noteImageItem img {
  object-fit: contain;
}

.noteImageStage {
  grid-column: 1 / -1;
  min-height: 320px;
  touch-action: 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;
}

.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;
}

.sharePanel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(245, 177, 66, 0.34);
  border-radius: 8px;
  background: rgba(245, 177, 66, 0.06);
  padding: 14px;
}

.shareActions {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.2fr) minmax(150px, 0.9fr);
  gap: 10px;
  align-items: end;
}

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

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

.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;
}

.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 - 22px));
    padding-top: 16px;
  }

  .topbar {
    display: grid;
  }

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

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

  .appStatus {
    width: 100%;
    justify-content: space-between;
  }

  nav {
    width: 100%;
  }

  nav a {
    flex: 1;
  }

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

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

  .categoryBar,
  .groupBar,
  .homeGroupBar,
  .homeCategoryBar,
  .homeAddActions,
  .homeManagePanel div,
  .roomCards,
  .typeBar,
  .reviewBar,
  .choices,
  .actions,
  .categoryManager,
  .shareActions,
  .noteEditor,
  .entryGrid,
  .entryForm,
  .editorActions,
  .categoryActions {
    grid-template-columns: 1fr;
  }

  .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;
  }
}

@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;
  }

  .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;
  }

  .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;
  }
}
