/* ───────── 게임 회사 키우기: 도트풍 UI ───────── */
:root {
  --deep: #1b2246;
  --deep-2: #232c5a;
  --bar: #2a3a6e;
  --bar-hi: #3d55a0;
  --ink: #2b1d14;
  --ink-soft: #5c4636;
  --cream: #fff6e0;
  --cream-2: #f6e6c2;
  --cream-3: #e9d3a5;
  --paper: #fffdf6;
  --blue: #3d7be0;
  --blue-d: #2a5cb3;
  --green: #36b26b;
  --green-d: #23864d;
  --orange: #ff9a2e;
  --orange-d: #d9741a;
  --red: #e5484d;
  --red-d: #b3262b;
  --yellow: #ffd23f;
  --purple: #9b6ad6;
  --teal: #2bb3a3;
  --pink: #ff7eb6;
  --gray: #8d8d86;
  --st-fun: #ff7a59;
  --st-cre: #ffc93c;
  --st-gra: #4fb3ff;
  --st-snd: #b07cff;
  --st-bug: #8f5a3c;
  --font: 'Galmuri11', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-big: 'Galmuri14', 'Galmuri11', sans-serif;
  --font-mono: 'GalmuriMono11', 'Galmuri11', monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--deep);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.04) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.03) 0 2px, transparent 3px);
  background-size: 48px 48px, 64px 64px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  touch-action: manipulation;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: block; }

/* ───────── 공통 부품 ───────── */
.win {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 4px 0 rgba(0,0,0,.35), inset 0 -4px 0 var(--cream-2);
}
.win-head {
  display: flex; align-items: center; gap: 8px;
  background: var(--blue);
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  border-bottom: 3px solid var(--ink);
  border-radius: 5px 5px 0 0;
  padding: 7px 10px;
  font-family: var(--font-big);
  font-size: 15px;
  box-shadow: inset 0 -3px 0 var(--blue-d), inset 0 3px 0 rgba(255,255,255,.25);
}
.win-head .grow { flex: 1; }
.win-body { padding: 10px; }

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  background: var(--orange);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.22), inset 0 3px 0 rgba(255,255,255,.35), 0 2px 0 rgba(0,0,0,.3);
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.22), inset 0 2px 0 rgba(255,255,255,.3); }
.btn:disabled { filter: grayscale(.9) brightness(.95); cursor: not-allowed; opacity: .7; }
.btn.blue { background: var(--blue); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.gray { background: #9a9187; }
.btn.yellow { background: var(--yellow); color: var(--ink); text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.btn.purple { background: var(--purple); }
.btn.small { min-height: 28px; padding: 3px 9px; font-size: 12px; border-width: 2px; border-radius: 6px; }
.btn.big { min-height: 48px; font-size: 16px; padding: 10px 22px; font-family: var(--font-big); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--cream-2); color: var(--ink); text-shadow: none; }

.chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
}
.chip.blue { background: #cfe0ff; } .chip.green { background: #c9f0d6; } .chip.red { background: #ffd1d1; }
.chip.yellow { background: #fff0b0; } .chip.purple { background: #e6d6ff; } .chip.gray { background: #e4ddd2; }
.stars { color: #f5a800; letter-spacing: -1px; text-shadow: 0 1px 0 var(--ink); }
.stars.legend { color: #ff4fd8; }
.stars.high { color: #ff6a3d; font-family: var(--font-big); letter-spacing: 0; padding: 0 3px; border: 2px solid var(--ink); border-radius: 5px; background: #fff3c4; text-shadow: none; font-size: 12px; }
.stars.high.t8, .stars.high.t9 { color: #fff; background: linear-gradient(135deg, #8e4ec6, #e5484d); text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.stars.rainbow { font-family: var(--font-big); padding: 0 4px; border: 2px solid var(--ink); border-radius: 5px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.6); font-size: 12px; letter-spacing: 0;
  background: linear-gradient(90deg, #ff5f6d, #ffc371, #f9f871, #67e38f, #4fb3ff, #b07cff); background-size: 200% 100%; animation: rainbowShift 2.5s linear infinite; }
@keyframes rainbowShift { from { background-position: 0 0; } to { background-position: 200% 0; } }
.chip.gem { background: linear-gradient(135deg, #7fe3ff, #b07cff); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.chip.rank { background: #3c4a6e; color: #fff; }
.muted { color: var(--ink-soft); }
.small { font-size: 11px; }
.big { font-size: 16px; font-family: var(--font-big); }
.good { color: var(--green-d); } .bad { color: var(--red-d); }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 8px; }
.sep { height: 3px; background: var(--cream-3); border-radius: 2px; margin: 8px 0; }

.input, select.input {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.08);
  outline: none;
}
.input:focus { background: #fff; box-shadow: inset 0 3px 0 rgba(0,0,0,.08), 0 0 0 3px var(--yellow); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }

.bar {
  position: relative;
  height: 12px;
  background: #e8d9b8;
  border: 2px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
}
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.bar.thin { height: 8px; border-width: 2px; }
.bar.blue > i { background: var(--blue); } .bar.orange > i { background: var(--orange); }
.bar.red > i { background: var(--red); } .bar.yellow > i { background: var(--yellow); }
.bar .bar-label { position: absolute; inset: 0; font-size: 9px; line-height: 9px; text-align: center; color: var(--ink); }

.card {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 8px;
  box-shadow: inset 0 -3px 0 var(--cream-2);
}
.card.selectable { cursor: pointer; }
.card.selectable:hover { background: #fff; }
.card.selected { background: #fff6c4; box-shadow: inset 0 -3px 0 #f2d76a, 0 0 0 3px var(--yellow); }
.card.disabled { opacity: .45; cursor: not-allowed; }
.empty { text-align: center; padding: 24px 10px; color: var(--ink-soft); }

.stat-dot { display: inline-block; width: 9px; height: 9px; border: 2px solid var(--ink); border-radius: 50%; vertical-align: -1px; }
.stat-dot.fun { background: var(--st-fun); } .stat-dot.creativity { background: var(--st-cre); }
.stat-dot.graphics { background: var(--st-gra); } .stat-dot.sound { background: var(--st-snd); }
.stat-dot.bugs { background: var(--st-bug); border-radius: 2px; }
.stat-dot.programming { background: var(--blue); } .stat-dot.scenario { background: var(--purple); } .stat-dot.stamina { background: var(--green); }

/* ───────── 타이틀 / 로비 ───────── */
#screen-title { overflow-y: auto; }
.title-wrap { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px 40px; gap: 18px; }
.logo-canvas { width: min(560px, 92vw); height: auto; }
.title-sub { color: #ffe9a8; font-family: var(--font-big); font-size: 15px; text-shadow: 0 2px 0 #000; text-align: center; }
.title-box { width: min(520px, 100%); }
.title-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.title-tabs .btn { flex: 1; }
.color-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.color-pick button { width: 30px; height: 30px; border: 3px solid var(--ink); border-radius: 6px; cursor: pointer; }
.color-pick button.on { box-shadow: 0 0 0 3px var(--yellow); transform: scale(1.08); }
.logo-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.logo-pick button { width: 36px; height: 36px; font-size: 20px; border: 3px solid var(--ink); border-radius: 6px; background: var(--paper); cursor: pointer; }
.logo-pick button.on { background: #fff3b0; box-shadow: 0 0 0 3px var(--yellow); }
.recent-list .card { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.code-big { font-family: var(--font-mono); font-size: 26px; letter-spacing: 4px; background: var(--paper); border: 3px dashed var(--ink); border-radius: 8px; padding: 6px 12px; display: inline-block; }
.lobby-players .card { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.lobby-logo { width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; border: 3px solid var(--ink); border-radius: 8px; }

/* ───────── 게임 화면 ───────── */
#screen-game.active { display: grid; grid-template-rows: auto 1fr auto; }
#topbar {
  position: relative; z-index: 180;  /* 창·연출이 떠 있어도 상단 바(▶ 시작·배속)는 항상 위에서 눌린다 */
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  padding: 6px 8px;
  background: linear-gradient(var(--bar-hi), var(--bar));
  border-bottom: 3px solid var(--ink);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25);
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.4);
  overflow-x: auto;
  scrollbar-width: none;
}
#topbar::-webkit-scrollbar { display: none; }
.tb-item {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,.28);
  border: 2px solid rgba(0,0,0,.45);
  border-radius: 7px;
  padding: 3px 8px;
  white-space: nowrap;
  font-size: 13px;
  min-height: 30px;
}
.tb-item b { font-family: var(--font-mono); font-weight: normal; }
.tb-item.money b { color: #ffe066; }
.tb-item.money.neg b { color: #ff8a8a; }
.tb-company { font-family: var(--font-big); }
.tb-logo { width: 26px; height: 26px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 6px; font-size: 15px; text-shadow: none; }
.tb-spacer { flex: 1; }
.speed-btns { display: inline-flex; gap: 3px; }
.speed-btns .btn { min-height: 28px; padding: 2px 8px; font-size: 12px; border-width: 2px; }
.speed-btns .btn.on { background: var(--yellow); color: var(--ink); text-shadow: none; }
.week-bar { width: 46px; height: 6px; background: rgba(0,0,0,.4); border-radius: 3px; overflow: hidden; }
.week-bar > i { display: block; height: 100%; background: #9fe870; }

#stage { position: relative; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
#office-wrap { position: relative; overflow: hidden; min-height: 0; background: #151b38; }
#office { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
#office-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#hud-projects { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; max-width: min(300px, 70%); pointer-events: auto; z-index: 3; }
#view-toggle { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; z-index: 3; }

.hud-card {
  background: rgba(255,246,224,.95);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 5px 8px 6px;
  box-shadow: 0 3px 0 rgba(0,0,0,.35);
  font-size: 12px;
  cursor: pointer;
}
.hud-card .t { display: flex; align-items: center; gap: 6px; font-family: var(--font-big); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-card .stats { display: grid; grid-template-columns: repeat(5, auto); gap: 2px 8px; margin-top: 4px; font-family: var(--font-mono); font-size: 12px; }
.hud-card .stats span { display: inline-flex; align-items: center; gap: 3px; }
.hud-card .stats span.bump { animation: bump .35s; }
.hud-card.ready { background: #fff6b8; animation: glow 1.2s infinite alternate; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); color: #c2410c; } 100% { transform: scale(1); } }
@keyframes glow { from { box-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 0 0 #ffd23f; } to { box-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 0 5px #ffd23f; } }
.phase-chip { font-size: 10px; padding: 0 6px; border-radius: 4px; border: 2px solid var(--ink); background: var(--blue); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.phase-chip.plan { background: var(--orange); } .phase-chip.program { background: var(--st-fun); } .phase-chip.graphics { background: var(--st-gra); }
.phase-chip.sound { background: var(--st-snd); } .phase-chip.debug { background: var(--st-bug); }
.phase-chip.ready { background: var(--green); } .phase-chip.contract { background: var(--teal); }

/* 사무실 위 말풍선 (DOM) */
.speech {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
  animation: speechIn .2s ease-out, fadeOut .4s ease-in forwards;
  animation-delay: 0s, var(--life, 2.2s);
}
.speech::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 6px; height: 6px; background: #fff; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.speech.idea { background: #fff7c2; } .speech.idea::after { background: #fff7c2; }
@keyframes speechIn { from { transform: translate(-50%, -80%) scale(.6); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
.name-tag {
  position: absolute; transform: translate(-50%, 0);
  background: rgba(43,29,20,.85); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}

/* 우측 순위판 (예전 로그 자리) */
#feed {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--cream);
  border-left: 3px solid var(--ink);
}
.feed-tabs { display: flex; border-bottom: 3px solid var(--ink); background: var(--cream-2); }
.feed-tabs button { flex: 1; min-height: 34px; border: 0; background: transparent; cursor: pointer; border-right: 2px solid var(--cream-3); }
.feed-tabs button.on { background: var(--cream); font-family: var(--font-big); }
@keyframes feedIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 하단 탭 */
#nav {
  display: flex; gap: 4px; padding: 6px 6px calc(6px + var(--safe-b));
  background: linear-gradient(var(--bar), var(--deep-2));
  border-top: 3px solid var(--ink);
  overflow-x: auto;
  scrollbar-width: none;
}
#nav::-webkit-scrollbar { display: none; }
.nav-btn {
  flex: 1 0 auto;
  min-width: 72px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 6px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 -4px 0 var(--cream-3), 0 2px 0 rgba(0,0,0,.4);
  cursor: pointer;
  font-size: 12px;
  position: relative;
}
.nav-btn .ico { font-size: 19px; line-height: 22px; }
.nav-btn.on { background: var(--yellow); box-shadow: inset 0 -4px 0 #e0b020, 0 2px 0 rgba(0,0,0,.4); transform: translateY(-2px); }
.nav-btn .dot { position: absolute; top: -5px; right: -3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; border: 2px solid var(--ink); font-size: 10px; display: grid; place-items: center; padding: 0 3px; }
.nav-btn.locked { opacity: .55; }

/* 탭 패널 (시트) */
#panel {
  position: absolute;
  left: 8px; right: 308px;
  bottom: 70px;
  top: 30%;
  display: flex; flex-direction: column;
  z-index: 20;
  animation: sheetUp .18s ease-out;
}
#panel.wide { top: 12%; }
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#panel .win-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panel-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-tabs .btn { min-height: 30px; padding: 3px 10px; font-size: 12px; border-width: 2px; }
.panel-tabs .btn.on { background: var(--yellow); color: var(--ink); text-shadow: none; }

/* 직원 카드 */
.emp-card { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: start; }
.emp-card canvas.portrait { width: 52px; height: 52px; background: #cfe3ff; border: 3px solid var(--ink); border-radius: 8px; }
.emp-name { font-family: var(--font-big); font-size: 14px; }
.skill-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 6px; align-items: center; font-size: 11px; }
.skill-grid .bar { height: 9px; }
.emp-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.traits { display: flex; gap: 3px; flex-wrap: wrap; }
.hearts { color: #e5484d; letter-spacing: -1px; }
.mood { font-size: 15px; }

/* 목록 격자 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.pick-grid .card { padding: 6px; text-align: center; }
.pick-grid .ico { font-size: 22px; }

/* 표 */
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.tbl th { text-align: left; background: var(--cream-2); border-bottom: 2px solid var(--ink); padding: 5px 6px; position: sticky; top: 0; }
table.tbl td { padding: 5px 6px; border-bottom: 2px solid var(--cream-3); }
table.tbl tr.me td { background: #fff6c4; }
.num { font-family: var(--font); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
table.tbl th.num, table.tbl td.num { text-align: right; }
table.tbl td, table.tbl th { vertical-align: middle; line-height: 1.35; }
.units-cell { display: flex; align-items: center; gap: 6px; }
.units-cell .bar { flex: 1; min-width: 50px; }
.chart { margin-top: 6px; }
.chart-svg { width: 100%; height: auto; display: block; background: #fffdf5; border: 2px solid var(--cream-3); border-radius: 6px; }
.chart-grid { stroke: #e8dcc0; stroke-width: 1; }
.chart-label { font-family: var(--font); font-size: 15px; fill: #7a6a55; }
.chart-svg { max-height: 240px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12px; }
.chart-legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.bar-rank { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.br-row { display: grid; grid-template-columns: 26px minmax(110px, 1.2fr) 2fr minmax(70px, auto); gap: 8px; align-items: center; font-size: 13px; }
.br-row.me { background: #fff6c4; border-radius: 6px; }
.br-no { text-align: center; }
.br-name { display: flex; align-items: center; gap: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.br-sub { font-size: 11px; color: #7a6a55; margin-left: 4px; }
.br-dot { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--ink); flex-shrink: 0; }
.br-bar { height: 12px; background: var(--cream-3); border-radius: 6px; overflow: hidden; }
.br-bar i { display: block; height: 100%; border-radius: 6px; }
.br-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.speed-btns .btn:first-child { min-width: 66px; }  /* ▶ 시작 ↔ ⏸ 로 바뀌어도 배속 버튼 위치가 밀리지 않게 */
.speed-btns .btn.play-go { animation: playPulse 1.4s ease-in-out infinite; }
@keyframes playPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 214, 0, .0); } 50% { box-shadow: 0 0 0 4px rgba(255, 214, 0, .55); } }

/* 모달 */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.modal-back { position: absolute; inset: 0; background: rgba(10,12,30,.62); pointer-events: auto; display: grid; grid-template-rows: 100%; place-items: center; padding: 12px; animation: fadeIn .15s; }  /* 줄 높이를 고정해야 긴 팝업도 화면 안에서 스크롤된다 */
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100% - 20px); display: flex; flex-direction: column; animation: popIn .22s cubic-bezier(.2,1.6,.4,1); }
.modal.wide { width: min(820px, 100%); }
.modal .win-body { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
@keyframes popIn { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-foot { display: flex; gap: 6px; justify-content: flex-end; padding: 8px 10px 10px; border-top: 3px solid var(--cream-3); flex-wrap: wrap; }

/* 토스트 */
#toast-root { position: fixed; top: 54px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(520px, 94vw); }
.toast { background: var(--paper); border: 3px solid var(--ink); border-radius: 8px; padding: 6px 12px; box-shadow: 0 3px 0 rgba(0,0,0,.4); font-size: 13px; animation: toastIn .25s cubic-bezier(.2,1.5,.4,1), fadeOut .5s ease-in forwards; animation-delay: 0s, 3.6s; pointer-events: auto; }
.toast.good { background: #dcfce4; } .toast.bad { background: #ffe0e0; } .toast.warn { background: #fff1c2; }
@keyframes toastIn { from { transform: translateY(-14px) scale(.9); opacity: 0; } }

/* 리뷰쇼 */
.review-stage { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.judge { text-align: center; }
.judge canvas { width: 64px; height: 64px; background: #ffe7b8; border: 3px solid var(--ink); border-radius: 8px; }
.judge .jname { font-family: var(--font-big); font-size: 12px; }
.judge .score { font-family: var(--font-big); font-size: 34px; line-height: 40px; height: 40px; color: var(--ink); opacity: 0; transform: scale(2.5); transition: all .25s cubic-bezier(.2,1.6,.4,1); text-shadow: 0 3px 0 var(--yellow); }
.judge .score.show { opacity: 1; transform: none; }
.judge .line { font-size: 11px; min-height: 30px; opacity: 0; transition: opacity .3s .2s; }
.judge .score.show + .line { opacity: 1; }
.review-total { text-align: center; font-family: var(--font-big); font-size: 22px; min-height: 40px; }
.review-total .big-num { font-size: 40px; color: var(--red); text-shadow: 0 3px 0 var(--ink); }
.drum { display: inline-block; animation: drum .12s infinite alternate; }
@keyframes drum { to { transform: translateY(-3px) rotate(3deg); } }

/* 전체 화면 축하 */
.celebrate { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: radial-gradient(circle, rgba(255,210,63,.35), rgba(10,12,30,.8) 70%); animation: fadeIn .3s; pointer-events: auto; }
.celebrate .box { text-align: center; color: #fff; text-shadow: 0 3px 0 #000; padding: 20px; max-width: 92vw; }
.celebrate .ico { font-size: 72px; animation: bounce 1s infinite; }
.celebrate h1 { font-family: var(--font-big); font-size: clamp(28px, 6vw, 46px); margin: 8px 0; color: #ffe066; letter-spacing: 2px; }
.celebrate p { font-size: 16px; margin: 6px 0 16px; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
#confetti { position: fixed; inset: 0; z-index: 151; pointer-events: none; }

/* 마법사 */
.wizard-steps { display: flex; gap: 4px; margin-bottom: 10px; }
.wizard-steps span { flex: 1; text-align: center; padding: 3px; border: 2px solid var(--ink); border-radius: 6px; background: var(--cream-2); font-size: 11px; }
.wizard-steps span.on { background: var(--yellow); }
.wizard-steps span.done { background: #c9f0d6; }
.compat-mark { font-family: var(--font-big); font-size: 14px; }
.compat-5 { color: #e5484d; } .compat-4 { color: #f08c00; } .compat-3 { color: #2a8a4a; } .compat-2 { color: #4a6ab0; } .compat-1 { color: #666; }
.trend-up { color: var(--green-d); } .trend-down { color: var(--red-d); }

/* 사옥 진행 */
.office-steps { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.office-steps div { text-align: center; padding: 6px 2px; border: 2px solid var(--ink); border-radius: 6px; background: var(--cream-2); font-size: 10px; }
.office-steps div.done { background: #c9f0d6; }
.office-steps div.now { background: var(--yellow); }

/* 막대 차트 */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; padding: 4px; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; }
.bars i { flex: 1; background: var(--blue); min-height: 1px; border-radius: 2px 2px 0 0; }
.bars i.neg { background: var(--red); }

/* 박물관 패키지 */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.pkg { cursor: pointer; text-align: center; }
.pkg canvas { width: 100%; aspect-ratio: 3 / 4; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 0 3px 0 rgba(0,0,0,.35); background: #333; }
.pkg .pt { font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ───────── 반응형 ───────── */
@media (max-width: 1024px) {
  #stage { grid-template-columns: 1fr; }
  #feed { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 86vw); z-index: 30; transform: translateX(105%); transition: transform .2s; box-shadow: -4px 0 0 rgba(0,0,0,.3); }
  #feed.open { transform: none; }
  #panel { right: 8px; }
}
@media (max-width: 640px) {
  body { font-size: 12px; }
  #topbar { gap: 4px; padding: 4px 6px; }
  .tb-item { padding: 2px 6px; font-size: 12px; min-height: 28px; }
  .tb-company .cname { display: none; }
  #panel { left: 4px; right: 4px; top: 8%; bottom: 66px; }
  .nav-btn { min-width: 60px; font-size: 11px; }
  .nav-btn .ico { font-size: 17px; }
  #hud-projects { max-width: calc(100% - 16px); }
  #view-toggle { top: auto; bottom: 8px; }
  .hud-card .stats { grid-template-columns: repeat(5, auto); gap: 1px 6px; font-size: 11px; }
  .review-stage { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .modal { max-height: calc(100% - 10px); }
}

/* ── 개발: 단계 타임라인 · 등급 도장 · 작품 미리보기 ── */
.phase-line { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.phase-step { border: 2px solid var(--ink); border-radius: 6px; background: var(--cream-2); padding: 2px 3px 3px; text-align: center; opacity: .55; }
.phase-step.done, .phase-step.cur { opacity: 1; }
.phase-step.cur { background: #fff6b8; box-shadow: 0 0 0 2px var(--yellow); }
.phase-step.done { background: #e2f7e8; }
.phase-step .ph-ico { font-size: 16px; line-height: 1.1; position: relative; display: flex; align-items: center; justify-content: center; gap: 2px; }
.phase-step .ph-name { font-size: 10px; white-space: nowrap; }
.phase-step .ph-bar { height: 4px; background: rgba(0,0,0,.15); border-radius: 2px; overflow: hidden; margin-top: 2px; }
.phase-step .ph-bar > i { display: block; height: 100%; background: var(--green); }
.phase-line.compact { gap: 2px; }
.phase-line.compact .phase-step { padding: 0 1px 1px; border-width: 1.5px; border-radius: 4px; }
.phase-line.compact .ph-ico { font-size: 11px; }
.grade-stamp { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 3px; border: 2px solid var(--ink); border-radius: 5px; color: #fff; font-family: var(--font-big); font-size: 14px; text-shadow: 0 1px 0 rgba(0,0,0,.5); transform: rotate(-6deg); }
.grade-stamp.mini { min-width: 14px; height: 14px; font-size: 9px; border-width: 1.5px; border-radius: 3px; }
.hold-box { margin-top: 4px; padding: 6px 8px; border: 2px dashed var(--ink); border-radius: 8px; background: #fffbe0; display: flex; flex-direction: column; gap: 4px; cursor: default; }
.hold-box.small { padding: 4px 6px; }
.hud-card.hold { box-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 0 3px #46a758; }
.hud-body { display: flex; gap: 6px; margin-top: 4px; align-items: flex-start; }
.hud-body .game-preview { width: 96px; height: 64px; flex: none; }
.game-preview { border: 3px solid var(--ink); border-radius: 6px; background: #111; image-rendering: pixelated; display: block; box-shadow: inset 0 0 0 2px #444; }
.dev-main { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.preview-wrap { display: flex; flex-direction: column; gap: 3px; }
.preview-wrap .game-preview { width: 288px; height: 192px; max-width: 100%; height: auto; aspect-ratio: 3 / 2; }
.phase-stamp { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); background: rgba(255,246,224,.97); border: 4px solid var(--ink); border-radius: 12px; padding: 10px 18px; text-align: center; box-shadow: 0 6px 0 rgba(0,0,0,.35); animation: stampIn .35s cubic-bezier(.2,1.6,.4,1), fadeOut .4s 2.2s forwards; z-index: 5; }
.phase-stamp .ps-title { font-family: var(--font-big); font-size: 15px; }
.phase-stamp .ps-grade { display: inline-block; margin: 6px 0 2px; width: 56px; height: 56px; line-height: 50px; border: 4px solid var(--ink); border-radius: 10px; color: #fff; font-family: var(--font-big); font-size: 38px; text-shadow: 0 2px 0 rgba(0,0,0,.45); transform: rotate(-8deg); }
.phase-stamp .ps-sub { font-size: 12px; }
@keyframes stampIn { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.inbox-btn { animation: glow 1s infinite alternate; }

/* ── 시상식 무대 ── */
.ceremony { position: fixed; inset: 0; z-index: 160; background: radial-gradient(ellipse at 50% 30%, #3b2a6e 0%, #120d2a 70%); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ceremony::before { content: ''; position: absolute; left: 50%; top: -10%; width: 70vw; height: 90vh; transform: translateX(-50%); background: radial-gradient(ellipse at 50% 0%, rgba(255,240,180,.35), transparent 65%); pointer-events: none; }
.cer-curtain { position: absolute; top: 0; bottom: 0; width: 51%; background: repeating-linear-gradient(90deg, #8e1b2b 0 18px, #b3263a 18px 30px); box-shadow: inset 0 -30px 40px rgba(0,0,0,.4); transition: transform 1.1s cubic-bezier(.6,0,.3,1); z-index: 2; }
.cer-curtain.left { left: 0; } .cer-curtain.right { right: 0; }
.ceremony.open .cer-curtain.left { transform: translateX(-92%); }
.ceremony.open .cer-curtain.right { transform: translateX(92%); }
.cer-box { position: relative; z-index: 1; width: min(720px, 94vw); background: rgba(255,246,224,.97); border: 4px solid var(--ink); border-radius: 12px; box-shadow: 0 8px 0 rgba(0,0,0,.4); overflow: hidden; }
.cer-head { color: #fff; font-family: var(--font-big); font-size: 20px; padding: 8px 12px; text-shadow: 0 2px 0 rgba(0,0,0,.4); border-bottom: 3px solid var(--ink); }
.cer-sub { padding: 6px 12px; font-size: 12px; background: #fff3c4; border-bottom: 2px dashed var(--ink); }
.cer-caption { text-align: center; font-family: var(--font-big); font-size: 18px; padding: 12px 8px 4px; min-height: 44px; }
.cer-stage { display: flex; gap: 10px; justify-content: center; padding: 10px; min-height: 170px; flex-wrap: wrap; }
.cer-stage.drum .cer-nom { animation: drum .18s infinite alternate; }
@keyframes drum { from { transform: translateY(0); } to { transform: translateY(-4px); } }
.cer-nom { width: 150px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; padding: 8px; text-align: center; transition: transform .4s, opacity .4s, box-shadow .4s; }
.cer-nom.win { transform: scale(1.12); box-shadow: 0 0 0 4px #ffd23f, 0 0 30px 8px rgba(255,210,63,.7); }
.cer-nom.lose { opacity: .45; transform: scale(.92); }
.cer-art { width: 64px; margin: 0 auto 4px; } .cer-art canvas { width: 64px; image-rendering: pixelated; }
.cer-art.studio { height: 64px; border-radius: 8px; border: 2px solid var(--ink); font-size: 34px; line-height: 60px; }
.cer-title { font-family: var(--font-big); font-size: 13px; }
.cer-co { font-size: 11px; font-weight: bold; }
.cer-score { font-size: 11px; color: #777; }
.cer-prize { border: 3px solid var(--ink); border-radius: 10px; background: #fff6b8; padding: 8px 12px; text-align: center; }
.cer-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 2px dashed var(--ink); }
.cer-foot .small { flex: 1; }

/* 소식 띠 */
.news-banner { position: fixed; left: 50%; top: 56px; transform: translateX(-50%); z-index: 150; max-width: min(560px, 92vw); background: rgba(255,246,224,.98); border: 3px solid var(--ink); border-radius: 10px; padding: 8px 14px; box-shadow: 0 4px 0 rgba(0,0,0,.35); text-align: center; animation: bannerIn .35s cubic-bezier(.2,1.5,.4,1); pointer-events: none; }
.news-banner.world { background: #eef3ff; }
.news-banner.legend { background: linear-gradient(135deg, #fff6b8, #ffd98a); box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 0 3px #ffd23f; }
.news-banner.out { opacity: 0; transition: opacity .4s; }
@keyframes bannerIn { from { transform: translate(-50%, -30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ── 성장 연출 ── */
.move-canvas { width: min(640px, 86vw); image-rendering: pixelated; border: 4px solid var(--ink); border-radius: 8px; display: block; margin: 8px auto; }
#ach-stack { position: fixed; right: 12px; bottom: 70px; z-index: 155; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.ach-pop { display: flex; gap: 8px; align-items: center; background: linear-gradient(135deg, #fff6b8, #ffe08a); border: 3px solid var(--ink); border-radius: 10px; padding: 6px 12px; box-shadow: 0 4px 0 rgba(0,0,0,.3); animation: achIn .4s cubic-bezier(.2,1.5,.4,1); max-width: 300px; }
.ach-pop .ach-ico { font-size: 28px; }
.ach-pop.out { opacity: 0; transform: translateX(30px); transition: all .5s; }
@keyframes achIn { from { transform: translateX(120%); } to { transform: translateX(0); } }
.sepia-box { background: #e8d9b8; border: 3px solid #7a5832; border-radius: 10px; padding: 10px; filter: sepia(.55); display: flex; flex-direction: column; gap: 6px; }
.ending { position: fixed; inset: 0; z-index: 170; background: radial-gradient(ellipse at 50% 20%, #2a2f6e, #0b0d24 75%); color: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.ending-stage { width: min(900px, 94vw); max-height: 92vh; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: fadeIn .6s; }
.ending-stage h2 { font-family: var(--font-big); font-size: 26px; margin: 0; }
.ending-title h1 { font-family: var(--font-big); font-size: 30px; margin: 6px 0; }
.ending-skip { position: absolute; right: 14px; top: 14px; }
.podium { display: flex; align-items: flex-end; gap: 14px; justify-content: center; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 170px; }
.pod.me b { color: #ffd23f; }
.pod-logo { width: 54px; height: 54px; border: 3px solid #000; border-radius: 12px; font-size: 30px; line-height: 50px; }
.pod-block { width: 100%; background: linear-gradient(#ffe08a, #c98a00); border: 3px solid #000; border-radius: 8px 8px 0 0; font-size: 34px; color: #000; text-shadow: none; }
.pod-1 .pod-block { height: 150px; } .pod-2 .pod-block { height: 110px; } .pod-3 .pod-block { height: 80px; }
.titles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; width: 100%; max-height: 70vh; overflow: auto; }
.title-card { display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.3); border-radius: 10px; padding: 6px 10px; text-align: left; animation: fadeIn .5s both; }
.title-card.me { border-color: #ffd23f; background: rgba(255,210,63,.18); }
.ending-table { background: rgba(255,246,224,.95); color: var(--ink); text-shadow: none; border-radius: 8px; }
.ending-table tr.me { background: #fff3c4; }
.credits-roll { animation: rollUp linear forwards; display: flex; flex-direction: column; gap: 4px; padding-top: 100vh; }
.credits-roll h2 { margin-top: 20px; }
.credits-sub { opacity: .7; margin-top: 10px; font-size: 12px; }
@keyframes rollUp { from { transform: translateY(0); } to { transform: translateY(-100%); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.ach-card { display: flex; gap: 6px; align-items: center; border: 2px solid var(--ink); border-radius: 8px; padding: 5px 8px; background: #fffbe8; }
.ach-card.locked { opacity: .45; filter: grayscale(1); background: #eee; }
.ach-card .ico { font-size: 22px; }

.chart-zero { stroke: #5a4a3a; stroke-width: 1.6; }
.chart-neg-zone { fill: rgba(229, 72, 77, .08); }
.fin-bar { fill: #36b26b; }
.fin-bar.neg { fill: #e5484d; }
.fin-bar.partial { opacity: .45; }

/* 게임 중에는 팝업·연출이 상단 바 아래부터 깔린다 → ▶ 시작·배속 버튼은 어떤 창이 떠 있어도 누를 수 있다
   (앱 화면이 고정 위치 레이어라 상단 바의 z-index만 올려서는 팝업 배경 위로 올라오지 않는다) */
body.in-game #modal-root, body.in-game .celebrate, body.in-game .ceremony, body.in-game .ending, body.in-game .court, body.in-game #confetti { top: var(--tb-h, 46px); }

/* 우측 순위판 */
.bd-head { display: flex; justify-content: space-between; padding: 6px 10px 2px; font-size: 11px; color: var(--ink-soft); }
.bd-list { flex: 1; overflow-y: auto; padding: 2px 6px 6px; display: flex; flex-direction: column; gap: 3px; }
.bd-row { display: grid; grid-template-columns: 20px 10px minmax(0, 1fr) auto 34px; align-items: center; gap: 6px; padding: 5px 6px; background: var(--paper); border: 2px solid var(--cream-3); border-radius: 6px; font-size: 12px; }
.bd-row.me { background: #fff3b0; border-color: var(--yellow); box-shadow: 0 0 0 1px var(--ink) inset; font-weight: bold; }
.bd-no { text-align: center; font-family: var(--font-big); }
.bd-dot { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--ink); }
.bd-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-name small { display: block; font-size: 10px; color: var(--ink-soft); font-weight: normal; overflow: hidden; text-overflow: ellipsis; }
.bd-val { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 11px; }
.bd-d { font-size: 10px; text-align: right; color: var(--ink-soft); white-space: nowrap; }
.bd-d.up { color: #2a8a4a; } .bd-d.down { color: #e5484d; } .bd-d.new { color: #8e4ec6; font-weight: bold; }
.bd-more { margin: 4px 8px 8px; }

/* 온라인 세 스탯 */
.btn.tiny { min-height: 24px; padding: 1px 7px; font-size: 11px; border-width: 2px; }
.btn.tiny.on { background: var(--yellow); color: var(--ink); text-shadow: none; }
.st-triad { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.st-rows { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 5px; }
.st-row { display: grid; grid-template-columns: 96px 1fr 30px 40px 38px; gap: 6px; align-items: center; font-size: 12px; }
.st-name { white-space: nowrap; }
.st-bar { position: relative; height: 12px; background: var(--cream-3); border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.st-bar i { display: block; height: 100%; transition: width .4s; }
.st-marks b { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(43,33,24,.45); }
.st-num { text-align: right; font-family: var(--font-big); font-variant-numeric: tabular-nums; }
.st-grade { text-align: center; font-family: var(--font-big); font-size: 11px; color: #fff; background: #5b6b8c; border: 2px solid var(--ink); border-radius: 5px; padding: 0 2px; }
.st-delta { font-size: 11px; white-space: nowrap; animation: stDelta 2.6s ease-out forwards; }
.st-delta.up { color: #2a8a4a; } .st-delta.down { color: #e5484d; }
@keyframes stDelta { 0% { opacity: 1; transform: translateY(-3px); } 70% { opacity: 1; transform: none; } 100% { opacity: .25; } }
.st-diag { font-size: 12px; font-weight: bold; padding: 3px 6px; background: var(--paper); border: 2px dashed var(--cream-3); border-radius: 6px; }
.st-triad.compact .st-row { grid-template-columns: 84px 1fr 26px 36px 30px; }
.radar { flex-shrink: 0; }
.radar-grid { fill: none; stroke: #d9cbb0; stroke-width: 1; }
.radar-ideal { fill: rgba(54,178,107,.08); stroke: rgba(54,178,107,.6); stroke-dasharray: 3 3; stroke-width: 1; }
.radar-val { fill: rgba(61,123,224,.35); stroke: #3d7be0; stroke-width: 2; }
.radar-label { font-family: var(--font); font-size: 10px; fill: #7a6a55; }
.online-card.god { box-shadow: 0 0 0 3px #ffd23f, 0 0 18px rgba(255,210,63,.6); }
.on-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.on-metric { background: var(--paper); border: 2px solid var(--cream-3); border-radius: 6px; padding: 5px 7px; }
.on-sec { margin-top: 4px; }
.on-ops { display: flex; flex-direction: column; gap: 4px; }
.on-op { display: grid; grid-template-columns: minmax(130px, 1fr) auto 76px; gap: 6px; align-items: center; font-size: 12px; }
.on-op-name small { display: block; font-size: 10px; color: var(--ink-soft); }
.on-op-lv { display: flex; flex-wrap: wrap; gap: 3px; }
.on-op-cost { text-align: right; font-size: 11px; color: var(--ink-soft); }
.price-tbl td, .price-tbl th { font-size: 11px; padding: 3px 5px; }
.alloc-row { display: grid; grid-template-columns: 110px auto minmax(40px, 1fr) auto 42px 130px; gap: 6px; align-items: center; }
.alloc-row .al-val { text-align: right; }
@media (max-width: 640px) { .on-op { grid-template-columns: 1fr; } .on-op-cost { text-align: left; } .st-row { grid-template-columns: 80px 1fr 26px 36px 30px; } }

/* 돈·팬 연출 */
.tb-item.mfx-up b { animation: mfxFlash .7s ease-out; color: #b8ffb0 !important; }
.tb-item.mfx-big b { animation: mfxFlash .9s ease-out; color: #ffe066 !important; text-shadow: 0 0 8px #ffd23f; }
.tb-item.mfx-down { animation: mfxShake .35s; }
.tb-item.mfx-down b { color: #ff8a8a !important; }
.tb-item.ffx { animation: mfxPulse .7s ease-out; }
@keyframes mfxFlash { 0% { filter: brightness(2.2); transform: scale(1.15); } 100% { filter: none; transform: none; } }
@keyframes mfxShake { 0%, 100% { transform: none; } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes mfxPulse { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.mfx-float { position: fixed; z-index: 260; pointer-events: none; transform: translateX(-50%); font-family: var(--font-big); white-space: nowrap; text-shadow: 0 2px 0 rgba(0,0,0,.5); animation: mfxRise 1.4s ease-out forwards; }
.mfx-float.green { color: #7dff8a; } .mfx-float.gold { color: #ffe066; } .mfx-float.red { color: #ff6b6b; } .mfx-float.pink { color: #ff9ec4; }
@keyframes mfxRise { 0% { opacity: 0; transform: translate(-50%, 6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -34px); } }
.mfx-part { position: fixed; z-index: 259; pointer-events: none; font-size: 16px; animation: mfxPart 1.2s ease-out forwards; }
@keyframes mfxPart { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1); } }
.mfx-edge { position: fixed; inset: 0; z-index: 258; pointer-events: none; animation: mfxEdge 1.6s ease-out forwards; }
.mfx-edge.gold { box-shadow: inset 0 0 70px 18px rgba(255, 210, 63, .75); }
@keyframes mfxEdge { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
.mfx-big-pop { position: fixed; left: 50%; top: 26%; z-index: 261; pointer-events: none; text-align: center; transform: translate(-50%, -50%); animation: mfxBig 1.6s cubic-bezier(.2, 1.5, .4, 1) forwards; }
.mfx-big-pop .t { font-family: var(--font-big); font-size: clamp(26px, 5vw, 42px); color: #ffe066; text-shadow: 0 3px 0 #000, 0 0 16px rgba(255,210,63,.8); white-space: nowrap; }
.mfx-big-pop .s { color: #fff; font-size: 14px; text-shadow: 0 2px 0 #000; }
@keyframes mfxBig { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* ── ⚖ 소송 ── */
.legal-form { gap: 6px; }
.legal-form .lf-sec { font-weight: bold; font-size: 13px; margin-top: 6px; color: var(--ink); border-top: 2px dashed rgba(0,0,0,.12); padding-top: 6px; }
.legal-form .lf-sum { margin-top: 8px; padding: 8px; background: #fff6c4; border-radius: 6px; gap: 8px; align-items: center; }
.legal-form .lf-sum b.good { color: var(--green-d); font-size: 18px; } .legal-form .lf-sum b.bad { color: var(--red-d); font-size: 18px; } .legal-form .lf-sum b { font-size: 18px; }
.remedy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.remedy-grid .remedy { padding: 7px; gap: 3px; display: flex; flex-direction: column; }
.remedy-grid .remedy.disabled { opacity: .45; cursor: not-allowed; }

/* 판결 연출 */
.court { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: radial-gradient(circle, rgba(120,90,50,.45), rgba(10,12,30,.85) 70%); animation: fadeIn .25s; cursor: pointer; }
.court-box { background: #5a3b22; border: 4px solid #2b1d14; box-shadow: 0 0 0 4px #c98f3e, 0 12px 40px rgba(0,0,0,.5); border-radius: 10px; padding: 16px 28px 18px; text-align: center; color: #fff; min-width: 300px; max-width: min(92vw, 460px); }
.court-who { font-size: 13px; opacity: .85; letter-spacing: .5px; }
.court-bench { position: relative; height: 120px; margin: 8px auto 4px; width: 220px; }
.court-judge { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); }
.court-judge .portrait { image-rendering: pixelated; border-radius: 8px; background: #3c2a1a; }
.court-bench::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: #8a5a30; border: 3px solid #2b1d14; border-radius: 4px; }
.court-gavel { position: absolute; right: 18px; bottom: 18px; font-size: 40px; transform-origin: 80% 80%; z-index: 1; animation: gavel .9s ease-in 1 both; }
.court-bang { position: absolute; right: -6px; bottom: 54px; font-size: 26px; font-weight: 900; color: #ffd23f; text-shadow: 2px 2px 0 #2b1d14; opacity: 0; z-index: 2; animation: bang .5s .78s ease-out 1 both; }
.court-title { font-size: 46px; font-weight: 900; margin-top: 6px; text-shadow: 3px 3px 0 #2b1d14; opacity: 0; animation: verdictIn .45s .85s cubic-bezier(.2,1.6,.4,1) 1 both; }
.court.win .court-title { color: #ffd23f; } .court.lose .court-title { color: #c9c9d6; } .court.scandal .court-title { color: #ff6b6b; }
.court-line { font-size: 14px; margin-top: 4px; opacity: 0; animation: fadeIn .3s 1.1s both; }
.court-detail { font-size: 12px; margin-top: 3px; opacity: .8; }
.court-detail.muted { opacity: .55; }
.court.win .court-box { animation: courtShake .25s .8s 1; } .court.lose .court-box, .court.scandal .court-box { animation: courtShake .25s .8s 1; }
@keyframes gavel { 0% { transform: rotate(-50deg) translate(0,-14px); } 70% { transform: rotate(-60deg) translate(0,-18px); } 86% { transform: rotate(15deg); } 100% { transform: rotate(0); } }
@keyframes bang { 0% { opacity: 0; transform: scale(.4); } 60% { opacity: 1; transform: scale(1.3); } 100% { opacity: 1; transform: scale(1); } }
@keyframes verdictIn { 0% { opacity: 0; transform: scale(2.2); } 100% { opacity: 1; transform: scale(1); } }
@keyframes courtShake { 0%,100% { transform: translate(0,0); } 25% { transform: translate(-4px,2px); } 50% { transform: translate(4px,-2px); } 75% { transform: translate(-2px,1px); } }

/* ── 새로 창업: 혼자 / 친구와 · 멀티 대기실 ── */
.play-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.play-pick { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 12px 8px; }
.play-pick .pp-ico { font-size: 30px; line-height: 1.1; }
.room-card { display: flex; align-items: center; gap: 8px; margin: 0; }
.room-card .rc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.room-card .rc-title { font-weight: bold; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-card .rc-info { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; line-height: 1.5; }
.room-card .rc-info > span { white-space: nowrap; }      /* 항목 단위로만 줄바꿈 */
.room-card .rc-info .chip { font-size: 11px; padding: 0 5px; }
.room-card > .btn { flex: 0 0 auto; min-width: 74px; }
.room-card.locked { background: #ece8e0; }
.room-card.locked .rc-title { color: var(--ink-soft); }
.room-list { gap: 6px; max-height: 420px; overflow-y: auto; padding: 2px; }
/* 서버 현황: 멀티 방 · 바로 참가 · 접속 중 · 혼자 하는 중 */
.room-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.rs-tile { border: 3px solid var(--ink); border-radius: 8px; padding: 6px 4px 5px; text-align: center; background: var(--paper); box-shadow: 0 3px 0 rgba(0,0,0,.18); min-width: 0; }
.rs-tile.blue { background: #dbe8ff; } .rs-tile.green { background: #d5f3df; } .rs-tile.yellow { background: #fff2bf; } .rs-tile.gray { background: #ece6dc; }
.rs-num { font-family: var(--font-big); font-size: 22px; line-height: 1.15; white-space: nowrap; }
.rs-label { font-weight: bold; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-sub { font-size: 10.5px; color: var(--ink-soft); line-height: 1.25; word-break: keep-all; }
.tab-count { display: inline-block; min-width: 18px; height: 18px; line-height: 14px; margin-left: 4px; padding: 0 4px; border: 2px solid var(--ink); border-radius: 9px; background: #ff5a5a; color: #fff; font-size: 11px; font-weight: bold; text-shadow: none; vertical-align: 1px; }
.tab-count[hidden] { display: none; }
.lobby-slot.ready { box-shadow: inset 0 -3px 0 #a8e6bc; }
.lobby-slot.empty-slot { opacity: .7; border-style: dashed; }

/* 멀티: 방장이 아니면 시간 버튼이 흐려진다 */
.btn.locked { opacity: .45; filter: grayscale(.6); }

/* ── 비상 구제금 ── */
.celebrate p.small { white-space: pre-line; }
.news-banner.sos { background: #ffe1e1; box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 0 3px #ff6b6b; }
.bail-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.bail-card { gap: 6px; }
.bail-card.negative { border-color: #d63b3b; background: #fff1f1; box-shadow: 0 0 0 2px #ffb3b3 inset; }
.bail-card.tight { background: #fffaf0; }
.bail-card .bail-name { font-weight: bold; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bail-card > .btn { align-self: stretch; }
.bail-owe { gap: 6px; background: #fff0f6; }
.bail-owe-row { gap: 6px; align-items: center; }
.bail-hist { gap: 8px; align-items: baseline; }
.bail-range { width: 100%; margin: 0; accent-color: #36b26b; }
.bail-sum { gap: 3px; background: var(--paper); }

/* ── 🎓 튜토리얼: 노란 테두리 · 도트 화살표 · 안내 카드 ── */
.tut-ring { position: fixed; z-index: 141; pointer-events: none; border: 3px solid #ffd23f; border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(43,29,20,.55), 0 0 18px 6px rgba(255,210,63,.7); animation: tutPulse 1.1s ease-in-out infinite; transition: left .18s, top .18s, width .18s, height .18s; }
.tut-dim { position: fixed; z-index: 140; background: rgba(10,12,30,.45); pointer-events: none; }
@keyframes tutPulse { 50% { border-color: #fff3a0; } }
.tut-arrow { position: fixed; z-index: 143; width: 40px; height: 40px; pointer-events: none; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); transition: left .18s, top .18s; }
.tut-arrow svg { display: block; width: 40px; height: 40px; }
.tut-arrow.down svg { animation: tutBobDown .7s ease-in-out infinite; }
.tut-arrow.up svg { transform: rotate(180deg); animation: tutBobUp .7s ease-in-out infinite; }
.tut-arrow.left svg { transform: rotate(90deg); animation: tutBobLeft .7s ease-in-out infinite; }
.tut-arrow.right svg { transform: rotate(-90deg); animation: tutBobRight .7s ease-in-out infinite; }
@keyframes tutBobDown { 50% { translate: 0 -8px; } }
@keyframes tutBobUp { 50% { translate: 0 8px; } }
@keyframes tutBobLeft { 50% { translate: 8px 0; } }
@keyframes tutBobRight { 50% { translate: -8px 0; } }
.tut-arrow-label { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-weight: bold; font-size: 12px; color: #2b1d14;
  background: #ffd23f; border: 2px solid #2b1d14; border-radius: 8px; padding: 0 6px; line-height: 18px; }
.tut-arrow-label:empty { display: none; }
.tut-arrow.down .tut-arrow-label { bottom: 42px; } .tut-arrow.up .tut-arrow-label { top: 42px; }
.tut-arrow.left .tut-arrow-label { top: 42px; } .tut-arrow.right .tut-arrow-label { top: 42px; }
.tut-card { position: fixed; z-index: 142; width: min(440px, calc(100vw - 24px)); max-height: 52vh; overflow-y: auto; background: #fff8e7; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 6px 0 rgba(0,0,0,.35); padding: 9px 12px 10px; animation: tutIn .22s cubic-bezier(.2,1.4,.4,1); }
@keyframes tutIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.tut-card .tut-head { display: flex; align-items: center; gap: 6px; }
.tut-card .tut-step { font-size: 11px; color: var(--ink-soft); font-weight: bold; }
.tut-progress { height: 5px; background: #eadfc6; border-radius: 3px; margin: 4px 0 6px; overflow: hidden; }
.tut-progress i { display: block; height: 100%; background: linear-gradient(90deg, #36b26b, #8ee39f); }
.tut-card .tut-title { font-weight: bold; font-size: 15.5px; line-height: 1.35; }
.tut-card .tut-body { white-space: pre-line; font-size: 13.5px; line-height: 1.6; margin: 6px 0 8px; }
.tut-card .tut-action { margin: 0 0 8px; }
.tut-card .tut-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tut-card.tip { left: 12px; bottom: calc(var(--nav-h, 62px) + 12px); border-color: #3d7be0; background: #f2f7ff; max-width: 360px; }
.tut-pill { position: fixed; z-index: 142; left: 10px; bottom: calc(var(--nav-h, 62px) + 10px); background: #fff8e7; border: 3px solid var(--ink); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: bold; color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.3); cursor: pointer; animation: tutPulse 1.4s infinite; }
.tut-card[hidden], .tut-ring[hidden], .tut-arrow[hidden], .tut-pill[hidden], .tut-dim[hidden] { display: none !important; }

/* ── 📖 게임 가이드 ── */
.guide-win { max-width: 860px; }
.gd-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; min-height: 0; }
.gd-nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 64vh; }
.gd-nav .btn { justify-content: flex-start; text-align: left; }
.gd-body { overflow-y: auto; max-height: 64vh; padding-right: 4px; }
.gd-title { margin: 0 0 8px; font-size: 20px; }
.gd-h { margin: 14px 0 6px; font-size: 15px; }
.gd-p { margin: 6px 0; line-height: 1.65; }
.gd-ul { margin: 4px 0 8px; padding-left: 20px; line-height: 1.65; }
.gd-ul li { margin: 2px 0; }
.gd-tip { background: #fff3c4; border: 2px solid #e5c75a; border-radius: 8px; padding: 6px 10px; margin: 8px 0; font-size: 13.5px; line-height: 1.55; }
.gd-tip.warn { background: #ffe6d6; border-color: #e8a070; }
.gd-tbl td, .gd-tbl th { font-size: 13px; }
.gd-pager { margin-top: 14px; gap: 6px; }
.tut-card.hint { border-color: #e5484d; background: #fff4ec; }
.tut-arrow.mini, .tut-arrow.mini svg { width: 26px; height: 26px; }

/* ── 배경음악 ── */
.bgm-toggle { position: fixed; z-index: 90; right: 12px; top: calc(10px + env(safe-area-inset-top, 0px)); width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--ink); background: #fff8e7; font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.bgm-toggle[hidden] { display: none; }
.bgm-row { gap: 8px; align-items: center; }
.bgm-vol { flex: 1 1 120px; min-width: 100px; accent-color: #36b26b; }

/* ── 주 진행: 하루씩 7칸 ── */
.week-bar.days { display: inline-grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: transparent; border-radius: 0; overflow: visible; width: 56px; height: 7px; }
.week-bar.days > i { display: block; height: 100%; background: rgba(0,0,0,.4); border-radius: 1px; }
.week-bar.days > i.on { background: #9fe870; }
.week-bar.days > i.on:last-of-type { background: #ffd23f; }
/* 빨리 감기 (3년차부터 하나의 버튼) */
#tb-speed { min-width: 56px; }
/* 하단 탭: 열린 탭 수만큼 칸을 꽉 채운다 */
.nav-btn { flex: 1 1 0; }

/* ── 휴대폰 '진행·판매' 카드 ── */
.pulse { display: flex; flex-direction: column; gap: 8px; padding: 8px; height: 100%; overflow: auto; background: var(--cream); }
.pulse .hud-card { margin: 0; cursor: pointer; }
.pulse .t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pulse .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pulse-pct { font-family: var(--font-big); font-size: 16px; color: #b35900; }
.sales-bars { display: grid; grid-template-columns: repeat(8, 1fr); align-items: end; gap: 5px; height: 120px; margin: 8px 0 4px; padding: 0 2px; border-bottom: 2px solid var(--ink); }
.sales-bars .sb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.sales-bars .sb i { display: block; width: 100%; background: linear-gradient(#6cc4ff, #3d7be0); border: 2px solid var(--ink); border-bottom: 0; border-radius: 3px 3px 0 0; min-height: 0; }
.sales-bars .sb.now i { background: linear-gradient(#ffe066, #ff9a2e); }
.sales-bars .sb.empty i { border: 0; }
.sales-bars .sb-v { font-size: 9px; line-height: 12px; white-space: nowrap; color: var(--ink); }
.sales-bars .sb-x { position: absolute; bottom: -16px; font-size: 9px; color: #6b6b7a; }
.pulse-card.sales .row { margin-top: 16px; }

/* ── 방어 카운트다운 줄 (팝업 대신) ── */
#defense-bar { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 25; display: flex; flex-direction: column; gap: 4px; width: min(560px, calc(100% - 16px)); pointer-events: auto; }
#defense-bar .db-row { display: flex; align-items: center; gap: 6px; background: #fff0f0; border: 3px solid var(--ink); border-radius: 10px; padding: 4px 6px; box-shadow: 0 3px 0 rgba(0,0,0,.35); animation: fadeIn .2s; }
#defense-bar .db-text { flex: 1 1 auto; min-width: 0; font-size: 12px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#defense-bar .db-sec { font-family: var(--font-big); font-size: 20px; color: #e5484d; min-width: 42px; text-align: center; }
#defense-bar .db-sec.hot { animation: pulseHot .5s infinite alternate; }
#defense-bar .btn.small { min-height: 30px; padding: 2px 6px; white-space: nowrap; }
@keyframes pulseHot { from { transform: scale(1); } to { transform: scale(1.18); } }
