:root {
  color-scheme: light;
  --bg: #eaf6fc;
  --panel: #f7fbfe;
  --line: #d6e6f0;
  --ink: #1f2f46;
  --muted: #526980;
  --faint: #8fa2b5;
  --navy: #1f3a5f;
  --navy-light: #2b4c78;
  --sky: #2f9ce8;
  --mint: #2fbf8f;
  --coral: #ee6a5f;
  --gold: #ffc93c;
  --pink: #ff9fd0;
  --screen: #15273c;
  --screen-ink: #eff6ff;
  --focus: #146eaf;
  --tag: linear-gradient(110deg, var(--navy), var(--navy-light));
  --glass: linear-gradient(145deg, rgb(255 255 255 / .98), rgb(247 251 254 / .92));
  --shadow: inset 0 1px 0 #fff, 0 4px 12px rgb(52 87 118 / .09);
  --shadow-small: inset 0 1px 0 #fff, 0 2px 4px rgb(52 87 118 / .08);
  --mono: "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, "Malgun Gothic", monospace;
  --sans: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font: 15px/1.5 var(--sans);
  color: var(--ink);
  background: var(--bg);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background: url("/static/ui/bg-pattern.svg") center top / 600px auto repeat,
              linear-gradient(155deg, #cfeaf8, #eaf6fc 75%);
}

h1, h2, h3, h4, p, pre { margin: 0; }
h1, h2, h3, h4 { line-height: 1.3; letter-spacing: -.035em; word-break: keep-all; }
h1, h2 { font-weight: 800; }
h3, label, summary { font-size: .91rem; font-weight: 700; }
pre, code { font-family: var(--mono); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }

button {
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid #c7dbe9;
  border-radius: 8px;
  background: linear-gradient(#fff, #f6faff);
  box-shadow: var(--shadow-small);
  color: var(--navy);
  font-weight: 700;
  line-height: 1.35;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

button:hover:not(:disabled) { border-color: #8cbddd; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled, button[aria-disabled="true"] {
  color: #66798b;
  border-color: #d3dfe7;
  background: #e7eef3;
  box-shadow: none;
  cursor: default;
}

button.gold {
  min-height: 40px;
  padding-inline: 20px;
  border-color: #dfad24;
  background: linear-gradient(#ffe14d, #ffd21f);
  color: #1f2a44;
  box-shadow: inset 0 1px 0 #fff3a2, 0 3px 0 #c59b2b, 0 5px 9px rgb(113 89 28 / .12);
  font-weight: 800;
}

button.gold:hover:not(:disabled) { transform: translateY(-1px); border-color: #bd901b; }
button.gold:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 2px #d6ad25; }
button.gold:disabled { background: #e6ebed; border-color: var(--line); color: #66798b; box-shadow: none; }

input, select, textarea {
  min-width: 0;
  max-width: 100%;
  padding: 8px 11px;
  border: 1px solid #c3d8e6;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 3px rgb(40 71 96 / .06);
}

input::placeholder, textarea::placeholder { color: #64798c; opacity: 1; }
select { padding-inline-end: 6px; }
textarea { resize: vertical; }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

::selection { color: var(--ink); background: #b7e6ff; }
.muted, #saved, #progress { color: var(--muted); font-size: .82rem; }
.eyebrow, .note-kicker {
  color: #306183;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .09em;
}

#entry, #studio {
  width: calc(100% - clamp(12px, 2vw, 36px));
  max-width: 1880px;
  margin: clamp(6px, 1vw, 18px) auto;
  border: 3px solid rgb(255 255 255 / .8);
  border-radius: 17px;
  box-shadow: 0 16px 48px rgb(52 93 123 / .14), 0 0 0 1px rgb(114 158 185 / .18);
}

#entry {
  display: flex;
  align-items: center;
  min-height: calc(100vh - clamp(12px, 2vw, 36px));
  min-height: calc(100svh - clamp(12px, 2vw, 36px));
  padding: clamp(26px, 6.5vw, 120px);
  background: linear-gradient(90deg, rgb(230 246 254 / .52), transparent 62%),
              url("/static/ui/entry-hero.svg") center / cover no-repeat, #cfeaf8;
}

.entry-text {
  width: min(100%, 430px);
  padding: clamp(26px, 3.4vw, 54px);
  border: 1px solid rgb(255 255 255 / .96);
  border-radius: 15px;
  background: linear-gradient(140deg, rgb(255 255 255 / .97), rgb(244 251 255 / .88));
  box-shadow: inset 0 2px 0 #fff, 0 16px 44px rgb(33 73 108 / .15);
  backdrop-filter: blur(8px);
}

.brand-rule {
  width: 70px;
  height: 7px;
  margin: 0 0 23px 2px;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, var(--sky) 66%, transparent 66% 73%, var(--gold) 73%);
}

.entry-text h1 {
  color: var(--navy);
  font: 900 clamp(2.6rem, 3.6vw, 4.2rem)/.93 var(--sans);  /* fits "ACADEMY" inside the 430px card */
  letter-spacing: -.075em;
}
.entry-text > .eyebrow { margin-top: 15px; color: #336083; font-size: .94rem; }
.entry-text form { margin-top: clamp(26px, 5vh, 56px); padding-top: 21px; border-top: 1px solid #c9dce8; }
.entry-text h2 { margin-bottom: 13px; font-size: 1.24rem; }
.entry-text label, .entry-text input, .entry-text button { display: block; width: 100%; }
.entry-text input { margin: 6px 0 12px; }
#login .discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 47px;
  border-color: #4956d6;
  background: #5865f2;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), 0 3px 0 #3c47ba;
  color: white;
}
#login .discord:hover:not(:disabled) { background: #4752c4; transform: translateY(-1px); }
#login .discord:focus-visible { outline: 3px solid var(--navy); outline-offset: 4px; }
#entry-note { margin-top: 10px; color: var(--muted); font-size: .86rem; }
#entry-note:empty { margin: 0; }

#studio {
  min-height: calc(100vh - clamp(12px, 2vw, 36px));
  background: url("/static/ui/bg-pattern.svg") center top / 560px auto repeat,
              linear-gradient(150deg, #cee8f7, #eaf6fc 78%);
}

#studio > header {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 36px);
  min-height: 85px;
  padding: 7px clamp(14px, 2vw, 38px);
  border-bottom: 1px solid #c8dfed;
  border-radius: 14px 14px 0 0;
  background: var(--glass);
  box-shadow: 0 3px 10px rgb(54 88 116 / .06);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
  font: 900 clamp(1rem, 1.55vw, 1.7rem)/1 var(--sans);
  letter-spacing: -.06em;
}

.wordmark::before {
  content: "";
  width: .72em;
  height: 1.13em;
  transform: skewX(-12deg);
  border-top: .23em solid var(--gold);
  background: var(--tag);
}

nav, .person, .actions, .bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
nav { align-self: stretch; gap: clamp(4px, .6vw, 12px); }
nav button[data-view] {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 76px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: #526980;
  font-size: .8rem;
  white-space: nowrap;
}
nav button[data-view]:hover:not(:disabled) { background: #edf7fd; border-color: var(--line); }
nav .nav-icon { display: block; width: 34px; height: 34px; object-fit: contain; }
nav button[data-view]:not(:has(.nav-icon))::before {
  display: grid;
  place-items: center;
  height: 34px;
  color: var(--navy-light);
  font: 800 18px/1 var(--mono);
  letter-spacing: -.08em;
}
nav [data-view="desk"]:not(:has(.nav-icon))::before { content: "</>" / ""; }
nav [data-view="theory"]:not(:has(.nav-icon))::before { content: "▤" / ""; }
nav [data-view="field"]:not(:has(.nav-icon))::before { content: "⚑" / ""; }
nav [data-view="rank"]:not(:has(.nav-icon))::before { content: "★" / ""; }

nav button[data-view][aria-current]:not([aria-current="false"]) {
  color: var(--navy);
  background: linear-gradient(#fff, #e1f0fb);
  border-color: #c4dbea;
  box-shadow: inset 0 -3px 0 var(--navy);
}
nav button[data-view][aria-current]:not([aria-current="false"])::after {
  content: "here" / "";
  position: absolute;
  top: 1px;
  right: 0;
  padding: 1px 5px 2px;
  transform: rotate(7deg);
  border-radius: 4px;
  color: var(--navy);
  background: var(--pink);
  font: italic 800 10px/1.15 var(--sans);
}

.person { margin-left: auto; min-width: 0; color: var(--muted); font-size: .83rem; }
.person button { min-height: 32px; padding: 5px 10px; font-size: .8rem; }
#user, #progress, #meters, #replay-step {
  width: fit-content;
  max-width: 100%;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--navy);
  background: white;
  box-shadow: var(--shadow-small);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
#user { max-width: min(17vw, 230px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(#user, #progress, #meters, #replay-step):empty { display: none; }

.desk {
  display: grid;
  grid-template-columns: clamp(180px, 16vw, 280px) minmax(0, 1fr) clamp(254px, 24vw, 405px);
  align-items: start;
  gap: clamp(10px, 1vw, 18px);
  padding: clamp(10px, 1vw, 18px);
}

.mission-list, .workspace, .brief, .reading, .field-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
  box-shadow: var(--shadow);
}
.mission-list, .workspace { padding: clamp(12px, 1vw, 20px); }
.mission-list h2, .brief h2 { font-size: clamp(1.14rem, 1.4vw, 1.48rem); }
.mission-list h2, .section-title h2, .note-h, .note-goals h2 {
  position: relative;
  z-index: 0;
  isolation: isolate;
  width: fit-content;
  max-width: calc(100% - 8px);
  margin-inline-start: 4px;
  padding: .34em .86em .39em;
  color: white;
}
:is(.mission-list h2, .section-title h2, .note-h, .note-goals h2)::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  transform: skewX(-12deg);
  border-radius: 3px;
  background: var(--tag);
  box-shadow: inset 3px 0 0 var(--sky), 0 2px 3px rgb(35 61 88 / .13);
}

.mission-list input { width: 100%; margin: 15px 0 9px; font-size: .88rem; }
#missions {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 273px);
  max-height: max(180px, calc(100dvh - 273px));
  margin-top: 12px;
  padding: 3px 4px 5px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #aac6d9 transparent;
}
#missions button {
  display: flex;
  align-items: baseline;
  gap: 7px;
  width: 100%;
  min-height: 40px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  overflow-wrap: anywhere;
  font-size: .85rem;
  font-weight: 650;
}
#missions small { flex: 0 0 auto; min-width: 33px; color: #39688a; font: 700 11px/1.5 var(--mono); }
#missions button:hover:not(:disabled) { border-color: #88badd; background: #f1f9ff; }
#missions button[aria-current]:not([aria-current="false"]) {
  border-color: var(--navy);
  background: var(--tag);
  color: white;
  box-shadow: inset 3px 0 0 #76d0ff, 0 2px 6px rgb(38 71 106 / .15);
}
#missions button[aria-current]:not([aria-current="false"]) small { color: #b8e7ff; }
#missions button:is(:disabled, [aria-disabled="true"], .locked) {
  color: #627486;
  border-color: #d8e1e8;
  background: rgb(223 232 239 / .71);
  box-shadow: none;
}
#missions button:is(:disabled, [aria-disabled="true"], .locked) small { color: inherit; }

.bar {
  flex-wrap: nowrap;
  min-height: 46px;
  padding: 5px 10px;
  border: 1px solid #bfd5e4;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(#eff8ff, #deedf7);
}
.fileicon {
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--tag);
  color: white;
  font: 800 12px/1.3 var(--mono);
}
.bar select { max-width: 55%; padding: 4px 6px; font: 13px/1.45 var(--mono); }
#saved { margin-left: auto; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.editor {
  display: flex;
  height: clamp(260px, 47vh, 720px);
  overflow: hidden;
  border: 1px solid #20364c;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--screen);
  color: var(--screen-ink);
  color-scheme: dark;
}
.editor pre, .editor textarea {
  font: 16px/1.7 var(--mono);
  font-variant-ligatures: none;
  letter-spacing: 0;
  word-spacing: 0;
  tab-size: 4;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  text-align: left;
}
.editor #gutter {
  flex-shrink: 0;
  min-width: 44px;
  padding: 12px 8px;
  overflow: hidden;
  border-right: 1px solid #34495e;
  color: #afc3d6;
  background: #122235;
  text-align: right;
}
.codepane { position: relative; flex: 1; min-width: 0; }
.codepane > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 12px 10px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.codepane pre { overflow: hidden; color: var(--screen-ink); pointer-events: none; }
.codepane textarea {
  resize: none;
  overflow: auto;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: #fff4b3;
  background: transparent;
}
.codepane textarea:focus-visible { outline: 2px solid #80ccfb; outline-offset: -2px; }
.codepane textarea::selection { color: transparent; background: rgb(107 188 249 / .34); }
.kw { color: #87d0ff; }
.str { color: #ffd59d; }
.comment { color: #a3c7b7; }
.num { color: #d8b9ff; }

.actions { margin: 13px 0 16px; }
.workspace > .actions { justify-content: flex-end; }
.workspace > .actions #save { margin-right: auto; }
.console label, .console h3 { color: var(--navy); }
.console textarea { display: block; width: 100%; margin: 6px 0 13px; font-family: var(--mono); }
#log, #example, .rp-term {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f8fc;
  color: #28445c;
  font: .86rem/1.65 var(--mono);
}
#log, #example { padding: 11px 13px; }
#log { min-height: 75px; max-height: 36vh; margin-top: 7px; overflow: auto; }

.mission-art, .section-title {
  background: url("/static/ui/banner.svg") 68% center / cover no-repeat, #d7edf9;
}
.mission-art {
  height: clamp(95px, 10vw, 152px);
  border-bottom: 1px solid var(--line);
  border-radius: 9px 9px 0 0;
}
.brief > .info { padding: clamp(14px, 1.2vw, 23px); }
.brief p, .reading p { line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.info h2 { margin: 7px 0 11px; color: var(--navy); overflow-wrap: anywhere; }
.info h3 { margin: 17px 0 7px; }
.info #task { font-size: .94rem; }
#qid { color: #366584; font-variant-numeric: tabular-nums; }
details, #mentor-box { margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--line); }
summary { color: var(--navy); }
summary::marker { color: #47789b; }
summary:hover { color: #156498; }
details p, #reply { margin-top: 8px; color: var(--muted); font-size: .89rem; }
#question { width: 100%; margin: 7px 0; }
#ask { width: 100%; }
#reply strong { color: var(--navy); font-weight: 750; }
#reply code, .note p code, .note li code {
  padding: .05em .33em;
  border: 1px solid #d9e7f0;
  border-radius: 4px;
  color: #245173;
  background: #f0f7fc;
  font-family: var(--mono);
  font-size: .88em;
}
#reply pre { margin: 7px 0; padding: 9px 11px; border-radius: 7px; background: var(--screen); color: var(--screen-ink); }
#reply pre code { padding: 0; border: 0; background: none; color: inherit; }

.secondary { max-width: 1100px; margin: clamp(14px, 3vw, 48px) auto; padding: 0 clamp(10px, 2vw, 28px); }
.section-title {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 7px;
  min-height: clamp(116px, 12vw, 176px);
  padding: 20px clamp(17px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
}
.section-title .eyebrow { padding: 2px 9px; border-radius: 20px; background: rgb(255 255 255 / .94); }
.section-title h2 { font-size: clamp(1.55rem, 2.5vw, 2.45rem); }
.reading { padding: clamp(18px, 3vw, 38px); line-height: 1.65; }
.section-title + .reading, .section-title + .field-card { border-top: 0; border-radius: 0 0 10px 10px; }
.reading select, .reading input { margin: 0 6px 10px 0; }
.reading h2, .reading p { margin: 6px 0 14px; }
.reading h2 { color: var(--navy); }
#answer { display: block; width: min(100%, 600px); }
#feedback:not(:empty) { padding: 12px 15px; border-left: 3px solid var(--sky); border-radius: 6px; background: #eef7fe; }
.field-card img { display: block; width: 100%; height: clamp(160px, 35vh, 340px); object-fit: cover; }
.field-card .reading { border: 0; border-radius: 0 0 10px 10px; box-shadow: none; }
#world-actions { margin-bottom: 0; }
#ranking { margin: 0; padding-inline-start: clamp(50px, 6vw, 76px); }
.reading li { margin: 6px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-small); }
.reading li::marker { color: var(--navy); font-weight: 800; font-variant-numeric: tabular-nums; }
#ranking li:first-child { border-color: #e5c562; background: linear-gradient(105deg, #fff8da, #fff 65%); }

#notice:not(:empty) {
  position: fixed;
  z-index: 4;
  inset: auto auto max(16px, env(safe-area-inset-bottom)) 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 11px 18px;
  border: 1px solid #486485;
  border-left: 4px solid var(--gold);
  border-radius: 9px;
  background: var(--navy);
  color: white;
  box-shadow: 0 7px 20px rgb(27 54 82 / .22);
  overflow-wrap: anywhere;
}

.replay {
  margin: 10px 0 16px;
  padding: clamp(11px, 1.2vw, 18px);
  border: 1px solid #c7deed;
  border-radius: 10px;
  background: linear-gradient(150deg, #edf7fd, #f8fcff);
  box-shadow: inset 0 1px 0 #fff;
}
.verdict {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 7px;
  background: white;
  font-weight: 800;
}
.verdict.good { border-left-color: var(--mint); color: #176847; background: #f4fcf8; }
.verdict.bad { border-left-color: var(--coral); color: #993c35; background: #fff7f5; }
.verdict.warn { border-left-color: var(--gold); color: #765515; background: #fffbee; }
.verdict.info { border-left-color: var(--sky); color: #225880; background: #f6fbff; }
.replay-brief { margin: 10px 2px; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.stage-view { min-height: 120px; overflow-wrap: anywhere; }
.rp-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 9px; }
.rp-panel { flex: 1 1 200px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow-small); }
.rp-panel h4 { margin: 0 0 9px; color: var(--navy); font-size: .85rem; font-weight: 800; }
.rp-term { max-height: 180px; padding: 8px 10px; overflow: auto; }
.rp-check { margin-top: 8px; font-size: .85rem; font-weight: 750; }
.rp-check.pass { color: #18744f; }
.rp-check.fail, .floor .floor-note, .slot em { color: #a03f38; }
.rp-diff { margin-top: 9px; color: #78530c; font: .83rem/1.55 var(--mono); }
.rp-empty { padding: 24px 8px; color: var(--muted); font-size: .9rem; }
.drawer { border: 1px dashed #98b3c7; border-radius: 8px; background: #f6fafc; }
.drawer.open { border-style: solid; border-color: #dec163; background: #fffcef; }
.tower { min-width: 0; }
.tower .floor { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tower .floor:last-child { border-bottom: 0; }
.floor-no, .more { font: 700 12px/1.4 var(--mono); }
.floor-no { min-width: 34px; color: var(--muted); }
.floor .floor-note { margin-left: auto; font-size: .79rem; }
.lamps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.lamp {
  width: 14px;
  height: 14px;
  border: 1px solid #bd901d;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff7bf 12%, #ffe370 35%, #ffc93c 75%);
  box-shadow: 0 0 5px rgb(255 201 60 / .5);
  animation: rp-light .28s ease-out;
}
.more { color: #79580e; }
.floor.bad .lamp { border-color: #c0574e; background: #ff9b90; box-shadow: inset 0 2px 0 #ffd1cb; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.slot {
  min-width: 0;
  padding: 9px 5px;
  border: 1px solid #bdd3e3;
  border-radius: 8px;
  background: #f4faff;
  color: var(--navy);
  text-align: center;
  font-size: .86rem;
  overflow-wrap: anywhere;
}
.slot small { display: block; color: var(--muted); font: 11px/1.5 var(--mono); }
.slot.empty { border-style: dashed; background: #f4f7f9; color: var(--muted); }
.slot.changed { border-color: #d0a72b; background: #fff7ce; animation: rp-drop .32s ease-out; }
.slot.bad { border-color: var(--coral); background: #fff5f3; }
.slot em { display: block; margin-top: 3px; font-size: .76rem; font-style: normal; }
.replay-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.replay-bar .actions { gap: 5px; margin: 0; }
.replay-bar button { min-height: 33px; padding: 5px 10px; font-size: .83rem; }
#rp-play:not(:disabled) { background: var(--tag); border-color: var(--navy); color: white; box-shadow: none; }
.replay details { margin-top: 11px; padding-top: 9px; }
#replay-log { max-height: 220px; margin: 7px 0 0; padding-left: 29px; overflow: auto; color: var(--muted); font-size: .84rem; }
#replay-log li { padding: 3px 5px; }
#replay-log li[aria-current]:not([aria-current="false"]) { border-radius: 4px; color: var(--navy); background: #dceffc; font-weight: 750; }
@keyframes rp-light { from { opacity: .3; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
@keyframes rp-drop { from { transform: translateY(-5px); } to { transform: translateY(0); } }

body.reading-note { overflow: hidden; }
.reader[hidden], .note-card[hidden] { display: none; }
.note-card, .reader { font-family: var(--sans); color: var(--ink); word-break: keep-all; overflow-wrap: anywhere; }
.note-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 7px 10px;
  width: 100%;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid #bfd9e9;
  border-radius: 9px;
  background: linear-gradient(120deg, #fff 60%, #eef8ff);
  box-shadow: inset 3px 0 0 var(--sky), var(--shadow-small);
  text-align: left;
}
.note-kicker, .note-meta, .note-open, .note-num, .note-figure figcaption, .note-code-title { font-variant-numeric: tabular-nums; }
.note-card .note-kicker, .note-card strong { grid-column: 1 / -1; }
.note-card strong { color: var(--navy); font-size: 1.27rem; line-height: 1.4; letter-spacing: -.04em; }
.note-meta, .note-open { font-size: .79rem; line-height: 1.6; }
.note-meta { color: var(--muted); font-weight: 550; }
.note-open { color: #1e648e; font-weight: 750; }
.note-card:hover { border-color: #8ab9d7; }
.note-card:hover .note-open { text-decoration: underline; text-underline-offset: 3px; }

.reader {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  grid-template-rows: minmax(0, 1fr);
  padding: clamp(12px, 3vh, 32px) 16px;
  background: rgb(28 55 80 / .56);
  backdrop-filter: blur(4px);
  color-scheme: light;
}
.reader-sheet {
  position: relative;
  width: min(100%, 880px);
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-block-start: 64px;
  scrollbar-color: #b3cddd #f6fbfe;
  border: 3px solid rgb(255 255 255 / .94);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 22px 72px rgb(17 43 68 / .27);
}
.reader-close {
  position: sticky;
  z-index: 3;
  top: 7px;
  display: block;
  min-height: 40px;
  margin: 7px 9px 7px auto;
  padding: 6px 14px;
  background: #fff;
  font-size: .86rem;
}
.reader-close:hover { color: #155b8d; }
.note-card:focus-visible, .reader-close:focus-visible, .note summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.note {
  --gutter: clamp(24px, 7.8%, 70px);
  padding: 0 var(--gutter) clamp(44px, 7vw, 76px);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: -.013em;
}
.note p { margin: 0 0 1em; }
.note strong { color: var(--navy); font-weight: 750; }
.note code { font: .89em var(--mono); font-variant-ligatures: none; letter-spacing: 0; }
.note-hero {
  position: relative;
  isolation: isolate;
  margin-inline: calc(-1 * var(--gutter));
  border-block: 1px solid var(--line);
  background: #eaf6fc;
}
.note-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.note-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f3faff 0%, rgb(244 251 255 / .97) 33%, rgb(244 251 255 / .86) 50%, transparent 73%);
  pointer-events: none;
}
.note-hero-text {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: start;
  width: 56%;
  min-height: 240px;
  padding: 26px 20px 26px var(--gutter);
}
.note-hero-text .note-kicker { margin: 0 0 14px; padding: 3px 9px; border: 1px solid #c3d9e7; border-radius: 30px; background: white; }
.note-hero h1 { color: var(--navy); font-size: clamp(2rem, 4vw, 2.85rem); line-height: 1.18; letter-spacing: -.055em; text-wrap: balance; }
.note-goals {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 3fr;
  align-items: start;
  gap: 17px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.note-goals h2 { margin-top: 3px; font-size: .93rem; }
.note-goals ol { margin: 0; padding-left: 2em; list-style: decimal-leading-zero; }
.note-goals li { padding-left: .4em; }
.note-goals li::marker { color: #376289; font: 700 12px var(--mono); }
.note-h {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-block: 43px 17px;
  font-size: clamp(1.25rem, 2.7vw, 1.65rem);
  line-height: 1.38;
}
.note-h strong { color: inherit; }
.note-num { flex: none; color: #ffe27a; font: 750 .73em/1 var(--mono); }

.note-figure { margin: 28px 0; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.note-figure img { display: block; width: 100%; height: auto; border-radius: 5px; }
.note-figure figcaption { padding: 8px 6px 2px; color: var(--muted); font-size: .83rem; line-height: 1.6; }
.note-table { margin: 23px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.note-table table { width: 100%; border-collapse: collapse; font-size: .94rem; font-variant-numeric: tabular-nums; }
.note-table th, .note-table td { padding: 10px 13px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.note-table th { background: #eaf4fb; color: var(--navy); font-size: .85rem; font-weight: 750; }
.note-table tbody tr:nth-child(even) { background: #f8fbfe; }
.note-table tbody tr:last-child td { border-bottom: 0; }

.note-callout {
  --label-color: var(--sky);
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
  gap: 3px 16px;
  margin: 24px 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  box-shadow: var(--shadow-small);
}
.note-callout::before {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  margin-top: 3px;
  padding: 4px 8px;
  border-left: 3px solid var(--label-color);
  border-radius: 3px;
  background: var(--tag);
  color: white;
  font: 750 10px/1.5 var(--mono);
  letter-spacing: .065em;
}
.note-callout > :where(p, details, .note-callout-title) { grid-column: 2; }
.note-callout p { margin: 0; }
.note-callout .note-callout-title { grid-row: 1; margin: 0 0 4px; color: var(--navy); font-size: 1.09rem; font-weight: 800; line-height: 1.5; }
.tone-key { --label-color: var(--sky); }
.tone-key::before { content: "CONCEPT"; }
.tone-tip { --label-color: var(--mint); }
.tone-tip::before { content: "TIP"; }
.tone-warn { --label-color: var(--coral); }
.tone-warn::before { content: "PITFALL"; }
.tone-try { --label-color: var(--gold); }
.tone-try::before { content: "EXERCISE"; }
.note-callout details { margin-top: 9px; padding-top: 4px; }

.note summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 0;
  list-style: none;
}
.note summary::-webkit-details-marker { display: none; }
.note summary::after {
  content: "+" / "";
  display: grid;
  flex: 0 0 24px;
  place-items: center;
  height: 24px;
  margin-inline-start: auto;
  border: 1px solid #c4dbe9;
  border-radius: 50%;
  color: var(--navy);
  background: #fff;
  font: 700 17px/1 var(--mono);
}
.note details[open] > summary::after { content: "−" / ""; background: var(--navy); color: white; }
.note summary:hover { color: #126296; }
.note-callout summary { font-size: .91rem; }
.note details[open] > p { margin: 3px 0 0; padding: 7px 0; color: var(--ink); font-size: .95rem; }
.note-quiz { margin: 20px 0; padding: 0 15px; border: 1px solid var(--line); border-radius: 9px; background: #f7fbff; }
.note-quiz summary { padding: 12px 0; font-size: 1rem; font-weight: 750; }
.note .note-quiz[open] > p { padding: 10px 0 14px; border-top: 1px solid var(--line); font-weight: 400; }
.note-quiz + .note-quiz { margin-top: -10px; }

.note-code {
  margin: 24px 0;
  overflow: hidden;
  border: 1px solid #263d56;
  border-radius: 9px;
  background: var(--screen);
  color: var(--screen-ink);
}
.note-code .note-code-title { margin: 0; padding: 9px 16px; border-bottom: 1px solid #3a526a; background: #203751; color: #d3e8f9; font-size: .84rem; font-weight: 700; }
.note-code pre { margin: 0; padding: 16px; overflow-x: auto; font: 14px/1.8 var(--mono); letter-spacing: 0; tab-size: 4; white-space: pre; overflow-wrap: normal; }
.note-code pre code { font: inherit; white-space: pre; }
.note-check { margin: 22px 0; padding: 0; list-style: none; }
.note-check li { position: relative; padding: 7px 0 7px 27px; }
.note-check li::before {
  content: "";
  position: absolute;
  top: 1em;
  left: 3px;
  width: 12px;
  height: 8px;
  transform: rotate(-45deg);
  border-left: 3px solid #278769;
  border-bottom: 3px solid #278769;
}

@media (max-width: 980px) {
  #studio > header { gap: 10px; flex-wrap: wrap; padding-inline: 12px; }
  nav { gap: 3px; }
  nav button[data-view] { min-width: 68px; padding-inline: 8px; }
  .desk { grid-template-columns: clamp(156px, 22vw, 202px) minmax(0, 1fr); }
  .brief { display: grid; grid-column: 1 / -1; grid-template-columns: minmax(110px, 23%) minmax(0, 1fr); }
  .mission-art { height: 100%; border: 0; border-right: 1px solid var(--line); border-radius: 9px 0 0 9px; }
  .brief > .info { padding: 20px; }
  #missions { max-height: 550px; }
}

@media (max-width: 720px) {
  .reader { padding: 0; }
  .reader-sheet { height: 100%; width: 100%; border: 0; border-radius: 0; }
  .reader-close { min-height: 44px; }
  .note { --gutter: clamp(19px, 5.5vw, 35px); }
  .note-hero img { position: static; display: block; height: auto; aspect-ratio: 1200 / 420; }
  .note-hero::after { display: none; }
  .note-hero-text { display: block; width: auto; min-height: 0; padding: 20px var(--gutter) 24px; }
  .note-hero-text .note-kicker { width: fit-content; margin-bottom: 10px; }
  .note-goals { grid-template-columns: 1fr; gap: 12px; padding: 21px 0; }
  .note-h { gap: 9px; margin-top: 34px; }
  .note-callout { display: block; margin: 21px 0; padding: 15px; }
  .note-callout::before { display: table; margin: 0 0 9px; }
  .note-table th, .note-table td { padding: 9px 8px; }
}

@media (max-width: 620px) {
  #entry {
    align-items: flex-end;
    padding: clamp(180px, 36svh, 320px) 13px 16px;
    background: linear-gradient(0deg, #e1f2fc 6%, rgb(225 242 252 / .1) 60%, transparent),
                url("/static/ui/entry-hero.svg") 78% top / auto 64% no-repeat, #d7eef9;
  }
  .entry-text { width: min(100%, 390px); padding: 22px; }
  .brand-rule { height: 5px; margin-bottom: 14px; }
  .entry-text h1 { font-size: clamp(3rem, 10vw, 4rem); }
  .entry-text > .eyebrow { margin-top: 10px; }
  .entry-text form { margin-top: 22px; padding-top: 16px; }
  #studio > header { gap: 7px; padding: 9px 8px 7px; }
  .wordmark { gap: 6px; }
  .person { order: 1; flex-wrap: nowrap; gap: 5px; }
  #user { max-width: 22vw; padding: 3px 7px; }
  nav { order: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 4px; }
  nav button[data-view] { min-width: 0; min-height: 59px; padding: 3px 1px 5px; font-size: .77rem; }
  nav .nav-icon { width: 34px; height: 34px; }
  .desk { display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 7px; }
  .mission-list, .workspace { padding: 10px; }
  .mission-list { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px 10px; }
  .mission-list h2 { font-size: 1rem; }
  .mission-list #progress { grid-column: 2; grid-row: 1; justify-self: end; font-size: .75rem; }
  .mission-list input, #missions { grid-column: 1 / -1; width: 100%; margin: 0; }
  #missions { display: flex; max-height: none; padding: 3px 2px 5px; overflow-x: auto; }
  #missions button { flex: 0 0 auto; width: auto; max-width: 85%; min-height: 38px; }
  #missions small { min-width: auto; }
  .bar { gap: 6px; padding-inline: 7px; }
  #saved { font-size: .73rem; }
  .editor { height: 48vh; min-height: 245px; }
  .editor #gutter { min-width: 35px; padding-inline: 5px; }
  .workspace > .actions { gap: 6px; }
  .workspace > .actions button { padding-inline: 10px; }
  .brief { display: block; }
  .mission-art { height: 76px; border: 0; border-radius: 9px 9px 0 0; background-position: center 56%; }
  .brief > .info { padding: 14px; }
  .secondary { padding-inline: 7px; margin-block: 9px; }
  .reading { padding: 15px; }
  .reading select, .reading input { width: 100%; margin-right: 0; }
  .replay-bar { align-items: flex-start; }
  .replay-bar button { min-height: 36px; }
}

@media (prefers-reduced-motion: no-preference) {
  .note details[open] > p { animation: note-answer .16s ease-out; }
}
@keyframes note-answer { from { opacity: .25; transform: translateY(-2px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button.gold:hover:not(:disabled), button:active:not(:disabled), #login .discord:hover:not(:disabled) { transform: none; }
}

@media (forced-colors: active) {
  .codepane pre { display: none; }
  .editor, .editor #gutter, .codepane textarea { background: Canvas; color: CanvasText; }
  .codepane textarea { -webkit-text-fill-color: CanvasText; caret-color: CanvasText; }
  .codepane textarea::selection { color: HighlightText; background: Highlight; }
  :where(a, button, input, select, textarea, summary):focus-visible { outline-color: Highlight; }
  nav button[data-view][aria-current]:not([aria-current="false"]),
  #missions button[aria-current]:not([aria-current="false"]),
  #replay-log li[aria-current]:not([aria-current="false"]) { outline: 2px solid Highlight; outline-offset: -3px; }
  .slot.changed, .drawer.open { border: 2px solid Highlight; }
  .slot.bad, .verdict.bad, .floor.bad .lamp { border: 3px double CanvasText; }
  .lamp { background: Highlight; border-color: CanvasText; }
  .reader { background: Canvas; }
  .note-callout::before, .note summary::after { border: 1px solid CanvasText; }
}

/* Visual Studio-style editor (Monaco). The file bar becomes a VS 2022 Dark document well. */
.workspace .bar { background: #2D2D30; border-color: #3F3F46; border-radius: 8px 8px 0 0; color: #F1F1F1; gap: 0; padding: 0 8px 0 0; min-height: 36px; }
.workspace .bar .fileicon { align-self: stretch; display: grid; place-items: center; margin-right: 0; padding: 0 10px; border-radius: 8px 0 0 0; background: #68217A; color: #fff; font: 700 11px/1 var(--mono); }
.workspace .bar select { align-self: stretch; max-width: 55%; padding: 0 28px 0 12px; border: 0; border-top: 2px solid #007ACC; border-radius: 0; background-color: #1E1E1E; color: #F1F1F1; font: 13px/1 "Segoe UI", "Malgun Gothic", sans-serif; }
.workspace .bar select:focus-visible { outline: 1px solid #007ACC; outline-offset: -1px; }
.workspace .bar #saved { color: #9DA5B4; font-size: .76rem; }
.editor.vs { background: #1E1E1E; border-color: #3F3F46; }
.editor.vs > #gutter, .editor.vs > .codepane { display: none; }
.monaco-host { flex: 1; min-width: 0; height: 100%; }
.monaco-host[hidden] { display: none; }
.vs-usertype { color: #4EC9B0 !important; }
/* Keep the site's global form styles out of Monaco's internal elements. */
.monaco-editor textarea.inputarea, .monaco-editor .native-edit-context { min-width: 0 !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; outline: none !important; resize: none !important; }
.monaco-editor input, .monaco-editor textarea:not(.inputarea) { min-height: 0; padding: 2px 4px; border: 1px solid #3F3F46; border-radius: 2px; background: #3C3C3C; color: #F1F1F1; box-shadow: none; font: 13px "Segoe UI", "Malgun Gothic", sans-serif; }
.monaco-editor button { min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; transform: none; }
.monaco-editor pre { white-space: pre; }

/* ---- Mission toys (static/toys.js) ---- */
.toy { position: relative; margin: 4px 0 12px; padding: 12px; border: 1px solid #d6e6f0; border-radius: 12px; background: linear-gradient(#f4fbff, #ffffff); box-shadow: 0 2px 8px rgb(31 58 95 / .08); }
.toy-svg { display: block; width: 100%; height: auto; max-height: 360px; }
.toy-caption { margin: 10px 2px 0; color: #1f2f46; font-weight: 700; line-height: 1.55; }
.toy svg g { transition: transform .45s cubic-bezier(.3,.9,.3,1.15), opacity .3s; }
/* C01 gate */
.toy-gate .lit > [id$="-on"] { animation: toy-lamp .45s ease-out both; animation-delay: inherit; transform-box: fill-box; transform-origin: center; }
.toy-gate [id^="lamp"].wrong { filter: drop-shadow(0 0 6px #ee6a5f) drop-shadow(0 0 2px #ee6a5f); }
.toy-gate [id="door-left"], .toy-gate [id="door-right"] { transition: transform 1.1s cubic-bezier(.5,0,.2,1) .7s; transform-box: view-box; }
.toy-gate-box.open [id="door-left"] { transform: translateX(-112px); }
.toy-gate-box.open [id="door-right"] { transform: translateX(112px); }
.toy-gate [id="gate-light"] { opacity: .25; transition: opacity 1s ease .9s; }
.toy-gate-box.open [id="gate-light"] { opacity: 1; }
@keyframes toy-lamp { 0% { transform: scale(.6); opacity: .2; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }

/* C03 loot */
@keyframes toy-bounce { 50% { transform: translateY(-4px); } }
@keyframes toy-jump { 40% { transform: translateY(-14px); } }
@keyframes toy-shake { 25% { transform: translateX(-4px) rotate(-3deg); } 75% { transform: translateX(4px) rotate(3deg); } }
@keyframes toy-coin { from { transform: translateY(-26px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
/* A01 robot */
.toy-robot-box { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: start; }
.toy-robot-box .toy-caption { grid-column: 1 / -1; }
.toy-robot-box.success { border-color: #2fbf8f; box-shadow: 0 0 0 3px rgb(47 191 143 / .25); }
.toy-robot [id="arm"] { transition: transform .5s cubic-bezier(.4,.1,.2,1); }
.toy-robot [id="crate"] { transition: transform .5s cubic-bezier(.4,.1,.2,1); }
.toy-commands { margin: 0; padding: 8px 8px 8px 28px; max-height: 300px; overflow: auto; border: 1px solid #d6e6f0; border-radius: 8px; background: #fff; font: .8rem/1.6 var(--mono); color: #1f2f46; }
.toy-commands li.bad { color: #b8392d; font-weight: 700; }
@media (max-width: 720px) { .toy-robot-box { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .toy *, .toy svg g { animation: none !important; transition: none !important; } }

/* File tab tools (add / delete project files) */
.workspace .bar .bar-btn { align-self: center; margin-left: 6px; min-height: 0; padding: 3px 10px; border: 1px solid #3F3F46; border-radius: 3px; background: #3E3E42; color: #F1F1F1; font: 12px/1.4 "Segoe UI", "Malgun Gothic", sans-serif; box-shadow: none; }
.workspace .bar .bar-btn:hover:not(:disabled) { background: #007ACC; border-color: #007ACC; transform: none; }
.workspace .bar .bar-btn:disabled { opacity: .45; }
.workspace .bar #file-del[data-arm] { background: #A1260D; border-color: #A1260D; }
.workspace .bar .file-form { display: inline-flex; align-items: center; margin-left: 6px; }
.workspace .bar .file-form[hidden] { display: none; }
.workspace .bar #file-name { width: 190px; min-height: 0; padding: 3px 8px; border: 1px solid #007ACC; border-radius: 2px; background: #1E1E1E; color: #F1F1F1; font: 12px/1.4 var(--mono); box-shadow: none; }

/* ---- Theater: full-screen stage for toy missions ---- */
body.theater-on { overflow: hidden; }
.theater { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: auto 1fr; background: radial-gradient(ellipse at 60% 30%, #1f3a5f 0%, #0d1622 70%); color: #eaf2f8; animation: th-in .45s cubic-bezier(.2,.9,.3,1) both; }
.theater[hidden] { display: none; }
@keyframes th-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
.theater-top { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: rgb(0 0 0 / .25); border-bottom: 1px solid rgb(255 255 255 / .08); }
.theater-live { padding: 3px 9px; border-radius: 4px; background: #e5484d; color: #fff; font: 800 .74rem/1.4 var(--mono); letter-spacing: .08em; animation: th-blink 1.2s steps(2) infinite; }
@keyframes th-blink { 50% { opacity: .55; } }
.theater-mode { padding: 3px 9px; border-radius: 999px; background: #ffd21f; color: #1f2a44; font-weight: 800; font-size: .78rem; }
.theater-top strong { font-size: 1.05rem; }
.theater-status { color: #9fc3df; font-size: .86rem; }
.theater[data-phase="loading"] .theater-status::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; border: 2px solid #9fc3df; border-top-color: transparent; border-radius: 50%; vertical-align: -2px; animation: th-spin .8s linear infinite; }
@keyframes th-spin { to { transform: rotate(360deg); } }
.theater-close { margin-left: auto; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .25); color: #fff; }
.theater-body { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; gap: 16px; padding: 16px 18px; min-height: 0; }
.theater-code { display: flex; flex-direction: column; min-height: 0; border: 1px solid #3F3F46; border-radius: 10px; background: #1E1E1E; overflow: hidden; box-shadow: 0 20px 50px rgb(0 0 0 / .45); }
.theater-file { margin: 0; padding: 8px 12px; background: #2D2D30; color: #9DA5B4; font: 12px/1.4 "Segoe UI", "Malgun Gothic", sans-serif; border-top: 2px solid #007ACC; }
.th-code { flex: 1; overflow: auto; padding: 8px 0; font: 14px/1.75 'Cascadia Mono', Consolas, monospace; color: #DCDCDC; }
.th-line { position: relative; display: flex; padding-right: 12px; white-space: pre; transition: background .25s, opacity .25s; }
.th-no { flex: 0 0 44px; padding-right: 12px; text-align: right; color: #2B91AF; user-select: none; }
.th-src { flex: 1; }
.th-line.done { background: rgb(47 191 143 / .08); }
.th-line.done .th-no::before { content: "✓"; position: absolute; left: 6px; color: #2fbf8f; }
.th-line.active { background: linear-gradient(90deg, rgb(255 210 31 / .35), rgb(255 210 31 / .08)); box-shadow: inset 3px 0 #ffd21f; animation: th-run .5s ease-out; }
.th-line.active .th-no { color: #ffd21f; font-weight: 800; }
.th-line.active .th-no::before { content: "▶"; position: absolute; left: 6px; color: #ffd21f; }
@keyframes th-run { from { background-color: rgb(255 210 31 / .7); transform: translateX(6px); } }
.theater-stage { min-height: 0; overflow: auto; }
.theater-stage .replay { margin: 0; border: 0; background: transparent; }
.theater-stage .replay-brief { color: #9fc3df; }
.theater-stage .verdict { display: none; }
.theater-stage .toy { box-shadow: 0 0 0 1px rgb(255 255 255 / .15), 0 30px 70px rgb(0 0 0 / .5); }
.theater-stage .toy-svg { max-height: 52vh; }
.theater-stage .rp-panel { background: #f4fbff; color: #1f2f46; }
.theater-stage .replay-bar, .theater-stage .replay details { color: #cfe3f2; }
.theater-count { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; font: 900 clamp(5rem, 16vw, 12rem)/1 "Segoe UI", "Malgun Gothic", sans-serif; color: #ffd21f; text-shadow: 0 0 40px rgb(255 210 31 / .6), 0 8px 0 #1f3a5f; }
.theater-count.pop { animation: th-count .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes th-count { from { transform: scale(2.4); opacity: 0; } 60% { opacity: 1; } to { transform: scale(1); opacity: .95; } }
.theater-result { position: fixed; left: 50%; top: 50%; z-index: 3; width: min(560px, 92vw); padding: 26px 28px 22px; border-radius: 18px; text-align: center; background: rgb(255 255 255 / .97); color: #1f2f46; box-shadow: 0 30px 90px rgb(0 0 0 / .6); transform: translate(-50%, -50%); animation: th-stamp .55s cubic-bezier(.2,1.5,.4,1) both; }
.theater-result[hidden] { display: none; }
@keyframes th-stamp { from { transform: translate(-50%, -50%) scale(2) rotate(-8deg); opacity: 0; } to { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; } }
.th-stamp { margin: 0 0 8px; font: 900 clamp(2rem, 5vw, 3.2rem)/1.05 "Segoe UI", "Malgun Gothic", sans-serif; letter-spacing: .02em; }
.theater-result.win .th-stamp { color: #1f3a5f; text-shadow: 0 3px 0 #ffd21f; }
.theater-result.lose .th-stamp { color: #c0392b; }
.theater-result.lose { animation: th-stamp .55s cubic-bezier(.2,1.5,.4,1) both, th-shake .5s ease-in-out .55s 1; }
@keyframes th-shake { 25% { margin-left: -8px; } 75% { margin-left: 8px; } }
.th-why { margin: 0 0 8px; white-space: pre-wrap; text-align: left; max-height: 30vh; overflow: auto; font-size: .92rem; line-height: 1.55; color: #33475e; }
.th-reward { margin: 0 0 14px; font-weight: 800; color: #9a6b00; }
.th-actions { display: flex; justify-content: center; gap: 10px; }
.theater-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.theater-confetti i { position: absolute; top: -20px; left: var(--x); width: 10px; height: 16px; border-radius: 2px; animation: th-fall var(--t) cubic-bezier(.25,.6,.4,1) var(--d) both; }
@keyframes th-fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }
@media (max-width: 860px) { .theater-body { grid-template-columns: 1fr; overflow: auto; } .theater-code { max-height: 34vh; } }
@media (prefers-reduced-motion: reduce) { .theater, .theater *, .theater-result { animation: none !important; } }

/* 이론실 quiz: timer gauge, round banner, feedback states */
.reading .round { margin: 0 0 6px; color: #306183; font-size: .82rem; font-weight: 800; }
.timer { position: relative; height: 14px; margin: 10px 0 12px; border-radius: 999px; background: #e3edf4; overflow: hidden; box-shadow: inset 0 1px 2px rgb(31 58 95 / .15); }
.timer[hidden] { display: none; }
.timer-bar { position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #2fbf8f, #5fd6a8); transition: width .1s linear, background .4s; }
.timer[data-level="warn"] .timer-bar { background: linear-gradient(90deg, #ff9f1c, #ffc24b); }
.timer[data-level="danger"] .timer-bar { background: linear-gradient(90deg, #e5484d, #ff6b6b); animation: timer-pulse .6s ease-in-out infinite alternate; }
@keyframes timer-pulse { to { filter: brightness(1.25); } }
.timer-text { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 800 .68rem/1 var(--mono); color: #1f2f46; }
#feedback { white-space: pre-wrap; min-height: 1.5em; padding: 10px 12px; border-radius: 8px; }
#feedback:empty { padding: 0; }
#feedback.good { background: #e6f8f0; color: #17694c; border: 1px solid #a9e3c9; }
#feedback.bad { background: #fff2ef; color: #9c2f22; border: 1px solid #f3c1b8; }
#feedback.reveal { background: #fff8e1; color: #6b4e00; border: 1px solid #f2d98a; }
@media (prefers-reduced-motion: reduce) { .timer-bar { animation: none !important; } }

/* A01 robot v2: degree scale, live dial, student work log */
.toy-robot-box { display: block; }
.toy-robot-stage { position: relative; }
.toy-robot-stage .toy-svg { max-height: 380px; margin: 0 auto; }
.toy-deg { font: 700 15px 'Cascadia Mono', Consolas, monospace; fill: #5d7189; }
.toy-tag { font: 800 15px "Segoe UI", "Malgun Gothic", sans-serif; fill: #9a6b00; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.toy-tag.pad { fill: #17694c; }
.toy-dial { position: absolute; right: 10px; top: 8px; display: grid; justify-items: center; margin: 0; padding: 8px 14px; border: 2px solid #1f3a5f; border-radius: 12px; background: #fff; box-shadow: 0 4px 0 #1f3a5f; }
.toy-dial span { font-size: .72rem; font-weight: 800; color: #5d7189; }
.toy-dial strong { font: 900 1.9rem/1.05 'Cascadia Mono', Consolas, monospace; color: #1f3a5f; font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: center; }
.toy-log { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.toy-log li { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; border: 1px solid #d6e6f0; border-radius: 10px; background: #fff; color: #1f2f46; font-size: .95rem; line-height: 1.45; word-break: keep-all; }
.toy-log li b { flex: 0 0 auto; font-size: 1.05rem; color: #2f9ce8; }
.toy-log li.bad { border-color: #f3c1b8; background: #fff4f1; color: #9c2f22; }
.toy-log li.bad b { color: #e5484d; }
.toy-log li.now { box-shadow: 0 0 0 2px #ffd21f; animation: toy-log-in .35s ease-out; }
@keyframes toy-log-in { from { transform: translateY(-6px); opacity: 0; } }
.toy-raw { margin-top: 8px; color: #5d7189; font-size: .82rem; }
.toy-raw summary { cursor: pointer; }
.toy-raw pre { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #f3f8fb; color: #33475e; }
.theater-stage .toy-raw { color: #9fc3df; }

/* Learning report after a toy run (replaces player controls under the editor) */
.replay.toy-mode .replay-bar, .replay.toy-mode > details { display: none; }
.console.toy-run > h3, .console.toy-run > #log { display: none; }
.learn-report { margin-top: 12px; padding: 14px 16px; border: 1px solid #d6e6f0; border-radius: 12px; background: #fff; color: #1f2f46; }
.learn-report h4 { display: inline-block; margin: 14px 0 8px; padding: 3px 12px 3px 10px; background: #1f3a5f; color: #fff; font-size: .82rem; clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.learn-report h4:first-child { margin-top: 0; }
.learn-steps { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.learn-steps li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 7px 10px; border-radius: 8px; background: #f6fafd; line-height: 1.45; word-break: keep-all; }
.learn-steps li.bad { background: #fff6f3; }
.learn-steps li > b { color: #2f9ce8; }
.learn-steps li.bad > b { color: #e5484d; }
.rp-line { display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 2px 8px 2px 4px; border: 1px solid #3F3F46; border-radius: 6px; background: #1E1E1E; color: #DCDCDC; font: 12.5px/1.5 'Cascadia Mono', Consolas, monospace; box-shadow: none; cursor: pointer; }
.rp-line:hover { border-color: #007ACC; transform: none; }
.rp-line-no { padding: 0 5px; border-radius: 4px; background: #2B91AF; color: #fff; font-weight: 700; }
.rp-line code { color: #DCDCAA; background: none; border: 0; padding: 0; }
.learn-what { flex: 1 1 220px; }
.learn-tip { margin: 0 0 8px; color: #5d7189; font-size: .86rem; }
.learn-hints { display: grid; gap: 6px; margin: 0 0 8px; padding-left: 22px; }
.learn-hints li { padding: 6px 10px; border-left: 3px solid #ffc93c; background: #fffaf0; line-height: 1.5; animation: toy-log-in .3s ease-out; }
.hint-next { background: #fff; border: 1px dashed #c9a23a; color: #7a5a00; }
.hint-next[hidden] { display: none; }
.learn-reflect { margin: 0; padding: 8px 12px; border-left: 3px solid #2fbf8f; background: #f0fbf6; line-height: 1.55; }
.learn-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d6e6f0; }
.learn-tools .toy-raw { margin: 0; }
.theater-stage .learn-report { background: #f7fbfe; }

/* "로봇이 이렇게 움직입니다" demo in the brief panel */
.demo { margin: 6px 0 10px; padding: 8px; border: 1px solid #d6e6f0; border-radius: 12px; background: #f4f9fd; }
.demo .toy-svg { display: block; width: 100%; height: auto; }
.demo .toy-svg [id="arm"], .demo .toy-svg [id="crate"] { transition-property: transform; transition-timing-function: cubic-bezier(.45,.05,.3,1); }
.demo-cap { min-height: 2.9em; margin: 6px 2px 4px; color: #1f2f46; font-weight: 600; line-height: 1.45; word-break: keep-all; }
.demo-again { min-height: 0; padding: 3px 12px; background: #fff; border: 1px solid #c8d9e6; color: #1f3a5f; font-size: .82rem; box-shadow: none; }

/* Code mentor as a limited chat */
.mentor-box { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid #d6e6f0; border-radius: 12px; background: #fff; }
.mentor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mentor-head label { margin: 0; font-weight: 800; color: #1f3a5f; }
.mentor-left { padding: 2px 10px; border-radius: 999px; background: #e7f4fd; color: #1f6fae; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.mentor-left[data-low="1"] { background: #fff1e8; color: #c2561a; }
.mentor-rule { margin: 0; color: #5d7189; font-size: .8rem; }
.chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding: 2px; }
.chat-log:empty { display: none; }
.chat-msg { max-width: 92%; padding: 8px 12px; border-radius: 14px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; font-size: .9rem; }
.chat-msg.me { align-self: flex-end; background: #2f9ce8; color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg.mentor { align-self: flex-start; background: #f1f6fa; color: #1f2f46; border-bottom-left-radius: 4px; }
.chat-msg.typing { color: #5d7189; font-style: italic; }
.chat-msg.error { background: #fff4ee; color: #a8461a; }
.chat-input { display: flex; gap: 6px; }
.chat-input input { flex: 1; min-width: 0; }
.chat-input button { flex: none; }
.console .mentor-box { margin-top: 12px; }

/* 처음부터 다시 풀기 */
.actions .reset-btn { background: #fff; border: 1px solid #c8d9e6; color: #4b5f78; box-shadow: none; }
.actions .reset-btn[data-arm] { background: #fff1e8; border-color: #e5484d; color: #c0392b; }

/* chat input row: undo the sidebar's full-width form controls */
.mentor-box .chat-input { display: flex !important; flex-direction: row; align-items: stretch; gap: 6px; }
.mentor-box .chat-input input { flex: 1 1 auto !important; width: auto !important; min-width: 0; height: auto; }
.mentor-box .chat-input button { flex: 0 0 auto !important; width: auto !important; padding: 0 16px; }

/* ==== Theater v2: bright game-lobby window (reference: user's 4 game UI images) ==== */
.theater { display: block; padding: clamp(8px, 1.6vw, 22px); color: #1f2f46;
  background: #bfe6fb url("/static/ui/stage-bg.svg") center / cover no-repeat; }
.theater-frame { position: relative; display: grid; grid-template-rows: auto 1fr; height: 100%; min-height: 0;
  border: 3px solid rgb(255 255 255 / .95); border-radius: 18px; background: linear-gradient(180deg, rgb(255 255 255 / .38), rgb(255 255 255 / .16));
  box-shadow: 0 0 0 1px #a9cfe6, 0 18px 50px rgb(31 58 95 / .22), inset 0 0 0 1px rgb(255 255 255 / .6); backdrop-filter: blur(2px); overflow: hidden; }
.theater-top { display: flex; align-items: center; gap: 14px; padding: 14px 18px 8px 0; background: none; border: 0; }
.theater-tab { display: flex; align-items: center; gap: 10px; padding: 11px 34px 11px 26px; background: linear-gradient(180deg, #24466f, #17304f);
  color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 100%, 0 100%); box-shadow: 0 4px 0 rgb(0 0 0 / .08); }
.theater-mode { padding: 0; border-radius: 0; background: none; color: #fff; font-size: 1.22rem; font-weight: 900; letter-spacing: -.01em; }
.theater-live { padding: 2px 9px; border-radius: 999px; background: #ff6f91; color: #fff; font: italic 800 .7rem/1.4 "Segoe UI", sans-serif; letter-spacing: .06em; box-shadow: inset 0 -2px 0 rgb(0 0 0 / .15); }
.theater-chips { display: flex; flex: 1; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: 0; }
.th-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 46ch; padding: 6px 16px 6px 8px; background: rgb(255 255 255 / .9);
  border: 1px solid #d3e7f3; border-radius: 10px; color: #1f2f46; font-weight: 800; font-size: .9rem; transform: skewX(-8deg); box-shadow: 0 2px 0 rgb(31 58 95 / .08); }
.th-chip > * { transform: skewX(8deg); }
.th-chip i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, #7fd0ff, #2f9ce8); color: #fff; font-style: normal; font-size: .7rem; }
.th-chip-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.theater .theater-status { color: #33506f; font-size: .88rem; }
.theater[data-phase="loading"] .theater-status::after { border-color: #2f9ce8; border-top-color: transparent; }
.theater-close { margin-left: 0; padding: 6px 14px; min-height: 0; background: transparent; border: 0; color: #1f3a5f; font-weight: 900; font-size: 1rem; box-shadow: none; }
.theater-close:hover { color: #2f9ce8; transform: none; }
.theater-body { gap: 14px; padding: 6px 18px 18px; }
.th-head { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 9px 16px; background: linear-gradient(180deg, #24466f, #1b3658); color: #fff; font-size: .95rem; font-weight: 900; }
.th-head small { color: #a9c8e4; font-size: .76rem; font-weight: 600; }
.theater-code { border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 1px #a9cfe6, 0 10px 28px rgb(31 58 95 / .18); }
.theater-stage-card { display: flex; flex-direction: column; min-height: 0; border: 3px solid #fff; border-radius: 12px; background: rgb(244 251 255 / .92);
  box-shadow: 0 0 0 1px #a9cfe6, 0 10px 28px rgb(31 58 95 / .14); overflow: hidden; }
.theater-stage { flex: 1; padding: 14px; }
.theater-stage .replay-brief { color: #4b6582; }
.theater-stage .toy { box-shadow: 0 0 0 1px #d3e7f3, 0 8px 22px rgb(31 58 95 / .12); }
.theater-stage .toy-raw, .theater-stage .replay-bar, .theater-stage .replay details { color: #4b6582; }
/* result card: mission-row style with CLEAR light sweep */
.theater-result { padding: 0 0 20px; overflow: hidden; border: 3px solid #fff; border-radius: 16px; background: #f4fbff; box-shadow: 0 0 0 1px #a9cfe6, 0 30px 80px rgb(31 58 95 / .35); }
.th-stamp { position: relative; margin: 0 0 14px; padding: 18px 20px; overflow: hidden; font: italic 900 clamp(2rem, 5vw, 3rem)/1 "Segoe UI", "Malgun Gothic", sans-serif; letter-spacing: .04em; }
.theater-result.win .th-stamp { background: linear-gradient(90deg, #2c4c74, #3b6a9c 50%, #2c4c74); color: #fff; text-shadow: 0 0 18px rgb(127 208 255 / .9); }
.theater-result.lose .th-stamp { background: linear-gradient(90deg, #fff0f3, #ffe1e8 50%, #fff0f3); color: #d6335c; }
.th-stamp::after { content: ""; position: absolute; inset: 0 auto 0 -40%; width: 40%; background: linear-gradient(100deg, transparent, rgb(255 255 255 / .75), transparent); animation: th-sweep 1.6s ease-in-out .5s 2; }
@keyframes th-sweep { to { left: 120%; } }
.th-why, .th-reward { margin-left: 22px; margin-right: 22px; }
.th-reward { display: inline-block; padding: 5px 14px; border-radius: 10px; background: #fff; border: 1px solid #f0d98a; color: #9a6b00; transform: skewX(-8deg); }
.th-actions { padding: 0 22px; }
.theater .th-actions button { min-height: 0; padding: 10px 22px; border-radius: 8px; transform: skewX(-8deg); background: #fff; border: 1px solid #c8d9e6; color: #1f3a5f; font-weight: 900; box-shadow: 0 3px 0 #c8d9e6; }
.theater .th-actions button.gold { background: linear-gradient(180deg, #fff27a, #ffd21f); border-color: #e6b800; color: #1f2a44; box-shadow: 0 3px 0 #d9a900; }
.theater .th-actions button:hover { filter: brightness(1.04); }
@media (max-width: 860px) { .theater-top { flex-wrap: wrap; } .theater-chips { justify-content: flex-start; padding-left: 12px; } .theater-body { overflow: auto; } }
.theater-result { animation: th-pop2 .5s cubic-bezier(.2,1.4,.4,1) both; }
.theater-result.lose { animation: th-pop2 .5s cubic-bezier(.2,1.4,.4,1) both, th-shake .45s ease-in-out .5s 1; }
@keyframes th-pop2 { from { transform: translate(-50%, -50%) scale(1.25); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.th-reward:empty, .th-why:empty { display: none; }
.theater-stage .learn-report { display: none; }
.th-line.active { background: linear-gradient(90deg, rgb(255 210 31 / .28), rgb(255 210 31 / .06)); }
.th-line.active .th-src { color: #fff; text-shadow: 0 0 1px #000; }
.th-line.active .th-src * { color: #fff8d6 !important; }

/* ==== Unified button family (Astra, 2026-11-22) ==== */
button:not(nav button, #missions button, .monaco-editor button, .rp-line, .theater-close, .note-card, .reader button, .demo-again, .hint-next, .vs-row), button.gold, button.primary, button.ghost, .workspace > .actions #run, .workspace > .actions #save, .workspace > .actions #reset, .workspace > .actions #grade, .actions .reset-btn[data-arm], .theater .th-actions button, .theater .th-actions button.primary, .mentor-box .chat-input button, .hint-next, .demo-again, button.hint-next, button.demo-again { box-sizing: border-box; appearance: none; padding: 9px 17px; border: 1px solid var(--fa-armed-border, var(--fa-border, #c8d9e6)); border-radius: 10px; background: var(--fa-armed-fill, var(--fa-fill, #ffffff)); color: var(--fa-armed-text, var(--fa-text, #1f3a5f)); box-shadow: var(--fa-shadow, inset 0 1px 0 rgb(255 255 255 / 55%), 0 3px 1px var(--fa-armed-ledge, var(--fa-ledge, #b3c8d8))); font-family: inherit; font-weight: 800; line-height: 1.25; word-break: keep-all; text-shadow: var(--fa-text-shadow, none); transform: var(--fa-press, none); cursor: pointer; transition: none; }
button.gold, button.primary, .theater .th-actions button.primary, .mentor-box .chat-input button { --fa-fill: linear-gradient(to bottom, #5cc8ff, #2f9ce8); --fa-border: #2f9ce8; --fa-text: #ffffff; --fa-text-shadow: 0 1px 1px rgb(31 58 95 / 65%); --fa-ledge: #227bb9; }
.workspace > .actions { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.workspace > .actions #grade { min-width: 120px; }
.workspace > .actions #run { --fa-fill: linear-gradient(to bottom, #24466f, #1f3a5f); --fa-border: #1f3a5f; --fa-text: #ffffff; --fa-ledge: #152b47; }
.workspace > .actions #save, .workspace > .actions #reset { --fa-fill: #ffffff; --fa-border: #c8d9e6; --fa-text: #1f3a5f; --fa-text-shadow: none; --fa-ledge: #b3c8d8; }
.actions .reset-btn[data-arm] { --fa-armed-fill: #fff1f1; --fa-armed-border: #d6335c; --fa-armed-text: #d6335c; --fa-armed-ledge: #b82b4e; }
button.ghost { --fa-fill: transparent; --fa-text: #1f3a5f; --fa-border: #c8d9e6; --fa-shadow: none; --fa-text-shadow: none; }
.theater .th-actions button, .theater .th-actions button.primary { padding: 11px 24px; transform: none; }
.mentor-box .chat-input button { align-self: stretch; height: auto; min-height: 0; padding: 0 13px; }
.hint-next, .demo-again { --fa-fill: #ffffff; --fa-text: #1f3a5f; --fa-border: #c8d9e6; --fa-ledge: #b3c8d8; --fa-text-shadow: none; padding: 5px 12px; border-radius: 999px; font-size: 0.875rem; }
button:not(nav button, #missions button, .monaco-editor button, .rp-line, .theater-close, .note-card, .reader button, .demo-again, .hint-next, .vs-row):hover:not(:disabled), button.gold:hover:not(:disabled), button.primary:hover:not(:disabled), .hint-next:hover:not(:disabled), .demo-again:hover:not(:disabled) { filter: brightness(0.97); }
.theater .th-actions button:hover:not(:disabled), .theater .th-actions button.primary:hover:not(:disabled) { transform: none; }
button.ghost:hover:not(:disabled) { border-color: #2f9ce8; }
button:not(nav button, #missions button, .monaco-editor button, .rp-line, .theater-close, .note-card, .reader button, .demo-again, .hint-next, .vs-row):active:not(:disabled), button.gold:active:not(:disabled), button.primary:active:not(:disabled), .theater .th-actions button:active:not(:disabled), .theater .th-actions button.primary:active:not(:disabled), .hint-next:active:not(:disabled), .demo-again:active:not(:disabled) { --fa-press: translateY(2px); --fa-shadow: none; transform: translateY(2px); box-shadow: none; }
button:not(nav button, #missions button, .monaco-editor button, .rp-line, .theater-close, .note-card, .reader button, .demo-again, .hint-next, .vs-row):disabled, button.gold:disabled, button.primary:disabled, .hint-next:disabled, .demo-again:disabled { --fa-shadow: none; opacity: 0.55; filter: none; cursor: not-allowed; }
button:focus-visible, .hint-next:focus-visible, .demo-again:focus-visible { outline: 2px solid #2f9ce8; outline-offset: 2px; }

.chat-msg.notice { align-self: stretch; max-width: none; background: #fff8e8; border: 1px solid #f0d98a; color: #6b4e00; white-space: pre-line; border-radius: 10px; }

/* C02 signal board */
.toy-camp .board-row { fill: #ffe066; font: 800 56px 'Cascadia Mono', Consolas, monospace; letter-spacing: .06em; filter: drop-shadow(0 0 6px rgb(255 224 102 / .55)); }
.toy-camp .board-row.empty { fill: #5d7189; filter: none; }
.toy-camp .board-more { fill: #9fc3df; font-size: 20px; font-weight: 700; filter: none; letter-spacing: 0; }
.toy-camp [id="flag"] { transition: transform .9s cubic-bezier(.3,1.3,.5,1); }
.toy-camp-box.success .toy-svg { animation: toy-cheer .6s ease-out; }
@keyframes toy-cheer { 50% { transform: scale(1.015); } }
.demo .toy { box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .toy-camp [id="flag"] { transition: none; } }
/* result card sits low so the scene (board, gate, arm) stays visible behind it */
.theater-result { top: auto; bottom: clamp(16px, 5vh, 40px); left: calc(50% + 12vw); width: min(520px, 46vw); transform: translate(-50%, 0); animation: th-pop3 .5s cubic-bezier(.2,1.4,.4,1) both; }
.theater-result.lose { animation: th-pop3 .5s cubic-bezier(.2,1.4,.4,1) both, th-shake .45s ease-in-out .5s 1; }
@keyframes th-pop3 { from { transform: translate(-50%, 30px) scale(.9); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@media (max-width: 860px) { .theater-result { left: 50%; width: min(520px, 92vw); } }

/* ==== Visual Studio-style error list + 멘토의 해석 ==== */
.errlist { margin-top: 6px; }
.vs-errlist { border: 1px solid #3F3F46; border-radius: 10px; overflow: hidden; background: #252526; color: #DCDCDC; font: 13px/1.45 "Segoe UI", "Malgun Gothic", sans-serif; text-align: left; }
.vs-head { display: flex; align-items: center; gap: 12px; padding: 7px 12px; background: #2D2D30; border-bottom: 1px solid #3F3F46; }
.vs-head strong { color: #fff; font-size: .9rem; }
.vs-count { padding: 1px 8px; border-radius: 4px; background: #3E3E42; font-size: .78rem; }
.vs-count.err { color: #f48771; } .vs-count.warn { color: #cca700; }
.vs-table { display: grid; }
.vs-errlist .vs-row { display: grid; grid-template-columns: 26px 70px minmax(0, 1fr) 90px 44px; align-items: center; gap: 8px; width: 100%; min-height: 0; margin: 0; padding: 6px 12px;
  border: 0; border-bottom: 1px solid #333337; border-radius: 0; background: transparent; color: #DCDCDC; box-shadow: none; text-align: left; font: inherit; filter: none; transform: none; cursor: pointer; }
.vs-errlist .vs-row:hover:not(:disabled) { background: #2A2D2E; filter: none; transform: none; }
.vs-errlist .vs-row:active:not(:disabled) { transform: none; box-shadow: none; }
.vs-errlist .vs-th { cursor: default; padding: 4px 12px; background: #2D2D30; color: #9DA5B4; font-size: .76rem; }
.vs-ico { color: #f14c4c; } .vs-row.warn .vs-ico { color: #cca700; }
.vs-code { color: #3794ff; font-family: 'Cascadia Mono', Consolas, monospace; }
.vs-msg { font-family: 'Cascadia Mono', Consolas, monospace; color: #fff; overflow-wrap: anywhere; }
.vs-file, .vs-line { color: #9DA5B4; font-size: .82rem; }
.vs-read { margin: 0; padding: 12px 14px 12px 46px; background: #f4fbff; color: #1f2f46; border-bottom: 1px solid #333337; }
.vs-read[hidden] { display: none; }
.vs-read-title { margin: 0 0 8px; color: #1f6fae; font-weight: 800; font-size: .84rem; }
.vs-words { display: grid; gap: 4px; margin: 0 0 8px; padding: 0; list-style: none; }
.vs-words li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.vs-words code { padding: 1px 7px; border-radius: 4px; background: #1E1E1E; color: #ffd27a; font: 12.5px 'Cascadia Mono', Consolas, monospace; }
.vs-arrow { color: #8aa3bb; }
.vs-words li.sum { margin-top: 4px; }
.vs-sum { padding: 6px 10px; border-left: 3px solid #2f9ce8; background: #e7f4fd; font-weight: 700; line-height: 1.5; }
.vs-tip { margin: 0; padding: 6px 10px; border-left: 3px solid #2fbf8f; background: #f0fbf6; line-height: 1.5; }
.vs-tip b { color: #1d8a63; }
.vs-plain { margin: 0 0 8px; }
.vs-note { margin: 0; padding: 7px 12px; background: #2D2D30; color: #cca700; font-size: .8rem; }
.vs-raw { margin: 0; padding: 6px 12px; background: #1E1E1E; color: #9DA5B4; }
.vs-raw summary { cursor: pointer; font-size: .8rem; }
.vs-raw pre { margin: 6px 0 0; max-height: 220px; overflow: auto; color: #DCDCDC; font: 12px/1.5 'Cascadia Mono', Consolas, monospace; white-space: pre-wrap; }
/* compact list inside the stage's result card */
.theater-result.compile { width: min(640px, 52vw); }
.theater-result .vs-errlist { margin: 0 22px 12px; max-height: 42vh; overflow: auto; }
.vs-errlist.compact .vs-row { grid-template-columns: 22px 62px minmax(0, 1fr) 40px; }
.vs-errlist.compact .vs-file, .vs-errlist.compact .vs-th span:nth-child(4) { display: none; }
@media (max-width: 860px) { .theater-result.compile { width: min(640px, 94vw); } .vs-errlist .vs-row { grid-template-columns: 22px 60px minmax(0, 1fr) 36px; } .vs-file, .vs-th span:nth-child(4) { display: none; } }

/* the stage never shows replay player controls (toy report / error list cover it) */
.theater-stage .replay-bar, .theater-stage .replay > details { display: none; }
.console:has(#errlist:not([hidden])) > #replay { display: none; }
.vs-raw summary { color: #9DA5B4; }
.vs-raw summary:hover { color: #DCDCDC; }

/* C01 bulb number board */
.toy-bulbs .plate-label { fill: #1f3a5f; font: 800 20px 'Cascadia Mono', Consolas, monospace; }
.toy-bulbs [class^="scr-"] { fill: #9fc3df; font-family: "Segoe UI", "Malgun Gothic", sans-serif; font-weight: 700; }
.toy-bulbs .scr-target-v, .toy-bulbs .scr-sum-v { fill: #ffe066; font: 800 32px 'Cascadia Mono', Consolas, monospace; filter: drop-shadow(0 0 6px rgb(255 224 102 / .5)); }
.toy-bulbs-box.success .scr-sum-v { fill: #7dffc4; }
.toy-bulbs-box.success .toy-svg { animation: toy-cheer .6s ease-out; }
/* C02 two-row board */
.toy-board2 .board-row { fill: #ffe066; font: 800 72px 'Cascadia Mono', Consolas, monospace; letter-spacing: .06em; filter: drop-shadow(0 0 7px rgb(255 224 102 / .55)); }
.toy-board2 .board-row.empty { fill: #5d7189; font-size: 28px; filter: none; letter-spacing: 0; }
.toy-board2 .board-more { fill: #ff9f9f; font-size: 18px; font-weight: 700; filter: none; letter-spacing: 0; }
.toy-board2 .badge { fill: #cfe3f2; font: 800 18px "Segoe UI", sans-serif; }
.toy-board-box.success .toy-svg { animation: toy-cheer .6s ease-out; }

/* C03 coin splitter */
.toy-coins text { stroke: none; }   /* the artwork sets a navy stroke on its root; labels must not inherit it */
.toy-coins .coin-scr-k { fill: #9fc3df; font: 700 18px "Segoe UI", "Malgun Gothic", sans-serif; }
.toy-coins .coin-scr-v { fill: #ffe066; font: 800 32px 'Cascadia Mono', Consolas, monospace; filter: drop-shadow(0 0 6px rgb(255 224 102 / .5)); }
.toy-coins .coin-scr-v.small { font-size: 24px; }
.toy-coins .coin-tray-n { fill: #1f3a5f; font: 800 18px 'Cascadia Mono', Consolas, monospace; }
.toy-coins .coin-tray-n.short { fill: #5d7189; }
.toy-coins .coin-cup-n { fill: #1f3a5f; font: 700 15px "Segoe UI", "Malgun Gothic", sans-serif; }
.toy-coins .coin-more { fill: #5d7189; font: 700 15px "Segoe UI", "Malgun Gothic", sans-serif; text-anchor: end; }
.toy-coins .coin-drop { animation: coin-drop .38s cubic-bezier(.3, 1.4, .6, 1) both; }
@keyframes coin-drop { from { transform: translateY(-70px); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
.toy-coins-box.success .coin-scr-v { fill: #7dffc4; }
.toy-coins-box.success .toy-svg { animation: toy-cheer .6s ease-out; }
@media (prefers-reduced-motion: reduce) { .toy-coins .coin-drop { animation: none; } }
/* ==== Result card: ONE fixed place and size for every mission and every outcome ==== */
.theater-stage-card { position: relative; }
.theater .theater-result, .theater .theater-result.compile, .theater .theater-result.win, .theater .theater-result.lose {
  position: absolute; top: auto; left: 50%; bottom: 18px; width: min(560px, calc(100% - 36px)); height: min(340px, calc(100% - 70px));
  display: flex; flex-direction: column; padding: 0 0 16px; transform: translateX(-50%); margin: 0; }
.theater .theater-result[hidden] { display: none; }
.theater .theater-result > .th-stamp { flex: none; }
.theater .theater-result > .th-why { flex: none; max-height: 4.8em; overflow: auto; }
.theater .theater-result > .vs-errlist { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; margin: 0 22px 10px; }
.theater .theater-result > .th-reward { flex: none; align-self: center; }
.theater .theater-result > .th-actions { flex: none; margin-top: auto; }
.theater .theater-result { animation: th-pop4 .45s cubic-bezier(.2,1.4,.4,1) both; }
.theater .theater-result.lose { animation: th-pop4 .45s cubic-bezier(.2,1.4,.4,1) both, th-shake4 .4s ease-in-out .45s 1; }
@keyframes th-pop4 { from { transform: translateX(-50%) translateY(24px) scale(.94); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
@keyframes th-shake4 { 25% { transform: translateX(calc(-50% - 7px)); } 75% { transform: translateX(calc(-50% + 7px)); } }

/* ==== Signup (after Discord) ==== */
#signup { display: flex; align-items: center; width: calc(100% - clamp(12px, 2vw, 36px)); max-width: 1880px; margin: clamp(6px, 1vw, 18px) auto;
  min-height: calc(100svh - clamp(12px, 2vw, 36px)); padding: clamp(26px, 6.5vw, 120px); border: 3px solid rgb(255 255 255 / .8); border-radius: 17px;
  box-shadow: 0 16px 48px rgb(52 93 123 / .14), 0 0 0 1px rgb(114 158 185 / .18);
  background: linear-gradient(90deg, rgb(230 246 254 / .52), transparent 62%), url("/static/ui/entry-hero.svg") center / cover no-repeat, #cfeaf8; }
#signup[hidden] { display: none; }
.signup-card label { margin-top: 4px; color: #1f3a5f; font-weight: 800; font-size: .9rem; }
.signup-verified { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 8px 12px; border-radius: 10px; background: #eef1ff; color: #3b45a8; font-size: .86rem; }
.signup-verified b { color: #1f2a44; }
.signup-help { margin: -6px 0 12px; color: #5d7189; font-size: .78rem; line-height: 1.45; }
.signup-card #promo { text-transform: uppercase; letter-spacing: .06em; font-family: 'Cascadia Mono', Consolas, monospace; }
.signup-card #signup-go { margin-top: 6px; min-height: 44px; font-size: 1rem; }
.signup-note { min-height: 1.2em; margin: 10px 0 6px; color: #c2561a; font-size: .86rem; font-weight: 700; }
.signup-card #signup-out { margin-top: 4px; font-size: .8rem; }

/* ==== Header wallet + profile chips (game-lobby currency style) ==== */
.person { gap: 10px; }
.person .wallet, .person .profile { display: inline-flex; align-items: center; gap: 8px; min-width: 0; height: 36px; padding: 0 14px 0 6px;
  border: 1px solid #d3e7f3; border-radius: 10px; background: rgb(255 255 255 / .92); box-shadow: 0 2px 0 rgb(31 58 95 / .08); transform: skewX(-8deg); }
.person .wallet > *, .person .profile > * { transform: skewX(8deg); }
.person .wallet img, .person .profile img { width: 26px; height: 26px; flex: none; }
.wallet-label { color: #5d7189; font-size: .74rem; font-weight: 700; }
.wallet b { min-width: 2ch; color: #1f2f46; font: 800 1rem/1 'Cascadia Mono', Consolas, monospace; text-align: right; font-variant-numeric: tabular-nums; }
.wallet.bump { animation: wallet-bump .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes wallet-bump { 40% { transform: skewX(-8deg) scale(1.12); background: #fff6d6; } }
.person .profile #user { padding: 0; border: 0; background: none; box-shadow: none; color: #1f3a5f; font-weight: 800; font-size: .92rem; max-width: min(16vw, 200px); }
@media (prefers-reduced-motion: reduce) { .wallet.bump { animation: none; } }

/* ==== Mentor chat: system messages and 1.예 / 2.아니요 choices ==== */
.chat-msg.system { align-self: stretch; max-width: none; border-radius: 10px; background: #eef6fc; border: 1px solid #cfe3f2; color: #1f3a5f; white-space: pre-line; }
.chat-choices { display: flex; gap: 8px; margin-top: 8px; }
.chat-choices button { min-height: 0; padding: 6px 16px; font-size: .86rem; }
.chat-choices[data-picked] button:disabled { opacity: .45; }
.signup-verified img { padding: 3px 3px; box-sizing: content-box; border-radius: 5px; background: #5865f2; }

/* ==== Level chip in the header ==== */
.person .profile { gap: 7px; }
.lv-tag { padding: 2px 7px; border-radius: 6px; background: linear-gradient(180deg, #24466f, #17304f); color: #ffe066; font: 800 .76rem/1.3 'Cascadia Mono', Consolas, monospace; }
.profile-text { display: inline-flex; flex-direction: column; gap: 3px; min-width: 0; }
.lv-bar { display: block; width: 100%; min-width: 64px; height: 4px; border-radius: 4px; background: #dbe9f3; overflow: hidden; }
.lv-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #5cc8ff, #2f9ce8); transition: width .8s cubic-bezier(.3,1,.4,1); }
.person .profile { height: 40px; }

/* ==== Ranking by level ==== */
.rank-help { margin: 0 0 12px; color: #5d7189; font-size: .88rem; }
.rank-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rank-row { display: grid; grid-template-columns: 44px 64px minmax(0, 1fr) 110px 140px 80px; align-items: center; gap: 12px; padding: 10px 14px;
  border: 1px solid #d3e7f3; border-radius: 12px; background: rgb(255 255 255 / .94); box-shadow: 0 2px 0 rgb(31 58 95 / .06); }
.rank-row.me { border-color: #2f9ce8; box-shadow: 0 0 0 2px rgb(47 156 232 / .25); }
.rank-no { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e7f0f7; color: #1f3a5f; font-weight: 900; }
.rank-row.top1 .rank-no { background: linear-gradient(180deg, #ffe066, #f0b429); color: #5a3d00; }
.rank-row.top2 .rank-no { background: linear-gradient(180deg, #eef3f7, #b9c7d3); }
.rank-row.top3 .rank-no { background: linear-gradient(180deg, #ffd3a8, #d9894a); color: #4a2600; }
.rank-lv { padding: 3px 8px; border-radius: 7px; background: linear-gradient(180deg, #24466f, #17304f); color: #ffe066; text-align: center; font: 800 .86rem 'Cascadia Mono', Consolas, monospace; }
.rank-who { display: flex; flex-direction: column; min-width: 0; }
.rank-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1f2f46; }
.rank-who small { color: #5d7189; font-size: .78rem; }
.rank-xp { color: #1f3a5f; font: 700 .86rem 'Cascadia Mono', Consolas, monospace; text-align: right; }
.rank-bar { height: 8px; border-radius: 6px; background: #e3eef6; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, #5cc8ff, #2f9ce8); }
.rank-count { color: #5d7189; font-size: .82rem; text-align: right; }
@media (max-width: 860px) { .rank-row { grid-template-columns: 36px 56px minmax(0, 1fr) 70px; } .rank-bar, .rank-count { display: none; } }

/* ==== Level-up card ==== */
.levelup { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgb(15 32 54 / .45); backdrop-filter: blur(3px); animation: lu-in .3s ease-out both; }
.levelup[hidden] { display: none; }
.levelup-card { width: min(360px, 88vw); padding: 26px 24px 22px; border: 3px solid #fff; border-radius: 18px; text-align: center;
  background: radial-gradient(circle at 50% 20%, #fffbe6, #e9f6ff 70%); box-shadow: 0 0 0 1px #a9cfe6, 0 30px 80px rgb(31 58 95 / .45); animation: lu-pop .55s cubic-bezier(.2,1.5,.4,1) both; }
.levelup-kicker { margin: 0; color: #2f9ce8; font: italic 900 1.5rem/1 "Segoe UI", sans-serif; letter-spacing: .08em; }
.levelup-lv { margin: 10px 0 2px; color: #1f3a5f; font: 900 3.2rem/1 'Cascadia Mono', Consolas, monospace; text-shadow: 0 4px 0 #ffe066; }
.levelup-title { margin: 0 0 16px; color: #5d7189; font-weight: 800; }
@keyframes lu-in { from { opacity: 0; } }
@keyframes lu-pop { from { transform: scale(.6) rotate(-4deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .levelup, .levelup-card { animation: none; } }
.rank-help { width: min(790px, 100%); margin: 0 auto 12px; } .rank-list { width: min(790px, 100%); margin: 0 auto; }

/* ==== Ranking: tier borders by level band + 작업실 구경 ==== */
.rank-row { grid-template-columns: 44px 64px minmax(0, 1fr) 100px 120px 70px 104px; border-width: 2px; }
.rank-visit { min-height: 0; padding: 6px 10px; font-size: .8rem; white-space: nowrap; }
.band-bronze { border-color: #d9894a !important; background: linear-gradient(90deg, #fff4ea, #fff 40%); }
.band-silver { border-color: #a7b6c4 !important; background: linear-gradient(90deg, #f1f5f8, #fff 40%); }
.band-gold { border-color: #f0b429 !important; background: linear-gradient(90deg, #fff7da, #fff 40%); box-shadow: 0 0 0 1px #ffe7a0, 0 3px 10px rgb(240 180 41 / .25); }
.band-platinum { border-color: #5ce1e6 !important; background: linear-gradient(90deg, #e8fcfd, #fff 40%); box-shadow: 0 3px 12px rgb(92 225 230 / .3); }
.band-diamond { border-color: #7a8cff !important; background: linear-gradient(90deg, #eef0ff, #fff 40%); box-shadow: 0 0 0 1px #c9d0ff, 0 4px 14px rgb(122 140 255 / .35); }
.band-legend { border: 2px solid transparent !important; background: linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, #ff6f91, #ffd84d, #5ce1e6, #7a8cff, #ff6f91) border-box; background-size: 100% 100%, 300% 100%; animation: legend-flow 4s linear infinite; }
@keyframes legend-flow { to { background-position: 0 0, 300% 0; } }
.rank-row.me { outline: 2px solid #2f9ce8; outline-offset: 2px; }
@media (max-width: 860px) { .rank-row { grid-template-columns: 36px 56px minmax(0, 1fr) 96px; } .rank-xp { display: none; } }
@media (prefers-reduced-motion: reduce) { .band-legend { animation: none; } }

/* ==== Header BIT chip ==== */
.wallet.bits b { color: #0f7c8a; }

/* ==== Developer room ==== */
.room-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.room-stage { position: relative; border: 3px solid #fff; border-radius: 16px; background: linear-gradient(180deg, #dff2fd, #f4fbff); box-shadow: 0 0 0 1px #a9cfe6, 0 10px 28px rgb(31 58 95 / .14); overflow: hidden; }
.room-view { position: relative; aspect-ratio: 16 / 10; min-height: 320px; }
.room-view canvas { display: block; width: 100% !important; height: 100% !important; }
.room-owner { position: absolute; left: 14px; top: 14px; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 2px solid #d3e7f3; border-radius: 12px; background: rgb(255 255 255 / .92); }
.room-owner small { color: #5d7189; }
.room-back { position: absolute; right: 14px; top: 14px; }
.room-pending { margin: 0; padding: 70px 20px 10px; color: #5d7189; text-align: center; }
.room-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 10px 18px 18px; list-style: none; }
.room-list li { display: grid; gap: 2px; padding: 8px 10px; border: 2px solid #d3e7f3; border-radius: 10px; background: #fff; }
.room-slot { color: #5d7189; font-size: .74rem; }
.room-shop { padding: 14px; border: 3px solid #fff; border-radius: 16px; background: rgb(255 255 255 / .94); box-shadow: 0 0 0 1px #a9cfe6, 0 10px 28px rgb(31 58 95 / .1); max-height: calc(100vh - 200px); overflow: auto; }
.room-shop[hidden] { display: none; }
.shop-head { display: flex; align-items: center; justify-content: space-between; }
.shop-head h3 { margin: 0; color: #1f3a5f; }
.shop-bits { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: #0f7c8a; }
.shop-bits img { width: 22px; height: 22px; }
.shop-help { margin: 6px 0 12px; color: #5d7189; font-size: .8rem; line-height: 1.45; }
.shop-slot h4 { margin: 12px 0 6px; color: #1f3a5f; font-size: .9rem; }
.shop-tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.shop-item { display: grid; gap: 3px; align-content: start; padding: 8px; border: 2px solid #d3e7f3; border-radius: 10px; background: #fff; }
.shop-item b { font-size: .82rem; color: #1f2f46; line-height: 1.3; }
.shop-item small { color: #5d7189; font-size: .72rem; }
.shop-item button { min-height: 0; margin-top: 4px; padding: 4px 8px; font-size: .76rem; }
.shop-item.on { border-color: #2f9ce8; box-shadow: 0 0 0 2px rgb(47 156 232 / .2); }
.shop-item.locked { opacity: .55; }
.grade-2 { border-color: #a7d8b6 !important; } .grade-3 { border-color: #7fc4f5 !important; } .grade-4 { border-color: #b89cff !important; } .grade-5 { border-color: #f0b429 !important; background: linear-gradient(180deg, #fffaf0, #fff) !important; }
@media (max-width: 1000px) { .room-layout { grid-template-columns: 1fr; } .room-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rank-row.band-legend { position: relative; isolation: isolate; border-color: transparent !important; background: linear-gradient(90deg, #fff5fb, #fff 45%) !important; animation: none; }
.rank-row.band-legend::before { content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: 13px; background: linear-gradient(90deg, #ff6f91, #ffd84d, #5ce1e6, #7a8cff, #ff6f91); background-size: 300% 100%; animation: legend-flow2 4s linear infinite; }
.rank-row.band-legend::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 10px; background: linear-gradient(90deg, #fff5fb, #fff 45%); }
@keyframes legend-flow2 { to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) { .rank-row.band-legend::before { animation: none; } }

/* ==== Ranking redesign (Astra, 2026-11-22) ==== */
#rank .rank-help { margin: 0 0 12px; padding-inline-start: 10px; border-inline-start: 3px solid #5cc8ff; color: #5d7189; font: inherit; font-size: .875rem; line-height: 1.5; word-break: keep-all; }
#rank #ranking.rank-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
#rank .rank-row { --tier: #a4b5c5; --plate: #eaf1f6; --ink: #24466f; position: relative; isolation: isolate; box-sizing: border-box; display: grid; grid-template-columns: 38px 64px minmax(6em, 1.5fr) max-content minmax(6em, 1fr) max-content max-content; grid-template-areas: "place crest who level xp missions visit" "place crest who level gauge missions visit"; grid-template-rows: auto auto; align-items: center; align-content: center; column-gap: clamp(8px, 1.2vw, 18px); row-gap: 4px; min-height: 76px; margin: 0; padding: 11px 16px 11px 10px; background: #fff !important; border: 1px solid #cbd8e4 !important; border-inline-start: 4px solid var(--tier) !important; border-radius: 9px 15px 15px 9px; box-shadow: 0 3px 0 #dce6ee; color: #1f2f46; font-variant-numeric: tabular-nums; }
#rank .rank-row::before, #rank .rank-row::after { content: none !important; }
#rank .band-bronze { --tier: #b58b77; }
#rank .band-silver { --tier: #a1afbf; }
#rank .band-gold { --tier: #bd9e71; }
#rank .band-platinum { --tier: #79b7ad; }
#rank .band-diamond { --tier: #79b5da; }
#rank .band-legend { --tier: #aa92c3; }
#rank .rank-row:is(.top1, .top2, .top3) { min-height: 90px; --plate: #24466f; --ink: #fff; box-shadow: 0 4px 0 #d4e0ea, 0 6px 12px rgb(31 58 95 / 7%); }
#rank .rank-row.top1 { min-height: 98px; --plate: #ffd84d; --ink: #1f3a5f; }
#rank .rank-row.top2 { --plate: #1f3a5f; }
#rank .rank-row.top3 { margin-bottom: 5px; }
#rank .rank-row.me { outline: 2px solid #2f9ce8; outline-offset: -1px; box-shadow: 0 4px 0 #b5dff6; }
#rank .rank-no { grid-area: place; display: grid; place-items: center; justify-self: center; width: 100%; min-height: 27px; padding: 0; background: var(--plate); color: var(--ink); border: 0; border-radius: 3px; clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%); font-size: .9rem; font-weight: 850; line-height: 1; }
#rank .rank-row:is(.top1, .top2, .top3) .rank-no { min-height: 39px; font-size: 1.45rem; font-style: italic; }
#rank .rank-row.top1 .rank-no { min-height: 45px; font-size: 1.7rem; }
#rank .rank-emblem { grid-area: crest; display: block; justify-self: center; box-sizing: border-box; width: 48px; height: 48px; max-width: 100%; padding: 0; object-fit: contain; background: transparent; border: 0; border-radius: 0; filter: drop-shadow(0 2px 1px rgb(31 58 95 / 15%)); }
#rank .rank-row:is(.top1, .top2, .top3) .rank-emblem { width: 60px; height: 60px; }
#rank .rank-who { grid-area: who; display: grid; justify-items: start; align-content: center; gap: 4px; min-width: 0; text-align: start; }
#rank .rank-who b, #rank .rank-who small { box-sizing: border-box; display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#rank .rank-who b { color: #1f2f46; font-size: 1.05rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.3; }
#rank .rank-row:is(.top1, .top2, .top3) .rank-who b { font-size: 1.2rem; }
#rank .rank-row.me .rank-who b { color: #17598b; }
#rank .rank-who small { padding: 2px 7px; border-radius: 4px; background: #eff4f8; color: #5d7189; font-size: .72rem; font-weight: 650; line-height: 1.4; }
#rank .rank-lv { grid-area: level; justify-self: start; padding: 4px 8px; border: 0; border-radius: 6px 2px; background: #24466f; color: #fff; font-size: .75rem; font-weight: 800; line-height: 1.2; white-space: nowrap; }
#rank .rank-xp { grid-area: xp; align-self: end; color: #24466f; font-size: .82rem; font-weight: 800; line-height: 1.25; text-align: start; white-space: nowrap; }
#rank .rank-bar { grid-area: gauge; position: relative; align-self: start; display: block; box-sizing: border-box; width: 100%; height: 9px; overflow: hidden; background: #e0eaf2; border: 1px solid #bacbd9; border-radius: 3px; }
#rank .rank-bar > i { display: block; max-width: 100%; height: 100%; background: #2f9ce8; border-radius: 0 2px 2px 0; box-shadow: inset 0 2px #5cc8ff; }
#rank .rank-bar::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), rgb(255 255 255 / 75%) calc(20% - 1px) 20%); }
#rank .rank-count { grid-area: missions; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid #d5e1eb; border-radius: 999px; background: #f7fafc; color: #5d7189; font-size: .73rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
#rank .rank-count::before { content: ""; width: 8px; height: 5px; box-sizing: border-box; border-inline-start: 2px solid #427a9f; border-bottom: 2px solid #427a9f; transform: translateY(-1px) rotate(-45deg); }
#rank .rank-visit { grid-area: visit; justify-self: end; appearance: none; box-sizing: border-box; width: auto; min-height: 34px; margin: 0; padding: 7px 12px; border: 1px solid #8dc6e8; border-radius: 8px 4px; background: #e4f6ff; box-shadow: 0 2px 0 #99bdd3; color: #1f3a5f; font-family: inherit; font-size: .8rem; font-weight: 800; line-height: 1.2; white-space: nowrap; cursor: pointer; }
#rank .rank-visit.ghost { background: #24466f; border-color: #1f3a5f; box-shadow: 0 2px 0 #132e4e; color: #fff; }
#rank .rank-visit:enabled:hover { background: #c8edff; border-color: #2f9ce8; }
#rank .rank-visit.ghost:enabled:hover { background: #315780; }
#rank .rank-visit:enabled:active { transform: translateY(2px); box-shadow: none; }
#rank .rank-visit:focus-visible { outline: 3px solid #2f9ce8; outline-offset: 3px; }
@media (max-width: 860px) {
#rank .rank-row { grid-template-columns: 32px 60px minmax(0, 1fr) max-content max-content; grid-template-areas: "place crest who level visit" "place crest who xp visit"; column-gap: 10px; }
#rank .rank-lv { align-self: end; }
#rank .rank-xp { align-self: start; font-size: .72rem; color: #5d7189; }
#rank .rank-bar, #rank .rank-count { display: none; }
}
@media (max-width: 480px) {
#rank .rank-row { grid-template-columns: 25px 48px minmax(0, 1fr) max-content; grid-template-areas: "place crest who visit" "place crest level visit"; column-gap: 6px; row-gap: 4px; padding: 10px 8px 10px 5px; }
#rank .rank-row:is(.top1, .top2, .top3) { grid-template-columns: 25px 56px minmax(0, 1fr) max-content; }
#rank .rank-row:is(.top1, .top2, .top3) .rank-emblem { width: 56px; height: 56px; }
#rank .rank-who { gap: 2px; }
#rank .rank-lv { padding: 2px 6px; font-size: .68rem; }
#rank .rank-xp { display: none; }
#rank .rank-visit { padding: 7px; font-size: .73rem; }
}
#rank .rank-list, #rank .rank-help { width: 100% !important; max-width: none !important; margin-left: 0; margin-right: 0; }

/* ==== 3D room build mode ==== */
.room-view { cursor: grab; }
.room-view.building { cursor: crosshair; }
.room-view:active { cursor: grabbing; }
.build-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; display: grid; gap: 8px; justify-items: start; pointer-events: none; }
.build-bar[hidden] { display: none; }
.build-bar > * { pointer-events: auto; }
.build-palette { width: 100%; display: grid; gap: 6px; padding: 10px 12px; border: 2px solid #fff; border-radius: 14px; background: rgb(255 255 255 / .93); box-shadow: 0 0 0 1px #a9cfe6, 0 8px 22px rgb(31 58 95 / .18); }
.build-palette[hidden] { display: none; }
.palette-group { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; }
.palette-title { color: #1f3a5f; font-weight: 900; font-size: .8rem; }
.palette-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.room-stage .pal { display: grid; gap: 1px; min-height: 0; padding: 5px 10px; border-radius: 9px; text-align: left; font-size: .78rem; }
.room-stage .pal small { color: #5d7189; font-size: .68rem; font-weight: 600; }
.room-stage .pal.on { border-color: #2f9ce8; background: #e7f4fd; box-shadow: 0 0 0 2px rgb(47 156 232 / .3); }
.build-help { margin: 0; color: #5d7189; font-size: .74rem; }
.build-help kbd { padding: 0 5px; border: 1px solid #c8d9e6; border-radius: 4px; background: #f4f8fb; font: 700 .7rem 'Cascadia Mono', Consolas, monospace; }
.build-saved { color: #2fbf8f; font-size: .76rem; font-weight: 700; margin-right: auto; }
.room-view { min-height: 420px; }
/* palette below the 3D view so it never covers the room */
.build-bar { position: static; padding: 10px 12px 12px; pointer-events: auto; background: rgb(255 255 255 / .6); border-top: 1px solid #d3e7f3; }
.build-palette { box-shadow: none; border-color: #e3eef6; }
.room-view.building.placing { cursor: none; }
/* license line under the nickname */
.license-line { display: block; color: #5d7189; font: 700 .68rem/1.2 'Cascadia Mono', Consolas, "Malgun Gothic", monospace; white-space: nowrap; }
.license-line:empty { display: none; }
.license-line.soon { color: #c2561a; }
.license-line.dev { color: #6b4fd8; }
.person .profile { height: 46px; }

/* ==== page guard: no selecting or dragging page content (editor and inputs stay normal) ==== */
body { -webkit-user-select: none; user-select: none; }
input, textarea, select, [contenteditable], .monaco-editor, .vs-raw pre, .toy-raw pre { -webkit-user-select: text; user-select: text; }
img, svg, a { -webkit-user-drag: none; }
#devtools-veil { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: rgb(15 32 54 / .92); backdrop-filter: blur(12px); }
#devtools-veil[hidden] { display: none; }
#devtools-veil div { max-width: 420px; padding: 26px 28px; border: 3px solid #fff; border-radius: 16px; background: #f4fbff; color: #1f2f46; text-align: center; }
#devtools-veil strong { display: block; margin-bottom: 8px; font-size: 1.2rem; color: #c0392b; }
html.devtools-open body > :not(#devtools-veil) { filter: blur(14px); }
