/* apps/seat/style.css — 자리 바꾸기: 크림색 공책 종이 + 칠판 초록 + 나무 교탁 + 머스터드 포인트.
 * 자리는 흰 책상 카드(초록 테두리), 공개될 때 카드가 뒤집힌다(3D flip, 움직임 줄이기면 바로). 모바일 한 줄(--app-width 480px).
 * 제목·버튼은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다).
 * 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 */
:root {
  --paper: #f7f2e6;
  --rule: rgba(36, 73, 58, 0.07);
  --ink: #1d2b24;
  --ink-dim: rgba(29, 43, 36, 0.78);
  --ink-faint: rgba(29, 43, 36, 0.58);
  --board: #24493a;
  --board-2: #2f5c4a;
  --board-soft: #e3eee7;
  --chalk: #fbfaf5;
  --wood: #b5763c;
  --wood-2: #8f5726;
  --mustard: #f2c14e;
  --coral: #e2574c;
  --line: rgba(29, 43, 36, 0.14);
  --card-shadow: 0 1px 0 rgba(29, 43, 36, 0.06), 0 10px 26px -14px rgba(36, 73, 58, 0.45);

  --font-display: 'Baloo 2', var(--font-sans);
  --display-weight: 800;
  --wb: normal;
  --hyphens: manual;

  --mg-top-fg: var(--ink);
  --mg-top-badge-bg: var(--board);
  --mg-top-badge-fg: var(--mustard);
  --lang-bg: #fff;
  --lang-fg: var(--ink);
  --lang-border: var(--line);
  --mg-star-on: #f0a92a;
  --mg-star-off: rgba(29, 43, 36, 0.16);
  --mg-heart-bg: #fff;
  --mg-heart-border: var(--coral);
  --mg-heart-fg: var(--coral);
  --mg-heart-on: var(--coral);
  --mg-share-bg: #fff;
  --mg-share-border: var(--line);
  --mg-x: var(--ink);
  --mg-tiktok: var(--ink);
  --mg-faq-bg: #fff;
  --mg-faq-border: var(--line);
  --mg-end-retry-bg: var(--board);
  --mg-end-retry-fg: #fff;
  --toast-bg: var(--board);
  --toast-fg: #fff;
}

html { background: var(--paper); }
body.st-body {
  min-height: 100vh;
  color: var(--ink);
  line-height: 1.6;
  word-break: var(--wb);
  hyphens: var(--hyphens);
  -webkit-hyphens: var(--hyphens);
  background-color: var(--paper);
  background-image: linear-gradient(var(--rule) 1px, transparent 1px);
  background-size: 100% 28px;
}
[hidden] { display: none !important; }

.st-h1, .st-kicker, .st-h1-main, .st-h1-main em, .st-btn, .st-h2, .st-badge, .st-doc h1, .st-more-btn, .st-card-title, .st-desk, .st-step-num {
  font-family: var(--font-display);
}

.st-shell { max-width: var(--app-width); margin: 0 auto; padding: 8px 16px 0; }
.st-screen { padding-top: 12px; }

/* ---------------- 제목 ---------------- */
.st-h1 { margin: 6px 0 8px; text-align: center; line-height: 1.15; font-weight: var(--display-weight); }
.st-kicker {
  display: inline-block; margin-bottom: 10px; padding: 3px 14px; border-radius: 999px;
  background: var(--board); color: var(--mustard); font-size: 14px; line-height: 1.5; letter-spacing: 0.01em;
}
.st-h1-main { display: block; font-size: 32px; color: var(--ink); overflow-wrap: break-word; }
.st-h1-main em {
  font-style: normal; color: var(--chalk); background: var(--board); padding: 0 10px; border-radius: 10px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.st-hook { margin: 0 auto 16px; max-width: 400px; text-align: center; font-size: 15px; color: var(--ink-dim); }

/* ---------------- 카드 ---------------- */
.st-form { display: flex; flex-direction: column; gap: 12px; }
.st-card { padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--card-shadow); }
.st-label { display: block; margin: 0 0 6px; font-size: 13.5px; font-weight: 800; line-height: 1.35; color: var(--ink-dim); }
.st-card-title { font-size: 17px; font-weight: var(--display-weight); color: var(--ink); margin-bottom: 10px; }
.st-hint { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-faint); }
.st-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.st-row-head .st-label { margin: 0; font-size: 17px; font-family: var(--font-display); font-weight: var(--display-weight); color: var(--ink); }
.st-head-btns { display: inline-flex; gap: 6px; }
.st-mini {
  min-height: 34px; padding: 4px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--board-soft);
  color: var(--board); font-size: 13px; font-weight: 800; line-height: 1.2; cursor: pointer;
}
.st-mini:hover { border-color: var(--board); }
.st-mini:disabled { opacity: 0.5; cursor: default; }
.st-textarea {
  display: block; width: 100%; min-height: 140px; padding: 10px 12px; resize: vertical;
  border: 2px solid var(--line); border-radius: 14px; background: #fffdf8; color: var(--ink);
  font: 600 16px/1.5 var(--font-sans);
}
.st-textarea:focus, .st-select:focus { outline: none; border-color: var(--board); box-shadow: 0 0 0 4px rgba(36, 73, 58, 0.16); }
.st-textarea[aria-invalid="true"] { border-color: var(--coral); }
.st-textarea::placeholder { color: rgba(29, 43, 36, 0.38); font-weight: 500; }
.st-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.st-count-pill { padding: 2px 10px; border-radius: 999px; background: var(--board-soft); color: var(--board); font-size: 13px; font-weight: 800; }
.st-count-pill.is-short { background: #fde4e1; color: #b3322a; }
.st-warn { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: #b3322a; }

/* ---------------- 줄·칸 ---------------- */
.st-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.st-side { min-width: 0; }
.st-stepper { display: flex; align-items: stretch; }
.st-step {
  width: 44px; min-height: 46px; flex: 0 0 auto; border: 2px solid var(--line); background: var(--board-soft); color: var(--board);
  font-size: 22px; font-weight: 800; line-height: 1; cursor: pointer;
}
.st-step:first-child { border-radius: 14px 0 0 14px; border-right: 0; }
.st-step:last-child { border-radius: 0 14px 14px 0; border-left: 0; }
.st-step:disabled { opacity: 0.4; cursor: default; }
.st-step-num {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); background: #fffdf8; font-size: 22px; font-weight: 800; color: var(--ink);
}

/* ---------------- 탭 방식 ---------------- */
.st-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--board-soft); }
.st-seg-btn {
  min-width: 0; min-height: 40px; padding: 4px 6px; border: 0; border-radius: 10px; background: transparent;
  color: var(--board); font-size: 14px; font-weight: 800; line-height: 1.2; cursor: pointer;
}
.st-seg-btn[aria-checked="true"] { background: var(--board); color: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.st-seg-sm .st-seg-btn { min-height: 34px; font-size: 13px; }
.st-pin-pick { display: block; margin-top: 10px; }
.st-select {
  display: block; width: 100%; min-width: 0; min-height: 44px; padding: 6px 10px; border: 2px solid var(--line); border-radius: 12px;
  background: #fffdf8; color: var(--ink); font: 600 15px/1.3 var(--font-sans);
}

/* ---------------- 자리 지도 ---------------- */
.st-map-wrap { margin-top: 12px; padding: 12px; border-radius: 16px; background: var(--board); }
.st-desk {
  display: block; margin: 0 auto; width: 58%; max-width: 240px; padding: 4px 8px; border-radius: 10px; text-align: center;
  background: linear-gradient(180deg, var(--wood) 0%, var(--wood-2) 100%); color: #fff; font-size: 14px; line-height: 1.5;
  font-weight: var(--display-weight); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); overflow-wrap: anywhere;
}
.st-desk-map { margin-bottom: 12px; }
.st-map { --cols: 6; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 5px; }
.st-mseat {
  position: relative; min-width: 0; aspect-ratio: 4 / 3; padding: 2px; border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 8px;
  background: var(--chalk); color: var(--board); cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.st-mseat:active { transform: scale(0.94); }
.st-mseat.is-front { background: #fff3cf; }
.st-mseat.is-blocked { background: transparent; border-style: dashed; border-color: rgba(255, 255, 255, 0.35); }
.st-mseat.is-blocked::before, .st-mseat.is-blocked::after {
  content: ''; position: absolute; left: 20%; right: 20%; top: 50%; height: 2px; background: rgba(255, 255, 255, 0.45); transform: rotate(35deg);
}
.st-mseat.is-blocked::after { transform: rotate(-35deg); }
.st-mseat.is-pinned { background: var(--mustard); border-color: var(--mustard); }
.st-mseat-name {
  display: block; max-width: 100%; font-size: 10px; font-weight: 800; line-height: 1.1; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.st-map.is-pin-mode .st-mseat:not(.is-blocked):not(.is-pinned) { border-color: var(--mustard); }
.st-mseat:focus-visible { outline: 3px solid var(--mustard); outline-offset: 1px; }

/* ---------------- 규칙 ---------------- */
.st-more-btn {
  display: block; width: 100%; min-height: 46px; padding: 8px 14px; border: 2px dashed rgba(36, 73, 58, 0.35); border-radius: 16px;
  background: rgba(255, 255, 255, 0.6); color: var(--board); font-size: 15px; font-weight: var(--display-weight); cursor: pointer; text-align: center;
}
.st-more-btn[aria-expanded="true"] { border-style: solid; background: #fff; }
.st-more { display: flex; flex-direction: column; gap: 16px; }
.st-rule .st-label { margin-bottom: 2px; color: var(--ink); font-size: 14.5px; }
.st-rule-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
.st-rule-row-2 { grid-template-columns: 1fr auto; }
.st-add { min-height: 44px; background: var(--board); color: #fff; border-color: var(--board); }
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.st-chip {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px 2px 2px 10px; border-radius: 999px;
  background: var(--board-soft); color: var(--board); font-size: 13px; font-weight: 800;
}
.st-chip-text { min-width: 0; overflow-wrap: anywhere; }
.st-chip-x {
  width: 28px; height: 28px; flex: 0 0 auto; border: 0; border-radius: 50%; background: transparent; color: var(--board);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.st-chip-x:hover { background: rgba(36, 73, 58, 0.12); }
.st-chip-none { font-size: 12.5px; color: var(--ink-faint); }

/* ---------------- 섞기 ---------------- */
.st-error {
  margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: #fde4e1; color: #a12b23; font-size: 14px; font-weight: 700; line-height: 1.45;
}
.st-btn {
  display: block; width: 100%; min-height: 56px; padding: 8px 16px; border: 0; border-radius: 18px; cursor: pointer;
  font-size: 19px; font-weight: var(--display-weight); line-height: 1.2; text-align: center;
}
.st-btn-primary {
  margin-top: 16px; background: var(--board); color: #fff;
  box-shadow: 0 5px 0 #14291f, 0 12px 24px -10px rgba(36, 73, 58, 0.6);
  transition: transform 0.08s, box-shadow 0.08s;
}
.st-btn-primary:active { transform: translateY(3px); box-shadow: 0 2px 0 #14291f; }
.st-btn-primary:disabled { opacity: 0.75; cursor: progress; }
.st-btn-ghost {
  min-height: 46px; font-size: 14.5px; background: #fff; color: var(--board); border: 2px solid rgba(36, 73, 58, 0.3); border-radius: 14px;
}
.st-btn-ghost:disabled { opacity: 0.5; cursor: default; }
.st-fair { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--ink-faint); }

/* ---------------- 결과 ---------------- */
.st-result { margin-top: 22px; }
.st-result-card { padding: 16px 12px; }
.st-result-card.is-shared { border-color: var(--mustard); box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.35), var(--card-shadow); }
.st-badge {
  display: inline-block; margin: 0 0 6px; padding: 2px 12px; border-radius: 999px; background: var(--mustard); color: var(--ink);
  font-size: 13px; font-weight: var(--display-weight);
}
.st-h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.25; font-weight: var(--display-weight); color: var(--ink); }
.st-shared-note { margin: 0 0 8px; font-size: 13px; color: var(--ink-dim); }
.st-res-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; }
.st-res-bar .st-seg { flex: 1 1 auto; max-width: 260px; }
.st-board { --cols: 6; padding: 12px 10px; border-radius: 16px; background: var(--board); }
.st-board .st-desk-board { margin: 0 auto 12px; }
.st-board.is-teacher .st-desk-board { margin: 12px auto 0; }
.st-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 5px; }
.st-seat { min-width: 0; aspect-ratio: 4 / 3; perspective: 500px; }
.st-seat.is-aisle { border: 2px dashed rgba(255, 255, 255, 0.18); border-radius: 8px; }
.st-flip {
  position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.st-seat.is-on .st-flip { transform: rotateY(180deg); }
.st-face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
}
.st-back {
  background: var(--board-2); border: 2px solid rgba(255, 255, 255, 0.35);
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.28) 0 18%, transparent 19%);
}
.st-front { transform: rotateY(180deg); background: var(--chalk); border: 2px solid #fff; padding: 2px 3px; }
.st-seat.is-empty .st-front { background: rgba(255, 255, 255, 0.14); border: 2px dashed rgba(255, 255, 255, 0.4); }
.st-name {
  display: block; text-align: center; color: var(--ink); font-weight: 800; line-height: 1.12; word-break: keep-all; overflow-wrap: normal;
  font-size: clamp(10px, calc(60px / var(--cols) + 5px), 17px);
}
.st-name.is-clip {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; overflow-wrap: anywhere;
}
.st-seat.is-empty .st-name { color: rgba(255, 255, 255, 0.7); font-weight: 600; }
.st-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.st-actions .st-btn-ghost { padding: 6px 4px; font-size: 13.5px; }

/* ---------------- 개인정보 ---------------- */
.st-doc { margin: 16px 0; padding: 20px 18px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--card-shadow); }
.st-doc h1 { margin: 0 0 12px; font-size: 26px; line-height: 1.25; font-weight: var(--display-weight); }
.st-doc h2 { margin: 18px 0 6px; font-size: 16px; }
.st-doc p { margin: 0 0 10px; font-size: 14.5px; color: var(--ink-dim); }
.st-doc a { color: var(--board); }

.site-footer { padding: 26px 0 30px; text-align: center; font-size: 12.5px; color: var(--ink-faint); }
.site-footer a { color: var(--ink-dim); }

/* ---------------- 언어별 ---------------- */
html:lang(th) body, html:lang(th) .st-h1-main, html:lang(th) .st-btn { line-height: 1.7; letter-spacing: 0; word-break: normal; }
html:lang(th) .st-h1 { line-height: 1.45; }
html:lang(th) .st-name, html:lang(th) .st-seg-btn, html:lang(th) .st-label { line-height: 1.5; }
html:lang(vi) .st-h1 { line-height: 1.3; }
html:lang(ja) .st-h1-main, html:lang(ja) .st-hook { word-break: auto-phrase; }
/* base.css 의 :lang(zh|th|vi) 글꼴 규칙이 제목 글꼴 상속을 끊으므로 다시 지정 */
html:lang(zh) .st-h1, html:lang(zh) .st-kicker, html:lang(zh) .st-h1-main, html:lang(zh) .st-btn, html:lang(zh) .st-h2, html:lang(zh) .st-desk, html:lang(zh) .st-more-btn, html:lang(zh) .st-card-title, html:lang(zh) .st-row-head .st-label,
html:lang(th) .st-h1, html:lang(th) .st-kicker, html:lang(th) .st-h1-main, html:lang(th) .st-btn, html:lang(th) .st-h2, html:lang(th) .st-desk, html:lang(th) .st-more-btn, html:lang(th) .st-card-title, html:lang(th) .st-row-head .st-label,
html:lang(vi) .st-h1, html:lang(vi) .st-kicker, html:lang(vi) .st-h1-main, html:lang(vi) .st-btn, html:lang(vi) .st-h2, html:lang(vi) .st-desk, html:lang(vi) .st-more-btn, html:lang(vi) .st-card-title, html:lang(vi) .st-row-head .st-label {
  font-family: var(--font-display);
}

@media (max-width: 374px) {
  .st-h1-main { font-size: 28px; }
  .st-card { padding: 14px 12px; }
  .st-map-wrap { padding: 10px 8px; }
  .st-board { padding: 10px 6px; }
  .st-grid, .st-map { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .st-flip, .st-mseat, .st-btn-primary { transition: none; }
}
