/* 어사문 스크래블 — 게임 전용 스타일. Yuja EDU v2 토큰(../DESIGN.md) 이식 + 플레이어 4색 시스템. */

:root {
  /* Yuja Lemon System (본체 DESIGN.md와 동일) */
  --yuja-lemon: #FFE135;
  --yuja-lemon-amber: #F5C800;
  --yuja-forest: #142814;
  --yuja-forest-mid: #1E3D1E;
  --yuja-lemon-tint: #FEFCE8;
  --leaf-green: #4CAA48;
  --leaf-green-mid: #388E3C;
  --leaf-green-deep: #2D7A29;
  --leaf-green-light: #B8E0B5;
  --leaf-green-tint: #E8F5E7;

  --canvas-white: #FFFFFF;
  --canvas-cream: #F7F6F3;
  --surface: #F1F0EE;
  --hairline: #E8E7E4;
  --hairline-strong: #D3D1CB;

  --ink-deep: #1A1A1A;
  --ink: #37352F;
  --charcoal: #4B4945;
  --slate: #6F6E69;
  --steel: #9B9A97;
  --stone: #B5B4B0;

  --success: #0F7B5C;
  --warning: #E67E22;
  --error: #C82014;

  /* 플레이어 4색 (DESIGN.md §2) */
  --p1-main: #F5C800; --p1-tint: #FEF7D6; --p1-deep: #B79500;
  --p2-main: #4CAA48; --p2-tint: #E4F3E3; --p2-deep: #2D7A29;
  --p3-main: #4A90D9; --p3-tint: #E3EEF9; --p3-deep: #2F6AA8;
  --p4-main: #E8734A; --p4-tint: #FBE7DE; --p4-deep: #B54F2C;

  /* 보드 보너스 칸 */
  --bonus-l2-bg: #DCEEFB; --bonus-l2-fg: #2F6AA8;
  --bonus-l3-bg: #4A90D9; --bonus-l3-fg: #FFFFFF;
  --bonus-w2-bg: #FBE1EC; --bonus-w2-fg: #B5406E;
  --bonus-w3-bg: #E24A4A; --bonus-w3-fg: #FFFFFF;
  --bonus-star-bg: #FFE135; --bonus-star-fg: #142814;

  --tile-bg: #FFFDF5;
  --tile-border: #E8E7E4;

  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-hanja: "Noto Serif KR", "Malgun Gothic", serif;

  --cell-size: 42px;
}

@media (max-width: 767px) {
  :root { --cell-size: 30px; }
}

* { box-sizing: border-box; }

body.scrabble-body {
  font-family: var(--font-ui);
  background: var(--canvas-cream);
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
}

/* ============================== 로비 ============================== */

.lobby-hero {
  background: var(--yuja-lemon-tint);
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--hairline);
}

.lobby-hero img { width: 96px; height: 96px; object-fit: contain; margin: 0 auto 0.75rem; display: block; }
.lobby-hero h1 { font-size: 1.6rem; font-weight: 800; color: var(--ink-deep); margin: 0 0 0.4rem; }
.lobby-hero p { color: var(--slate); margin: 0; font-size: 0.95rem; }

.lobby-body { max-width: 640px; margin: 0 auto; padding: 1.5rem; }

.lobby-section { margin-bottom: 1.75rem; }
.lobby-section > label.lobby-label {
  display: block; font-weight: 700; font-size: 0.9rem; color: var(--charcoal); margin-bottom: 0.6rem;
}

.count-picker { display: flex; gap: 0.5rem; }
.count-picker button {
  flex: 1; padding: 0.7rem 0; border-radius: 12px; border: 1.5px solid var(--hairline-strong);
  background: var(--canvas-white); font-weight: 700; font-size: 1rem; cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.count-picker button.active {
  border-color: var(--yuja-lemon-amber); background: var(--yuja-lemon-tint); color: var(--ink-deep);
}
.count-picker button:active { transform: scale(0.95); }

.player-row {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem;
  border: 1px solid var(--hairline); border-radius: 12px; margin-bottom: 0.5rem; background: var(--canvas-white);
}
.player-row .swatch {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(0,0,0,0.08);
}
.player-row input[type="text"] {
  flex: 1; border: none; background: transparent; font-size: 0.95rem; font-weight: 600; color: var(--ink);
  outline: none; min-width: 0;
}
.player-row .player-num { font-size: 0.75rem; color: var(--steel); font-weight: 700; }

.vol-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.vol-chip {
  padding: 0.5rem 0; text-align: center; border-radius: 10px; border: 1.5px solid var(--hairline-strong);
  background: var(--canvas-white); font-weight: 700; font-size: 0.85rem; cursor: pointer; user-select: none;
}
.vol-chip.active { border-color: var(--leaf-green); background: var(--leaf-green-tint); color: var(--leaf-green-deep); }

.option-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0; border-bottom: 1px solid var(--hairline);
}
.option-row:last-child { border-bottom: none; }
.option-row .opt-label { font-size: 0.9rem; font-weight: 600; color: var(--charcoal); }
.option-row select {
  border: 1.5px solid var(--hairline-strong); border-radius: 8px; padding: 0.35rem 0.6rem;
  font-family: var(--font-ui); font-size: 0.85rem; background: var(--canvas-white);
}

.cta-primary {
  display: block; width: 100%; padding: 0.9rem; border-radius: 50px; border: none;
  background: var(--yuja-lemon-amber); color: var(--ink-deep); font-weight: 800; font-size: 1.05rem;
  cursor: pointer; transition: transform 0.12s ease; box-shadow: 0 4px 14px rgba(245, 200, 0, 0.35);
}
.cta-primary:active { transform: scale(0.95); }
.cta-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.lobby-error {
  color: var(--error); font-size: 0.85rem; margin-top: 0.5rem; min-height: 1.2em;
}

/* ============================== 게임 화면 공통 ============================== */

.game-shell {
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}

.game-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem; background: var(--yuja-forest); color: #fff; flex-shrink: 0;
}
.game-topbar .title { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.game-topbar .title img { width: 28px; height: 28px; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; }
.sound-toggle {
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 1rem; display: flex; align-items: center; justify-content: center;
}
.sound-toggle:active { transform: scale(0.92); }

.player-chip-row {
  display: flex; gap: 0.5rem; padding: 0.6rem 1rem; overflow-x: auto; background: var(--canvas-white);
  border-bottom: 1px solid var(--hairline); flex-shrink: 0;
}
.player-chip {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  border-radius: 999px; border: 1.5px solid var(--hairline-strong); font-size: 0.82rem; font-weight: 700;
  white-space: nowrap; background: var(--canvas-white); transition: box-shadow 0.15s ease;
}
.player-chip .dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.player-chip.current {
  border-color: var(--yuja-lemon-amber); box-shadow: 0 0 0 3px rgba(245,200,0,0.25);
  background: var(--yuja-lemon-tint);
}
.player-chip .score { color: var(--steel); font-weight: 800; }
.player-chip .crown { font-size: 0.9rem; }

.game-main-3col {
  flex: 1; display: flex; min-height: 0;
}
/* 데스크톱: DOM 순서 그대로 좌(점수/로그) → 중앙(보드) → 우(입력/힌트/패스) */
.side-panel-left { order: 1; }
.board-center { flex: 1; display: flex; min-height: 0; min-width: 0; order: 2; }
.action-panel-right { order: 3; }

@media (max-width: 1023px) {
  .game-main-3col { flex-direction: column; overflow-y: auto; }
  .board-center { order: 1; flex: none; height: 46vh; min-height: 320px; }
  .action-panel-right { order: 2; }
  .side-panel-left { order: 3; }
}

/* ============================== 보드 ============================== */

.board-viewport {
  flex: 1; position: relative; overflow: hidden; background: var(--canvas-cream);
  touch-action: none; cursor: grab;
}
.board-viewport:active { cursor: grabbing; }

.board-pan-zoom {
  position: absolute; top: 50%; left: 50%; transform-origin: 0 0;
  will-change: transform;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(15, var(--cell-size));
  grid-template-rows: repeat(15, var(--cell-size));
  transform: translate(-50%, -50%);
  background: var(--canvas-white);
  border: 3px solid var(--yuja-forest);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(20, 40, 20, 0.18);
}

.board-cell {
  position: relative;
  border: 0.5px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cell-size) * 0.24);
}

.board-cell.bonus-l2 { background: var(--bonus-l2-bg); color: var(--bonus-l2-fg); }
.board-cell.bonus-l3 { background: var(--bonus-l3-bg); color: var(--bonus-l3-fg); }
.board-cell.bonus-w2 { background: var(--bonus-w2-bg); color: var(--bonus-w2-fg); }
.board-cell.bonus-w3 { background: var(--bonus-w3-bg); color: var(--bonus-w3-fg); }
.board-cell.bonus-star { background: var(--bonus-star-bg); color: var(--bonus-star-fg); }

.bonus-label { font-weight: 800; font-size: calc(var(--cell-size) * 0.22); opacity: 0.85; }

.board-cell.has-tile {
  background: var(--tile-bg);
  border: 1.5px solid var(--tile-border);
  z-index: 1;
}

.board-cell.has-tile.owner-p1 { background: var(--p1-tint); border-color: var(--p1-main); }
.board-cell.has-tile.owner-p2 { background: var(--p2-tint); border-color: var(--p2-main); }
.board-cell.has-tile.owner-p3 { background: var(--p3-tint); border-color: var(--p3-main); }
.board-cell.has-tile.owner-p4 { background: var(--p4-tint); border-color: var(--p4-main); }

/* 타일 중앙의 큰 글자는 한자가 아니라 한글 음(音)이다 — 어사문은 한자 글자를 화면에 노출하지 않는다. */
.tile-main {
  font-family: var(--font-hanja); font-weight: 700; color: var(--ink);
  font-size: calc(var(--cell-size) * 0.46);
  line-height: 1;
}

.tile-owner-dot {
  position: absolute; top: 2px; left: 2px; width: 6px; height: 6px; border-radius: 50%;
}
.owner-p1 .tile-owner-dot { background: var(--p1-main); }
.owner-p2 .tile-owner-dot { background: var(--p2-main); }
.owner-p3 .tile-owner-dot { background: var(--p3-main); }
.owner-p4 .tile-owner-dot { background: var(--p4-main); }

/* 훈(訓) — 뜻을 나타내는 짧은 라벨(예: "넉", "죽을"). 한자 대신 뜻으로 학습하는 어사문 원칙. */
.tile-hun {
  position: absolute; bottom: 1px; left: 3px; font-size: calc(var(--cell-size) * 0.15);
  color: var(--slate); font-family: var(--font-ui); line-height: 1;
}
.tile-pts {
  position: absolute; bottom: 1px; right: 3px; font-size: calc(var(--cell-size) * 0.15);
  color: var(--steel); font-family: var(--font-ui); font-weight: 700; line-height: 1;
}
.tile-dir-arrow {
  position: absolute; top: 1px; right: 2px; font-size: calc(var(--cell-size) * 0.2);
  color: var(--leaf-green-deep); font-weight: 800; line-height: 1;
}

/* 교차(더블크로스) 링 표시 */
.board-cell.has-tile.crossed-p1 { box-shadow: inset 0 0 0 2.5px var(--p1-main); }
.board-cell.has-tile.crossed-p2 { box-shadow: inset 0 0 0 2.5px var(--p2-main); }
.board-cell.has-tile.crossed-p3 { box-shadow: inset 0 0 0 2.5px var(--p3-main); }
.board-cell.has-tile.crossed-p4 { box-shadow: inset 0 0 0 2.5px var(--p4-main); }

.board-cell.anchor-highlight {
  box-shadow: inset 0 0 0 3px var(--yuja-lemon-amber);
  animation: anchor-pulse 1.1s ease-in-out infinite;
}
@keyframes anchor-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--yuja-lemon-amber); }
  50% { box-shadow: inset 0 0 0 4px var(--yuja-lemon-amber); }
}

@media (prefers-reduced-motion: reduce) {
  .board-cell.anchor-highlight { animation: none; }
}

.board-cell.ghost-tile {
  background: var(--yuja-lemon-tint);
  box-shadow: inset 0 0 0 1.5px var(--yuja-lemon-amber);
}
.ghost-main {
  font-family: var(--font-hanja); font-weight: 700; color: var(--yuja-lemon-amber);
  font-size: calc(var(--cell-size) * 0.46); opacity: 0.75;
}

/* ============================== 좌측 패널: 점수판·로그 ============================== */

.side-panel-left {
  width: 260px; flex-shrink: 0; background: var(--canvas-white); border-right: 1px solid var(--hairline);
  padding: 1rem; overflow-y: auto;
}

.side-panel-left h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--steel); margin: 1.2rem 0 0.5rem; }
.side-panel-left h2:first-child { margin-top: 0; }

.score-row {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; border-radius: 10px; margin-bottom: 0.3rem;
}
.score-row.current { background: var(--yuja-lemon-tint); }
.score-row .dot { width: 12px; height: 12px; border-radius: 50%; }
.score-row .name { flex: 1; font-weight: 700; font-size: 0.88rem; }
.score-row .score { font-weight: 800; font-size: 0.95rem; }

.log-list { font-size: 0.8rem; color: var(--slate); }
.log-list li { margin-bottom: 0.3rem; list-style: none; }

/* ============================== 우측 패널: 입력·힌트·패스 ============================== */

.action-panel-right {
  width: 320px; flex-shrink: 0; background: var(--canvas-white); border-left: 1px solid var(--hairline);
  padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem;
}

.turn-banner {
  text-align: center; font-size: 0.85rem; font-weight: 700; color: var(--charcoal);
  padding: 0.5rem; background: var(--surface); border-radius: 12px;
}

.word-input-panel, .hint-panel {
  background: var(--canvas-white); border: 1px solid var(--hairline); border-radius: 14px; padding: 0.9rem;
}
.panel-heading { font-size: 0.8rem; font-weight: 800; color: var(--charcoal); margin-bottom: 0.5rem; }
.panel-hint-text { font-size: 0.8rem; color: var(--slate); line-height: 1.5; }

.selected-anchor-chip {
  display: flex; align-items: center; gap: 0.5rem; background: var(--yuja-lemon-tint);
  border-radius: 10px; padding: 0.5rem 0.7rem; margin-bottom: 0.7rem;
}
.selected-anchor-chip .hun { font-family: var(--font-hanja); font-weight: 800; color: var(--ink-deep); font-size: 0.95rem; }
.selected-anchor-chip .clear-btn {
  margin-left: auto; border: none; background: none; color: var(--slate); cursor: pointer; font-size: 0.8rem;
}

.word-type-input {
  width: 100%; box-sizing: border-box; padding: 0.6rem 0.7rem; border-radius: 10px;
  border: 1.5px solid var(--hairline-strong); font-size: 1rem; font-family: var(--font-ui);
  margin-bottom: 0.6rem; text-align: center; letter-spacing: 0.05em;
}
.word-type-input:focus { outline: none; border-color: var(--yuja-lemon-amber); }

.direction-choice { display: flex; gap: 0.5rem; margin-bottom: 0.6rem; }
.direction-choice button {
  flex: 1; padding: 0.5rem; border-radius: 10px; border: 1.5px solid var(--hairline-strong);
  background: var(--canvas-white); font-weight: 700; cursor: pointer;
}
.direction-choice button.active { border-color: var(--yuja-lemon-amber); background: var(--yuja-lemon-tint); }

.word-input-confirm-btn {
  width: 100%; padding: 0.7rem; border-radius: 999px; border: none;
  background: var(--yuja-lemon-amber); color: var(--ink-deep); font-weight: 800; cursor: pointer;
}
.word-input-confirm-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.hint-target-chip {
  display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 700;
  color: var(--ink-deep); margin-bottom: 0.6rem;
}
.hint-word-list { max-height: 220px; overflow-y: auto; }
.hint-word-item {
  padding: 0.5rem 0.6rem; border-radius: 10px; background: var(--surface); margin-bottom: 0.4rem;
}
.hint-word-item .w { font-weight: 800; font-size: 0.88rem; color: var(--ink-deep); }
.hint-word-item .def { font-size: 0.74rem; color: var(--slate); }

.hint-btn-row button {
  width: 100%; padding: 0.65rem; border-radius: 12px; border: 1.5px solid var(--leaf-green);
  background: var(--canvas-white); color: var(--leaf-green-deep); font-weight: 700; cursor: pointer;
}
.hint-btn-row button:disabled { opacity: 0.4; cursor: not-allowed; }

.bottom-actions button {
  width: 100%; padding: 0.75rem; border-radius: 12px; border: 1.5px solid var(--error);
  background: var(--canvas-white); color: var(--error); font-weight: 700; cursor: pointer;
}
.score-estimate-chip {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 190px;
  background: var(--yuja-forest); color: #fff; padding: 0.4rem 0.9rem; border-radius: 999px;
  font-weight: 800; font-size: 0.85rem; box-shadow: 0 4px 14px rgba(0,0,0,0.25); z-index: 20;
}

/* ============================== 토스트 / 팝업 ============================== */

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  background: var(--ink-deep); color: #fff; padding: 0.6rem 1rem; border-radius: 10px;
  font-size: 0.85rem; font-weight: 600; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  max-width: 90vw; text-align: center;
}
.toast.warning { background: var(--error); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 40, 20, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal-card {
  background: var(--canvas-white); border-radius: 20px; max-width: 420px; width: 100%;
  padding: 1.5rem; max-height: 85vh; overflow-y: auto;
}
.modal-card img.modal-mascot { width: 64px; height: 64px; display: block; margin: 0 auto 0.6rem; }
.modal-title { text-align: center; font-weight: 800; font-size: 1.1rem; margin-bottom: 1rem; color: var(--ink-deep); }

.mismatch-compare { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1.2rem; }
.mismatch-card { flex: 1; text-align: center; padding: 0.75rem 0.5rem; border-radius: 12px; }
.mismatch-card.existing { background: var(--surface); }
.mismatch-card.attempted { background: var(--yuja-lemon-tint); }
.mismatch-card .label { font-size: 0.7rem; color: var(--steel); margin-bottom: 0.3rem; }
.mismatch-card .hun { font-family: var(--font-hanja); font-weight: 800; font-size: 1.05rem; color: var(--ink-deep); }
.mismatch-neq { font-size: 1.3rem; font-weight: 800; color: var(--error); }

.homophone-list-title { font-size: 0.82rem; font-weight: 700; color: var(--charcoal); margin-bottom: 0.5rem; }
.homophone-item {
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.5rem 0.6rem;
  border-radius: 10px; background: var(--surface); margin-bottom: 0.4rem;
}
.homophone-item .hun { font-weight: 700; font-family: var(--font-hanja); font-size: 0.9rem; color: var(--ink); }
.homophone-item .def { font-size: 0.75rem; color: var(--slate); }

.modal-cta {
  display: block; width: 100%; margin-top: 0.5rem; padding: 0.75rem; border-radius: 50px; border: none;
  background: var(--yuja-lemon-amber); color: var(--ink-deep); font-weight: 800; cursor: pointer;
}
.modal-cta.secondary {
  background: var(--canvas-white); border: 1.5px solid var(--hairline-strong); color: var(--slate); margin-top: 0.75rem;
}
.modal-cta:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================== 힌트: 관문1 단톡방 퀴즈 ============================== */

.quiz-card { max-width: 460px; }

.quiz-bubble-list {
  max-height: 42vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem;
  margin-bottom: 0.75rem; padding: 0.25rem;
}
.quiz-bubble {
  align-self: flex-start; max-width: 88%; background: var(--surface); border-radius: 14px;
  padding: 0.5rem 0.7rem; opacity: 0; transform: translateY(8px); transition: opacity 0.25s ease, transform 0.25s ease;
}
.quiz-bubble.in { opacity: 1; transform: translateY(0); }
.quiz-speaker { display: block; font-size: 0.7rem; font-weight: 700; color: var(--leaf-green-deep); margin-bottom: 0.15rem; }
.quiz-text { font-size: 0.85rem; color: var(--ink); line-height: 1.4; }
.quiz-blank {
  display: inline-block; font-weight: 800; color: var(--yuja-lemon-amber);
  background: var(--yuja-lemon-tint); border-radius: 6px; padding: 0 0.3rem;
}

.quiz-footer { display: flex; align-items: center; gap: 0.9rem; }
.quiz-timer {
  --pct: 100%;
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(var(--leaf-green) var(--pct), var(--hairline) var(--pct));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem; color: var(--ink-deep);
  transition: background 0.3s linear;
}
.quiz-timer span { background: var(--canvas-white); width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.quiz-options { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.quiz-option-btn {
  padding: 0.55rem 0.4rem; border-radius: 10px; border: 1.5px solid var(--hairline-strong);
  background: var(--canvas-white); font-weight: 700; font-size: 0.82rem; cursor: pointer;
}
.quiz-option-btn:disabled { cursor: default; }
.quiz-option-btn.correct { border-color: var(--success); background: var(--leaf-green-tint); color: var(--success); }
.quiz-option-btn.wrong { border-color: var(--error); background: #FCEAE8; color: var(--error); }

/* ============================== 힌트: 탐색 배너 ============================== */

.tile-pick-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--yuja-forest); color: #fff; padding: 0.55rem 0.6rem 0.55rem 1rem;
  border-radius: 999px; display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.82rem; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,0.3); max-width: 92vw;
}
.tile-pick-banner button {
  border: none; background: rgba(255,255,255,0.15); color: #fff; border-radius: 999px;
  padding: 0.3rem 0.7rem; font-size: 0.75rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
}

/* ============================== 힌트: 단어 리스트 시트 ============================== */

.word-list-sheet { max-height: 50vh; overflow-y: auto; margin-bottom: 0.5rem; }
.word-list-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; width: 100%;
  text-align: left; padding: 0.6rem 0.7rem; border-radius: 12px; border: 1.5px solid var(--hairline);
  background: var(--canvas-white); margin-bottom: 0.4rem; cursor: pointer;
}
.word-list-item:hover { border-color: var(--yuja-lemon-amber); }
.word-list-item .w { font-weight: 800; font-size: 0.95rem; color: var(--ink-deep); }
.word-list-item .def { font-size: 0.75rem; color: var(--slate); }

/* ============================== 동의 팝업 (다른 플레이어 승인) ============================== */

.approval-word { text-align: center; font-size: 1.4rem; font-weight: 800; color: var(--ink-deep); margin-bottom: 0.3rem; }
.approval-instruction { text-align: center; font-size: 0.85rem; color: var(--charcoal); margin-bottom: 1rem; line-height: 1.5; }

.approval-dict-links { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.approval-dict-links a {
  flex: 1; text-align: center; padding: 0.55rem 0.3rem; border-radius: 10px; border: 1.5px solid var(--hairline-strong);
  background: var(--surface); color: var(--charcoal); font-size: 0.75rem; font-weight: 700; text-decoration: none;
}
.approval-dict-hint { text-align: center; font-size: 0.72rem; color: var(--steel); margin-bottom: 1.1rem; }

.approval-question { text-align: center; font-weight: 700; font-size: 0.88rem; color: var(--ink-deep); margin-bottom: 0.6rem; }
.approval-voters { display: flex; flex-direction: column; gap: 0.5rem; }
.approval-voter-row { display: flex; align-items: center; gap: 0.6rem; }
.approval-voter-row .name-tag {
  flex: 1; font-weight: 700; font-size: 0.85rem; padding: 0.4rem 0.6rem; border-radius: 10px; color: var(--ink-deep);
}
.approval-voter-row button {
  padding: 0.45rem 0.9rem; border-radius: 10px; border: none; font-weight: 800; cursor: pointer; font-size: 0.82rem;
}
.approval-voter-row .btn-yes { background: var(--leaf-green-tint); color: var(--success); }
.approval-voter-row .btn-no { background: #FCEAE8; color: var(--error); }
.approval-voter-row button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================== 힌트: 관문2 뜻연결 ============================== */

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1rem; }
.match-col { display: flex; flex-direction: column; gap: 0.5rem; }
.match-word-btn, .match-def-btn {
  padding: 0.6rem 0.5rem; border-radius: 10px; border: 2px solid var(--hairline-strong);
  background: var(--canvas-white); font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: left;
  min-height: 52px; transition: border-color 0.15s ease, transform 0.1s ease;
}
.match-word-btn { font-weight: 800; text-align: center; }
.match-word-btn.active { border-color: var(--yuja-lemon-amber); background: var(--yuja-lemon-tint); }
.match-word-btn.paired, .match-def-btn.paired { border-width: 3px; }
.match-def-btn.paired, .match-word-btn.paired { cursor: default; }

/* ============================== 모션 연출 ============================== */

@keyframes tile-pop-in {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.tile-pop-in { animation: tile-pop-in 0.35s ease-out both; }

@keyframes idiom-glow-sweep {
  0% { box-shadow: inset 0 0 0 0 rgba(255, 225, 53, 0); }
  50% { box-shadow: inset 0 0 14px 5px rgba(255, 225, 53, 0.95); }
  100% { box-shadow: inset 0 0 0 0 rgba(255, 225, 53, 0); }
}
.idiom-glow { animation: idiom-glow-sweep 1.1s ease-in-out; }

@keyframes score-float-up {
  0% { opacity: 0; transform: translate(-50%, 0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -46px); }
}
.score-float {
  position: fixed; z-index: 70; transform: translate(-50%, 0);
  font-weight: 800; font-size: 1rem; color: var(--yuja-lemon-amber);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4); pointer-events: none;
  animation: score-float-up 1.4s ease-out both;
}

.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(var(--rot)); opacity: 0; }
}
.confetti-piece {
  position: absolute; top: -20px; width: 8px; height: 14px; border-radius: 2px;
  animation-name: confetti-fall; animation-timing-function: ease-in; animation-fill-mode: forwards;
}

@keyframes crown-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.6); }
  100% { transform: scale(1); }
}
.crown-pulse { display: inline-block; animation: crown-pulse 0.5s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .tile-pop-in, .idiom-glow, .score-float, .confetti-piece, .crown-pulse { animation: none !important; }
}

/* ============================== 종료 화면(대관식) ============================== */

.end-screen-overlay {
  position: fixed; inset: 0; background: var(--yuja-forest); z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.5rem; overflow-y: auto;
}
.end-screen-mascot { width: 96px; height: 96px; margin-bottom: 0.5rem; }
@keyframes crown-drop {
  0% { transform: translateY(-80px) scale(1.3); opacity: 0; }
  60% { transform: translateY(6px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
.end-screen-crown { font-size: 2rem; animation: crown-drop 0.7s cubic-bezier(.34,1.56,.64,1) both; }
.end-screen-title { color: #fff; font-size: 1.3rem; font-weight: 800; margin: 0.4rem 0 1.2rem; text-align: center; }

.podium-list { width: 100%; max-width: 420px; margin-bottom: 1.2rem; }
.podium-row {
  display: flex; align-items: center; gap: 0.6rem; background: var(--yuja-forest-mid);
  border-radius: 14px; padding: 0.7rem 0.9rem; margin-bottom: 0.5rem; color: #fff;
}
.podium-row.rank-1 { background: var(--yuja-lemon-tint); color: var(--ink-deep); }
.podium-rank { font-weight: 800; font-size: 1rem; width: 28px; text-align: center; }
.podium-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.podium-name { flex: 1; font-weight: 700; font-size: 0.95rem; }
.podium-score { font-weight: 800; font-size: 1.05rem; }

.end-stats {
  width: 100%; max-width: 420px; background: rgba(255,255,255,0.08); border-radius: 14px;
  padding: 0.8rem 1rem; margin-bottom: 1.3rem; color: #fff; font-size: 0.82rem;
}
.end-stats-row { display: flex; justify-content: space-between; padding: 0.25rem 0; }
.end-stats-row .label { color: rgba(255,255,255,0.6); }
.end-stats-row .value { font-weight: 700; }

.end-cta-row { display: flex; gap: 0.6rem; width: 100%; max-width: 420px; }
.end-cta-row button {
  flex: 1; padding: 0.8rem; border-radius: 50px; font-weight: 800; cursor: pointer; border: none;
}
.end-cta-row .btn-restart { background: var(--yuja-lemon-amber); color: var(--ink-deep); }
.end-cta-row .btn-lobby { background: rgba(255,255,255,0.12); color: #fff; }

/* ============================== 개회 사자성어 룰렛 ============================== */
/* 태블릿·데스크톱 공통 — 화면 방향 회전 없이 항상 정방향으로 표시된다. */

.opening-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.6rem; padding: 1.2rem; text-align: center;
}

.opening-mascot { width: 56px; height: 56px; }
.opening-title { color: #fff; font-size: 1.1rem; font-weight: 800; min-height: 1.6em; }

.wheel-wrap { position: relative; width: 220px; height: 220px; margin: 0.3rem 0; }
.wheel-pointer {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 1.5rem; color: var(--yuja-lemon-amber); z-index: 2; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}
.wheel-disc {
  width: 220px; height: 220px; border-radius: 50%;
  border: 5px solid var(--yuja-lemon-amber);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  position: relative;
  transform: rotate(0deg);
}
.wheel-label {
  position: absolute; top: 50%; left: 50%; transform-origin: 0 0;
  color: #fff; font-weight: 800; font-size: 0.85rem; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  white-space: nowrap;
}

.opening-quiz-panel {
  background: var(--yuja-forest-mid); border-radius: 16px; padding: 0.9rem 1rem;
  width: 100%; max-width: 340px; box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.opening-player-tag {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-weight: 800;
  font-size: 0.75rem; color: var(--ink-deep); margin-bottom: 0.5rem;
}
.opening-question { color: #fff; font-size: 0.85rem; line-height: 1.4; margin-bottom: 0.6rem; }
.opening-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.opening-option-btn {
  padding: 0.6rem 0.5rem; border-radius: 10px; border: 1.5px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08); color: #fff; font-weight: 700; font-size: 0.8rem; cursor: pointer;
}
.opening-option-btn:active { transform: scale(0.95); }
.opening-option-btn.correct { border-color: var(--success); background: rgba(15,123,92,0.4); }
.opening-option-btn.wrong { border-color: var(--error); background: rgba(200,32,20,0.35); opacity: 0.6; }
.opening-option-btn:disabled { cursor: default; }
.opening-attempt-timer { margin-top: 0.5rem; font-size: 0.72rem; color: rgba(255,255,255,0.6); }
.opening-fail-msg { color: #fff; font-size: 0.9rem; font-weight: 700; padding: 0.5rem 0; }

@media (max-width: 480px) {
  .wheel-wrap { width: 180px; height: 180px; }
  .wheel-disc { width: 180px; height: 180px; }
  .wheel-label { font-size: 0.72rem; }
}
