/* 옹기 ongi — 햇살 같은 노랑과 옹기 흙빛 갈색 */
@font-face { font-family: 'OngiMark'; src: url('/fonts/ongi-mark.woff2') format('woff2'); font-weight: 400; font-display: swap; }
:root {
  --sun: #ffc93c;       /* 햇살 노랑: 주요 단추, 로고 */
  --honey: #f2a20c;     /* 짙은 꿀빛: 눌렀을 때, 강조 테두리 */
  --brand-yellow: #e9a000; /* 로고 옆 ongi 글자 */
  --butter: #fff8dc;    /* 옅은 버터빛: 앱 바탕 */
  --paper: #ffffff;     /* 카드 */
  --ink: #3a2a14;       /* 옹기 흙빛 갈색: 글자 */
  --ink-2: #6f5b3b;     /* 옅은 글자 */
  --ink-3: #a08c69;     /* 더 옅은 글자 */
  --line: #efe0b0;      /* 선 */
  --line-2: rgba(58, 42, 20, 0.12);
  --heart: #e5484d;
  --danger: #c2362f;
  --wait: #b46a00;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(58, 42, 20, 0.05), 0 2px 10px rgba(58, 42, 20, 0.07);
  --shadow-up: 0 10px 30px rgba(58, 42, 20, 0.16);
  /* 로고 글자(옹기 ongi)에만: 학교안심 지우개 (KERIS, SIL OFL 1.1 — 로고 사용·수정·웹 탑재 허용).
     '옹기ongi' 글자만 뽑은 파일 fonts/ongi-mark.woff2 (1KB). 다른 글자는 모두 Pretendard. */
  --font-mark: 'OngiMark', 'Pretendard Variable', Pretendard, sans-serif;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--butter);
  min-height: 100vh;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── 단추와 입력 ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1.5px solid transparent; background: transparent; cursor: pointer;
  font-weight: 650; font-size: 15px; white-space: nowrap; text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--sun); color: var(--ink); border-color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.btn.primary:hover { background: #ffd35e; }
.btn.primary:active { box-shadow: 0 0 0 var(--ink); transform: translateY(2px); }
.btn.primary:disabled { opacity: .5; cursor: default; transform: none; box-shadow: 0 2px 0 var(--ink); }
.btn.ghost { border-color: var(--line-2); background: rgba(255, 255, 255, .6); }
.btn.ghost:hover { background: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.topbar .btn.small svg { width: 16px; height: 16px; }
.btn svg { width: 18px; height: 18px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  border: 0; background: transparent; cursor: pointer; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: rgba(58, 42, 20, .07); color: var(--ink); }
.input, .textarea, .select {
  width: 100%; border: 1.5px solid var(--line-2); border-radius: 10px; background: #fff;
  padding: 10px 12px; font-size: 16px; line-height: 1.5;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--honey); box-shadow: 0 0 0 3px rgba(255, 201, 60, .35); }
.textarea { resize: vertical; min-height: 110px; }
.label { display: block; font-weight: 650; font-size: 14px; margin: 0 0 6px; }
.field { margin-bottom: 18px; }
.hint { color: var(--ink-2); font-size: 13.5px; margin: 4px 0 0; }

/* ───────── 위쪽 줄 ───────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left)); min-height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; flex: none; white-space: nowrap; }
.brand-mark + .brand-ko { margin-left: 2px; }
.brand-mark { display: inline-flex; }
/* 로고 글꼴(학교안심 지우개)은 글자 아래 여백이 커서 가운데 맞춤만 하면 장독이 글자보다 2px쯤 낮아 보인다 — 글자 높이에 맞춰 올림 */
.topbar .brand-mark, .play-top .brand-mark:has(+ .pt-brand) { position: relative; top: -2px; }
.brand-ko { font-family: var(--font-mark); font-weight: 400; font-size: 21px; letter-spacing: 0; }
.brand-en { font-family: var(--font-mark); font-weight: 400; font-size: 21px; letter-spacing: 0; color: var(--brand-yellow); }
.topbar-end { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--ink); color: var(--sun); font-size: 13px; font-weight: 700;
}

/* ───────── 처음 화면 ───────── */
.home { max-width: 980px; margin: 0 auto; padding: 0 16px 80px; }
.hero { padding: 36px 0 28px; display: grid; gap: 10px; }
.hero h1 {
  /* 왼쪽 위 로고 글자와 같은 짜임: 한글과 영어를 같은 크기·굵기로 나란히 */
  margin: 0; font-family: var(--font-mark); font-size: clamp(40px, 8vw, 72px); line-height: 1.05; letter-spacing: 0; font-weight: 400;
  display: flex; align-items: baseline; gap: .28em; flex-wrap: wrap;
}
.hero h1 .en { font-size: 1em; letter-spacing: 0; font-weight: 400; color: var(--brand-yellow); }
.hero p { margin: 0; font-size: clamp(17px, 2.4vw, 21px); color: var(--ink-2); max-width: 30em; }
.sunrise {
  /* 처음 화면의 해: 노란 원이 천천히 떠오르며 온기를 준다 (한 번만) */
  position: fixed; inset: auto -20vmax -38vmax auto; width: 70vmax; height: 70vmax; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 201, 60, .55), rgba(255, 201, 60, .18) 45%, rgba(255, 201, 60, 0) 70%);
  pointer-events: none; z-index: -1; animation: rise 1.6s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise { from { transform: translateY(18vmax); opacity: 0; } to { transform: none; opacity: 1; } }

.panel {
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink); padding: 24px; margin-bottom: 36px;
}
.panel h2 { margin: 0 0 18px; font-size: 22px; letter-spacing: -0.02em; }
.create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.create-grid .full { grid-column: 1 / -1; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice {
  position: relative; display: grid; gap: 4px; align-content: start; padding: 10px 12px; border-radius: 12px;
  border: 1.5px solid var(--line-2); background: #fff; cursor: pointer; text-align: left;
}
.choice:hover { border-color: var(--honey); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--ink); background: #fff6d2; box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:focus-visible) { outline: 3px solid var(--honey); outline-offset: 2px; }
.choice .pic { color: var(--honey); }
.choice:has(input:checked) .pic { color: var(--ink); }
.choice b { font-size: 15px; }
.choice small { color: var(--ink-2); font-size: 12.5px; line-height: 1.35; }
.choices.two { grid-template-columns: 1fr 1fr; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { display: grid; justify-items: center; gap: 4px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span.dot { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.swatch:has(input:checked) span.dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.swatch:has(input:checked) { color: var(--ink); font-weight: 650; }
.swatch:has(input:focus-visible) span.dot { outline: 3px solid var(--honey); outline-offset: 4px; }
.create-actions { display: flex; justify-content: flex-end; margin-top: 6px; }

.section-title { font-size: 19px; margin: 0 0 12px; letter-spacing: -0.01em; }
.board-list { list-style: none; padding: 0; margin: 0 0 36px; display: grid; gap: 8px; }
.board-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: rgba(255, 255, 255, .75);
  border: 1px solid var(--line); border-radius: 12px;
}
.board-row .pic { color: var(--honey); flex: none; }
.board-row a.name { font-weight: 700; text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row a.name:hover { text-decoration: underline; }
.board-row .meta { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }
.empty-note { color: var(--ink-2); margin: 0 0 36px; }
.vis-select { width: auto; flex: none; padding: 5px 30px 5px 10px; font-size: 14px; border-radius: 999px; }
.board-row { flex-wrap: wrap; }
.board-row a.name { flex: 1 1 180px; }
.vis-chip { display: inline-flex; align-items: center; gap: 4px; }
.vis-chip svg { width: 16px; height: 16px; }
.foot { text-align: center; color: var(--ink-2); font-size: 14px; padding: 20px 0 40px; }
.foot a { color: var(--ink-2); }

/* 관리자 로그인 */
.login { max-width: 400px; margin: 8vh auto; padding: 0 16px; }

/* ───────── 게시판 배경 ───────── */
.bg-sun { --bg: #ffeb94; background: radial-gradient(120% 90% at 85% -10%, #fff7cf 0%, #ffeb94 55%, #ffe170 100%) fixed; }
.bg-peach { --bg: #ffe2c6; background: #ffe2c6; }
.bg-mint { --bg: #e3efd6; background: #e3efd6; }
.bg-sky { --bg: #dcebf6; background: #dcebf6; }
.bg-stone { --bg: #f3f0e8; background: #f3f0e8; }
.bg-jar { --bg: #3e2c1c; background: #3e2c1c; --hd: #fff4d6; --hd-2: #e6cf9f; }
.bg-jar .adminbar { background: rgba(255, 244, 214, .08); border: 1px solid rgba(255, 244, 214, .22); }
.bg-jar .chip { background: var(--sun); color: var(--ink); }
.bg-jar .topbar .btn.ghost { background: #fff4d6; border-color: transparent; }
.bg-jar .canvas-wrap { background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 1px rgba(255, 244, 214, .12); }
.bg-jar .empty-board { color: #e6cf9f; }
.dot.bg-sun { background: radial-gradient(circle at 70% 25%, #fff7cf, #ffe170); }

/* ───────── 게시판 화면 ───────── */
.board-page { min-height: 100vh; }
.board-page .topbar { color: var(--hd, var(--ink)); }
.board-page .topbar .btn.ghost { color: var(--ink); }
.board-head { padding: 4px max(16px, env(safe-area-inset-left)) 18px; color: var(--hd, var(--ink)); max-width: 1400px; }
.board-head h1 { margin: 0; font-size: clamp(28px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.035em; font-weight: 850; }
.board-head .desc { margin: 8px 0 0; color: var(--hd-2, var(--ink-2)); white-space: pre-wrap; max-width: 46em; }
.board-head .status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; font-size: 13.5px; color: var(--hd-2, var(--ink-2)); }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #2fa84f; box-shadow: 0 0 0 3px rgba(47, 168, 79, .2); }
.live.off::before { background: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, .2); }
.locked-note { display: inline-flex; align-items: center; gap: 4px; }
.locked-note svg { width: 16px; height: 16px; }
.adminbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 max(16px, env(safe-area-inset-left)) 16px;
  padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--ink); color: #fff4d6; font-size: 14px;
}
.adminbar b { color: var(--sun); }
.adminbar .grow { flex: 1; }
.adminbar .btn.ghost { background: transparent; color: #fff4d6; border-color: rgba(255, 244, 214, .35); }

.board { padding: 0 max(16px, env(safe-area-inset-left)) 120px; }
.empty-board { text-align: center; padding: 60px 16px; color: var(--hd-2, var(--ink-2)); font-size: 17px; }

/* 카드 */
.card {
  position: relative; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer;
}
.card:hover { box-shadow: 0 1px 0 rgba(58, 42, 20, .05), 0 6px 18px rgba(58, 42, 20, .12); }
.card.is-hidden { opacity: .6; }
.card.is-hidden:hover { opacity: .85; }
.card.is-wait { box-shadow: inset 0 0 0 2px var(--honey), var(--shadow); }
.card-top { display: flex; align-items: center; gap: 6px; padding: 10px 6px 0 14px; min-height: 38px; font-size: 13px; color: var(--ink-2); }
.card-top .who { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.card-top .when { white-space: nowrap; }
.card-top .sp { flex: 1; }
.card-top .icon-btn { width: 30px; height: 30px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(58, 42, 20, .08); color: var(--ink-2); }
.badge.wait { background: #ffe9b0; color: var(--wait); }
.card h3 { margin: 4px 14px 6px; font-size: 17px; line-height: 1.35; letter-spacing: -0.01em; }
.card .body { margin: 0 14px 12px; white-space: pre-wrap; font-size: 15px; }
.card .body a { color: #8a5a00; }
.card .att { margin: 6px 0 10px; }
.card-top + .att { margin-top: 8px; }
.card-foot { display: flex; align-items: center; gap: 4px; padding: 0 8px 8px; }
.card-foot:empty { display: none; }
.react {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 999px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 14px; font-weight: 600;
}
.react:hover { background: rgba(58, 42, 20, .06); color: var(--ink); }
.react svg { width: 18px; height: 18px; }
.react.liked { color: var(--heart); }
.react.liked svg path { fill: currentColor; }
.react.approve { margin-left: auto; background: var(--sun); color: var(--ink); border: 1.5px solid var(--ink); }

/* 첨부 */
.att-img { width: 100%; height: auto; background: #f6efd9; object-fit: cover; }
.att-img.capped { max-height: 520px; }
.att-video { position: relative; display: block; background: #000; }
.att-video img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; opacity: .9; }
.att-video .play {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center; background: var(--sun); color: var(--ink); border: 2px solid var(--ink);
}
.linkcard {
  display: block; margin: 0 14px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden;
  text-decoration: none; background: #fffdf5;
}
.linkcard img { width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; background: #f6efd9; }
.linkcard .lc-text { padding: 8px 10px 10px; display: grid; gap: 2px; }
.linkcard .lc-site { font-size: 12px; color: var(--ink-3); }
.linkcard .lc-title { font-size: 14px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.linkcard .lc-desc { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.filechip {
  display: flex; align-items: center; gap: 10px; margin: 0 14px; padding: 10px 12px; border-radius: 10px;
  background: #fff6d2; border: 1px solid var(--line); text-decoration: none;
}
.filechip .fi { color: var(--honey); display: grid; }
.filechip .fn { font-weight: 650; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filechip .fs { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }

/* 담벼락 */
.wall { display: flex; gap: 16px; align-items: flex-start; }
.wall-col { flex: 1; min-width: 0; display: grid; gap: 16px; }
/* 스트림 */
.stream { max-width: 640px; margin: 0 auto; display: grid; gap: 16px; }
/* 격자 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.grid .card .att-img { aspect-ratio: 4 / 3; height: auto; }
/* 칸 */
.columns { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 20px; scroll-snap-type: x proximity; }
.col { flex: none; width: 300px; display: grid; gap: 12px; scroll-snap-align: start; }
.col-head { display: flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 2px 0 4px; color: var(--hd, var(--ink)); }
.col-head h2 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .n { color: var(--hd-2, var(--ink-2)); font-size: 13px; font-weight: 600; margin-right: 4px; }
.col-head .icon-btn { color: var(--hd-2, var(--ink-2)); }
.col-add {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-radius: var(--radius);
  border: 1.5px dashed rgba(58, 42, 20, .3); background: rgba(255, 255, 255, .45); cursor: pointer; font-weight: 650; color: var(--ink-2);
}
.bg-jar .col-add { border-color: rgba(255, 244, 214, .35); background: rgba(255, 255, 255, .08); color: #fff4d6; }
.col-add:hover { background: rgba(255, 255, 255, .8); color: var(--ink); }
.col-add svg { width: 18px; height: 18px; }
.col.new-col { width: 220px; }
/* 타임라인 */
.timeline { display: flex; gap: 18px; overflow-x: auto; align-items: flex-start; padding: 0 0 24px; position: relative; }
.tl-item { flex: none; width: 280px; display: grid; gap: 10px; position: relative; }
.tl-mark { position: relative; height: 44px; }
.tl-mark::before { content: ''; position: absolute; left: -18px; right: 0; top: 30px; height: 2px; background: rgba(58, 42, 20, .25); }
.bg-jar .tl-mark::before { background: rgba(255, 244, 214, .3); }
.tl-mark::after { content: ''; position: absolute; left: 0; top: 24px; width: 14px; height: 14px; border-radius: 50%; background: var(--sun); border: 2px solid var(--ink); }
.tl-mark span { position: absolute; left: 0; top: 0; font-size: 13px; font-weight: 650; color: var(--hd-2, var(--ink-2)); white-space: nowrap; }
.timeline .tl-item:first-child .tl-mark::before { left: 0; }
/* 캔버스 */
.canvas-wrap { overflow: auto; height: calc(100vh - 210px); min-height: 420px; border-radius: 14px; background: rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 1px rgba(58, 42, 20, .08); -webkit-overflow-scrolling: touch; }
.canvas { position: relative; }
.canvas .card { position: absolute; width: 240px; }
.canvas .card.dragging { box-shadow: var(--shadow-up); z-index: 5; cursor: grabbing; }
.canvas .card .grab { cursor: grab; touch-action: none; color: var(--ink-3); }

/* 글 쓰기 단추 (떠 있는 노란 해) */
.fab {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--ink); cursor: pointer; z-index: 20;
  display: grid; place-items: center; color: var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff1b8 0%, var(--sun) 45%, var(--honey) 100%);
  box-shadow: 0 3px 0 var(--ink), 0 10px 26px rgba(242, 162, 12, .45);
  transition: transform .15s;
}
.fab:hover { transform: translateY(-2px) rotate(90deg); }
.fab:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink), 0 6px 16px rgba(242, 162, 12, .4); }
.fab svg { width: 28px; height: 28px; }

/* ───────── 대화창 ───────── */
dialog.modal {
  border: 0; padding: 0; background: transparent; max-width: min(560px, calc(100vw - 24px)); width: 100%;
  max-height: calc(100dvh - 24px); color: var(--ink);
}
dialog.modal.wide { max-width: min(760px, calc(100vw - 24px)); }
dialog.modal.small { max-width: min(400px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(40, 28, 10, .45); }
dialog.modal[open] .modal-box { animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-box { background: #fff; border-radius: 18px; display: flex; flex-direction: column; max-height: calc(100dvh - 24px); border: 1.5px solid var(--ink); box-shadow: 0 5px 0 var(--ink); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px 20px; }
.modal-head h2 { margin: 0; font-size: 19px; flex: 1; letter-spacing: -0.01em; }
.modal-body { padding: 8px 20px 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.confirm-text { margin: 12px 0 0; font-size: 16px; }

/* 글 쓰기 창 */
.compose .row { display: flex; gap: 8px; }
.compose .title-in { font-weight: 700; font-size: 17px; }
.compose .tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.compose .tools .btn { gap: 6px; }
.compose .att-preview { margin-top: 12px; position: relative; border-radius: 12px; border: 1px solid var(--line); background: #fffaf0; padding: 10px; }
.compose .att-preview .x { position: absolute; top: 6px; right: 6px; background: #fff; box-shadow: var(--shadow); z-index: 1; }
.compose .att-preview img.prev { max-height: 260px; width: auto; margin: 0 auto; border-radius: 8px; }
.compose .att-preview .linkcard, .compose .att-preview .filechip { margin: 0; }
.compose .progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.compose .progress i { display: block; height: 100%; background: var(--honey); width: 0; transition: width .2s; }
.compose .link-row { display: flex; gap: 8px; margin-top: 10px; }
.compose.dropping .modal-body { outline: 3px dashed var(--honey); outline-offset: -8px; }
.err { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

/* 크게 보기 */
.detail .who-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; margin-bottom: 6px; }
.detail .who-line b { color: var(--ink); }
.detail h3 { margin: 0 0 10px; font-size: 22px; line-height: 1.3; letter-spacing: -0.02em; }
.detail .body { white-space: pre-wrap; font-size: 16.5px; margin: 0 0 14px; }
.detail .body a { color: #8a5a00; }
.detail .att { margin: 0 0 14px; }
.detail .att-img { border-radius: 10px; max-height: 70vh; width: auto; margin: 0 auto; }
.detail .linkcard, .detail .filechip { margin: 0; }
.detail iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; }
.detail .acts { display: flex; gap: 4px; margin: 0 0 6px -8px; }
.comments { border-top: 1px solid var(--line); padding-top: 14px; }
.comments h4 { margin: 0 0 10px; font-size: 15px; }
.cmt-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.cmt { background: #fffaf0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px 8px 12px; }
.cmt.is-hidden { opacity: .6; }
.cmt.is-wait { border-color: var(--honey); }
.cmt-top { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.cmt-top b { color: var(--ink); }
.cmt-top .sp { flex: 1; }
.cmt-top .icon-btn { width: 28px; height: 28px; }
.cmt p { margin: 2px 0 0; white-space: pre-wrap; font-size: 15px; padding-right: 6px; }
.cmt-form { display: grid; gap: 8px; }
.cmt-form .row { display: flex; gap: 8px; align-items: flex-end; }
.cmt-form textarea { min-height: 44px; height: 44px; resize: none; }
.muted { color: var(--ink-2); font-size: 14px; }

/* 설정 */
.settings .checks { display: grid; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.check span b { display: block; font-weight: 650; font-size: 15px; }
.check span small { color: var(--ink-2); font-size: 13px; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--line-2); border-radius: 999px; cursor: pointer; font-size: 14.5px; }
.radio-row label:has(input:checked) { border-color: var(--ink); background: #fff6d2; font-weight: 650; }
.radio-row input { accent-color: var(--ink); margin: 0; }

/* 공유 */
.share-box { display: grid; gap: 14px; justify-items: center; text-align: center; }
.share-box .qr { width: min(320px, 70vw); aspect-ratio: 1; background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.share-box .qr svg { width: 100%; height: 100%; display: block; }
.share-box .link { display: flex; gap: 8px; width: 100%; }
.share-box .link .input { font-size: 15px; }

/* 메뉴와 알림 */
.menu {
  position: fixed; z-index: 1000; min-width: 170px; padding: 6px; border-radius: 12px; background: #fff;
  border: 1.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink), var(--shadow-up); display: grid;
}
.menu-item { text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.menu-item:hover, .menu-item:focus { background: #fff6d2; outline: none; }
.menu-item.danger { color: var(--danger); }
.toasts { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 2000; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff4d6; padding: 10px 16px; border-radius: 999px; font-size: 14.5px; box-shadow: var(--shadow-up); transition: opacity .3s, transform .3s; }
.toast.err { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

.center-msg { max-width: 460px; margin: 18vh auto; text-align: center; padding: 0 16px; }
.center-msg p { font-size: 18px; }

/* ───────── 휴대폰 ───────── */
@media (max-width: 720px) {
  .create-grid { grid-template-columns: 1fr; }
  .choices { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 18px 16px; }
  .board-row .meta { display: none; }
  .col { width: min(300px, 82vw); }
  .tl-item { width: min(280px, 78vw); }
  .canvas-wrap { height: calc(100dvh - 190px); }
  .topbar .btn .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═════════════════ 게임 ═════════════════ */
/* 보기 색: 고추, 쪽빛, 꿀, 쑥을 은은하게 (바탕은 옅게, 모양 표시와 막대만 조금 짙게). O/X는 또렷한 색 그대로 */
.ans-0 { --tile: #f9e3dc; --tile-line: #efc6ba; --tile-mark: #b9533f; --tile-bar: #e2a594; }
.ans-1 { --tile: #e1e9f5; --tile-line: #c4d3ea; --tile-mark: #4867a3; --tile-bar: #9fb6dc; }
.ans-2 { --tile: #fbedc4; --tile-line: #f0d98f; --tile-mark: #a77a12; --tile-bar: #ecc96a; }
.ans-3 { --tile: #e1eedd; --tile-line: #c3dcbd; --tile-mark: #4a8152; --tile-bar: #a5caa0; }
.ans-0, .ans-1, .ans-2, .ans-3 { --tile-fg: var(--ink); }
.ans-o { --tile: #2d5aa8; --tile-fg: #fff; }
.ans-x { --tile: #c8412d; --tile-fg: #fff; }
:root { --ok: #2f8f4e; }

/* 처음 화면 탭 */
.tabs { display: flex; gap: 8px; margin: 0 0 26px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 12px; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: rgba(255, 255, 255, .65); text-decoration: none; font-weight: 750; font-size: 16px;
}
.tab:hover { background: #fff; }
.tab .tab-pic { display: inline-grid; color: var(--honey); }
.tab .tab-pic svg { width: 30px; height: 21px; }
.tab.on { background: var(--ink); color: var(--sun); border-color: var(--ink); }
.tab.on .tab-pic { color: var(--sun); }
.btn.big { min-height: 54px; padding: 0 28px; font-size: 18px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-head .section-title { margin: 0; }
.row-acts { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.row-acts .btn svg { width: 14px; height: 14px; }
.quiz-row .pic { display: grid; }
.join-hint { margin: -20px 0 36px; }
.live-games { margin-bottom: 8px; }
.live-row { border-color: var(--honey); background: #fff6d2; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #2fa84f; box-shadow: 0 0 0 4px rgba(47, 168, 79, .2); }

/* PIN·이름 넣기 */
.join-panel { max-width: 440px; width: 100%; margin: 0 auto 36px; display: grid; gap: 12px; text-align: center; }
.join-panel h2 { margin: 0; }
.join-panel .hint { margin: -4px 0 4px; }
.pin-in { font-size: 34px; letter-spacing: .14em; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; padding: 12px; }
.name-in { font-size: 22px; text-align: center; font-weight: 700; padding: 12px; }
.jp-game { margin: 0; font-weight: 700; color: var(--ink-2); }

/* ───── 퀴즈 만들기 ───── */
.quiz-page { background: var(--butter); }
.qe { max-width: 1200px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
.qe-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 18px; }
.qe-head .back { flex-basis: 100%; color: var(--ink-2); font-size: 14px; text-decoration: none; font-weight: 650; }
.qe-head .back:hover { color: var(--ink); text-decoration: underline; }
.qe-title {
  flex: 1 1 280px; min-width: 0; font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -0.02em;
  border: 0; border-bottom: 2px dashed var(--line-2); background: transparent; padding: 4px 2px;
}
.qe-title:focus { outline: none; border-bottom-color: var(--honey); }
.save-status { color: var(--ink-3); font-size: 14px; white-space: nowrap; }
.save-status.bad { color: var(--danger); font-weight: 700; }
.qe-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.qe-side { position: sticky; top: 12px; display: grid; gap: 10px; }
.qe-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: calc(100vh - 230px); overflow: auto; }
.qe-list li { min-width: 0; }
.qe-item {
  width: 100%; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; cursor: pointer; text-align: left;
  border: 1.5px solid transparent; background: rgba(255, 255, 255, .7); font-size: 14.5px;
}
.qe-item:hover { background: #fff; }
.qe-item.on { background: #fff; border-color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.qe-n { width: 20px; flex: none; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.qe-tp { display: grid; color: var(--honey); flex: none; }
.qe-tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qe-warn { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; }
.qe-side-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.qe-side-acts .btn svg { width: 14px; height: 14px; }
.qe-edit { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); padding: 20px 22px 8px; min-width: 0; }
.qe-edit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 18px; }
.qe-edit-head h2 { margin: 0; font-size: 18px; white-space: nowrap; }
.qe-edit-head .icon-btn { margin-left: auto; }
@media (max-width: 1080px) { .qe-edit-head .icon-btn { order: 2; } .qe-edit-head .seg { order: 3; flex-basis: 100%; justify-content: space-between; border-radius: 16px; } }
@media (max-width: 480px) { .qe-edit-head .seg { flex-wrap: nowrap; padding: 3px; } .qe-edit-head .seg button { padding: 6px 7px; font-size: 13px; gap: 4px; white-space: nowrap; } }
.p-img { max-height: 26vh; width: auto; max-width: 100%; margin: 0 auto; border-radius: 12px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: #fff6d2; border-radius: 999px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 999px; padding: 6px 12px;
  font-weight: 650; font-size: 14px; color: var(--ink-2); cursor: pointer;
}
.seg button span { display: inline-grid; }
.seg button:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.seg button.on { background: var(--ink); color: var(--sun); }
.qe-text { font-size: 18px; font-weight: 650; min-height: 76px; }
.qe-photo { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: -6px 0 18px; }
.qe-photo img { max-height: 180px; width: auto; border-radius: 10px; border: 1px solid var(--line); }
.qe-choices { display: grid; gap: 8px; margin-bottom: 10px; }
.qe-choice { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 14px; background: var(--tile); color: var(--tile-fg); }
.qe-choice .input { flex: 1; min-width: 0; border-color: transparent; font-weight: 650; }
.qe-choice .icon-btn { color: var(--tile-fg); }
.qe-choice .icon-btn:hover { background: rgba(255, 255, 255, .2); color: var(--tile-fg); }
.qe-shape { display: grid; place-items: center; width: 32px; flex: none; }
.qe-ok {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; flex: none; cursor: pointer;
  border: 1.5px solid currentColor; background: transparent; color: var(--tile-fg); font-weight: 750; font-size: 14px;
}
.qe-ok .ck { width: 18px; height: 18px; border-radius: 5px; border: 2px solid currentColor; display: grid; place-items: center; }
.qe-ok.on { background: #fff; color: var(--ink); border-color: #fff; }
.qe-ok.on .ck { background: var(--ok); border-color: var(--ok); }
.qe-ok.on .ck::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.qe-ox { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qe-oxbtn {
  min-height: 112px; border-radius: 16px; background: var(--tile); color: var(--tile-fg); border: 3px solid transparent; opacity: .45;
  display: grid; place-items: center; align-content: center; gap: 2px; cursor: pointer;
}
.qe-oxbtn:hover { opacity: .75; }
.qe-oxbtn.on { opacity: 1; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.qe-oxok { font-weight: 800; font-size: 14px; }
.qe-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.qe-prob { color: var(--danger); font-size: 14px; font-weight: 650; margin: -6px 0 16px; }
.paste-help { white-space: pre-wrap; margin: 0 0 12px; }

/* ───── 진행 화면 (교실 화면) ───── */
.host-page { background: radial-gradient(120% 90% at 85% -10%, #fff7cf 0%, #ffeb94 55%, #ffe170 100%) fixed; }
.host { min-height: 100dvh; display: flex; flex-direction: column; }
.host-top {
  display: flex; align-items: center; gap: 10px; min-height: 56px;
  padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.host-top .brand { flex: none; }
.host-title { font-weight: 800; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-step { font-weight: 750; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.host-top .grow { flex: 1; }
.pin-chip { font-variant-numeric: tabular-nums; letter-spacing: .04em; white-space: nowrap; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: #2fa84f; flex: none; }
.conn.off { background: var(--danger); }
.host main {
  flex: 1; display: flex; flex-direction: column; gap: 18px;
  padding-block: 4px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* 대기실 */
.host main.lobby { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.lobby-join {
  container-type: inline-size;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink);
  padding: 26px; display: grid; justify-items: center; text-align: center; gap: 6px;
}
.lj-line { margin: 0; font-size: clamp(18px, 2.3vw, 26px); font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.lj-line.sub { color: var(--ink-2); font-weight: 650; font-size: clamp(16px, 1.8vw, 20px); }
.big-pin {
  font-size: clamp(40px, 15cqi, 116px); font-weight: 850; letter-spacing: .06em; font-variant-numeric: tabular-nums; line-height: 1;
  margin: 12px 0 14px; padding: 10px 28px; border-radius: 18px; background: var(--sun); border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  white-space: nowrap; max-width: 100%;
}
.lobby-join .qr { width: min(220px, 52vw); aspect-ratio: 1; max-width: 100%; }
.lobby-join .qr svg { width: 100%; height: 100%; display: block; }
.lobby-join .hint { margin: 0; }
.lobby-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lobby-count { display: flex; align-items: baseline; gap: 8px; }
.lobby-count .n { font-size: 60px; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; }
.lobby-count span { font-weight: 750; color: var(--ink-2); font-size: 18px; }
.names { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; min-height: 110px; }
.names li { animation: pop .25s ease-out; }
.names li.waiting { color: var(--ink-2); font-size: 16px; animation: none; }
.name-chip {
  padding: 8px 16px; border-radius: 999px; background: #fff; border: 1.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
  font-weight: 750; font-size: 18px; cursor: pointer; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.name-chip:hover { background: #fde4df; border-color: var(--danger); color: var(--danger); text-decoration: line-through; }
.names li.away .name-chip { opacity: .5; }
.lobby-opts { display: grid; gap: 10px; background: rgba(255, 255, 255, .6); border-radius: 14px; padding: 14px; }
.lobby-side .host-primary { align-self: stretch; }

/* 문제 */
.host main.qstage { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "card side" "tiles tiles"; gap: 18px; align-content: start; }
.host main.qstage.intro { grid-template-columns: minmax(0, 1fr); grid-template-areas: "card" "ready"; align-content: center; }
.q-card {
  grid-area: card; background: var(--paper); border: 2px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink);
  padding: 22px 26px; display: grid; gap: 12px; justify-items: center; text-align: center; min-width: 0;
}
.q-type { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 700; font-size: 14px; }
.q-type span { display: inline-grid; }
.q-text { margin: 0; font-size: clamp(24px, 3.6vw, 46px); line-height: 1.25; letter-spacing: -0.02em; font-weight: 800; text-wrap: balance; }
.q-text.small { font-size: clamp(20px, 2.6vw, 32px); }
.q-img { max-height: 34vh; width: auto; max-width: 100%; border-radius: 12px; }
.q-side { grid-area: side; display: grid; justify-items: center; align-content: center; gap: 10px; min-width: 150px; }
.answered { font-weight: 750; font-size: 17px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ready { grid-area: ready; display: grid; justify-items: center; gap: 10px; }
.ready-bar { width: min(520px, 80%); height: 12px; border-radius: 6px; background: rgba(58, 42, 20, .12); overflow: hidden; }
.ready-bar i { display: block; height: 100%; width: 0; background: var(--honey); border-radius: 6px; }
.ready p { margin: 0; font-size: 20px; font-weight: 750; color: var(--ink-2); }
.tiles { grid-area: tiles; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--tile); color: var(--tile-fg); border-radius: 16px; min-height: clamp(76px, 12vh, 130px);
  display: flex; align-items: center; gap: 16px; padding: 14px 22px; font-size: clamp(18px, 2.4vw, 30px); font-weight: 800;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18); min-width: 0;
}
.tile-mark { display: grid; flex: none; }
.tile-text { min-width: 0; overflow-wrap: anywhere; }
.tiles.ox .tile { justify-content: center; min-height: clamp(110px, 24vh, 230px); }
.type-wait {
  grid-area: tiles; display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 140px; padding: 16px;
  border: 2px dashed rgba(58, 42, 20, .28); border-radius: 18px; font-size: clamp(17px, 2vw, 22px); font-weight: 700; color: var(--ink-2); text-align: center;
}
.type-wait span:first-child { display: grid; color: var(--honey); }

/* 남은 시간 고리 */
.timer { position: relative; flex: none; }
.timer svg { width: 100%; height: 100%; display: block; }
.timer .tr-bg { fill: #fff; stroke: rgba(58, 42, 20, .12); stroke-width: 9; }
.timer .tr-fg { fill: none; stroke: var(--honey); stroke-width: 9; stroke-linecap: round; }
.timer .tr-n { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 850; font-variant-numeric: tabular-nums; }
.host-timer .tr-n { font-size: 46px; }
.play-timer .tr-n { font-size: 20px; }
.timer.low .tr-fg { stroke: var(--danger); }
.timer.low .tr-n { color: var(--danger); }

/* 답 공개 */
.r-head { display: grid; gap: 6px; text-align: center; justify-items: center; }
.r-sum { margin: 0; color: var(--ink-2); font-weight: 700; font-size: 18px; }
.r-answers { margin: 0; font-weight: 750; font-size: 18px; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 16px; height: min(46vh, 380px); width: min(980px, 100%); margin: 0 auto; }
.bar-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; text-align: center; }
.bar-n { font-size: 26px; font-weight: 850; font-variant-numeric: tabular-nums; }
.bar-well { flex: 1; display: flex; align-items: flex-end; }
.bar { display: block; width: 100%; background: var(--tile); border-radius: 10px 10px 0 0; }
.bar-col.no .bar, .bar-col.no .bar-foot { opacity: .35; }
.bar-foot { display: flex; justify-content: center; align-items: center; gap: 8px; background: var(--tile); color: var(--tile-fg); padding: 8px; border-radius: 0 0 10px 10px; margin-top: -6px; }
.bar-foot > span { display: grid; }
.bar-ok { background: #fff; color: var(--ok); border-radius: 50%; width: 28px; height: 28px; place-items: center; }
.bar-label { font-weight: 750; font-size: clamp(14px, 1.6vw, 18px); overflow-wrap: anywhere; }
.groups { display: grid; gap: 10px; width: min(820px, 100%); margin: 0 auto; }
.grp { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1.5px solid var(--line-2); border-radius: 14px; padding: 10px 14px; font-size: clamp(17px, 2vw, 22px); font-weight: 750; }
.grp.ok { border-color: var(--ok); background: #eaf6ec; }
.grp-mark { display: grid; color: var(--ok); width: 22px; flex: none; }
.grp-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.grp-n { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 16px; }
.stage-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: auto; }

/* 순위 */
.stage-title { margin: 0; text-align: center; font-size: clamp(28px, 4vw, 48px); font-weight: 850; letter-spacing: -0.02em; }
.rank-list { list-style: none; padding: 0; margin: 0 auto; width: min(860px, 100%); display: grid; gap: 10px; }
.rank-row {
  display: grid; grid-template-columns: 40px minmax(0, 1.3fr) minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  background: var(--paper); border-radius: 14px; padding: 12px 16px; font-size: clamp(17px, 2vw, 22px); font-weight: 750; animation: pop .3s ease-out both;
}
.rank-row:nth-child(2) { animation-delay: .06s; } .rank-row:nth-child(3) { animation-delay: .12s; } .rank-row:nth-child(4) { animation-delay: .18s; } .rank-row:nth-child(5) { animation-delay: .24s; }
.rank-row.first { background: var(--sun); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.rk { font-weight: 850; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.rk-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-bar { height: 10px; border-radius: 5px; background: rgba(58, 42, 20, .1); overflow: hidden; }
.rk-bar i { display: block; height: 100%; background: var(--honey); border-radius: 5px; }
.rank-row.first .rk-bar i { background: var(--ink); }
.rk-gain { color: var(--ok); font-size: 15px; font-variant-numeric: tabular-nums; }
.rank-row.first .rk-gain { color: var(--ink); }
.rk-score { font-variant-numeric: tabular-nums; text-align: right; min-width: 4ch; }

/* 끝: 장독대 시상대 */
.host main.estage { align-items: center; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 2vw, 18px); width: 100%; margin-top: 8px; }
.pod { display: grid; justify-items: center; gap: 4px; width: min(200px, 30vw); animation: rise-in .6s cubic-bezier(.2, .7, .2, 1) both; }
.pod-2 { animation-delay: .25s; } .pod-1 { animation-delay: .6s; }
@keyframes rise-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.pod-name { font-weight: 800; font-size: clamp(16px, 2.2vw, 26px); text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.pod-score { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.pod-jar {
  position: relative; width: 100%; margin-top: 14px; display: grid; place-items: center; background: var(--sun);
  border: 2px solid var(--ink); border-radius: 44% 44% 16px 16px / 34% 34% 16px 16px; box-shadow: 0 4px 0 var(--ink);
}
.pod-lip { position: absolute; top: -11px; left: 28%; right: 28%; height: 16px; border: 2px solid var(--ink); border-radius: 8px; background: inherit; }
.pod-jar b { font-size: clamp(34px, 5vw, 56px); font-weight: 900; }
.pod-1 .pod-jar { height: clamp(140px, 26vh, 220px); }
.pod-2 .pod-jar { height: clamp(104px, 19vh, 160px); background: #ffe08a; }
.pod-3 .pod-jar { height: clamp(78px, 14vh, 118px); background: #fff0c4; }
.rest { list-style: none; padding: 0; margin: 0; width: min(560px, 100%); display: grid; gap: 6px; counter-reset: r 3; }
.rest li { display: flex; gap: 10px; padding: 8px 14px; background: rgba(255, 255, 255, .75); border-radius: 10px; font-weight: 650; counter-increment: r; }
.rest li::before { content: counter(r); color: var(--ink-3); font-weight: 800; width: 2ch; font-variant-numeric: tabular-nums; }
.rest li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rest li span:last-child { font-variant-numeric: tabular-nums; }
.end-acts { justify-content: center; margin-top: 8px; }

/* 결과 표 */
.table-wrap { overflow-x: auto; }
.rtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.rtable th, .rtable td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.rtable th { font-size: 13px; color: var(--ink-2); }
.rtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.rtable td:first-child, .rtable th:first-child { width: 3em; }
h3.sub { font-size: 16px; margin: 20px 0 8px; }
.byq { margin: 0; padding-left: 24px; display: grid; gap: 8px; font-size: 14.5px; }
.byq li { padding-left: 4px; }
.byq li > * { vertical-align: middle; }
.byq-t { display: block; }
.byq-bar { display: inline-block; width: calc(100% - 56px); height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.byq-bar i { display: block; height: 100%; background: var(--ok); }
.byq-n { display: inline-block; width: 48px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ───── 학생 폰 ───── */
.play-page { background: var(--butter); }
.play { min-height: 100dvh; display: flex; flex-direction: column; background: var(--butter); color: var(--ink); transition: background .25s; }
.play-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 750; min-height: 50px; }
.play-top .brand-mark { display: grid; }
.play-top .grow { flex: 1; }
.pt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-brand .brand-ko, .pt-brand .brand-en { font-size: 19px; }
.pt-score { background: var(--ink); color: var(--sun); border-radius: 999px; padding: 3px 10px; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.play-off { background: var(--danger); color: #fff; text-align: center; font-size: 14px; padding: 6px 12px; }
.play-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 8px 14px 18px; }
.play.ask .play-body { justify-content: flex-start; }
.play .join-panel { margin: 0 auto; }
.play .center-msg { margin: 0 auto; }
.wait-box { display: grid; justify-items: center; text-align: center; gap: 8px; }
.wait-box h1 { margin: 0; font-size: clamp(26px, 7vw, 36px); font-weight: 850; letter-spacing: -0.02em; text-wrap: balance; }
.wait-box p { margin: 0; }
.jar-bob { animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.big-name { font-size: 26px; font-weight: 850; background: #fff; padding: 6px 18px; border-radius: 999px; border: 1.5px solid var(--ink); max-width: 100%; overflow-wrap: anywhere; }
.qof { font-weight: 750; color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.p-qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p-qtext { margin: 0; font-size: clamp(20px, 5.6vw, 28px); line-height: 1.3; font-weight: 800; text-align: center; text-wrap: balance; }
.wait-box .p-qtext { margin: 6px 0 10px; }
.p-look { margin: 0; text-align: center; color: var(--ink-2); font-weight: 700; }
.p-tiles { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 260px; }
.p-tiles.n3 .p-tile:last-child { grid-column: span 2; }
.p-tile {
  border: 0; border-radius: 18px; background: var(--tile); color: var(--tile-fg); display: grid; place-items: center; align-content: center; gap: 6px;
  padding: 12px; font-weight: 800; font-size: 17px; cursor: pointer; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .2); touch-action: manipulation; min-width: 0;
}
.p-tile:active { transform: scale(.97); }
.p-tile .tile-text { text-align: center; }
.type-form { display: grid; gap: 10px; margin-top: 8px; }
.type-in { font-size: 22px; text-align: center; padding: 14px; font-weight: 700; }
.sent-mark, .res-mark { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; }
.sent-mark { background: var(--sun); border: 2px solid var(--ink); }
.sent-mark svg, .res-mark svg { width: 48px; height: 48px; }
.res-mark { background: rgba(255, 255, 255, .22); }
.play.res-right { background: var(--ok); color: #fff; }
.play.res-wrong, .play.res-late { background: #b8422f; color: #fff; }
.play.res-right .muted, .play.res-wrong .muted, .play.res-late .muted { color: inherit; opacity: .85; }
.play.res-poll .res-mark, .play.res-none .res-mark { background: var(--sun); color: var(--ink); border: 2px solid var(--ink); }
.gain { font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; }
.streak { font-weight: 750; background: rgba(255, 255, 255, .2); padding: 4px 12px; border-radius: 999px; }
.answer-was { font-weight: 750; background: rgba(255, 255, 255, .16); border-radius: 10px; padding: 6px 12px; max-width: 100%; overflow-wrap: anywhere; }
.rank-line { font-weight: 750; font-variant-numeric: tabular-nums; }
.play.end { background: var(--sun); }
.play { container-type: inline-size; }
.final-rank { font-size: clamp(36px, 15cqi, 64px) !important; font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 860px) {
  .host main.lobby { grid-template-columns: minmax(0, 1fr); }
  .host main.qstage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "card" "tiles"; }
  .q-side { grid-template-columns: auto auto auto; align-items: center; justify-content: center; }
  .host-timer { width: 84px !important; height: 84px !important; }
  .host-timer .tr-n { font-size: 30px; }
  .rank-row { grid-template-columns: 32px minmax(0, 1fr) auto auto; }
  .rank-row .rk-bar { display: none; }
}
@media (max-width: 820px) {
  .qe-body { grid-template-columns: minmax(0, 1fr); }
  .qe-side { position: static; }
  .qe-list { display: flex; overflow-x: auto; max-height: none; padding-bottom: 4px; }
  .qe-list li { flex: none; }
  .qe-item { width: auto; max-width: 200px; }
  .qe-edit { padding: 16px 14px 4px; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tiles.ox { grid-template-columns: 1fr 1fr; }
  .bars { gap: 8px; }
  .bar-n { font-size: 20px; }
  .qe-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .quiz-row .meta { display: none; }
  .host-title { display: none; }
  .row-acts .btn.small { padding: 0 10px; }
}

/* ───── 객관식·투표 보기: 은은한 색 카드 ───── */
:is(.tile, .p-tile):is(.ans-0, .ans-1, .ans-2, .ans-3) {
  border: 1.5px solid var(--tile-line); box-shadow: 0 2px 0 var(--tile-line); font-weight: 750;
}
:is(.tile, .p-tile):is(.ans-0, .ans-1, .ans-2, .ans-3) .tile-mark {
  width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, .75); color: var(--tile-mark); place-items: center; flex: none;
}
.tile-img { display: block; width: 100%; max-height: 24vh; object-fit: contain; border-radius: 10px; }
.tiles.pics .tile { flex-direction: column; align-items: stretch; justify-content: center; position: relative; padding: 12px; gap: 8px; min-height: 0; }
.tiles.pics .tile .tile-mark { position: absolute; top: 10px; left: 10px; z-index: 1; }
.tiles.pics .tile .tile-text { text-align: center; }
.p-tile:is(.ans-0, .ans-1, .ans-2, .ans-3) { position: relative; padding: 14px 12px; font-size: 18px; }
.p-tile:is(.ans-0, .ans-1, .ans-2, .ans-3) .tile-mark { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; border-radius: 8px; }
.p-tile:is(.ans-0, .ans-1, .ans-2, .ans-3):active { filter: brightness(.96); }
.p-tiles.pics .tile-img { max-height: 18vh; }
.pv-phone-screen .p-tiles.pics .tile-img { max-height: 120px; }
/* 공개 막대: 보기 색 그대로, 정답이 아닌 것은 흐리게 */
.bar-col:is(.ans-0, .ans-1, .ans-2, .ans-3) .bar { background: var(--tile-bar); }
.bar-col:is(.ans-0, .ans-1, .ans-2, .ans-3) .bar-foot { background: var(--tile); color: var(--tile-mark); }
.bar-col.ok .bar-ok { background: var(--ok); color: #fff; }
.bar-img { display: block; max-width: 100%; max-height: 90px; margin: 2px auto 0; object-fit: contain; border-radius: 8px; }
/* 만들기 화면의 보기 줄 */
.qe-choice:is(.ans-0, .ans-1, .ans-2, .ans-3) { background: var(--tile); border: 1.5px solid var(--tile-line); }
.qe-choice:is(.ans-0, .ans-1, .ans-2, .ans-3) .input { border-color: var(--line-2); background: #fff; }
.qe-choice:is(.ans-0, .ans-1, .ans-2, .ans-3) .qe-shape { color: var(--tile-mark); width: 24px; }
.qe-choice .icon-btn:hover { background: rgba(58, 42, 20, .07); color: var(--ink); }
.qe-addpic { color: var(--ink-3); }
.qe-thumb { width: 44px; height: 44px; padding: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff; cursor: pointer; flex: none; }
.qe-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qe-choice:is(.ans-0, .ans-1, .ans-2, .ans-3) .qe-ok { border-color: var(--tile-line); color: var(--ink-2); background: rgba(255, 255, 255, .6); }
.qe-choice:is(.ans-0, .ans-1, .ans-2, .ans-3) .qe-ok.on { background: #fff; border-color: var(--ok); color: #1f6b3a; }
@media (max-width: 480px) {
  .qe-choice { gap: 4px; padding: 5px; }
  .qe-choice .qe-ok { padding: 0 8px; }
  .qe-choice .qe-ok span:last-child { display: none; }
}

/* ───── 혼자 연습 ───── */
.pr-chip {
  flex: none; border: 1.5px solid var(--honey); background: #fff4d0; color: var(--ink); border-radius: 999px;
  padding: 2px 10px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pr-chip:hover { background: var(--sun); }
.pr-box > p:first-child { margin: 0 0 4px; text-align: left; }
.pr-box .check { text-align: left; }
.pr-box .check small { display: block; color: var(--ink-2); font-weight: 400; }
.pr-link { display: grid; gap: 10px; justify-items: center; }
.pr-link[hidden] { display: none; }
.pr-link .link { width: 100%; }
.pr-badge { background: var(--sun); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }
.practice .play-body { width: 100%; max-width: 720px; margin: 0 auto; }
.pr-intro .pr-title { margin: 0; font-size: clamp(24px, 6vw, 32px); font-weight: 850; text-wrap: balance; }
.pr-progress { flex: 1; max-width: 220px; height: 8px; border-radius: 4px; background: rgba(58, 42, 20, .12); overflow: hidden; }
.pr-progress i { display: block; height: 100%; background: var(--honey); transition: width .3s; }
.pr-yours { font-weight: 650; opacity: .9; overflow-wrap: anywhere; }
.play.res .pr-next { margin-top: 14px; min-width: 200px; background: #fff; color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.play.res .qof { color: inherit; opacity: .8; }
.pr-end .play-body { justify-content: flex-start; padding-top: 24px; }
.pr-score { font-variant-numeric: tabular-nums; }
.pr-review-box { padding: 16px 18px; }
.pr-review-box h2 { margin: 0 0 8px; font-size: 17px; }
.pr-review { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; }
.pr-review li { display: grid; gap: 2px; }
.pr-r-ans { color: var(--ok); font-weight: 700; }
.pr-r-mine { color: var(--ink-2); font-size: 14px; }
.pr-acts { display: grid; gap: 10px; }
.share-box.pr-box { text-align: left; justify-items: stretch; }
.pr-box .pr-link { justify-items: center; text-align: center; }
/* 노란 바탕(끝 화면)에서는 로고 옆 ongi 글자가 묻히므로 갈색으로 */
.play.end .pt-brand .brand-en { color: var(--ink); opacity: .7; }
.pr-box .qr { width: min(220px, 60vw); }
