:root {
  color-scheme: light;
  --paper: #f6f0e3;
  --paper-bright: #fffdf7;
  --paper-deep: #e8deca;
  --ink: #202522;
  --blue: #123b8f;
  --blue-dark: #082d70;
  --orange: #f0672a;
  --yellow: #f5c84b;
  --mint: #75bfa3;
  --red: #c93f32;
  --green: #25865c;
  --muted: #6f746f;
  --border: 2px solid var(--ink);
  --radius: 8px;
  --radius-large: 14px;
  --shadow-ink: 5px 5px 0 var(--ink);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: "Pretendard Variable", Pretendard, "SUIT Variable", SUIT, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 18% 32%, rgba(18, 59, 143, 0.045) 0 1px, transparent 1.5px),
    radial-gradient(circle at 74% 68%, rgba(32, 37, 34, 0.035) 0 1px, transparent 1.5px),
    linear-gradient(96deg, rgba(255, 255, 255, 0.2), transparent 22%, rgba(76, 55, 26, 0.025) 68%, transparent);
  background-size: 11px 13px, 17px 19px, 100% 100%;
  overflow-x: hidden;
}

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

button,
select {
  cursor: pointer;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--blue);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 24px;
  padding: 10px clamp(18px, 4vw, 60px);
  border-bottom: 3px solid var(--blue);
  background: rgba(255, 253, 247, 0.94);
}

.topbar::after {
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 7px;
  content: "";
  background: linear-gradient(135deg, var(--blue) 45%, transparent 46%) 0 0 / 12px 8px repeat-x;
  opacity: 0.18;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  min-width: 142px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 18px 10px;
  border: 0;
  color: var(--blue);
  background: var(--paper-bright);
  box-shadow: 4px 5px 0 rgba(32, 37, 34, 0.22);
  clip-path: polygon(2% 6%, 96% 0, 100% 91%, 52% 96%, 4% 100%, 0 43%);
  transform: rotate(-1.5deg);
  transition: transform 160ms var(--spring);
}

.brand-mark:hover {
  transform: rotate(0.8deg) translateY(-2px);
}

.brand-mark span {
  font-family: "NanumSquareRound", "Arial Black", sans-serif;
  font-size: 29px;
  font-weight: 950;
  letter-spacing: -2px;
}

.brand-mark b {
  align-self: flex-start;
  color: var(--orange);
}

.class-context {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-left: 1px solid rgba(32, 37, 34, 0.24);
  font-size: 15px;
}

.context-item {
  padding: 5px 8px;
  border: 1px solid rgba(32, 37, 34, 0.2);
  background: var(--paper-bright);
  font-size: 12px;
  white-space: nowrap;
}

.context-item--school {
  color: var(--blue);
  border-color: var(--blue);
  font-weight: 950;
}

.context-item--grade {
  color: var(--orange);
  border-color: var(--orange);
  font-weight: 950;
  transform: rotate(-1.5deg);
}

.context-item--activity {
  border: 0;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  transform: rotate(0.7deg);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-button,
.back-link {
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
}

.nav-button {
  padding: 10px 12px;
  border-bottom: 2px solid transparent;
}

.nav-button:hover {
  border-bottom-color: var(--blue);
}

.nav-button--teacher {
  border: 2px solid var(--ink);
  background: var(--paper-bright);
  box-shadow: 3px 3px 0 var(--yellow);
}

.view {
  min-height: calc(100vh - 76px);
}

.view--entry {
  position: relative;
  isolation: isolate;
  display: grid;
  overflow: hidden;
  min-height: calc(100vh - 76px);
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  align-items: center;
  gap: clamp(40px, 8vw, 130px);
  padding: clamp(36px, 6vw, 90px) clamp(24px, 8vw, 130px);
}

.view--entry::before {
  position: absolute;
  z-index: -1;
  top: 9%;
  right: 52%;
  bottom: 8%;
  left: -8%;
  content: "";
  background: var(--blue);
  clip-path: polygon(5% 4%, 91% 0, 100% 20%, 94% 89%, 73% 100%, 4% 94%, 0 43%);
  transform: rotate(-1deg);
}

.entry-copy {
  position: relative;
  max-width: 760px;
  color: white;
}

.entry-school {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 15px;
  font-weight: 950;
  transform: rotate(-1deg);
}

.entry-school b {
  color: var(--orange);
}

.entry-copy h1 {
  margin: 0;
  font-family: "NanumSquareRound", "Arial Black", sans-serif;
  font-size: clamp(62px, 7vw, 108px);
  font-weight: 950;
  letter-spacing: -0.075em;
  line-height: 0.92;
}

.entry-copy h1 span,
.entry-copy h1 em {
  display: block;
  white-space: nowrap;
}

.entry-copy h1 em {
  color: var(--yellow);
  font-style: normal;
}

.entry-description {
  margin: 32px 0 0;
  color: #e9efff;
  font-size: clamp(17px, 1.6vw, 24px);
  font-weight: 750;
  line-height: 1.5;
}

.entry-stars {
  position: absolute;
  top: 7%;
  right: -2%;
  width: 180px;
  height: 270px;
  pointer-events: none;
}

.entry-stars::before {
  position: absolute;
  top: 20px;
  bottom: 15px;
  left: 50%;
  width: 2px;
  content: "";
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.8) 0 3px, transparent 4px 16px);
  transform: rotate(22deg);
}

.entry-stars i {
  position: absolute;
  color: var(--yellow);
  font-size: 30px;
  font-style: normal;
  animation: sparkle-flow 3.2s ease-in-out infinite;
}

.entry-stars i:nth-child(1) { top: 0; left: 70%; }
.entry-stars i:nth-child(2) { top: 34%; left: 35%; color: white; animation-delay: -0.8s; }
.entry-stars i:nth-child(3) { top: 65%; left: 67%; color: var(--orange); animation-delay: -1.6s; }
.entry-stars i:nth-child(4) { bottom: 0; left: 22%; color: var(--mint); animation-delay: -2.3s; }

.entry-card {
  position: relative;
  width: min(100%, 480px);
  justify-self: center;
  padding: clamp(28px, 4vw, 48px);
  border: 3px solid var(--ink);
  background: var(--paper-bright);
  box-shadow: 10px 12px 0 var(--ink), -8px -8px 0 var(--yellow);
  transform: rotate(0.5deg);
}

.entry-card::before {
  position: absolute;
  top: -16px;
  left: 50%;
  width: 100px;
  height: 28px;
  content: "";
  background: rgba(117, 191, 163, 0.78);
  transform: translateX(-50%) rotate(-2deg);
}

.entry-step {
  margin: 0 0 4px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 950;
}

.entry-card h2 {
  margin: 0 0 25px;
  color: var(--blue);
  font-family: "NanumSquareRound", "Arial Black", sans-serif;
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: -2px;
}

.entry-card label {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  font-size: 12px;
  font-weight: 950;
}

.entry-card input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  font-size: 17px;
  font-weight: 800;
}

.number-input-wrap {
  position: relative;
}

.number-input-wrap input {
  padding-right: 16px;
}

.number-input-wrap span {
  position: absolute;
  top: 15px;
  right: 16px;
  font-size: 15px;
  font-weight: 950;
}

.entry-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 15px 17px;
  border: 2px solid var(--ink);
  color: white;
  background: var(--blue);
  box-shadow: 5px 5px 0 var(--yellow);
  font-weight: 950;
  transition: transform 140ms var(--spring), box-shadow 140ms ease;
}

.entry-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--yellow);
}

.entry-button:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--yellow);
}

.entry-button:disabled {
  cursor: wait;
  background: var(--muted);
}

.entry-help {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed rgba(32, 37, 34, 0.35);
  color: var(--muted);
}

.entry-help > span {
  color: var(--green);
}

.entry-help p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.entry-help strong {
  color: var(--ink);
}

.entry-url {
  margin: 18px 0 0;
  color: var(--blue);
  font: 800 11px/1 Consolas, monospace;
  text-align: center;
}

.view--student {
  padding: clamp(22px, 3.2vw, 48px) clamp(18px, 4vw, 62px) 104px;
}

.studio-intro {
  display: flex;
  max-width: 1700px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin: 0 auto 24px;
}

.student-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
}

.student-line button {
  margin-left: 4px;
  padding: 3px 6px;
  border: 1px solid currentColor;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 850;
}

.studio-intro h1,
.teacher-heading h1,
.gallery-hero h1 {
  margin: 0;
  font-family: "NanumSquareRound", "Arial Black", sans-serif;
  font-weight: 950;
  letter-spacing: -0.055em;
}

.studio-intro h1 {
  max-width: 760px;
  font-size: clamp(28px, 3.5vw, 54px);
  line-height: 1.05;
}

.studio-intro h1 em,
.gallery-hero h1 em {
  position: relative;
  color: var(--blue);
  font-style: normal;
  isolation: isolate;
}

.studio-intro h1 em::after,
.gallery-hero h1 em::after {
  position: absolute;
  z-index: -1;
  right: -0.08em;
  bottom: 0.02em;
  left: -0.08em;
  height: 0.28em;
  content: "";
  background: var(--yellow);
  transform: rotate(-1deg);
}

.save-cluster {
  display: grid;
  grid-template-columns: 15px auto;
  align-items: center;
  gap: 0 8px;
  min-width: 180px;
  padding: 11px 14px;
  border: 1px dashed rgba(32, 37, 34, 0.45);
  background: rgba(255, 253, 247, 0.7);
  transform: rotate(0.5deg);
}

.save-dot {
  grid-row: 1 / 3;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
}

.save-dot.is-saved {
  background: var(--mint);
}

.save-dot.is-error {
  background: var(--red);
}

.save-cluster strong {
  font-size: 14px;
}

.save-cluster small {
  color: var(--muted);
  font-size: 11px;
}

.studio-grid {
  display: grid;
  max-width: 1700px;
  min-height: 520px;
  height: clamp(520px, calc(100vh - 285px), 760px);
  grid-template-columns: minmax(340px, 0.9fr) 82px minmax(480px, 1.25fr);
  align-items: stretch;
  margin: 0 auto;
}

.editor-panel,
.preview-panel {
  min-width: 0;
  overflow: hidden;
  border: var(--border);
  background: var(--paper-bright);
}

.editor-panel {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border-color: #121817;
  background: #171e1d;
  box-shadow: -6px 7px 0 var(--blue);
  transform: rotate(-0.25deg);
}

.editor-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: white;
  border-bottom: 1px solid #3e4947;
  background: #222a29;
}

.title-field {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
}

.title-field span {
  flex: 0 0 auto;
  color: #9ed5c0;
  font-size: 11px;
  font-weight: 900;
}

.title-field input {
  min-width: 0;
  width: 100%;
  padding: 5px 0;
  border: 0;
  border-bottom: 1px dashed #87908e;
  color: white;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
}

.pencil-mark {
  color: var(--yellow);
  font-size: 20px;
}

.code-tabs {
  display: flex;
  gap: 5px;
  padding: 10px 12px 0;
  background: #171e1d;
}

.code-tabs button {
  min-width: 86px;
  padding: 10px 18px 9px;
  border: 1px solid #525b59;
  border-bottom: 0;
  color: #1d2422;
  background: #dcd9c8;
  font-weight: 950;
  clip-path: polygon(3% 3%, 97% 0, 100% 100%, 0 100%);
  transition: transform 140ms var(--spring), background 140ms ease;
}

.code-tabs button:nth-child(2) {
  background: #d9e7d9;
}

.code-tabs button:nth-child(3) {
  background: #f4dd8b;
}

.code-tabs button[aria-selected="true"] {
  color: var(--blue);
  background: var(--paper-bright);
  transform: translateY(-3px) rotate(-0.6deg);
}

.editor-body {
  display: grid;
  min-height: 0;
  grid-template-columns: 44px 1fr;
  border-top: 1px solid #4b5553;
}

.line-numbers {
  overflow: hidden;
  padding: 16px 10px 16px 0;
  color: #687370;
  border-right: 1px solid #303a38;
  font: 13px/1.62 Consolas, "Courier New", monospace;
  text-align: right;
  white-space: pre;
  user-select: none;
}

#codeEditor {
  width: 100%;
  min-height: 0;
  resize: none;
  padding: 16px 18px;
  border: 0;
  outline: 0;
  color: #f2f0e8;
  background: #171e1d;
  caret-color: var(--yellow);
  font: 13px/1.62 Consolas, "Courier New", monospace;
  tab-size: 2;
  white-space: pre;
}

.editor-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  color: #b9c0bd;
  border-top: 1px solid #343d3b;
  background: #202826;
  font-size: 10px;
}

.editor-foot i {
  color: var(--mint);
  font-style: normal;
}

.spark-rail {
  position: relative;
  z-index: 3;
  overflow: visible;
}

.spark-rail::before,
.spark-rail::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.spark-rail::before {
  top: 13%;
  bottom: 11%;
  left: 50%;
  width: 2px;
  background: repeating-linear-gradient(to bottom, transparent 0 12px, var(--blue) 13px 16px, transparent 17px 25px);
  transform: rotate(-4deg);
  opacity: 0.5;
}

.spark-rail::after {
  top: 46%;
  right: -13px;
  width: 27px;
  height: 27px;
  border-top: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
  transform: rotate(45deg);
}

.spark {
  position: absolute;
  z-index: 2;
  color: var(--blue);
  filter: drop-shadow(1px 1px 0 white);
  animation: sparkle-flow 3.2s ease-in-out infinite;
}

.spark--1 { top: 11%; left: 29%; font-size: 18px; }
.spark--2 { top: 24%; right: 22%; color: var(--orange); font-size: 34px; animation-delay: -0.5s; }
.spark--3 { top: 34%; left: 18%; color: var(--mint); font-size: 25px; animation-delay: -1.2s; }
.spark--4 { top: 61%; right: 20%; color: var(--yellow); font-size: 27px; animation-delay: -1.8s; }
.spark--5 { top: 76%; left: 30%; color: var(--orange); font-size: 32px; animation-delay: -2.4s; }
.spark--6 { bottom: 8%; right: 22%; color: var(--blue); font-size: 19px; animation-delay: -0.8s; }

.transform-note {
  position: absolute;
  z-index: 4;
  top: 43%;
  left: 50%;
  width: 72px;
  padding: 7px 5px;
  border: 2px solid var(--ink);
  background: var(--paper-bright);
  box-shadow: 3px 3px 0 var(--yellow);
  font-size: 10px;
  font-weight: 950;
  line-height: 1.2;
  text-align: center;
  transform: translateX(-50%) rotate(-3deg);
}

@keyframes sparkle-flow {
  0%, 100% { transform: translate(-4px, 8px) rotate(-8deg); opacity: 0.45; }
  45% { transform: translate(9px, -12px) rotate(12deg); opacity: 1; }
}

.preview-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  box-shadow: 7px 7px 0 rgba(18, 59, 143, 0.2);
  transform: rotate(0.15deg);
}

.preview-toolbar {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px 8px 16px;
  border-bottom: var(--border);
}

.refresh-button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
}

.refresh-button span {
  display: inline-block;
  font-size: 28px;
  line-height: 1;
}

.refresh-button.is-spinning span {
  animation: one-spin 350ms var(--ease-out);
}

@keyframes one-spin { to { transform: rotate(360deg); } }

.device-switcher {
  display: flex;
  gap: 3px;
}

.device-switcher button {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.device-switcher button[aria-pressed="true"] {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(18, 59, 143, 0.06);
}

.preview-stage {
  display: flex;
  min-height: 0;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background:
    linear-gradient(90deg, rgba(18, 59, 143, 0.06) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(rgba(18, 59, 143, 0.06) 1px, transparent 1px) 0 0 / 20px 20px,
    #ddd7ca;
  transition: padding 260ms var(--ease-out);
}

#previewFrame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  border: 0;
  background: white;
  transition: width 260ms var(--ease-out), border-radius 260ms var(--ease-out), box-shadow 260ms var(--ease-out);
}

.preview-stage.is-tablet,
.preview-stage.is-mobile {
  padding: 22px;
}

.preview-stage.is-tablet #previewFrame {
  width: min(78%, 760px);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 5px 0 var(--blue);
}

.preview-stage.is-mobile #previewFrame {
  width: min(43%, 390px);
  border: 5px solid var(--ink);
  border-radius: 24px;
  box-shadow: 5px 5px 0 var(--blue);
}

.student-actions {
  display: flex;
  max-width: 1700px;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  margin: 20px auto 0;
}

.student-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.student-actions p span {
  color: var(--orange);
}

.publish-button,
.ink-button {
  border: var(--border);
  color: var(--ink);
  background: var(--yellow);
  box-shadow: var(--shadow-ink);
  font-weight: 950;
  transition: transform 140ms var(--spring), box-shadow 140ms ease, background 140ms ease;
}

.publish-button {
  padding: 14px 20px;
  font-size: 15px;
  transform: rotate(-0.5deg);
}

.publish-button span {
  color: var(--orange);
}

.publish-button:hover,
.ink-button:hover {
  transform: translate(-1px, -2px) rotate(0.5deg);
  box-shadow: 7px 8px 0 var(--ink);
}

.publish-button:active,
.ink-button:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}

.publish-button:disabled {
  cursor: default;
  color: #42564c;
  background: var(--mint);
}

.anonymous-fab {
  position: fixed;
  z-index: 40;
  right: clamp(16px, 2vw, 32px);
  bottom: clamp(16px, 2vw, 28px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px 11px 10px;
  border: 3px solid var(--ink);
  color: white;
  background: var(--blue);
  box-shadow: 5px 6px 0 var(--ink), -3px -3px 0 var(--yellow);
  clip-path: polygon(2% 5%, 96% 0, 100% 86%, 89% 91%, 82% 100%, 75% 92%, 4% 96%);
  transform: rotate(-1deg);
  transition: transform 160ms var(--spring);
}

.anonymous-fab:hover {
  transform: rotate(1deg) translateY(-3px);
}

.question-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: var(--yellow);
  font-size: 21px;
  font-weight: 950;
}

.anonymous-fab > span:last-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.anonymous-fab strong {
  font-size: 14px;
}

.anonymous-fab small {
  margin-top: 2px;
  color: #dce7ff;
  font-size: 9px;
}

/* Teacher */
.view--teacher {
  padding: 34px clamp(18px, 3.5vw, 54px) 60px;
}

.teacher-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin: 0 auto 24px;
  max-width: 1700px;
}

.back-link {
  margin: 0 0 12px;
  padding: 5px 0;
  color: var(--blue);
}

.teacher-heading h1 {
  position: relative;
  color: var(--blue);
  font-size: clamp(38px, 4vw, 64px);
  line-height: 1;
}

.teacher-heading h1::after {
  position: absolute;
  right: -12px;
  bottom: -10px;
  left: 0;
  height: 9px;
  content: "";
  border-top: 3px solid var(--blue);
  border-radius: 50%;
  transform: rotate(-1deg);
}

.teacher-heading p {
  margin: 18px 0 0;
}

.teacher-heading p strong {
  color: var(--orange);
  font-size: 24px;
}

.request-ticket {
  padding: 15px 18px;
  border: 2px solid var(--orange);
  background: var(--paper-bright);
  box-shadow: 4px 4px 0 rgba(240, 103, 42, 0.22);
  color: var(--orange);
  transform: rotate(1deg);
}

.teacher-layout {
  display: grid;
  max-width: 1700px;
  min-height: 650px;
  grid-template-columns: minmax(760px, 1fr) 390px;
  margin: 0 auto;
  border-top: 3px solid var(--blue);
  border-bottom: 3px solid var(--blue);
}

.classroom-board {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-rows: 1fr auto;
  padding: 28px 28px 18px 0;
}

.constellation-line {
  position: absolute;
  z-index: 0;
  top: 35px;
  right: 0;
  left: 1%;
  height: 130px;
  opacity: 0.35;
  background:
    radial-gradient(circle at 8% 70%, var(--blue) 0 3px, transparent 4px),
    radial-gradient(circle at 29% 22%, var(--blue) 0 3px, transparent 4px),
    radial-gradient(circle at 55% 60%, var(--orange) 0 3px, transparent 4px),
    radial-gradient(circle at 82% 18%, var(--blue) 0 3px, transparent 4px);
}

.constellation-line::after {
  position: absolute;
  top: 64px;
  left: 6%;
  width: 87%;
  height: 1px;
  content: "";
  background: var(--blue);
  transform: rotate(-2deg);
}

.student-board {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  grid-template-columns: repeat(7, minmax(88px, 1fr));
  gap: 16px 12px;
}

.student-note,
.loading-note {
  min-height: 128px;
  padding: 13px 11px 10px;
  border: 1px solid rgba(32, 37, 34, 0.28);
  background: var(--paper-bright);
  box-shadow: 3px 4px 0 rgba(32, 37, 34, 0.16);
  transform: rotate(var(--note-angle, -0.4deg));
}

.student-note {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  animation: note-arrive 430ms var(--ease-out) both;
  animation-delay: calc(var(--note-index) * 18ms);
}

.student-note::before {
  position: absolute;
  top: -7px;
  left: 48%;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(32, 37, 34, 0.36);
  border-radius: 50%;
  content: "";
  background: var(--pin-color, var(--orange));
  box-shadow: 1px 2px 2px rgba(32, 37, 34, 0.25);
}

.student-note.is-request {
  border: 2px solid var(--orange);
  box-shadow: 4px 5px 0 rgba(240, 103, 42, 0.25);
}

.student-note.is-published {
  border-color: var(--green);
}

@keyframes note-arrive {
  from { opacity: 0; transform: translateY(14px) rotate(var(--note-angle, -0.4deg)); }
  to { opacity: 1; transform: translateY(0) rotate(var(--note-angle, -0.4deg)); }
}

.student-number {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.student-number strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-site-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 14px 0 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.note-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  color: var(--blue);
  font-size: 11px;
  font-weight: 950;
}

.note-status.is-help,
.note-status.is-request {
  color: var(--orange);
}

.note-status.is-published {
  color: var(--green);
}

.note-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.note-actions button,
.note-actions a {
  flex: 1;
  padding: 5px 4px;
  border: 1px solid currentColor;
  color: var(--blue);
  background: transparent;
  font-size: 9px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.note-actions .approve-action {
  color: white;
  background: var(--orange);
}

.status-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 28px;
  padding: 13px 14px;
  border-top: 1px solid rgba(32, 37, 34, 0.3);
  border-bottom: 1px solid rgba(32, 37, 34, 0.3);
  background: rgba(255, 253, 247, 0.7);
}

.status-legend span {
  display: grid;
  grid-template-columns: 30px 1fr;
  color: var(--muted);
  font-size: 9px;
}

.status-legend strong {
  color: var(--ink);
  font-size: 11px;
}

.status-symbol {
  display: grid;
  grid-row: 1 / 3;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.status-symbol--working { color: var(--blue); }
.status-symbol--help,
.status-symbol--request { color: var(--orange); }
.status-symbol--published { color: var(--green); }

.question-inbox {
  position: relative;
  overflow: hidden;
  padding: 28px 20px 22px 28px;
  color: white;
  background: var(--blue);
}

.question-inbox::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -9px;
  width: 12px;
  content: "";
  background: linear-gradient(45deg, transparent 40%, var(--blue) 42%) 0 0 / 12px 14px repeat-y;
}

.inbox-heading {
  position: relative;
  margin-bottom: 18px;
  text-align: center;
}

.inbox-heading h2 {
  margin: 0;
  font-family: "NanumSquareRound", "Arial Black", sans-serif;
  font-size: 36px;
  letter-spacing: -2px;
}

.inbox-heading p {
  display: inline-block;
  margin: 12px 0 0;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.22);
  font-size: 10px;
  font-weight: 900;
  transform: rotate(-1deg);
}

.mail-doodle {
  position: absolute;
  top: -5px;
  right: 12px;
  font-size: 27px;
  transform: rotate(12deg);
}

.question-list {
  display: grid;
  max-height: 565px;
  gap: 14px;
  overflow: auto;
  padding: 5px 6px 15px 2px;
  scrollbar-color: var(--yellow) transparent;
}

.question-note,
.inbox-loading {
  position: relative;
  padding: 15px 14px 13px;
  color: var(--ink);
  border: 1px solid rgba(32, 37, 34, 0.45);
  background: var(--paper-bright);
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.35);
  transform: rotate(var(--question-angle, 0.5deg));
}

.question-note::before {
  position: absolute;
  top: -9px;
  left: 15px;
  content: "⌕";
  color: var(--blue);
  font-size: 25px;
  transform: rotate(-25deg);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-left: 18px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 950;
}

.question-meta time {
  color: var(--muted);
  font-weight: 700;
}

.question-note p {
  margin: 12px 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.resolve-question {
  display: block;
  margin-left: auto;
  padding: 5px 0;
  border: 0;
  color: var(--orange);
  background: transparent;
  font-size: 11px;
  font-weight: 950;
}

.question-note.is-resolved {
  background: #eff8f2;
  opacity: 0.8;
}

.question-note.is-resolved .resolve-question {
  color: var(--green);
}

/* Gallery */
.view--gallery {
  padding: 45px clamp(20px, 5vw, 80px) 110px;
}

.gallery-hero {
  position: relative;
  max-width: 1500px;
  margin: 0 auto 48px;
  padding: 35px 33% 38px 0;
  border-bottom: 3px solid var(--blue);
}

.gallery-hero > p {
  margin: 0 0 10px;
  color: var(--orange);
  font-weight: 950;
}

.gallery-hero h1 {
  font-size: clamp(42px, 6vw, 86px);
  line-height: 0.98;
}

.gallery-orbit {
  position: absolute;
  top: 15px;
  right: 6%;
  width: 230px;
  height: 180px;
  border: 2px dashed var(--blue);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.gallery-orbit i {
  position: absolute;
  color: var(--orange);
  font-size: 28px;
  font-style: normal;
  animation: orbit-pulse 2.8s ease-in-out infinite;
}

.gallery-orbit i:nth-child(1) { top: 20px; left: 38px; }
.gallery-orbit i:nth-child(2) { right: 24px; bottom: 30px; color: var(--blue); animation-delay: -1s; }
.gallery-orbit i:nth-child(3) { bottom: 5px; left: 70px; color: var(--yellow); animation-delay: -2s; }

@keyframes orbit-pulse { 50% { transform: scale(1.3) rotate(15deg); } }

.gallery-grid {
  display: grid;
  max-width: 1500px;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin: 0 auto;
}

.gallery-card {
  position: relative;
  min-height: 260px;
  padding: 28px;
  border: var(--border);
  color: var(--ink);
  background: var(--paper-bright);
  box-shadow: 7px 8px 0 var(--blue);
  text-decoration: none;
  transform: rotate(var(--card-angle, -0.4deg));
  transition: transform 180ms var(--spring), box-shadow 180ms ease;
}

.gallery-card:hover {
  transform: translateY(-7px) rotate(0.5deg);
  box-shadow: 10px 13px 0 var(--orange);
}

.gallery-card::after {
  position: absolute;
  right: 20px;
  bottom: 18px;
  content: "웹으로 보기 →";
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
}

.gallery-card .gallery-number {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid var(--orange);
  border-radius: 50%;
  color: var(--orange);
  font-weight: 950;
}

.gallery-card h2 {
  margin: 38px 0 8px;
  font-size: 25px;
}

.gallery-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.gallery-empty {
  grid-column: 1 / -1;
  padding: 70px 20px;
  border: 2px dashed var(--blue);
  text-align: center;
}

.gallery-empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 28px;
}

/* Dialogs and feedback */
.paper-dialog,
.preview-dialog {
  border: var(--border);
  background: var(--paper-bright);
  box-shadow: 10px 12px 0 var(--ink);
}

.paper-dialog {
  width: min(92vw, 540px);
  padding: 34px;
  overflow: visible;
  transform: rotate(-0.35deg);
}

.paper-dialog[open] {
  animation: dialog-in 360ms var(--spring);
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(24px) rotate(-2deg) scale(0.96); }
  to { opacity: 1; transform: translateY(0) rotate(-0.35deg) scale(1); }
}

dialog::backdrop {
  background: rgba(8, 20, 39, 0.68);
  backdrop-filter: blur(2px);
}

.dialog-close-form {
  position: absolute;
  top: 9px;
  right: 12px;
}

.dialog-close-form button,
.preview-dialog-bar button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
}

.dialog-kicker {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 950;
}

.paper-dialog h2 {
  margin: 0;
  color: var(--blue);
  font-family: "NanumSquareRound", "Arial Black", sans-serif;
  font-size: clamp(27px, 5vw, 38px);
  letter-spacing: -2px;
}

.privacy-copy {
  margin: 16px 0 24px;
  padding: 10px 12px;
  color: #27523f;
  background: #dff1e8;
  font-size: 12px;
  font-weight: 800;
}

.paper-dialog label {
  display: grid;
  gap: 7px;
  margin-top: 17px;
  font-size: 12px;
  font-weight: 950;
}

.paper-dialog select,
.paper-dialog textarea,
.paper-dialog input {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
}

.paper-dialog select,
.paper-dialog input {
  height: 45px;
  padding: 0 12px;
}

.paper-dialog textarea {
  min-height: 145px;
  padding: 13px;
  resize: vertical;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 17px;
}

.dialog-actions > span {
  color: var(--muted);
  font-size: 11px;
}

.ink-button {
  padding: 12px 17px;
  background: var(--yellow);
}

.ink-button:disabled {
  cursor: wait;
  color: var(--muted);
  background: var(--paper-deep);
}

.question-success {
  padding: 24px 8px 12px;
  text-align: center;
}

.question-success > span {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin: 0 auto 20px;
  border: 4px solid var(--green);
  border-radius: 50%;
  color: var(--green);
  font-size: 42px;
  font-weight: 950;
  animation: success-stamp 420ms var(--spring);
}

@keyframes success-stamp { from { transform: scale(1.7) rotate(-12deg); opacity: 0; } }

.question-success p {
  margin: 12px auto 22px;
  color: var(--muted);
  line-height: 1.55;
}

.teacher-login-dialog {
  width: min(90vw, 430px);
}

.form-error {
  min-height: 20px;
  margin: 8px 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.preview-dialog {
  width: min(94vw, 1100px);
  height: min(88vh, 760px);
  padding: 0;
}

.preview-dialog-bar {
  display: flex;
  height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 20px;
  border-bottom: var(--border);
}

.preview-dialog iframe {
  width: 100%;
  height: calc(100% - 54px);
  border: 0;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 28px;
  left: 50%;
  max-width: min(90vw, 520px);
  padding: 12px 18px;
  border: var(--border);
  color: white;
  background: var(--ink);
  box-shadow: 4px 4px 0 var(--yellow);
  font-size: 13px;
  font-weight: 850;
  transform: translateX(-50%);
  animation: toast-in 280ms var(--ease-out);
}

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } }

@media (max-width: 1180px) {
  .studio-grid {
    grid-template-columns: minmax(315px, 0.85fr) 62px minmax(440px, 1.15fr);
  }

  .device-switcher button span {
    display: none;
  }

  .teacher-layout {
    grid-template-columns: minmax(650px, 1fr) 340px;
  }

  .student-board {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 920px) {
  .topbar {
    gap: 10px;
    padding-inline: 16px;
  }

  .class-context {
    display: none;
  }

  .view--entry {
    grid-template-columns: 1fr;
    gap: 42px;
    padding: 55px 18px 80px;
  }

  .view--entry::before {
    top: 18px;
    right: -8%;
    bottom: auto;
    left: -8%;
    height: 470px;
  }

  .entry-copy {
    padding: 30px 20px 70px;
  }

  .entry-copy h1 {
    font-size: clamp(57px, 15vw, 72px);
  }

  .entry-stars {
    right: 0;
  }

  .studio-grid {
    height: auto;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .editor-panel,
  .preview-panel {
    min-height: 560px;
    transform: none;
  }

  .spark-rail {
    height: 90px;
  }

  .spark-rail::before {
    top: 50%;
    right: 10%;
    bottom: auto;
    left: 10%;
    width: auto;
    height: 2px;
    background: repeating-linear-gradient(to right, transparent 0 12px, var(--blue) 13px 16px, transparent 17px 25px);
    transform: rotate(-1deg);
  }

  .spark-rail::after {
    top: 32px;
    right: 6%;
  }

  .spark--1 { top: 30px; left: 15%; }
  .spark--2 { top: 16px; right: 23%; }
  .spark--3 { top: 54px; left: 33%; }
  .spark--4 { top: 48px; right: 38%; }
  .spark--5 { top: 10px; left: 54%; }
  .spark--6 { bottom: 6px; right: 12%; }

  .transform-note {
    top: 26px;
  }

  .teacher-layout {
    grid-template-columns: 1fr;
  }

  .classroom-board {
    padding-right: 0;
  }

  .question-inbox {
    min-height: 600px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 66px;
  }

  .brand-mark {
    min-width: 112px;
    padding: 9px 12px;
  }

  .brand-mark span {
    font-size: 23px;
  }

  .topnav .nav-button:first-child {
    display: none;
  }

  .nav-button--teacher {
    font-size: 0;
  }

  .nav-button--teacher span {
    font-size: 17px;
  }

  .view--student {
    padding: 22px 13px 110px;
  }

  .studio-intro {
    display: block;
  }

  .studio-intro h1 {
    font-size: 34px;
  }

  .save-cluster {
    margin-top: 17px;
  }

  .editor-panel,
  .preview-panel {
    min-height: 520px;
  }

  .code-tabs button {
    min-width: 0;
    flex: 1;
  }

  .preview-toolbar {
    align-items: flex-start;
  }

  .student-actions {
    display: grid;
    justify-items: stretch;
  }

  .student-actions p {
    text-align: center;
  }

  .anonymous-fab {
    right: 13px;
    bottom: 13px;
  }

  .anonymous-fab small {
    display: none;
  }

  .teacher-heading {
    display: block;
  }

  .request-ticket {
    display: inline-block;
    margin-top: 24px;
  }

  .view--teacher {
    padding: 26px 13px 80px;
  }

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

  .student-note {
    min-height: 145px;
  }

  .status-legend {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-hero {
    padding-right: 0;
  }

  .gallery-orbit {
    display: none;
  }

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

  .paper-dialog {
    width: calc(100vw - 22px);
    padding: 28px 20px;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
