/*
  마니또 — 학생 화면 "비밀 친구 임무"
  방향: Playful Maximalism(common/design/09_LIBRARY) × 임무 지도(Journey).
  - 흰 캔버스 위에 굵은 검정 테두리 + 딱딱한 그림자를 준 종이 카드: 보드게임 카드·스티커 판의 물성.
  - 색은 개념 하나에 하나: 오렌지 = 비밀 임무(지금 할 일·비밀 친구), 초록 = 기록·스티커, 파랑 = 나(내 카드), 노랑 = 공개·축하.
  - 그림(배경·마스코트·스티커·카드 뒷면)은 GPT 에셋 자리(.st-slot)로 비워 둔다. docs/ASSET_PROMPTS.md 참고.
  - 기준 기기: 학교 태블릿 세로(768~834×1024~1194)와 가로(1024~1366×768~1024).

  토큰 규칙(교사 화면과 같다)
  - 글자 12 14 16 18 20 24 28 32 36 40 48 / 행간 20 이하 140%, 24 이상 120%
  - 마진·패딩 16 20 24, 섹션 사이 48 / 한 덩어리 안의 붙은 간격만 4·8
  - 버튼·입력칸 높이 52 48 40 36 (상태 칩 24)
*/

:root {
  --ink: #171717;
  --muted: #5b5b5b;
  --line: #dedede;
  --canvas: #ffffff;

  --secret: #d93d16;       /* 흰 글자 4.5:1 */
  --secret-bright: #ff5c35;
  --secret-tint: #fff1ec;
  --log: #13804c;          /* 흰 글자 5.0:1 */
  --log-bright: #20a464;
  --log-tint: #eaf7ef;
  --me: #2b59c3;           /* 흰 글자 6.3:1 */
  --me-tint: #eef3ff;
  --reveal: #ffc533;       /* 면 전용, 위에는 검정 글자 */
  --reveal-tint: #fff6d6;

  --font: "Pretendard Variable", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --mono: "Consolas", "Menlo", "DejaVu Sans Mono", "Pretendard Variable", "Pretendard", "Malgun Gothic", monospace;

  --fs-12: 12px; --fs-14: 14px; --fs-16: 16px; --fs-18: 18px; --fs-20: 20px;
  --fs-24: 24px; --fs-28: 28px; --fs-32: 32px; --fs-36: 36px; --fs-40: 40px; --fs-48: 48px;
  --lh-text: 1.4;
  --lh-head: 1.2;

  --m-16: 16px; --m-20: 20px; --m-24: 24px;
  --section: calc(var(--m-24) * 2);
  --tight: 8px;
  --hair: 4px;

  --h-52: 52px; --h-48: 48px; --h-40: 40px; --h-36: 36px; --h-24: 24px;

  --stroke: 3px solid var(--ink);
  --lift: 6px 6px 0 var(--ink);
  --lift-sm: 0 4px 0 var(--ink);
  --r-card: 24px;
  --r-btn: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body.st {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-18);
  line-height: var(--lh-text);
  word-break: keep-all;
  overflow-wrap: break-word;
  /* 배경 그림이 아직 없을 때: 게임 보드 같은 옅은 점 격자 */
  background-color: var(--canvas);
  background-image: radial-gradient(circle, #e4e4e4 1.5px, transparent 1.6px);
  background-size: 24px 24px;
}

/* 테마 배경(bg.png / bg-portrait.png)은 /theme/<테마>.css가 여기에 넣는다 */
.st-backdrop {
  position: fixed; inset: 0; z-index: -1;
  background-position: center; background-size: cover; background-repeat: no-repeat;
}

h1, h2, p, dl, dd, ol, ul, fieldset { margin: 0; }
ol, ul { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
a { color: var(--me); }
strong { font-weight: 800; }

:focus-visible { outline: 4px solid var(--me); outline-offset: 3px; border-radius: 8px; }

.st-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.st-icon { width: 24px; height: 24px; flex: none; }

/* ── 글자 역할 ── */
.st-title { font-size: var(--fs-32); line-height: var(--lh-head); font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
.st-panel-title, .st-subtitle, .st-join-title { text-wrap: balance; }
.st-subtitle { font-size: var(--fs-24); line-height: var(--lh-head); font-weight: 800; }
.st-lead { font-size: var(--fs-18); line-height: var(--lh-text); color: var(--muted); }
.st-lead a { display: inline-flex; align-items: center; gap: var(--hair); font-weight: 700; }
.st-kicker { font-size: var(--fs-16); font-weight: 800; color: var(--secret); }
.st-muted { color: var(--muted); font-size: var(--fs-16); }
.st-count { font-size: var(--fs-16); line-height: var(--lh-text); color: var(--log); vertical-align: middle; }

/* ── 종이 카드: 굵은 테두리 + 딱딱한 그림자 ── */
.st-paper {
  background: var(--canvas);
  border: var(--stroke);
  border-radius: var(--r-card);
  box-shadow: var(--lift);
}
.st-tone-me { background: var(--me-tint); }
.st-tone-secret { background: var(--secret-tint); }
.st-tone-log { background: var(--log-tint); }
.st-tone-reveal { background: var(--reveal-tint); }

/* ── 버튼: 눌러지는 블록. 아래 그림자가 두께, 누르면 4px 내려간다 ── */
.st-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tight);
  height: var(--h-48); padding: 0 var(--m-24);
  border: var(--stroke); border-radius: var(--r-btn);
  box-shadow: var(--lift-sm);
  font: inherit; font-size: var(--fs-20); line-height: var(--lh-text); font-weight: 800;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.st-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.st-btn-xl { height: var(--h-52); padding: 0 var(--m-24); }
.st-btn-lg { height: var(--h-48); }
.st-btn-md { height: var(--h-40); padding: 0 var(--m-20); font-size: var(--fs-18); border-radius: 14px; }
.st-btn-sm { height: var(--h-36); padding: 0 var(--m-16); font-size: var(--fs-16); border-width: 2px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.st-btn-sm:active { transform: translateY(3px); }
.st-btn-sm .st-icon { width: 20px; height: 20px; }

.st-btn-go { background: var(--secret); color: #fff; }
.st-btn-me { background: var(--me); color: #fff; }
.st-btn-log { background: var(--log); color: #fff; }
.st-btn-reveal { background: var(--reveal); color: var(--ink); }
.st-btn-soft { background: var(--canvas); color: var(--ink); }
.st-btn-danger { background: var(--canvas); color: var(--secret); }

/* ── 말풍선 알림 ── */
.st-bubble {
  position: relative;
  padding: var(--m-16) var(--m-20);
  border: var(--stroke); border-radius: 20px;
  background: var(--canvas);
  font-size: var(--fs-18); font-weight: 700;
}
.st-bubble::after {
  content: ""; position: absolute; left: 32px; bottom: -12px;
  width: 20px; height: 20px; background: inherit;
  border-right: var(--stroke); border-bottom: var(--stroke);
  transform: rotate(45deg);
}
.st-bubble-error { background: var(--secret-tint); }
.st-bubble-done { background: var(--log-tint); }

/* ── 에셋 자리 ── */
.st-slot {
  display: inline-grid; place-items: center; flex: none;
  width: 200px; aspect-ratio: 1; max-width: 100%;
}
.st-slot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.st-slot.is-empty { border: 2px dashed #b5b5b5; border-radius: 20px; background: rgb(255 255 255 / 0.85); }
.st-slot-label {
  padding: var(--tight); text-align: center;
  font-family: var(--mono); font-size: var(--fs-12); line-height: var(--lh-text); color: var(--muted); letter-spacing: 0;
  overflow-wrap: anywhere;
}
.st-slot-avatar { width: 48px; border-radius: 50%; overflow: hidden; border: 2px solid var(--ink); background: var(--reveal-tint); }
.st-slot-avatar.is-empty { border-style: solid; border-color: var(--ink); }
.st-slot-avatar .st-slot-label { display: none; }
.st-slot-logo { width: 420px; aspect-ratio: 3 / 1; }
.st-slot-sticker { width: 72px; }
.st-slot-sticker .st-slot-label { display: none; }
.st-slot-cardback { width: 280px; aspect-ratio: 5 / 7; border-radius: var(--r-card); }

/* ── 입장 ── */
.st-join-stage {
  min-height: 100vh;
  display: grid; align-content: center; justify-items: center; gap: var(--m-24);
  padding: var(--m-24) var(--m-20) var(--section);
  max-width: 640px; margin: 0 auto;
}
.st-join-hero { display: grid; justify-items: center; gap: var(--m-16); text-align: center; }
.st-join-title {
  font-size: var(--fs-48); line-height: var(--lh-head); font-weight: 800; letter-spacing: -0.02em;
  /* 점 격자 위에서도 또렷하게 */
  text-shadow: 3px 3px 0 var(--canvas), -3px -3px 0 var(--canvas), 3px -3px 0 var(--canvas), -3px 3px 0 var(--canvas);
}
.st-join-mascot { width: 200px; }
.st-join-panel { width: 100%; padding: var(--m-24); display: grid; gap: var(--m-20); }
.st-panel-title { font-size: var(--fs-28); line-height: var(--lh-head); font-weight: 800; }
.st-panel-lead { color: var(--muted); font-size: var(--fs-18); margin-top: calc(var(--m-20) * -1 + var(--tight)); }

.st-steps { display: flex; gap: var(--m-16); flex-wrap: wrap; }
.st-steps li { display: flex; align-items: center; gap: var(--tight); font-size: var(--fs-16); font-weight: 700; color: var(--muted); }
.st-steps-num {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid currentColor; font-size: var(--fs-16); font-weight: 800; background: var(--canvas);
}
.st-steps-num .st-icon { width: 20px; height: 20px; }
.st-steps .is-current { color: var(--ink); }
.st-steps .is-current .st-steps-num { background: var(--secret); border-color: var(--ink); color: #fff; }
.st-steps .is-done { color: var(--log); }

.st-form { display: grid; gap: var(--m-20); }
.st-form-row { display: flex; flex-wrap: wrap; gap: var(--m-16); justify-content: space-between; align-items: center; }
.st-form > .st-btn-xl:last-child { justify-self: stretch; }

.st-code-input {
  width: 100%; height: var(--h-52);
  padding: 0 var(--m-20);
  border: var(--stroke); border-radius: var(--r-btn);
  background: var(--canvas);
  font-family: var(--mono); font-size: var(--fs-40); line-height: var(--lh-head); font-weight: 700;
  letter-spacing: 0.3em; text-align: center; text-transform: uppercase; color: var(--ink);
}
.st-code-input:focus { outline: none; border-color: var(--secret); box-shadow: 0 0 0 4px var(--secret-tint); }
.st-code-input::placeholder { color: var(--line); }

/* 글자 패드: 31자 + 지우기 = 8열 × 4줄 */
.st-keypad { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--tight); }
.st-keypad[hidden] { display: none; }
.st-key {
  height: var(--h-52);
  border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
  background: var(--canvas); color: var(--ink);
  font-family: var(--mono); font-size: var(--fs-24); line-height: var(--lh-head); font-weight: 700;
  cursor: pointer; touch-action: manipulation;
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
}
.st-key:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); background: var(--reveal-tint); }
.st-key-erase { display: grid; place-items: center; background: var(--secret-tint); }

.st-numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--tight); }
.st-number { position: relative; }
.st-number input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.st-number span {
  display: grid; place-items: center; height: var(--h-52);
  border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink); background: var(--canvas);
  font-size: var(--fs-24); line-height: var(--lh-head); font-weight: 800; font-variant-numeric: tabular-nums;
}
.st-number input:checked + span { background: var(--secret); color: #fff; transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.st-number input:focus-visible + span { outline: 4px solid var(--me); outline-offset: 3px; }

/* ── 로그인 뒤 틀: 기본(세로 태블릿·폰) = 위에서 아래로 ── */
.st-frame {
  max-width: 760px; margin: 0 auto;
  padding: var(--m-20) var(--m-20) var(--section);
  display: grid; gap: var(--m-24);
  grid-template-areas: "hud" "side" "main";
}
.st-hud { grid-area: hud; }
.st-side { grid-area: side; }
.st-main { grid-area: main; min-width: 0; display: grid; gap: var(--m-24); align-content: start; }
.st-main > section { display: grid; gap: var(--m-24); align-content: start; }
.st-main > section > section { display: grid; gap: var(--m-16); align-content: start; }

.st-hud {
  display: flex; align-items: center; gap: var(--m-16);
  padding: var(--tight) var(--tight) var(--tight) var(--m-16);
  background: var(--canvas); border: var(--stroke); border-radius: 20px; box-shadow: var(--lift-sm);
}
.st-hud-me { display: flex; align-items: center; gap: var(--tight); color: var(--ink); text-decoration: none; font-size: var(--fs-18); min-width: 0; }
.st-hud-me > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-hud-num { font-weight: 800; }
.st-hud-name { font-weight: 600; }
.st-hud-stars { display: flex; align-items: center; gap: var(--hair); margin-left: auto; }
.st-star { color: var(--line); }
.st-star .st-icon { width: 28px; height: 28px; }
.st-star.is-on { color: var(--log-bright); }
.st-star.is-on .st-icon { fill: var(--log-bright); stroke: var(--ink); }
.st-hud-count { min-width: 2ch; font-size: var(--fs-20); font-weight: 800; color: var(--log); font-variant-numeric: tabular-nums; }

/* 임무 지도: 세로 화면에서는 가로 한 줄, 점선이 다음 정류장으로 이어진다 */
.st-map ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.st-map-stop { position: relative; }
.st-map-stop + .st-map-stop::before {
  content: ""; position: absolute; z-index: 0;
  top: 26px; right: calc(50% + 26px); width: calc(100% - 52px);
  border-top: 4px dotted var(--ink);
}
.st-map-stop.is-locked::before { border-top-color: #bdbdbd; }
.st-map-link {
  position: relative; z-index: 1;
  display: grid; justify-items: center; gap: var(--tight); text-align: center;
  color: var(--ink); text-decoration: none;
}
.st-map-node {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  border: var(--stroke); background: var(--canvas); box-shadow: 0 4px 0 var(--ink);
  font-size: var(--fs-24); line-height: var(--lh-head); font-weight: 800;
}
.st-map-text { display: grid; }
.st-map-label { font-size: var(--fs-16); font-weight: 800; }
.st-map-state { font-size: var(--fs-12); font-weight: 700; color: var(--muted); }
.is-done .st-map-node { background: var(--log); color: #fff; }
.is-done .st-map-state { color: var(--log); }
.is-current .st-map-node { background: var(--secret); color: #fff; animation: st-bob 1.6s ease-in-out infinite; }
.is-current .st-map-state { color: var(--secret); }
.is-open .st-map-node { color: var(--me); }
.is-locked .st-map-link { color: #6b6b6b; cursor: not-allowed; }
/* 잠긴 글자도 4.5:1(#6b6b6b) */
.is-locked .st-map-state { color: #6b6b6b; }
.is-locked .st-map-node { background: #f2f2f2; border-color: #bdbdbd; box-shadow: 0 4px 0 #bdbdbd; color: #6b6b6b; }
.is-here .st-map-label { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 3px; }
.is-here .st-map-state { margin-top: var(--hair); }
.st-map-link:hover .st-map-node { transform: translateY(-2px); }

@keyframes st-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ── 홈: 지금 할 일 ── */
.st-quest { display: grid; justify-items: center; text-align: center; gap: var(--m-20); padding: var(--m-24); }
.st-quest-mascot { width: 220px; }
.st-quest-body { display: grid; gap: var(--m-16); justify-items: center; }
.st-quest-body .st-btn { margin-top: var(--tight); }

/* ── 페이지 머리 ── */
.st-page-head { display: grid; gap: var(--tight); }

/* ── 내 카드 ── */
.st-profile { display: grid; gap: var(--m-24); padding: var(--m-24); }
.st-profile-head { display: flex; align-items: center; gap: var(--m-20); }
.st-profile-mascot { width: 120px; }
.st-profile-name { font-size: var(--fs-32); line-height: var(--lh-head); font-weight: 800; }
.st-profile-name span { color: var(--me); }
.st-profile-fields { display: grid; gap: var(--m-20); }
.st-field { display: grid; gap: var(--tight); }
.st-field-label { font-size: var(--fs-16); font-weight: 800; }
.st-field input, .st-field textarea {
  width: 100%;
  border: var(--stroke); border-radius: 14px; background: var(--canvas);
  font: inherit; font-size: var(--fs-18); line-height: var(--lh-text); color: var(--ink);
}
.st-field input { height: var(--h-52); padding: 0 var(--m-16); }
.st-field textarea { padding: var(--m-16); min-height: 140px; resize: vertical; }
.st-field input:focus, .st-field textarea:focus { outline: none; box-shadow: 0 0 0 4px var(--me-tint); border-color: var(--me); }
.st-field input[readonly] { background: transparent; border-style: dashed; }
.st-field-date input { max-width: 260px; }
.st-profile > .st-btn { justify-self: start; }

/* ── 카드 뒤집기 ── */
.st-flip > summary { list-style: none; cursor: pointer; }
.st-flip > summary::-webkit-details-marker { display: none; }
.st-flip-front { display: grid; justify-items: center; gap: var(--m-20); }
.st-flip-front .st-slot-cardback.is-empty { background: var(--secret-tint); border-color: var(--secret); }
.st-flip-cta { pointer-events: none; }
.st-flip[open] > .st-flip-front { display: none; }
.st-flip-back { display: grid; gap: var(--m-24); padding: var(--m-24); animation: st-flip-in 420ms cubic-bezier(.2, .8, .2, 1.2); }
@keyframes st-flip-in { from { transform: perspective(900px) rotateY(80deg) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.st-friend-head { display: flex; align-items: center; gap: var(--m-20); flex-wrap: wrap; }
.st-friend-mascot { width: 160px; }
.st-friend-name { display: grid; font-size: var(--fs-48); line-height: var(--lh-head); font-weight: 800; letter-spacing: -0.02em; }
.st-friend-num { font-size: var(--fs-20); line-height: var(--lh-text); color: var(--secret); }
.st-tone-reveal .st-friend-num { color: var(--ink); }
.st-answers { display: grid; gap: var(--m-16); }
.st-answers > div { padding: var(--m-16) var(--m-20); background: var(--canvas); border: 2px solid var(--ink); border-radius: 16px; }
.st-answers dt { font-size: var(--fs-14); font-weight: 700; color: var(--muted); }
.st-answers dd { font-size: var(--fs-20); font-weight: 700; }

/* ── 기록 ── */
.st-log-layout { display: grid; gap: var(--m-24); align-items: start; }
.st-log-layout > * { min-width: 0; }
.st-log-form { display: grid; gap: var(--m-20); padding: var(--m-24); }
.st-log-form > .st-btn { justify-self: stretch; }
.st-log-list { display: grid; gap: var(--m-16); align-content: start; }

.st-kinds { display: grid; gap: var(--tight); }
.st-kinds legend { padding: 0; margin-bottom: var(--m-16); }
.st-kinds-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--tight); }
.st-kind { position: relative; }
.st-kind input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
/* 스티커 선택 칸: 버튼이 아니라 그림이 든 선택 카드라 높이는 그림에 맞춘다 */
.st-kind-face {
  display: grid; justify-items: center; gap: var(--hair);
  padding: var(--tight) var(--hair) var(--tight);
  border: 2px solid var(--ink); border-radius: 16px; background: var(--canvas); box-shadow: 0 3px 0 var(--ink);
  transition: transform 80ms ease-out;
}
.st-kind-label { font-size: var(--fs-16); font-weight: 800; }
.st-kind input:checked + .st-kind-face { background: var(--log-bright); color: #fff; transform: rotate(-2deg); }
.st-kind input:checked + .st-kind-face .st-kind-label { color: var(--ink); background: var(--canvas); border-radius: 999px; padding: 0 var(--tight); }
.st-kind input:focus-visible + .st-kind-face { outline: 4px solid var(--me); outline-offset: 3px; }

/* 스티커 판: 사람의 목소리라 종이 쪽지처럼 살짝씩 기울인다 */
.st-board { display: grid; gap: var(--m-16); }
.st-note { display: flex; gap: var(--m-16); align-items: flex-start; padding: var(--m-16) var(--m-20); box-shadow: 4px 4px 0 var(--ink); }
.st-board > .st-note:nth-child(odd) { transform: rotate(-0.6deg); }
.st-board > .st-note:nth-child(even) { transform: rotate(0.6deg); }
.st-note-sticker { width: 64px; }
.st-note-body { display: grid; gap: var(--tight); min-width: 0; justify-items: start; }
.st-note-meta { display: flex; flex-wrap: wrap; gap: var(--hair) var(--tight); align-items: center; font-size: var(--fs-14); color: var(--muted); font-weight: 600; white-space: nowrap; }
.st-note-kind {
  display: inline-flex; align-items: center; height: var(--h-24); padding: 0 var(--tight);
  border: 2px solid var(--ink); border-radius: 999px; background: var(--log-tint);
  font-size: var(--fs-12); font-weight: 800; color: var(--ink);
}
.st-note-text { font-size: var(--fs-18); }

.st-empty { display: flex; align-items: center; gap: var(--m-16); padding: var(--m-20); border: 2px dashed #b5b5b5; border-radius: 20px; background: rgb(255 255 255 / 0.85); color: var(--muted); font-size: var(--fs-18); }
.st-empty-mascot { width: 96px; }

.st-delete { display: grid; gap: var(--m-16); padding: var(--m-20); justify-items: start; box-shadow: 4px 4px 0 var(--ink); }
.st-delete p { font-size: var(--fs-16); color: var(--muted); }

/* ── 오늘의 미션 ── */
.st-mission { display: flex; align-items: center; gap: var(--m-16); padding: var(--m-16) var(--m-20); box-shadow: 4px 4px 0 var(--ink); }
.st-mission-badge {
  display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 50%;
  border: var(--stroke); background: var(--secret); color: #fff;
}
.st-mission-badge .st-icon { width: 28px; height: 28px; fill: var(--reveal); stroke: var(--ink); }
.st-mission-text { font-size: var(--fs-20); font-weight: 800; }

/* ── 감사 한마디 ── */
.st-thanks { display: grid; gap: var(--m-16); }
.st-thanks-form { display: grid; gap: var(--m-20); padding: var(--m-24); }
.st-thanks-form > .st-btn { justify-self: start; }
.st-thanks-head { display: flex; align-items: flex-start; gap: var(--m-20); }
.st-thanks-head > .st-field { flex: 1; min-width: 0; }
.st-thanks-mascot { width: 96px; }
@media (max-width: 599px) { .st-thanks-mascot { display: none; } }
.st-thanks-in { display: grid; gap: var(--m-16); }

/* ── 사진 ── */
.st-photo-field { border: 0; padding: 0; margin: 0; }
.st-photo-field legend { padding: 0; margin-bottom: var(--tight); }
.st-optional { font-size: var(--fs-14); font-weight: 600; color: var(--muted); }
.st-photo-rule { font-size: var(--fs-14); color: var(--muted); }
.st-photo-pick { position: relative; justify-self: start; overflow: hidden; }
.st-photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.st-photo-pick:focus-within { outline: 4px solid var(--me); outline-offset: 3px; }
.st-photo-picked { font-size: var(--fs-14); font-weight: 700; color: var(--log); min-height: calc(var(--fs-14) * 1.4); }
.st-photo-keep { display: flex; flex-wrap: wrap; gap: var(--m-16); }
.st-photo-keep-item { display: grid; gap: var(--hair); font-size: var(--fs-14); font-weight: 700; }
.st-photo-keep-item img { width: 120px; height: 90px; object-fit: cover; border: 2px solid var(--ink); border-radius: 12px; }
.st-photo-keep-item span { display: flex; align-items: center; gap: var(--hair); }
.st-photo-keep-item input { width: 20px; height: 20px; accent-color: var(--log); }
.st-photos { display: flex; flex-wrap: wrap; gap: var(--tight); }
.st-photo img { display: block; width: 120px; height: 90px; object-fit: cover; border: 2px solid var(--ink); border-radius: 12px; }

/* ── 공개 ── */
.st-reveal .st-flip-front .st-slot-cardback.is-empty { background: var(--reveal-tint); border-color: #b08600; }

/* ── 가로 태블릿(1000px 이상 가로): 왼쪽 지도 + 오른쪽 화면 ── */
@media (orientation: landscape) and (min-width: 1000px) {
  .st-frame {
    max-width: 1320px;
    padding: var(--m-24) var(--m-24) var(--section);
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-areas: "hud hud" "side main";
    column-gap: var(--section);
  }
  .st-side { position: sticky; top: var(--m-24); align-self: start; }
  .st-map ol { grid-template-columns: 1fr; gap: var(--m-24); }
  .st-map-stop + .st-map-stop::before {
    top: calc(-1 * var(--m-24)); left: 24px; right: auto; width: 0; height: var(--m-24);
    border-top: 0; border-left: 4px dotted var(--ink);
  }
  .st-map-stop.is-locked::before { border-left-color: #bdbdbd; }
  .st-map-link { grid-template-columns: 52px 1fr; justify-items: start; align-items: center; text-align: left; gap: var(--m-16); }
  .st-map-label { font-size: var(--fs-18); }
  .st-map-state { font-size: var(--fs-14); }

  .st-quest { grid-template-columns: auto 1fr; justify-items: start; text-align: left; align-items: center; gap: var(--m-24); padding: var(--section) var(--section) var(--section) var(--m-24); }
  .st-quest-mascot { width: 280px; }
  .st-quest-body { justify-items: start; }
  .st-quest .st-title { font-size: var(--fs-40); }

  .st-profile-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-log-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); }
  .st-flip-back { grid-template-columns: auto 1fr; align-items: start; }
  .st-flip-back > .st-friend-head { grid-column: 1 / -1; }
  .st-flip-back > .st-answers { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-flip-back > .st-form-row, .st-flip-back > .st-lead { grid-column: 1 / -1; }

  /* 입장: 왼쪽 그림, 오른쪽 입력 */
  .st-join-stage { max-width: 1200px; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); align-items: center; column-gap: var(--section); }
  .st-join-mascot { width: 300px; }
}

/* 작은 가로 태블릿(1000~1179): 지도 칸을 줄여 기록 두 칸에 자리를 준다 */
@media (orientation: landscape) and (min-width: 1000px) and (max-width: 1179px) {
  .st-frame { grid-template-columns: 200px minmax(0, 1fr); column-gap: var(--m-24); }
  .st-map-link { grid-template-columns: 52px 1fr; gap: var(--tight); }
  .st-map-label { font-size: var(--fs-16); }
  .st-quest-mascot { width: 220px; }
}

/* ── 세로 태블릿: 지도와 화면을 넉넉하게 ── */
@media (orientation: portrait) and (min-width: 700px) {
  .st-frame { padding-top: var(--m-24); }
  .st-join-mascot { width: 220px; }
  .st-quest-mascot { width: 240px; }
  .st-quest .st-title { font-size: var(--fs-36); }
}

/* ── 폰 폭(보조) ── */
@media (max-width: 599px) {
  body.st { font-size: var(--fs-16); }
  .st-frame { padding: var(--m-16) var(--m-16) var(--section); gap: var(--m-20); }
  .st-title { font-size: var(--fs-28); }
  .st-join-title { font-size: var(--fs-36); }
  .st-panel-title { font-size: var(--fs-24); }
  .st-join-panel, .st-quest, .st-profile, .st-log-form, .st-flip-back { padding: var(--m-20); }
  .st-slot-logo { width: 280px; }
  .st-join-mascot { width: 140px; }
  .st-quest-mascot { width: 160px; }
  .st-friend-name { font-size: var(--fs-36); }
  .st-hud-me .st-hud-name { display: none; }
  .st-hud .st-btn-sm { padding: 0 var(--tight); }
  .st-map-label { font-size: var(--fs-14); }
  .st-keypad { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .st-code-input { font-size: var(--fs-32); letter-spacing: 0.2em; }
  .st-form-row > .st-btn { flex: 1 1 100%; }
  .st-kinds-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

/* 교사 미리보기 띠: 학생 화면이 아니라는 것을 늘 보이게 한다 */
.st-preview-bar {
  position: sticky; top: 0; z-index: 10;
  margin: 0; padding: var(--tight) var(--m-20);
  background: var(--ink); color: #fff; font-size: var(--fs-16); line-height: var(--lh-text);
}
.st-preview-bar a { color: var(--reveal); font-weight: 800; margin-left: var(--tight); }
/* 미리보기는 카드를 펼친 채로 열므로 뒤집기 움직임을 하지 않는다 */
.st-preview .st-flip-back { animation: none; }

/* 캐릭터·카드 색 고르기(모양은 디자인 단계에서 다듬는다) */
.st-looks { display: grid; gap: var(--tight); }
.st-looks legend { padding: 0; margin-bottom: var(--tight); }
.st-looks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--tight); }
.st-colors { display: flex; flex-wrap: wrap; gap: var(--tight); }
.st-color { position: relative; }
.st-color input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.st-color span {
  display: inline-flex; align-items: center; height: var(--h-48); padding: 0 var(--m-20);
  border: 2px solid var(--ink); border-radius: 999px; font-size: var(--fs-16); font-weight: 800;
  background: inherit;
}
.st-color input:checked + span { box-shadow: 0 0 0 4px var(--ink); }
.st-color input:focus-visible + span { outline: 4px solid var(--me); outline-offset: 4px; }

/* 하나의 입구: 학생 입장 아래 선생님 로그인 링크 */
.st-join-teacher { grid-column: 1 / -1; justify-self: center; font-size: var(--fs-16); font-weight: 700; }
.st-join-teacher a { color: var(--ink); background: var(--canvas); padding: var(--hair) var(--tight); border-radius: 8px; }
