:root {
  --ink: #2c2a26;
  --ink-soft: #6b665d;
  --paper: #f7f2e8;
  --card: #fffdf8;
  --line: #e6dccb;
  --accent: #3d5a80;
  --el-0: #4f9d69;
  --el-1: #e0603f;
  --el-2: #d4a23c;
  --el-3: #8e99a5;
  --el-4: #3d5a80;
  --radius: 18px;
  --serif: 'Gowun Batang', serif;
  --sans: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------- 입력 · 결과 ---------- */
#intro, #result {
  overflow-y: auto;
  padding: 32px 16px 48px;
  background:
    radial-gradient(circle at 15% 10%, rgba(79,157,105,.14), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(224,96,63,.12), transparent 40%),
    radial-gradient(circle at 50% 95%, rgba(61,90,128,.14), transparent 45%),
    var(--paper);
}
#intro.active, #result.active { display: flex; justify-content: center; align-items: flex-start; }
.intro-card, .result-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: 0 10px 40px rgba(60, 45, 20, .08);
}
.eyebrow { margin: 0 0 6px; letter-spacing: .2em; font-size: 12px; color: var(--ink-soft); }
h1 { font-family: var(--serif); font-size: 40px; margin: 0 0 8px; }
.lead { color: var(--ink-soft); line-height: 1.6; margin: 0 0 22px; }
form { display: grid; gap: 14px; }
form label { display: grid; gap: 6px; font-size: 14px; }
form label.check { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 12px; }
input[type=date], input[type=time], select {
  font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}
details { font-size: 13px; color: var(--ink-soft); }
details summary { cursor: pointer; margin-bottom: 8px; }
.primary {
  border: 0; border-radius: 14px; padding: 14px 18px; font-size: 16px;
  background: var(--ink); color: #fff; font-family: var(--serif); font-weight: 700;
}
.ghost { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 18px; }
.link { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; padding: 8px; }
.privacy { font-size: 12px; color: var(--ink-soft); text-align: center; margin: 18px 0 0; }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 18px; }
.pillar { text-align: center; }
.pillar .cap { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.pillar .ch {
  display: grid; place-items: center; height: 64px; border-radius: 14px; margin-bottom: 6px;
  font-family: var(--serif); font-size: 30px; color: #fff; position: relative;
}
.pillar .ch small { position: absolute; bottom: 4px; font-size: 11px; font-family: var(--sans); opacity: .85; }
.pillar .ch.empty { background: #eee8dc; color: var(--ink-soft); font-size: 14px; }
.bars { display: grid; gap: 8px; margin-bottom: 18px; }
.bar { display: grid; grid-template-columns: 44px 1fr 28px; align-items: center; gap: 8px; font-size: 14px; }
.bar-track { height: 10px; background: #f0e9dc; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .8s ease; }
.bar.lacking .bar-name { font-weight: 700; }
.verdict { border-radius: 16px; padding: 18px; color: #fff; margin-bottom: 12px; line-height: 1.6; }
.verdict h2 { font-family: var(--serif); margin: 4px 0 6px; font-size: 24px; }
.verdict .avatar { font-size: 15px; opacity: .95; }
/* 궁합 */
.gung { display: flex; gap: 14px; align-items: center; background: #fff0f3; border-radius: 14px; padding: 12px 14px; margin: 8px 0; line-height: 1.5; }
.gung-score { font-family: var(--serif); font-size: 34px; color: #d6456b; white-space: nowrap; }
.gung-score small { font-size: 14px; margin-left: 2px; }
.gung-box { background: #fffaf6; border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.gung-box h3 { margin: 0 0 4px; font-family: var(--serif); }
.gung-box .items li { font-size: 13px; }
.gung-banner { background: #fff0f3; color: #b8325a; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.meta { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.actions { display: grid; gap: 10px; margin-top: 16px; }

/* ---------- 마을 HUD ---------- */
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap; z-index: 3;
  background: #fffdf8; color: var(--ink); font-size: 13px; padding: 6px 10px; border-radius: 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,.15);
}
.bubble.pin { background: var(--ink); color: #fff; font-size: 13px; }
.bubble.pin::after { border-top-color: var(--ink) !important; }
.guide { display: grid; gap: 10px; margin: 6px 0 4px; }
.guide div { display: flex; gap: 12px; align-items: center; font-size: 14px; line-height: 1.45; }
.guide p { margin: 0; flex: 1; }
.guide span { flex: 0 0 40px; height: 40px; border-radius: 12px; background: #f6f1e7; display: grid; place-items: center; font-size: 20px; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fffdf8; border-bottom: 0; }
.floater {
  position: absolute; left: 0; top: 0; font-weight: 700; font-size: 16px; white-space: nowrap;
  text-shadow: 0 1px 0 #fff, 0 0 6px rgba(255,255,255,.9);
}
.hud-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; justify-content: space-between; align-items: flex-start;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 0; pointer-events: none;
}
/* 마을 이름 카드와 날 · 시간 칩을 한 칸에 쌓아서, 카드가 두 줄로 늘어나도 칩이 겹치지 않게 */
.hud-left { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.place { display: grid; gap: 2px; background: rgba(255,253,248,.88); padding: 10px 14px; border-radius: 14px; backdrop-filter: blur(6px); }
.place strong { font-family: var(--serif); font-size: 18px; }
.place span { font-size: 12px; color: var(--ink-soft); }
.hud-buttons { display: flex; gap: 6px; pointer-events: auto; }
.chip-btn.on { background: var(--ink); color: #fff; }
.invite-btn { background: #ffe3ea; color: #b8325a; }
.intro-link-btn { display: block; margin: 14px auto 0; border: 0; background: none; color: var(--ink-soft); font-size: 13px; text-decoration: underline; }
.intro-link { margin: 0 0 14px; padding: 12px; border-radius: 14px; background: #f1ebdf; font-size: 13px; line-height: 1.5; }
.intro-link p { margin: 0; }
.intro-link-note { margin-top: 6px !important; color: #b8325a; }
.link-code { margin: 10px 0 4px; text-align: center; font-family: var(--serif); font-size: 34px; letter-spacing: 6px; }
.invite-card { margin: 4px 0 12px; padding: 14px; border-radius: 16px; background: linear-gradient(160deg, #ffe3ea, #fffdf8); text-align: center; line-height: 1.5; }
.invite-card .em { font-size: 40px; }
.invite-card strong { display: block; font-family: var(--serif); font-size: 17px; margin-top: 4px; }
.invite-card small { color: var(--ink-soft); font-size: 12px; }
.invite-link { display: flex; gap: 6px; margin-top: 10px; }
.invite-link input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 12px; color: var(--ink-soft); background: #fff; }
.chip-btn:disabled { opacity: .4; }
.charms .dot { width: 14px; height: 18px; border-radius: 3px; }
.chip-btn { white-space: nowrap; border: 0; background: rgba(255,253,248,.92); padding: 9px 12px; border-radius: 12px; font-size: 13px; backdrop-filter: blur(6px); }
.hud-chips { display: grid; gap: 6px; width: 0; pointer-events: none; } /* 폭을 0으로 두고 칩은 한 줄로 넘쳐 보이게 — 칩 길이 때문에 위 카드가 버튼 쪽으로 밀리지 않는다 */
.chip { justify-self: start; white-space: nowrap; background: rgba(255,253,248,.85); padding: 6px 10px; border-radius: 10px; font-size: 12px; }
.chip.hot { background: var(--accent); color: #fff; }
#h-day, #h-mission { pointer-events: auto; cursor: pointer; } /* 누르면 오늘의 운세 · 미션 */
.stamps { display: flex; gap: 6px; margin: 10px 0; }
.stamps span { flex: 1; text-align: center; padding: 8px 0; border-radius: 10px; background: #f1ece2; font-size: 13px; color: var(--ink-soft); }
.stamps span.on { background: #c0392b; color: #fff; }
.emotes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.emotes button { border: 1px solid var(--line); background: #fff; border-radius: 14px; font-size: 28px; padding: 10px 0; }
.phrases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.phrases button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 8px; font-size: 13px; }
/* 운세 탭 · 달력 · 부적 */
.tabs { display: flex; gap: 6px; margin: 0 0 12px; }
.f-hero { text-align: center; border-radius: 18px; padding: 16px 14px 14px; }
.f-date { font-size: 12px; color: var(--ink-soft); }
.f-god { display: inline-block; margin: 8px 0 2px; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.75); font-size: 12px; }
.f-hero h3 { margin: 4px 0 2px; font-size: 22px; }
.f-hero p { margin: 4px 0 0; font-size: 14px; color: #4a4640; line-height: 1.5; }
.f-total { margin-top: 8px; font-size: 22px; color: #e0a42a; letter-spacing: 2px; }
.f-notes { margin-top: 8px; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.f-cell { display: flex; justify-content: space-between; align-items: center; background: #f6f1e7; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.f-cell b { color: #e0a42a; font-weight: 400; letter-spacing: 1px; font-size: 12px; }
.f-lucky { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.f-luck { background: #f6f1e7; border-radius: 12px; padding: 9px 4px; text-align: center; font-size: 11px; color: var(--ink-soft); }
.f-luck b { display: block; margin-top: 3px; font-size: 13px; color: var(--ink); font-weight: 400; }
.f-item { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); }
.f-item .em { font-size: 30px; }
.f-item div { flex: 1; font-size: 13px; line-height: 1.45; }
.f-item small { color: var(--ink-soft); font-size: 11px; }
.f-item button { white-space: nowrap; padding: 10px 14px; font-size: 14px; }
.tab { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 0; font-size: 13px; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0 6px; text-align: center; font-size: 12px; }
.cal b { font-weight: 400; color: var(--ink-soft); }
.cal-d { border: 0; border-radius: 8px; padding: 8px 0; font-size: 13px; background: #f1ece2; color: var(--ink); }
.cal-d.good { background: #3d7d52; color: #fff; }
.cal-d.care { background: #e6876b; color: #fff; }
.cal-d.today { outline: 2px solid var(--ink); }
.cal-d.sel { box-shadow: 0 0 0 3px #e0a42a inset; }
.stars { color: #e0a42a; letter-spacing: 1px; }
.charm { display: flex; gap: 12px; align-items: center; background: #fff8e1; border-radius: 14px; padding: 10px; margin-top: 10px; font-size: 13px; line-height: 1.5; }
.charm img { width: 64px; border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.items .need.stars { color: #e0a42a; letter-spacing: 1px; }
.gauge {
  position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 92px);
  max-width: 420px; margin: 0 auto; background: rgba(255,253,248,.9); border-radius: 14px; padding: 10px 14px; pointer-events: none;
}
.gauge-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.gauge-track { height: 10px; background: #ece4d4; border-radius: 6px; overflow: hidden; }
.gauge-fill { height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .6s ease; }
.gauge.pulse { animation: pulse .5s ease; }
@keyframes pulse { 50% { transform: scale(1.03); } }

.actionbar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: safe center; gap: 6px;
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 14px); overflow-x: auto; scrollbar-width: none;
}
.act {
  flex: 0 0 auto; display: grid; justify-items: center; gap: 2px; min-width: 60px; white-space: nowrap;
  border: 0; border-radius: 16px; padding: 9px 10px; background: rgba(255,253,248,.94);
  box-shadow: 0 4px 14px rgba(0,0,0,.08); font-size: 11px;
}
.act .ic { font-size: 22px; line-height: 1; }
.act.on { background: var(--accent); color: #fff; }
.act:disabled { opacity: .45; }

#toasts { position: absolute; top: calc(env(safe-area-inset-top) + 76px); right: 16px; display: grid; gap: 6px; justify-items: end; pointer-events: none; max-width: 70%; }
.toast {
  background: rgba(44,42,38,.88); color: #fff; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4;
  animation: toast-in .3s ease;
}
.toast.good { background: var(--accent); }
.menu-btn { display: none; } /* 휴대폰에서만 ☰ 메뉴로 묶는다 */
.hud-more { display: contents; }
@media (max-width: 639px) {
  #toasts { top: calc(env(safe-area-inset-top) + 140px); left: 16px; right: 16px; max-width: none; justify-items: center; }
  .toast { max-width: 88%; padding: 6px 11px; font-size: 12px; text-align: center; }
  #game.room #toasts { top: auto; bottom: calc(var(--room-bottom, 160px) + 10px); }
  .act { min-width: 56px; padding: 8px; font-size: 10.5px; }
  /* 휴대폰: 버튼이 여섯 개여도 한 화면에 들어가게 나눠 갖는다 */
  .actionbar { gap: 4px; padding-left: 8px; padding-right: 8px; }
  .actionbar .act { flex: 1 1 0; min-width: 0; padding: 8px 2px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
  /* 휴대폰: 위는 [마을 카드 · 광장 버튼 · ☰] 한 줄 + 칩 한 줄(옆으로 밀기)로 줄여 마을이 넓게 보이게 */
  .hud-top:not(.room-top) { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; padding-top: calc(env(safe-area-inset-top) + 8px); }
  .hud-top:not(.room-top) .hud-left { display: contents; }
  .hud-top:not(.room-top) .place { justify-self: start; max-width: 100%; gap: 1px; padding: 7px 11px; border-radius: 12px; }
  .hud-top:not(.room-top) .place strong { font-size: 15px; }
  .hud-top:not(.room-top) .place span { font-size: 11px; line-height: 1.35; word-break: keep-all; }
  /* 칩은 자르지 않고 줄을 바꿔 다 보이게 */
  .hud-chips { grid-row: 2; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; width: auto; }
  .chip { padding: 4px 9px; font-size: 11px; line-height: 1.35; white-space: normal; word-break: keep-all; }
  .hud-top:not(.room-top) .hud-buttons { position: relative; grid-row: 1; grid-column: 2; }
  .hud-top:not(.room-top) .chip-btn { padding: 8px 11px; }
  .menu-btn { display: block; font-size: 15px; line-height: 1; }
  .menu-btn[aria-expanded="true"] { background: var(--ink); color: #fff; }
  .hud-more {
    display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; flex-direction: column; gap: 4px; min-width: 132px;
    padding: 6px; border-radius: 14px; background: rgba(255,253,248,.97); box-shadow: 0 8px 24px rgba(0,0,0,.14);
  }
  .hud-more.open { display: flex; }
  .hud-more .chip-btn { text-align: left; padding: 11px 12px; font-size: 14px; background: transparent; backdrop-filter: none; }
  .hud-more .invite-btn { background: #ffe3ea; }
  /* 게이지는 얇은 한 줄로 액션바 바로 위에 */
  .gauge { display: flex; align-items: center; gap: 10px; bottom: calc(env(safe-area-inset-bottom) + 80px); padding: 6px 12px; border-radius: 12px; }
  .gauge-label { flex: 0 0 auto; gap: 6px; margin: 0; font-size: 11.5px; }
  .gauge-track { flex: 1; height: 7px; }
}
/* 휴대폰 조이스틱: 세로 화면 한 손 엄지가 닿는 아래 가운데에 늘 보이고, 화면 아래쪽 어디를 눌러도 누른 자리로 따라와 움직인다 */
#stick {
  display: none; position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 176px); width: 0; height: 0;
  pointer-events: none; opacity: .6; transition: opacity .2s ease;
}
@media (pointer: coarse) { #stick { display: block; } }
#stick.on { opacity: 1; }
#stick::before { content: ''; position: absolute; left: -52px; top: -52px; width: 104px; height: 104px; border-radius: 50%; background: rgba(255,253,248,.2); border: 2px solid rgba(255,253,248,.6); box-shadow: 0 2px 10px rgba(0,0,0,.12); }
#stick i { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,253,248,.92); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
#stick:not(.on) i { transition: transform .15s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 76%; overflow-y: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 0 18px calc(env(safe-area-inset-bottom) + 22px);
  box-shadow: 0 -10px 40px rgba(0,0,0,.15); max-width: 520px; margin: 0 auto; animation: sheet-in .25s ease;
  z-index: 10;
}
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }
.sheet[hidden] { display: none; }
.sheet-bar { position: sticky; top: 0; z-index: 2; height: 44px; margin: 0 -18px 4px; background: var(--card); display: flex; align-items: center; justify-content: center; }
.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: #ddd3c2; }
.sheet-close { position: absolute; right: 12px; top: 8px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #f1ebdf; color: var(--ink-soft); font-size: 13px; line-height: 30px; padding: 0; }
.sheet h3 { font-family: var(--serif); margin: 0 0 4px; font-size: 21px; }
.sheet .sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 14px; }
.sheet h4 { margin: 18px 0 8px; font-size: 14px; }
.sheet .rel { padding: 10px 12px; border-radius: 12px; background: #f4eee2; font-size: 14px; line-height: 1.5; }
.sheet .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
/* 버튼은 글자 폭만큼 잡고, 한 줄에 안 들어가면 다음 줄로 (좁아져 글자가 한 자씩 꺾이지 않게) */
.sheet .row button { flex: 1 1 auto; white-space: nowrap; }
/* 주민 카드의 행동: 아이콘 위 · 글자 아래 타일 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 8px; margin-top: 12px; }
.tile { display: grid; justify-items: center; gap: 3px; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 4px; font-size: 12px; white-space: nowrap; color: var(--ink); }
.tile span { font-size: 22px; line-height: 1; }
.items { display: grid; padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--line); }
.items li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.items li.got { color: #2f6b45; }
.items li.got .need { color: #3d7d52; }
.items li .need { color: var(--ink-soft); font-size: 12px; }
.stones { display: grid; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.progress { height: 10px; background: #ece4d4; border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
.progress div { height: 100%; border-radius: 6px; background: var(--accent); }
.rare { font-style: normal; font-size: 10px; background: #d4a23c; color: #fff; border-radius: 6px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
textarea { width: 100%; min-height: 70px; font: inherit; border-radius: 12px; border: 1px solid var(--line); padding: 10px; resize: vertical; }
.notes { font-size: 13px; color: var(--ink-soft); display: grid; gap: 4px; margin-top: 8px; }

/* ---------- 집 안 ---------- */
#game.room .hud-top:not(.room-top), #game.room .hud-chips, #game.room .gauge,
#game.room .actionbar, #game.room .proto-badge, #game.room #stick { display: none; }
#room-ui[hidden] { display: none; }
#room-ui .room-top { z-index: 2; }
/* 방 기운 카드도 집 이름 카드 바로 아래에 쌓는다 (위치를 고정하면 이름 카드 높이에 따라 붙거나 겹친다) */
.room-score {
  width: 210px;
  background: rgba(255,253,248,.92); border-radius: 14px; padding: 10px 12px; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.rs-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 13px; color: var(--ink-soft); }
.rs-head strong { font-family: var(--serif); font-size: 26px; color: var(--ink); }
.rs-row { display: grid; grid-template-columns: 18px 1fr 46px; align-items: center; gap: 6px; font-size: 12px; margin-top: 4px; }
.rs-el { font-family: var(--serif); font-weight: 700; }
.rs-track { height: 7px; background: #ece4d4; border-radius: 4px; overflow: hidden; }
.rs-track div { height: 100%; border-radius: 4px; transition: width .5s ease; }
.rs-num { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rs-foot { margin-top: 6px; font-size: 11px; color: var(--ink-soft); line-height: 1.4; }
.room-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
.room-actions { display: flex; justify-content: center; gap: 8px; padding: 10px 12px 14px; }
.room-actions .act { min-width: 110px; }
.toolbar {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; margin: 0 auto; max-width: 720px;
}
.sel-name { flex: 1; font-size: 13px; background: rgba(255,253,248,.92); padding: 8px 10px; border-radius: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-name.hint { color: var(--ink-soft); font-size: 12px; }
.tool { border: 0; border-radius: 10px; padding: 9px 12px; background: rgba(255,253,248,.95); font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.08); white-space: nowrap; }
.primary-tool { background: var(--ink); color: #fff; }
.tool:disabled { opacity: .45; }
.tray {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 12px 14px; scrollbar-width: none;
  background: linear-gradient(to top, rgba(255,253,248,.95), rgba(255,253,248,.75));
  border-radius: 18px 18px 0 0;
}
/* PC: 마우스로는 옆으로 밀 수 없으니 여러 줄로 펼치고 휠로 위아래 스크롤 */
@media (min-width: 640px) {
  .tray { flex-wrap: wrap; justify-content: center; overflow-x: hidden; overflow-y: auto; max-height: min(232px, 34vh); scrollbar-width: thin; }
}
.card {
  position: relative; flex: 0 0 auto; width: 96px; display: grid; justify-items: center; gap: 2px; text-align: center;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 8px 6px; margin-top: 8px;
}
.card.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.card.locked { opacity: .5; background: #f4efe4; }
.c-emoji { font-size: 26px; line-height: 1.1; }
.c-name { font-size: 11.5px; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; }
.c-meta { font-size: 10px; color: var(--ink-soft); display: flex; align-items: center; gap: 3px; }
.c-meta i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.c-lucky { position: absolute; top: -6px; left: -4px; background: #3d7d52; color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 6px; }
.c-count { position: absolute; top: -6px; right: -4px; background: var(--accent); color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 6px; }
.card-preview { width: 100%; max-width: 260px; display: block; margin: 0 auto; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
@media (max-width: 639px) {
  .room-top .hud-left { flex: 1; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .sel-name { flex-basis: 100%; }

  .room-score { width: auto; justify-self: stretch; padding: 8px 10px; }
  .rs-head strong { font-size: 22px; }
}

/* ---------- 멍 모드 ---------- */
.hud-top, .hud-chips, .gauge, .actionbar, #toasts { transition: opacity 1.2s ease; }
#game.mung .hud-top, #game.mung .hud-chips, #game.mung .gauge, #game.mung .actionbar,
#game.mung #toasts, #game.mung .proto-badge, #game.mung #stick { opacity: 0; pointer-events: none; }
.letterbox { position: absolute; left: 0; right: 0; height: 0; background: #0b0d14; transition: height 1.6s ease; pointer-events: none; }
.letterbox.top { top: 0; }
.letterbox.bottom { bottom: 0; }
#game.mung .letterbox { height: 9vh; }
#mung { position: absolute; inset: 0; cursor: pointer; }
#mung[hidden] { display: none; }
#mung-line {
  position: absolute; left: 16px; right: 16px; top: calc(9vh + 24px); margin: 0; text-align: center;
  font-family: var(--serif); font-size: 18px; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.45);
  opacity: 0; transition: opacity 1.4s ease;
}
#mung-line.show { opacity: 1; }
.mung-foot {
  position: absolute; left: 0; right: 0; bottom: 0; height: 9vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: rgba(255,255,255,.85);
}
#mung-timer { font-family: var(--serif); font-size: 15px; letter-spacing: .08em; }
.mung-hint { font-size: 11px; color: rgba(255,255,255,.45); }

.proto-badge {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 6px);
  font-size: 10px; letter-spacing: .05em; color: rgba(44,42,38,.55); pointer-events: none; display: none;
}
@media (min-width: 640px) { .proto-badge { display: block; } }
.tag { display: inline-block; font-family: var(--sans); font-size: 11px; font-weight: 400; vertical-align: middle; padding: 2px 7px; border-radius: 8px; background: #ece6da; color: var(--ink-soft); margin-left: 4px; }
.tag.real { background: #ffe7c2; color: #8a5a12; }
.here { display: inline-block; margin-left: 6px; padding: 6px 10px; border-radius: 12px; background: #e9f3ea; color: #2f6b45; font-size: 12px; white-space: nowrap; }
.sheet .chip-btn { border: 1px solid var(--line); background: #fff; padding: 7px 12px; }
