:root {
  --bg: #f1f8ec;
  --ink: #2d2a3e;
  --muted: #7a7590;
  --card: #fcfffa;
  --line: #d6e5cb;
  --red: #ef5b5b;
  --red-d: #c43d3d;
  --red-bg: #ffe3e1;
  --blue: #3d8bfd;
  --blue-d: #2a69c9;
  --blue-bg: #dfeeff;
  --neutral: #e9dfca;
  --accent: #9be26b;
  --accent-d: #5fae35;
  --radius: 16px;
  --gutter: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  word-break: keep-all;
  min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

#app { max-width: 560px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--actions-h, 0px) + 40px + env(safe-area-inset-bottom)); min-height: 100dvh; }
.home { padding-bottom: 24px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 800; cursor: pointer;
  transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); }
.btn.big { min-height: 56px; font-size: 1.1rem; width: 100%; }
.btn.small { min-height: 42px; padding: 6px 12px; font-size: .95rem; flex: 1; }
.btn.on { background: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; text-decoration: underline; width: 100%; color: var(--muted); }
.btn.red { background: var(--red); color: #fff; }
.btn.blue { background: var(--blue); color: #fff; }

/* 홈 */
.logo { text-align: center; padding: 36px 0 18px; }
.logo svg { width: 120px; height: 120px; }
.logo h1 { font-size: 2.4rem; letter-spacing: -1px; margin-top: 4px; }
.logo p { color: var(--muted); margin-top: 4px; font-weight: 600; }
.field { display: block; font-weight: 800; margin: 14px 0 12px; }
.field input, .join input {
  display: block; width: 100%; height: 52px; margin-top: 6px; padding: 0 14px;
  background: #fff; border: 2px solid var(--ink); border-radius: 14px; font-size: 1.05rem;
}
.or { text-align: center; color: var(--muted); font-size: .92rem; margin: 22px 0 10px; font-weight: 600; }
.join { display: flex; gap: 10px; }
.join input { margin: 0; text-transform: uppercase; letter-spacing: 3px; text-align: center; font-weight: 800; }
.join .btn { width: 110px; }
.home .btn.ghost { margin-top: 18px; }
.home footer { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 18px; }
.home .btn.primary { margin-top: 4px; }

/* 상단 바 */
.top { display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.top .code { flex: 1; text-align: center; font-weight: 700; color: var(--muted); font-size: .9rem; }
.top .code b { color: var(--ink); font-size: 1.15rem; letter-spacing: 3px; margin-left: 4px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--ink); background: var(--card); font-weight: 900; cursor: pointer; font-size: 1.1rem; }

/* 대기실 */
.share { margin: 6px 0 14px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team { border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.team.red { background: var(--red-bg); }
.team.blue { background: var(--blue-bg); }
.team h2 { font-size: 1.15rem; }
.team.red h2 { color: var(--red-d); }
.team.blue h2 { color: var(--blue-d); }
.slot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 30px; }
.slot .label { font-size: .78rem; font-weight: 800; color: var(--muted); width: 100%; }
.slot em { color: var(--muted); font-size: .9rem; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); font-weight: 700; font-size: .92rem; }
.pill.me { background: var(--accent); }
.pill.off { opacity: .45; }
.team .row { display: flex; gap: 6px; margin-top: auto; flex-direction: column; }
.spectators { margin-top: 12px; padding: 12px; border: 2px dashed var(--line); border-radius: var(--radius); }
.spectators h3 { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.spectators .slot { margin-bottom: 8px; }
.start-area { margin-top: 18px; text-align: center; }
.start-area p { color: var(--muted); margin-top: 10px; font-size: .95rem; }
.warn { color: var(--red-d) !important; font-weight: 700; }

/* 게임 */
.scorebar { display: flex; gap: 6px; align-items: stretch; margin-bottom: 8px; }
.chip { flex: 0 0 60px; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 4px 2px; border-radius: 12px; border: 2px solid var(--ink); font-weight: 800; line-height: 1.15; }
.chip small { display: block; font-size: .68rem; font-weight: 700; opacity: .9; }
.chip b { font-size: 1.35rem; }
.chip.red { background: var(--red); color: #fff; }
.chip.blue { background: var(--blue); color: #fff; }
.chip.turn-on { outline: 4px solid var(--accent); outline-offset: 1px; }
.turnbar { text-align: center; font-weight: 800; padding: 8px; border-radius: 12px; margin-bottom: 8px; border: 2px solid var(--ink); }
.turnbar.red { background: var(--red-bg); color: var(--red-d); }
.turnbar.blue { background: var(--blue-bg); color: var(--blue-d); }
.turnbar .clueword { font-size: 1.35rem; color: var(--ink); }
.log { flex: 1; min-width: 0; height: 4.9em; overflow-y: auto; -webkit-overflow-scrolling: touch; font-size: .76rem; color: var(--muted); padding: 3px 6px; border: 2px solid var(--line); border-radius: 12px; background: #fffaf0; }
.log div { padding: 1px 0; line-height: 1.3; overflow-wrap: anywhere; }
.log div.red { color: var(--red-d); }
.log div.blue { color: var(--blue-d); }

.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.card {
  position: relative; aspect-ratio: 1 / 0.82; min-width: 0;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 2px; background: var(--card); border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  font-weight: 800; font-size: clamp(11px, 3.5vw, 16px); line-height: 1.15; cursor: pointer;
  overflow: hidden; overflow-wrap: break-word;
}
.card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
/* 대장에게만 보이는 색 힌트 */
.card.hint.red { background: #fff1f0; border-color: var(--red); box-shadow: 0 3px 0 var(--red); color: var(--red-d); }
.card.hint.blue { background: #eef6ff; border-color: var(--blue); box-shadow: 0 3px 0 var(--blue); color: var(--blue-d); }
.card.hint.neutral { background: #f3ecdc; color: #8a7f66; }
.card.hint.assassin { background: var(--ink); color: #fff; }
/* 열린 카드 */
.card.rev { box-shadow: none; transform: translateY(3px); cursor: default; }
.card.rev.red { background: var(--red); color: #fff; border-color: var(--red-d); }
.card.rev.blue { background: var(--blue); color: #fff; border-color: var(--blue-d); }
.card.rev.neutral { background: var(--neutral); color: #8a7f66; border-color: #cbbf9f; }
.card.rev.assassin { background: var(--ink); color: #fff; }
.card.dim { opacity: .55; }
.card.sel { outline: 4px solid var(--accent); outline-offset: 1px; transform: translateY(-2px); }
.card .mk { position: absolute; top: 1px; right: 3px; font-size: .75rem; }

/* 하단 행동 바 */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--card); border-top: 2px solid var(--ink);
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
}
.actions .inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.actions .msg { text-align: center; font-weight: 700; }
.actions .msg.warn { color: var(--red-d); }
.actions .msg small { display: block; color: var(--muted); font-weight: 600; }
.actions .row { display: flex; gap: 10px; }
.clue-form input { width: 100%; height: 50px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-size: 1.1rem; }
.nums { display: flex; gap: 4px; }
.nums button { flex: 1; height: 42px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; font-weight: 900; cursor: pointer; }
.nums button.on { background: var(--accent); }

.result { text-align: center; }
.result h2 { font-size: 1.5rem; }
.result.red h2 { color: var(--red-d); }
.result.blue h2 { color: var(--blue-d); }
.result p { color: var(--muted); font-weight: 600; margin: 4px 0 10px; }

/* 팝업 */
.modal { position: fixed; inset: 0; background: rgba(45, 42, 62, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; border-radius: 22px 22px 0 0; padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom)); border: 2px solid var(--ink); border-bottom: 0; }
.modal h2 { margin-bottom: 10px; }
.modal ol { padding-left: 22px; margin: 0 0 12px; }
.modal li { margin-bottom: 8px; }
.modal .tip { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: .95rem; margin-bottom: 14px; }

.banner { position: fixed; top: 0; left: 0; right: 0; background: var(--ink); color: #fff; text-align: center; padding: 6px; font-size: .9rem; z-index: 100; }
.toast { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 120; max-width: 90vw; text-align: center; font-weight: 700; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.center { text-align: center; padding-top: 80px; }
.center p { margin: 12px 0 20px; color: var(--muted); }

@media (min-width: 560px) {
  .card { font-size: 17px; }
}

.note { margin-top: 12px; padding: 10px 12px; background: #fff; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: .88rem; line-height: 1.5; }

/* ----- 언어 ----- */
.homebar { display: flex; justify-content: flex-end; padding-top: 12px; }
.lang-btn { min-height: 40px; padding: 6px 14px; background: var(--card); border: 2px solid var(--ink); border-radius: 999px; font-weight: 800; font-size: .92rem; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.lang-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.wordlang { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; padding: 8px 12px; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; font-weight: 700; }
.wordlang .btn.small { flex: 0 0 auto; min-height: 38px; }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.lang-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 48px; padding: 8px 14px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; font-weight: 800; font-size: 1.02rem; cursor: pointer; text-align: start; }
.lang-item.on { background: var(--accent); }
.picker-note { color: var(--muted); font-size: .9rem; margin: 0 0 6px; }

/* 카드 판은 어느 언어에서도 같은 위치로 보이게 고정하고, 단어는 그 글자의 방향대로 그린다 */
.board { direction: ltr; }
.card .w { unicode-bidi: plaintext; max-width: 100%; }

/* 오른쪽에서 왼쪽으로 쓰는 언어(아랍어) */
[dir="rtl"] .top .code { text-align: center; }
[dir="rtl"] .slot { direction: rtl; }
[dir="rtl"] .actions .msg { direction: rtl; }

/* 긴 단어는 작게, 라틴 문자 언어는 하이픈으로 줄바꿈 */
.card .w { hyphens: auto; -webkit-hyphens: auto; }
.card.s .w { font-size: .8em; }
.card.xs .w { font-size: .66em; }

.clue-form input:disabled { background: #f3ecdc; color: var(--muted); border-color: var(--line); cursor: not-allowed; }

/* ----- 소리 메뉴 ----- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; font-weight: 800; font-size: 1.05rem; }
.switch { min-width: 92px; min-height: 46px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 900; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.switch.on { background: var(--accent); }
.switch:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
/* 위쪽 버튼이 늘어나서 조금 줄인다 */
.top { gap: 6px; }
.top .icon-btn { width: 40px; height: 40px; }


/* 초대: "보내기" 옆에 "복사" */
.share { display: flex; gap: 8px; }
.share .btn.big { width: auto; flex: 1; }
.share .btn.copy { flex: 0 0 auto; padding: 0 14px; background: var(--card); }

/* ----- 제한 시간 ----- */
.timerrow { text-align: center; margin: -2px 0 8px; }
.timer { display: inline-block; min-width: 120px; padding: 4px 16px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 900; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.timer.low { background: var(--red); color: #fff; animation: timerPulse 1s ease-in-out infinite; }
@keyframes timerPulse { 50% { transform: scale(1.08); } }

/* ----- 맞춘 카드: 덮개로 단어를 가리고, 누르면 덮개가 살짝 들려서 단어가 보인다 ----- */
.card.rev { cursor: pointer; }
.card .cover { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; transition: transform .25s ease; }
.card.rev.red .cover { background: var(--red); }
.card.rev.blue .cover { background: var(--blue); }
.card.rev.neutral .cover { background: #d9cfb4; }
.card.rev.assassin .cover { background: var(--ink); }
.card .cover .ic { height: 84%; width: auto; max-width: 90%; }
.card .cover .skull { font-size: 1.6em; line-height: 1; }
.card.rev.peek .cover { transform: translateY(-78%); }

/* ----- 요원이 체크한 카드: 몇 명이 골랐는지 표시 ----- */
.card .vote { position: absolute; top: 1px; left: 1px; z-index: 3; min-width: 20px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--ink); border: 2px solid var(--ink); font-size: .7rem; font-weight: 800; line-height: 1.2; }

/* 체크한 카드가 여러 장이면 확정 버튼도 여러 개: 가로로 나란히, 모자라면 줄바꿈 */
.confirms { display: flex; flex-wrap: wrap; gap: 6px; }
.confirms .btn { flex: 1 1 40%; min-width: 0; overflow-wrap: anywhere; }
.confirms { max-height: 7.5em; overflow-y: auto; }

/* ----- 공개 방 · 참가자 · 채팅 ----- */
.check { display: flex; align-items: flex-start; gap: 10px; margin: 10px 2px 12px; font-size: .92rem; font-weight: 700; color: var(--muted); }
.check input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--accent); margin-top: 1px; }
.top .icon-btn { width: 36px; height: 36px; font-size: 1rem; padding: 0; }
.top { gap: 4px; }
@media (max-width: 430px) { .top .code .lbl { display: none; } }
.chatbtn { position: relative; }
.badge { position: absolute; top: -6px; right: -5px; min-width: 18px; padding: 0 4px; border-radius: 999px; background: #e11d48; color: #fff; border: 2px solid var(--ink); font-size: .68rem; font-style: normal; font-weight: 800; line-height: 1.25; }
.plist { margin-bottom: 12px; }
.prow { display: flex; flex-direction: column; gap: 6px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.prow.off .pname { opacity: .5; }
.prow.me .pname { background: #fff2c2; border-radius: 8px; padding: 2px 6px; align-self: flex-start; }
.pname { font-weight: 800; }
.pname small { font-weight: 700; color: var(--muted); margin-inline-start: 4px; }
.pname .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; background: var(--muted); }
.pname .dot.red { background: var(--red); }
.pname .dot.blue { background: var(--blue); }
.pact { display: flex; flex-wrap: wrap; gap: 6px; }
.pact .btn { flex: 0 0 auto; min-height: 36px; padding: 0 12px; }
.btn.danger { background: #ffe4e6; border-color: #be123c; color: #be123c; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; min-height: 40px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 800; cursor: pointer; }
.tabs button.on { background: var(--accent); }
.tabs button:disabled { opacity: .4; cursor: not-allowed; }
.chatlist { height: 38dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.cmsg { padding: 3px 0; line-height: 1.35; overflow-wrap: anywhere; }
.cmsg b { margin-inline-end: 4px; }
.cmsg.red b { color: var(--red-d); }
.cmsg.blue b { color: var(--blue-d); }
.cmsg.mine span { background: #fff2c2; border-radius: 8px; padding: 0 4px; }
.chatform { display: flex; gap: 6px; margin-bottom: 10px; }
.chatform input { flex: 1; min-width: 0; min-height: 46px; border: 2px solid var(--ink); border-radius: 12px; padding: 0 12px; font-size: 1rem; background: #fff; }
.chatform .btn { flex: 0 0 auto; padding: 0 16px; }

.home .check + .btn, .home .btn[data-act="random"] { margin-top: 12px; }
.home .btn[data-act="create"] { margin-bottom: 0; }

/* ----- 공개 방 목록 · 방 제목 ----- */
.titlefield { width: 100%; min-height: 48px; border: 2px solid var(--ink); border-radius: 14px; padding: 0 14px; font-size: 1rem; background: #fff; margin: 0 0 12px; }
.row2 { display: flex; gap: 8px; margin-top: 12px; }
.row2 .btn { flex: 1; min-width: 0; padding-inline: 8px; font-size: .95rem; }
.roomlist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; max-height: 52dvh; overflow-y: auto; }
.roomitem { text-align: start; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.roomitem b { font-size: 1.05rem; overflow-wrap: anywhere; }
.roomitem small { color: var(--muted); font-weight: 700; }
.roomitem:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.roomitem:disabled { opacity: .5; cursor: not-allowed; }
.wordlang .ttl { flex: 1; min-width: 0; text-align: end; overflow-wrap: anywhere; }

.home .row2 .btn { margin-top: 0; }

/* ----- 게임 중 자리 바꾸기 ----- */
.seatbtn { align-self: center; margin-top: 4px; min-height: 34px; padding: 0 14px; }
.seatopts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

/* 참가자 목록: 팀과 역할(대장/요원) */
.prole { font-size: .82rem; font-weight: 700; color: var(--muted); margin-top: 2px; }
.prole.cap { color: var(--ink); font-weight: 900; font-size: .95rem; }

/* ----- 36장(6×6) 판 ----- */
.board.b6 { grid-template-columns: repeat(6, 1fr); gap: 4px; }
.board.b6 .card { aspect-ratio: 1 / 0.95; font-size: clamp(9px, 2.9vw, 14px); border-radius: 8px; padding: 1px; }
.board.b6 .card.s .w { font-size: .8em; }
.board.b6 .card.xs .w { font-size: .62em; }
.board.b6 .card .vote { font-size: .6rem; min-width: 16px; padding: 0 2px; }
.nums.n12 { flex-wrap: wrap; }
.nums.n12 button { flex: 1 0 14%; }
.seg { display: flex; gap: 6px; }
.seg button { min-height: 38px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 800; cursor: pointer; }
.seg button.on { background: var(--accent); }

/* ===== 낱말사냥 ===== */
.logo-emoji { font-size: 84px; line-height: 1; }
.btn.green { background: #bfe6a3; }
.solonote { text-align: center; color: var(--muted); font-size: .9rem; font-weight: 600; margin: 6px 0 4px; }
.divider { height: 2px; background: var(--line); margin: 18px 0; border-radius: 2px; }
.lobby .roomname { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin: 6px 0 10px; font-size: 1.15rem; }
.lobby .roomname .btn { flex: 0 0 auto; min-height: 36px; }
.subhead { font-size: .9rem; color: var(--muted); margin: 14px 0 8px; font-weight: 800; }
.hint { display: block; color: var(--muted); font-weight: 600; font-size: .8rem; }
.switch { min-width: 84px; min-height: 40px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 800; cursor: pointer; }
.switch.on { background: var(--accent); }
.tip.small { font-size: .78rem; color: var(--muted); }
.center-t { text-align: center; }

.stats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 4px 0 10px; }
.stats span { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 2px 12px; font-weight: 800; font-size: .86rem; }
.guessform { position: sticky; top: 64px; z-index: 4; display: flex; gap: 8px; background: var(--bg); padding: 6px 0 8px; }
.guessform input { flex: 1; min-width: 0; min-height: 54px; border: 2px solid var(--ink); border-radius: 14px; padding: 0 14px; font-size: 1.15rem; font-weight: 700; background: #fff; }
.guessform .btn { width: 92px; min-height: 54px; font-size: 1.05rem; }
.tools { margin-top: 0; margin-bottom: 4px; }

.glist { display: flex; flex-direction: column; gap: 6px; }
.grow { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.grow .gbar { position: absolute; inset: 0 auto 0 0; background: #e3f1d9; z-index: 0; }
.grow > span { position: relative; z-index: 1; }
.grow .gword { flex: 1; min-width: 0; font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; }
.grow .gword small { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; }
.grow .grank { font-weight: 900; color: var(--accent-d); font-size: .95rem; }
.grow .gscore { min-width: 56px; text-align: end; font-weight: 800; font-variant-numeric: tabular-nums; }
.grow.cold { border-color: #dfe6ea; }
.grow.cold .gbar { background: #eef2f4; }
.grow.mild .gbar { background: #e6f1cf; }
.grow.warm { border-color: #f5c84c; }
.grow.warm .gbar { background: #fdeba8; }
.grow.hot { border-color: #ef7b45; }
.grow.hot .gbar { background: #ffd0b3; }
.grow.hot .grank, .grow.warm .grank { color: #c2410c; }
.grow.win { border-color: var(--accent-d); }
.grow.win .gbar { background: #b6ec8d; }
.grow.last { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }

.result { text-align: center; padding: 10px 0 6px; }
.result h2 { font-size: 1.6rem; }
.result .sub { color: var(--muted); font-weight: 700; margin-top: 4px; }
.result .answer { font-size: 2.6rem; font-weight: 900; letter-spacing: -1px; margin: 2px 0 6px; }
.near { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip2 { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: .92rem; }
.chip2 small { color: var(--muted); margin-inline-end: 4px; font-size: .7rem; }
.endbtns { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.home .logo { padding: 14px 0 6px; }
.logo-emoji { font-size: 64px; }
.home .logo h1 { font-size: 2rem; }

.levelbox { margin: 10px 0 12px; text-align: center; }
.levellabel { display: block; font-size: .85rem; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.levels { display: flex; gap: 8px; }
.lvl { flex: 1; min-height: 44px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.lvl.on { background: var(--accent); }
.lvl:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.levelnote { color: var(--muted); font-size: .82rem; font-weight: 600; margin-top: 6px; }
.levelcur { font-size: 1.1rem; }

.levels .lvl { font-size: .9rem; padding-inline: 2px; }
@media (max-width: 380px) { .levels .lvl { font-size: .82rem; } }

.homebar { justify-content: space-between; align-items: center; gap: 8px; }
.install-btn { min-height: 40px; padding: 6px 14px; background: var(--accent); border: 2px solid var(--ink); border-radius: 999px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 var(--ink); font-size: .9rem; }
.install-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.homebar .lang-btn { margin-inline-start: auto; }
.inputnote { color: var(--muted); font-size: .78rem; font-weight: 600; margin: 0 0 6px; text-align: center; }

.solvers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 0 0 10px; }
.solvers-title { font-size: .85rem; font-weight: 800; color: var(--muted); }
.chip2.solver { background: #fff7d6; border-color: #f5c84c; }
.solvedbox { text-align: center; background: #fff; border: 2px solid var(--accent-d); border-radius: 16px; padding: 14px 12px; margin: 6px 0 12px; }
.solvedbox h2 { font-size: 1.3rem; }
.solvedbox .answer { font-size: 2.2rem; font-weight: 900; margin: 2px 0 6px; }
.solvedbox .sub { color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.ranking { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; text-align: start; }
.ranking li { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 6px 12px; }
.ranking li .medal { width: 28px; text-align: center; font-size: 1.2rem; }
.ranking li b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ranking li small { color: var(--muted); font-weight: 700; }
.ranking li.miss { opacity: .6; }

/* 추측 입력칸을 건드리지 않고 갱신하려고 조각으로 나눈 묶음: 레이아웃에는 영향이 없게 한다(sticky 입력줄 유지) */
.game > div { display: contents; }

/* 추측 오류 안내: 화면 위쪽(위 줄 바로 아래) */
.toast-top { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 8px); transform: translateX(-50%) translateY(-12px); z-index: 70; max-width: calc(100vw - 32px); background: #c43d3d; color: #fff; padding: 12px 18px; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); font-weight: 800; font-size: 1rem; text-align: center; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; overflow-wrap: anywhere; }
.toast-top.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.stats .lenchip { background: #fff7d6; border-color: #f5c84c; }
.tools .btn.small[disabled] { opacity: .45; cursor: not-allowed; }
.row2.tools { flex-wrap: wrap; }
.row2.tools .btn.small { flex: 1 1 45%; }
