:root {
  --ink: #2a1b4a;
  --ink2: #56428a;
  --muted: #8a7aa8;
  --pink: #ff4f9a;
  --pink2: #ffb6d2;
  --purple: #7c5cff;
  --lav: #f1ebff;
  --line: #ebe1f8;
  --good: #0a8f69;
  --bad: #d93a57;
  --warn: #e68a00;
  --card: #fff;
  --shadow: 0 14px 34px rgba(90, 50, 140, .18);
  --head: 'Jua', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  color: var(--ink);
  font: 15px/1.55 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background-color: #dcbaf2;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .35) 2px, transparent 2.5px),
    linear-gradient(135deg, #ffc4e1 0%, #b8a8ff 100%);
  background-size: 34px 34px, 100% 100%;
  background-attachment: fixed;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--head); font-weight: 400; letter-spacing: -.01em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; font-weight: 700; line-height: 1.2; text-align: center;
  transition: transform .12s, background .12s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); background: var(--lav); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; box-shadow: 0 6px 16px rgba(255, 79, 154, .35); }
.btn.primary:hover:not(:disabled) { background: #ff3a8c; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.wide { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-width: 1.5px; }
.btn.sm small { font-weight: 400; color: var(--muted); font-size: 11px; }
.btn:disabled { opacity: .45; }
.icon-btn { width: 40px; height: 40px; flex: none; border: 2px solid var(--line); border-radius: 50%; background: #fff; font-size: 17px; }
.icon-btn:hover { border-color: var(--purple); }

.card { background: var(--card); border-radius: 28px; box-shadow: var(--shadow); }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .22em; color: var(--purple); }
.small { font-size: 13px; color: var(--muted); }

/* 타이틀·탄생·결산 */
.screen.center { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.title-card { width: min(100%, 440px); padding: 36px 28px 30px; text-align: center; }
.title-av { width: 132px; margin: 0 auto 14px; animation: bob 1.6s ease-in-out infinite; }
.title-card h1 { margin: 8px 0 6px; font-size: clamp(34px, 9vw, 46px); line-height: 1.15; }
.title-card .lead { color: var(--ink2); margin-bottom: 24px; }
.col-btns { display: grid; gap: 10px; margin-bottom: 16px; }
@keyframes bob { 50% { transform: translateY(-6%) rotate(-3deg); } }

.birth { position: relative; min-height: 100vh; background: #0b0824; }
#birthMap { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.birth-cap {
  position: fixed; top: 9%; z-index: 1; padding: 0 16px; text-align: center; pointer-events: none;
  font-family: var(--head); font-size: clamp(24px, 4.2vw, 44px); line-height: 1.25; color: #fff;
  text-shadow: 0 2px 16px rgba(10, 6, 30, .6); opacity: 0;
}
.birth-cap.dark { color: var(--ink); text-shadow: 0 2px 14px rgba(255, 255, 255, .9); }
.birth-cap.show { animation: capin .9s ease-out both; }
@keyframes capin { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.skip {
  position: fixed; right: 16px; bottom: 16px; z-index: 3; padding: 9px 16px; border: 1.5px solid rgba(255, 255, 255, .6);
  border-radius: 999px; background: rgba(20, 12, 50, .45); color: #fff; font-weight: 700; backdrop-filter: blur(4px);
}
.skip:hover { background: rgba(20, 12, 50, .7); }
.birth-wrap { position: relative; z-index: 2; min-height: 100vh; display: flex; align-items: center; justify-content: flex-end; padding: 24px clamp(16px, 3vw, 40px); pointer-events: none; }
.birth-wrap .card { pointer-events: auto; animation: cardin .7s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes cardin { from { opacity: 0; transform: translateX(40px); } }
.birth-card { width: min(100%, 660px); padding: 28px 24px; text-align: center; }
/* 에고서치 */
.top-btns .btn.dot { position: relative; }
.top-btns .btn.dot::after { content: ''; position: absolute; top: 2px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 2px #fff; }
.ego-q { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; background: #fff; }
.ego-q b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ego-q small { flex: none; font-size: 12px; color: var(--muted); }
.ego-seg button small { margin-left: 4px; font-size: 11.5px; color: var(--muted); }
.ego-mood { margin: 0 0 8px; padding: 9px 12px; border-radius: 12px; background: var(--lav); font-size: 13.5px; font-weight: 700; color: var(--ink2); }
.ego-mood.good { background: #e2f7ef; color: var(--good); }
.ego-mood.bad { background: #fde8ec; color: var(--bad); }
.ego-tw { display: flex; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.ego-tw > div { flex: 1; min-width: 0; }
.ego-pf { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-style: normal; font-weight: 700; color: var(--ink); }
.ego-pf.anon { background: #ddd8e6; color: #6b6280; }
.ego-tw-h { font-size: 13.5px; }
.ego-tw-h small, .ego-tw-f { font-size: 12px; color: var(--muted); }
.ego-tx { font-size: 14px; overflow-wrap: anywhere; }
.ego-tw.k-hate .ego-tx, .ego-tw.k-doxx .ego-tx, .ego-tw.k-pctrv .ego-tx { color: var(--bad); }
.ego-tw-f { display: flex; gap: 16px; margin-top: 4px; }
.ego-art { display: grid; place-items: center; height: 150px; margin-top: 8px; border-radius: 14px; overflow: hidden; }
.ego-art svg { width: auto; height: 140px; }
.ego-dm { margin-bottom: 4px; padding: 10px 12px; border-radius: 14px; background: #f6f3fb; }
.ego-dm-h { margin-bottom: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.ego-dm-row { display: flex; gap: 10px; font-size: 13.5px; }
.ego-dm-row + .ego-dm-row { margin-top: 10px; }
.ego-shroom { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 120px; height: 96px; margin-top: 6px; border-radius: 12px; background: linear-gradient(160deg, #46613f, #22331f); }
.ego-shroom span { font-size: 44px; line-height: 1; }
.ego-shroom small { margin-top: 4px; font-size: 11.5px; color: #dfe8d8; }
.ego-board { margin-bottom: 2px; padding: 7px 12px; border-radius: 10px; background: #3b4890; font-size: 13px; font-weight: 700; color: #fff; }
.ego-board.fm { background: #1f6fb2; }
.ego-row { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 8px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.ego-row small { grid-column: 2; font-size: 11.5px; color: var(--muted); }
.ego-head { font-size: 12px; font-weight: 700; color: var(--ink2); white-space: nowrap; }
.ego-row.k-ctrv .ego-head, .ego-row.k-doxx .ego-head, .ego-row.k-pctrv .ego-head { color: var(--bad); }
.ego-tt { min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.ego-tt em { font-size: 12px; font-style: normal; font-weight: 700; color: var(--pink); }
.ego-tag { padding: 1px 6px; border-radius: 6px; background: #fde8ec; font-size: 11px; font-weight: 700; color: var(--bad); white-space: nowrap; }
.ego-mask { font-style: italic; color: var(--muted); }
.ego-up { min-width: 34px; padding: 2px 4px; border-radius: 8px; background: var(--lav); font-size: 12px; text-align: center; color: var(--ink2); }

/* 인생 결산: 대표 칭호 아래 나머지 칭호, 통계·SNS 기록 버튼 */
.end-title .end-subs { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(124, 92, 255, .35); list-style: none; }
.end-title .end-subs li { font-size: 12.5px; line-height: 1.45; color: var(--ink2); }
.end-title .end-subs b { display: inline; margin: 0 6px 0 0; font-size: 15px; color: var(--purple); }
.end-more { margin: -4px 0 14px; }
.ego-era { margin: 14px 0 2px; font-size: 12.5px; font-weight: 700; color: var(--purple); }
.ego-era:first-child { margin-top: 4px; }
.ego-dmnote { padding: 6px 2px; font-size: 12px; color: var(--bad); }

/* 인간관계: 고백·이별 버튼 */
.rel-act { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 3px; }
.rel-act small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sh-note.good { color: var(--good); font-weight: 700; }

@media (max-width: 899px) {
  .birth-wrap { display: block; padding: 44vh 16px 24px; }
  .birth-card { margin: 0 auto; }
  @keyframes cardin { from { opacity: 0; transform: translateY(40px); } }
}
.birth-card h2 { margin: 6px 0 4px; font-size: 30px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 22px 0; text-align: left; }
.bcard { padding: 14px 16px; border-radius: 18px; background: var(--lav); animation: pop .5s calc(var(--i) * .18s) both cubic-bezier(.2, .9, .3, 1.2); }
.bcard small { font-size: 12px; color: var(--muted); }
.bcard b { display: block; margin: 2px 0 4px; font-family: var(--head); font-weight: 400; font-size: 21px; line-height: 1.25; }
.bcard p { font-size: 13px; color: var(--ink2); }
.bcard.warn { background: #fff1de; }
/* 세로가 낮은 창에서는 출생 카드를 촘촘하게 (부모님·소득·재능 출처까지 한 화면에) */
@media (max-height: 780px) {
  .birth-card { padding: 18px 20px; }
  .birth-card h2 { font-size: 25px; }
  .cards { margin: 12px 0; gap: 8px; }
  .bcard { padding: 9px 12px; border-radius: 14px; }
  .bcard b { margin: 1px 0 2px; font-size: 18px; }
  .bcard p { font-size: 12px; line-height: 1.35; }
  .name-row { margin-bottom: 10px; }
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.name-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.name-row label { font-weight: 700; }
.name-row input { flex: 1; min-width: 0; padding: 10px 16px; border: 2px solid var(--line); border-radius: 999px; font: inherit; font-size: 17px; color: var(--ink); outline: none; }
.name-row input:focus { border-color: var(--purple); }

/* 인생 화면 */
.life { max-width: 1280px; margin: 0 auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: 22px; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow);
}
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mini-av { width: 48px; flex: none; }
.who-txt { min-width: 0; }
.who-txt p { font-size: 18px; line-height: 1.25; }
.who-txt b { font-family: var(--head); font-weight: 400; font-size: 22px; }
.who-txt span { color: var(--pink); font-weight: 700; }
.trophies { display: inline-flex; flex: none; align-items: center; gap: 1px; padding: 3px 6px; border-radius: 999px; background: #fff7dd; }
.trophies:empty { display: none; }
.trophy { width: 20px; height: 20px; filter: drop-shadow(0 1px 1px rgba(42, 27, 74, .35)); }
.trophies small { font-size: 11px; font-weight: 700; color: var(--ink2); margin-left: 2px; }
/* 화면이 좁으면 최근 트로피 셋과 개수만 */
@media (max-width: 1199px) {
  .trophies .trophy:not(:nth-last-of-type(-n+3)) { display: none; }
}

.who-txt .career { font-style: normal; font-size: 13px; font-weight: 700; color: var(--ink2); margin-left: 8px; white-space: nowrap; }
.who-txt .career:empty { display: none; }
.who-txt small { display: block; color: var(--ink2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.speed { display: flex; flex: none; padding: 4px; border-radius: 999px; background: var(--lav); }
.speed button { min-width: 44px; padding: 7px 10px; border: 0; border-radius: 999px; background: transparent; font-weight: 700; font-size: 14px; color: var(--ink2); }
.speed button.on { background: var(--ink); color: #fff; }

/* 왼쪽(지표·상태)과 오른쪽(방침·능력치)은 따로 쌓는다: 한쪽이 길어져도 다른 쪽이 눌리지 않는다 */
.grid {
  display: grid; gap: 12px;
  grid-template-columns: 290px minmax(0, 1fr) 300px;
  grid-template-areas: "left log right";
  grid-template-rows: minmax(0, 1fr);
}
.col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.col-l { grid-area: left; }
.col-r { grid-area: right; }
.col .panel { flex: none; }
.panel { padding: 16px; border-radius: 22px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); min-width: 0; }
.panel h3 { font-size: 18px; margin-bottom: 10px; }
.p-conds h3, .p-stats h3, .p-policy h3 { font-size: 17px; margin-bottom: 8px; }
.p-metrics { grid-area: metrics; }
.p-log { grid-area: log; display: flex; flex-direction: column; min-height: 0; }
.p-policy { grid-area: policy; }
.p-conds { grid-area: conds; }
.p-stats { grid-area: stats; }

@media (min-width: 1000px) {
  .life { height: 100vh; }
  .grid { flex: 1; min-height: 0; }
  .log { flex: 1; min-height: 0; }
  /* 아주 낮은 창에서만 옆 열이 통째로 스크롤된다 */
  .col { overflow-y: auto; scrollbar-width: thin; }
}
/* 노트북처럼 세로가 낮은 화면: 여백과 글자를 줄여 스크롤 없이 들어가게 */
@media (min-width: 1000px) and (max-height: 820px) {
  .life { padding: 6px 14px 6px; gap: 6px; }
  .grid, .col { gap: 8px; }
  .top { padding: 4px 12px; }
  .mini-av { width: 34px; }
  .who-txt b { font-size: 19px; }
  .panel { padding: 11px 13px; border-radius: 18px; }
  .panel h3, .p-conds h3, .p-stats h3, .p-policy h3 { font-size: 15.5px; margin-bottom: 5px; }
}
@media (max-width: 999px) {
  .col { display: contents; }
  .grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "metrics" "log" "policy" "conds" "stats"; }
  .top { position: sticky; top: 8px; z-index: 5; }
  .log { height: 52vh; }
}

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m { padding: 10px 12px; border-radius: 16px; background: var(--lav); min-width: 0; }
.m small { display: block; font-size: 12px; color: var(--muted); }
.m b { display: block; font-family: var(--head); font-weight: 400; font-size: 21px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m b.dim { color: var(--muted); }
.m b.neg { color: var(--bad); }
.m small.neg { color: var(--bad); font-weight: 700; white-space: nowrap; }
.m .debt .ds { display: none; }
.m.big { grid-column: 1 / -1; background: linear-gradient(120deg, #ffe1ef, #ece4ff); }
.m.big b { font-size: 32px; }
.m .bar { margin-top: 4px; }
.pre-note { grid-column: 1 / -1; padding: 6px 4px 0; font-size: 13px; color: var(--muted); }
.grade { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: #e6fff5; color: #00875a; font-size: 11px; font-weight: 700; }
.grade.challenger { background: #efedff; color: #5b3fd6; }
.grade.partner { background: #fff3d6; color: #a86400; }
.host-pick { width: 100%; margin-bottom: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); }
.host-range { width: 100%; margin: 2px 0 6px; accent-color: var(--pink); }
.host-sup { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--lav); font-weight: 700; font-size: 14px; }
.host-sup small { flex-basis: 100%; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.host-sup.dis { opacity: .6; }
#shBody .seg { margin-bottom: 10px; }
.mopts .name-row { margin-bottom: 6px; }

.log { overflow-y: auto; overflow-anchor: none; padding-right: 6px; }
.log .age {
  position: sticky; top: 0; z-index: 1; margin: 10px 0 4px; padding: 2px 0;
  font-family: var(--head); font-size: 17px; color: var(--purple); background: rgba(255, 255, 255, .96);
}
.log .grp:first-child .age { margin-top: 0; }
.e { position: relative; padding: 5px 0 5px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; animation: fadein .35s ease-out; }
.log .e { animation-name: dropin; }
.e::before { content: ''; position: absolute; left: 2px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: #cbbde6; }
.e.k-good::before { background: var(--good); }
.e.k-bad::before { background: var(--bad); }
.e.k-health::before { background: var(--warn); }
.e.k-big { font-weight: 700; }
.e.k-big::before { background: var(--pink); width: 9px; height: 9px; left: 1px; top: 12px; }
.e.k-stat { color: var(--muted); font-size: 13px; }
.e.k-death { font-weight: 700; color: var(--ink); }
.e.k-death::before { background: var(--ink); }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
@keyframes dropin { from { opacity: 0; transform: translateY(-6px); } }

.lbl { font-size: 13px; font-weight: 700; color: var(--ink2); margin: 4px 0 6px; }
.seg { display: flex; padding: 3px; border-radius: 14px; background: var(--lav); }
.seg button { flex: 1; padding: 8px 4px; border: 0; border-radius: 11px; background: transparent; font-weight: 700; font-size: 13.5px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--pink); box-shadow: 0 2px 8px rgba(90, 50, 140, .15); }
.seg button:disabled { opacity: .4; }
.hint { margin: 4px 2px 8px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.hint:last-child { margin-bottom: 0; }
.lbl .lbl-note { margin-left: 4px; font-weight: 400; color: var(--muted); }
.lbl-row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.lbl-row .lbl { flex: none; margin: 0; }
.seg.mini { flex: 1; padding: 2px; border-radius: 11px; }
.seg.mini button { padding: 5px 4px; font-size: 12.5px; border-radius: 9px; }
.top-btns { display: flex; flex: none; gap: 6px; margin-left: auto; }
.top-btns .btn { padding: 7px 12px; font-size: 13.5px; white-space: nowrap; }
/* 이름 줄이 길어지면(트로피 등) 버튼 대신 이름 줄이 줄어든다 */
.who { flex: 1 1 auto; }
.who-txt p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top-btns .ghost { padding: 7px 8px; }

.st { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; margin-bottom: 7px; font-size: 14px; }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.stats2 .st { margin-bottom: 6px; font-size: 13.5px; }
.st b { font-family: var(--head); font-weight: 400; font-size: 16px; }
.st .bar { grid-column: 1 / -1; }
.bar { height: 7px; border-radius: 7px; background: var(--lav); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, #b8a8ff, var(--purple)); transition: width .4s; }
.bar.hp i { background: linear-gradient(90deg, #8ee6c4, var(--good)); }
.bar.mind i { background: linear-gradient(90deg, #ffc0dc, var(--pink)); }
.bar.stress i { background: linear-gradient(90deg, #ffd59a, var(--warn)); }
.bar.low i { background: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--lav); }
.chip.warn { background: #fff1de; color: #a35f00; }
.chip.ok { background: #e2f7ef; color: var(--good); }
.chip.bad { background: #ffe5ea; color: var(--bad); }

/* 선택 창·시트 */
.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgba(42, 27, 74, .45); backdrop-filter: blur(3px);
}
.mcard { width: min(100%, 470px); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px 22px 20px; border-radius: 26px; background: #fff; box-shadow: 0 24px 60px rgba(42, 27, 74, .35); animation: pop .3s both; }
.mcard { position: relative; }
.mmin { position: absolute; top: 14px; right: 14px; font-size: 20px; line-height: 1; }
.m-restore { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: 18px; z-index: 31; box-shadow: 0 10px 28px rgba(42, 27, 74, .35); animation: pop .25s both; }
.mtag { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--lav); color: var(--purple); font-size: 12px; font-weight: 700; }
.mcard h2 { margin: 10px 0 8px; font-size: 26px; line-height: 1.25; }
.mtext { margin-bottom: 16px; color: var(--ink2); }
.mopts { display: grid; gap: 8px; }
.opt { display: grid; gap: 2px; padding: 12px 16px; border: 2px solid var(--line); border-radius: 16px; background: #fff; text-align: left; transition: border-color .12s, background .12s; }
.opt:hover:not(:disabled) { border-color: var(--purple); background: #faf7ff; }
.opt b { font-size: 15px; }
.opt small { font-size: 12.5px; color: var(--muted); }
.opt small.why { color: var(--bad); }
.opt.toggle.on { border-color: var(--pink); background: #fff0f7; }
.opt.toggle.on b::before { content: '✓ '; color: var(--pink); }
.opt:disabled { opacity: .5; }
.mopts .btn.wide { margin-top: 6px; }
.mnote { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: #f4f0fb; font-size: 12.5px; color: var(--ink2); }

.sheet { width: min(100%, 520px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; }
.sh-text { margin: 6px 0 18px; }
.sh-sub, .sh-note { margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.sh-money { margin-bottom: 4px; }
.sh-money b { font-family: var(--head); font-weight: 400; font-size: 22px; color: var(--pink); }
.sh-sub b { color: var(--ink); }
.sh-note.bad { color: var(--bad); font-weight: 700; }
.sh-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sh-btns.col { flex-direction: column; margin-bottom: 12px; }
.shop-row, .rel-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.shop-row b, .rel-row b { display: block; }
.shop-row small, .rel-row small { display: block; font-size: 12.5px; color: var(--muted); }
.shop-row .btn { flex: none; flex-direction: column; gap: 0; min-width: 120px; }
.home-btns { display: flex; flex-direction: column; gap: 6px; }
.max { font-size: 13px; color: var(--good); font-weight: 700; flex: none; }
.rel-main { flex: 1; min-width: 0; }
.rel-main .bar { margin-top: 6px; }
.rel-acts { display: flex; gap: 6px; flex: none; }
.rel-row.partner b::after { content: ' ♥'; color: var(--pink); }

/* 방송 창 */
.bc { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 12px; background: rgba(42, 27, 74, .6); backdrop-filter: blur(4px); }
.bc-win { width: min(100%, 960px); max-height: calc(100vh - 24px); overflow-y: auto; padding: 14px; border-radius: 26px; background: #fff; box-shadow: 0 30px 70px rgba(20, 10, 40, .45); }
.bc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: #ff3b5c; color: #fff; font-size: 12px; font-weight: 700; }
.live em, .bc-view em { font-style: normal; }
.live.stage { background: var(--purple); }
.msg.crowd b { color: var(--purple); }
.live b { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.plat { padding: 3px 10px; border-radius: 999px; background: #e6fff5; color: #00875a; font-size: 12px; font-weight: 700; }
.bc-title { flex: 1; min-width: 140px; font-family: var(--head); font-weight: 400; font-size: 20px; }
.bc-view { font-size: 13px; color: var(--ink2); }
.bc-view b { font-family: var(--head); font-weight: 400; font-size: 18px; color: var(--ink); }
.bc-bar { height: 5px; margin-bottom: 10px; border-radius: 5px; background: var(--lav); overflow: hidden; }
.bc-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff8fc0, var(--pink)); }
.bc-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.bc-stage { position: relative; height: 330px; border-radius: 20px; background: linear-gradient(160deg, #f3ecff, #ffe3f1); overflow: hidden; }
.bc-av { position: absolute; left: 50%; top: 54%; width: 46%; max-width: 230px; transform: translate(-50%, -50%); }
.bc-av svg { display: block; animation: bob 1.4s ease-in-out infinite; }
.bc-av.talk svg { animation: bob .45s ease-in-out infinite; }
.gaming .bc-av { left: auto; right: 10px; top: 10px; width: 64px; transform: none; z-index: 2; }
.bubble {
  position: absolute; left: 50%; top: 14px; z-index: 3; max-width: 86%; transform: translateX(-50%);
  padding: 9px 14px; border-radius: 16px; background: #fff; box-shadow: 0 6px 18px rgba(90, 50, 140, .2);
  font-weight: 700; font-size: 14px; text-align: center; animation: pop .25s both;
}
.gaming .bubble { left: auto; right: 84px; top: 14px; transform: none; max-width: 60%; }
#bcGame { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: manipulation; cursor: pointer; }
.hype { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 2; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--ink2); }
.gaming .hype { bottom: auto; top: 34px; left: 12px; right: auto; width: 46%; }
.hype div { flex: 1; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .8); overflow: hidden; }
.hype i { display: block; height: 100%; background: linear-gradient(90deg, #ffd166, var(--pink)); transition: width .2s; }
.bc-chat { height: 330px; padding: 8px 10px; border-radius: 20px; background: #faf8ff; overflow-y: auto; font-size: 13.5px; }
.bc-chat .sys { color: var(--muted); font-size: 13px; padding: 6px; }
.msg { padding: 4px 6px; border-radius: 10px; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; animation: fadein .25s; }
.msg.sp { margin: 3px 0; padding: 6px 8px; background: #fff; box-shadow: 0 0 0 1.5px var(--c, #b8a8ff) inset; animation: fadein .25s; }
.msg.del { opacity: .5; font-style: italic; }
.msg.del .bdg { background: #bdb3d3; }
.bc-rule { padding: 3px 10px; border-radius: 999px; background: var(--lav); color: var(--ink2); font-size: 12px; font-weight: 700; }
.bc-label { position: absolute; left: 12px; top: 10px; z-index: 3; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .85); font-size: 13px; font-weight: 700; color: var(--ink2); }
.gaming .bc-label { top: 56px; }
.bc-fx { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.note { position: absolute; bottom: 20%; font-size: 26px; color: var(--pink); animation: noteup 2.6s ease-out forwards; }
@keyframes noteup { from { opacity: 0; transform: translateY(0) rotate(-10deg); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(-160px) rotate(12deg); } }
.bc-run { display: flex; align-items: center; gap: 10px; }
.bc-run .bc-hint { flex: 1; }
.msg.q { --c: #7c5cff; }
.msg.don { --c: #00b37a; background: #f0fff8; }
.msg.meme { --c: #ffb020; }
.msg.hate { --c: #ff5c7a; }
.msg.doxx { --c: #ff9f1c; }
.msg.sub { --c: #00a3c4; background: #effbff; }
/* 유료 구독 뱃지 (1티어 ♥ · 2티어 ★ + 개월 수) */
.sb { display: inline-block; margin-right: 4px; padding: 0 5px; border-radius: 6px; background: #ffe0ef; color: #e0337f; font-size: 10.5px; font-weight: 800; font-style: normal; line-height: 1.5; vertical-align: 1px; }
.sb.t2 { background: linear-gradient(135deg, #ffe9a8, #ffc6e4); color: #8a4b00; box-shadow: 0 0 0 1px #f5b400 inset; }
/* 채팅 이모티콘 (응원봉·하트·반짝) */
.emo { display: inline-block; width: 1.75em; height: 1.75em; margin: 0 1px; vertical-align: -.5em; }
.emo.stick { animation: stickwave 1.1s ease-in-out infinite alternate; transform-origin: 50% 95%; }
@keyframes stickwave { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .emo.stick { animation: none; } }
.msg.boss { --c: #f5a400; background: linear-gradient(90deg, #fff6d6, #ffe9f3); font-weight: 700; }
.boss-alert {
  position: absolute; left: 50%; top: 42%; z-index: 4; transform: translate(-50%, -50%);
  padding: 12px 20px; border-radius: 18px; background: linear-gradient(120deg, #ffd54a, #ff8fc0);
  color: #2a1b4a; font-family: var(--head); font-size: 22px; text-align: center; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(255, 140, 0, .35); pointer-events: none;
}
.boss-alert.go { animation: bossin 2.6s ease-out both; }
@keyframes bossin { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 20% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }

.msg.done { animation: none; box-shadow: none; opacity: .55; cursor: default; }
.bdg { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; background: var(--c, var(--purple)); color: #fff; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.msg.done .bdg { background: #bdb3d3; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px var(--c) inset, 0 0 12px var(--c); } }
.hate-acts { display: flex; gap: 6px; margin-top: 6px; }
.hate-acts button { padding: 4px 12px; border: 1.5px solid var(--ink); border-radius: 999px; background: #fff; font-size: 12px; font-weight: 700; }
.hate-acts button:hover { background: var(--lav); }
.bc-foot { margin-top: 12px; }
.bc-ask { margin-bottom: 8px; font-family: var(--head); font-size: 20px; }
.bc-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bc-modes button { display: grid; gap: 3px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 16px; background: #fff; text-align: left; }
.bc-modes button:hover { border-color: var(--pink); background: #fff5fa; }
.bc-modes b { font-size: 16px; }
.bc-modes small { font-size: 12.5px; color: var(--muted); }
.bc-modes .ghost { background: #faf8ff; }
.bc-hint { padding: 10px 14px; border-radius: 14px; background: var(--lav); font-size: 13.5px; color: var(--ink2); }
.bc-res { text-align: center; }
.bc-res h3 { font-size: 22px; margin-bottom: 8px; }
.res-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.res-grid div { padding: 10px; border-radius: 14px; background: var(--lav); }
.res-grid small { display: block; font-size: 12px; color: var(--muted); }
.res-grid b { font-family: var(--head); font-weight: 400; font-size: 22px; }
.res-note { margin-bottom: 12px; color: var(--ink2); }
.res-note b { color: var(--pink); }

@media (max-width: 720px) {
  .bc { padding: 0; place-items: stretch; }
  .bc-win { max-height: 100vh; border-radius: 0; }
  .bc-body { grid-template-columns: minmax(0, 1fr); }
  .bc-stage { height: 250px; }
  .bc-chat { height: 210px; }
  .bc-modes { grid-template-columns: minmax(0, 1fr); }
  .res-grid { grid-template-columns: 1fr 1fr; }
  .top { padding: 8px 10px; flex-wrap: wrap; row-gap: 6px; }
  .top-btns { order: 3; width: 100%; margin-left: 0; }
  .top-btns .btn { flex: 1; padding: 6px 4px; font-size: 12.5px; white-space: nowrap; }
  .speed button { min-width: 34px; padding: 7px 5px; font-size: 13px; }
  .mini-av { width: 38px; }
  .who-txt small { white-space: normal; font-size: 12px; line-height: 1.3; }
  .panel { padding: 12px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .m { padding: 8px 9px; }
  .m b { font-size: 17px; }
  .m small { font-size: 11px; }
  .m.big b { font-size: 26px; }
  .m .bar { display: none; }
  .log { height: 46vh; }
}

/* 결산 */
.end-card { width: min(100%, 620px); padding: 32px 24px 26px; text-align: center; }
.end-av { width: 120px; margin: 10px auto 6px; }
.end-av img { width: 100%; border-radius: 24px; }
.end-card h2 { font-size: 34px; }
.end-why { color: var(--ink2); margin-bottom: 16px; }
.end-title { margin: 0 auto 18px; padding: 16px; border-radius: 22px; background: linear-gradient(120deg, #ffe1ef, #ece4ff); }
.end-title small { font-size: 12px; font-weight: 700; letter-spacing: .15em; color: var(--purple); }
.end-title b { display: block; margin: 2px 0; font-family: var(--head); font-weight: 400; font-size: 30px; color: var(--pink); }
.end-title p { color: var(--ink2); font-size: 14px; }
.end-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
.end-grid div { padding: 10px; border-radius: 14px; background: var(--lav); }
.end-grid small { display: block; font-size: 12px; color: var(--muted); }
.end-grid b { font-family: var(--head); font-weight: 400; font-size: 19px; }
.end-people { margin-bottom: 14px; font-size: 14px; color: var(--ink2); }
.end-log { margin-bottom: 18px; text-align: left; }
.end-log summary { cursor: pointer; text-align: center; font-weight: 700; color: var(--purple); padding: 6px; }
.end-log > div { max-height: 360px; overflow-y: auto; margin-top: 8px; padding: 6px 12px; border-radius: 14px; background: #faf8ff; }
.end-log .e span { display: inline-block; min-width: 42px; color: var(--purple); font-weight: 700; }
.row-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* 소리 버튼 */
.top-r { display: flex; align-items: center; gap: 8px; flex: none; }
.snd { font-size: 18px; font-weight: 700; color: var(--pink); }
.snd.off { color: var(--muted); text-decoration: line-through; opacity: .6; }
.title-card { position: relative; }
.title-snd { position: absolute; top: 14px; right: 14px; }

/* 합방: 두 아바타 */
.duo .bc-av { left: 30%; width: 34%; }
.duo .bc-partner { left: 72%; }
.duo .bubble { left: 30%; max-width: 46%; }
.bubble2 { left: 72%; background: #f1ebff; }
/* 합방하는 상대의 말풍선은 상대 캐릭터 위에 (내 말풍선 위치 규칙이 덮어쓰지 않게) */
.duo .bubble2 { left: 72%; max-width: 46%; }

/* 아바타 꾸미기 */
.mcard.wide { width: min(100%, 760px); }
.av-edit { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.av-prev { padding: 12px; border-radius: 22px; background: linear-gradient(160deg, #f3ecff, #ffe3f1); }
.av-row { margin-bottom: 8px; }
.av-row .lbl { margin: 0 0 4px; }
.av-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.av-opt { padding: 5px 11px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; font-weight: 700; color: var(--ink2); }
.av-opt.on { border-color: var(--pink); background: #fff0f7; color: var(--pink); }
.av-opt.sw { width: 28px; height: 28px; padding: 0; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); }
.av-opt.sw.on { box-shadow: 0 0 0 2.5px var(--pink); }
.av-opt:disabled { opacity: .4; }
.av-acts { justify-content: flex-end; margin-top: 8px; }
@media (max-width: 640px) {
  .av-edit { grid-template-columns: minmax(0, 1fr); }
  .av-prev { width: 160px; margin: 0 auto; }
}
.duo .bc-label { top: auto; bottom: 34px; }

/* 방송 통계 */
.sheet.wide { width: min(100%, 760px); }
.st-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.st-tiles div { padding: 8px 10px; border-radius: 14px; background: var(--lav); }
.st-tiles small { display: block; font-size: 11.5px; color: var(--muted); }
.st-tiles b { font-family: var(--head); font-weight: 400; font-size: 19px; }
.st-seg button { white-space: nowrap; }
.st-head { margin: 4px 2px 0; font-size: 13px; color: var(--ink2); }
.st-head b { margin-right: 6px; color: var(--ink); }
.st-chart { position: relative; margin: 2px 0 10px; }
.st-chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.st-grid { stroke: var(--line); stroke-width: 1; }
.st-ax { fill: var(--muted); font-size: 11px; }
.st-mark { stroke: var(--purple); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }
.st-mtx { fill: var(--ink2); font-size: 10.5px; font-weight: 700; }
.st-line { fill: none; stroke: var(--pink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.st-area { fill: var(--pink); opacity: .1; }
.st-dot { fill: var(--pink); stroke: #fff; stroke-width: 2; }
.st-cross { stroke: var(--ink2); stroke-width: 1; opacity: .4; }
.st-tip { position: absolute; top: 34px; display: grid; gap: 1px; padding: 6px 10px; border-radius: 10px; background: #fff; box-shadow: 0 6px 18px rgba(40, 20, 80, .22); font-size: 12px; white-space: nowrap; pointer-events: none; }
.st-tip small { color: var(--muted); }
.st-tip b { font-size: 14px; }
.st-tip i { font-style: normal; color: var(--purple); font-weight: 700; }
.st-details summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink2); }
.st-table { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 12px; }
.st-table th, .st-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.st-table th:first-child, .st-table td:first-child { text-align: left; }
.st-table th { color: var(--muted); font-weight: 700; }
.st-details { overflow-x: auto; }
@media (max-width: 640px) { .st-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .st-seg button { font-size: 12px; padding: 7px 2px; } }

/* 함께 방송하는 사람 캠 (대회 팀원 · 합방 서버에서 마주친 방송인) */
.bc-cams { position: absolute; left: 10px; bottom: 10px; z-index: 3; display: flex; gap: 6px; pointer-events: none; }
.cam { position: relative; width: 54px; padding: 3px 3px 2px; border-radius: 12px; background: rgba(255, 255, 255, .9); box-shadow: 0 4px 12px rgba(40, 20, 80, .25); text-align: center; animation: pop .25s both; }
.cam svg { display: block; width: 100%; }
.cam.talk svg { animation: bob .45s ease-in-out infinite; }
.cam i { display: block; overflow: hidden; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--ink2); white-space: nowrap; text-overflow: ellipsis; }
.bc-stage:not(.gaming) .bc-cams { bottom: 30px; }
.bc-cams.many { gap: 4px; }
.bc-cams.many .cam { width: 44px; padding: 2px 2px 1px; }
.bc-cams.many .cam i { font-size: 9.5px; }
.cam.meet { width: 64px; box-shadow: 0 0 0 2px var(--pink), 0 4px 12px rgba(40, 20, 80, .25); }
.cam .cb { position: absolute; left: 0; bottom: calc(100% + 6px); width: max-content; max-width: 190px; padding: 6px 10px; border-radius: 12px; background: #fff; box-shadow: 0 6px 16px rgba(40, 20, 80, .25); font-size: 12.5px; font-weight: 700; text-align: left; animation: pop .2s both; }
/* 대회 라운드 결과 */
.cup-flash { position: absolute; left: 50%; top: 46%; z-index: 4; padding: 8px 22px; border-radius: 999px; background: linear-gradient(90deg, #ffd166, #ff8fc0); color: var(--ink); font-family: var(--head); font-size: 26px; white-space: nowrap; box-shadow: 0 10px 30px rgba(40, 20, 80, .35); transform: translate(-50%, -50%); animation: cupflash 2.2s both; pointer-events: none; }
.cup-flash.lose { background: linear-gradient(90deg, #d9d3ea, #b8b0d0); }
@keyframes cupflash { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 20% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } to { opacity: 0; } }
.res-cup { display: grid; gap: 2px; margin-bottom: 8px; padding: 10px 14px; border-radius: 16px; background: #fff5fa; box-shadow: 0 0 0 1.5px #ffc2dc inset; }
.res-cup small { font-size: 12px; color: var(--muted); }
.res-cup b { font-family: var(--head); font-weight: 400; font-size: 26px; color: var(--pink); }
.res-cup span { font-size: 13px; color: var(--ink2); }
.res-cup.win { background: linear-gradient(90deg, #fff6d6, #ffe3f1); box-shadow: 0 0 0 2px #ffd166 inset; }
.res-cup.lose b { color: var(--ink2); }
/* 주식 방송 결과: 국내 증권 앱처럼 수익은 빨강, 손실은 파랑 */
.res-cup.stk-up b { color: #e8344e; }
.res-cup.stk-down b { color: #2f6fe0; }
.res-cup .res-viral { font-family: inherit; font-weight: 800; font-size: 13px; color: var(--pink); }
.ego-row.k-mstalk .ego-head { color: var(--bad); }
/* 선택 창 슬라이더 (주식 방송 시드머니) */
.range-row { margin-bottom: 8px; padding: 10px 14px 6px; border-radius: 14px; background: var(--lav); }
.range-row p { display: flex; justify-content: space-between; align-items: baseline; margin: 0; font-weight: 700; font-size: 13px; color: var(--ink2); }
.range-row b { font-size: 18px; color: var(--pink); }
.range-row input { width: 100%; margin: 6px 0 2px; accent-color: var(--pink); }
.range-row .ends small { font-weight: 400; font-size: 11.5px; color: var(--muted); }

/* 선택 창 속 지금 능력치 */
.mstats:empty { display: none; }
.mstats { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.mstats .lbl { margin: 0 0 6px; }
.ms-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 5px; }
.ms-grid span { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 4px 8px; border-radius: 10px; background: var(--lav); min-width: 0; }
.ms-grid small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-grid b { font-family: var(--head); font-weight: 400; font-size: 15px; white-space: nowrap; }
.ms-grid span.bad b { color: var(--bad); }

/* 올해 진행 막대 */
.yearbox { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; width: 150px; }
.yearbox small { font-size: 11.5px; font-weight: 700; color: var(--ink2); }
.yearbar { position: relative; width: 100%; height: 8px; border-radius: 8px; background: var(--lav); overflow: hidden; }
.yearbar i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, #ffb6d2, var(--pink)); }
.yearbar .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 12 - 1.5px), rgba(255, 255, 255, .95) calc(100% / 12 - 1.5px) calc(100% / 12)); }
@media (max-width: 720px) { .yearbox { width: 70px; } .yearbox small { font-size: 10.5px; } }

/* 세로가 아주 낮은 창: 지표를 세 칸으로, 글자와 막대를 조금 더 작게 (기본 규칙보다 뒤에 둬야 적용된다) */
@media (min-width: 1000px) and (max-height: 660px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .m { padding: 7px 9px; border-radius: 13px; }
  .m small { font-size: 11px; }
  .m b { font-size: 17px; }
  .m .debt .dl { display: none; }
  .m .debt .ds { display: inline; }
  .m.big b { font-size: 26px; }
  .st { margin-bottom: 4px; font-size: 13px; }
  .st b { font-size: 14.5px; }
  .stats2 .st { margin-bottom: 3px; font-size: 12.5px; }
  .bar { height: 6px; }
  .lbl { margin: 2px 0 4px; font-size: 12.5px; }
  .seg button { padding: 6px 4px; font-size: 13px; }
  .hint { margin: 3px 2px 5px; font-size: 11.5px; }
  .chips { gap: 4px; margin-top: 2px; }
  .chip { padding: 2px 8px; font-size: 11.5px; }
}

/* 중간 폭 화면: 상단 버튼을 조금 줄여 이름 줄 자리를 남긴다 (기본 규칙보다 뒤에 있어야 먹힌다) */
@media (max-width: 1199px) and (min-width: 721px) {
  .top-btns .btn { padding: 6px 8px; font-size: 12.5px; }
  .top-btns .ghost { padding: 6px 6px; }
}

/* 태블릿 폭: 상단 버튼이 이름 줄에 다 들어가지 않아 아래 한 줄로 내린다 (기본 규칙보다 뒤에 있어야 먹힌다) */
@media (max-width: 999px) and (min-width: 721px) {
  .top { flex-wrap: wrap; row-gap: 6px; }
  .top-btns { order: 3; width: 100%; margin-left: 0; }
  .top-btns .btn { flex: 1; }
}
/* 내가 세운 기업세: 회사 관리 창 */
.co-steps { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: co; }
.co-steps li { counter-increment: co; padding: 4px 10px; border-radius: 999px; background: var(--lav); font-size: 12px; font-weight: 700; color: var(--muted); }
.co-steps li::before { content: counter(co) '. '; }
.co-steps li.done { color: var(--ink2); }
.co-steps li.now { background: var(--pink); color: #fff; }
.co-h { margin: 16px 0 6px; font-family: var(--head); font-size: 17px; font-weight: 400; color: var(--ink); }
.co-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; font-size: 13px; font-weight: 700; color: var(--ink2); }
.co-row .seg { flex: 1; }
.co-card { position: relative; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: #fff; }
.co-card[data-sel] { cursor: pointer; padding-right: 44px; }
.co-card[data-sel]:hover, .co-card[data-sel]:focus-visible { border-color: var(--pink2); outline: none; }
.co-card.on { border-color: var(--pink); background: #fff6fa; }
.co-face { flex: none; width: 52px; height: 52px; }
.co-face svg { width: 100%; height: 100%; display: block; }
.co-info { flex: 1; min-width: 0; }
.co-info p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.co-info p small, .co-foot { font-size: 12px; color: var(--muted); }
.co-foot { display: block; margin-top: 4px; }
.co-st { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.co-st span { display: inline-flex; gap: 4px; align-items: baseline; padding: 2px 7px; border-radius: 8px; background: var(--lav); font-size: 12px; }
.co-st i { font-style: normal; color: var(--ink2); }
.co-st b { color: var(--ink); }
.co-check { position: absolute; right: 12px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border: 2px solid var(--line); border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; }
.co-card.on .co-check { border-color: var(--pink); background: var(--pink); }
.co-close { margin-top: 16px; justify-content: flex-end; }
.co-tabs { margin: 4px 0 14px; }
.co-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.co-tiles b { font-size: 16px; }
.co-tiles b.neg, .st-table td.neg { color: var(--bad); }
.co-tscroll { overflow-x: auto; }
.co-tscroll .st-table { min-width: 520px; }
.st-zero { stroke: var(--muted); }
.co-p-tabs { margin: 8px 0 10px; }
.co-p-mseg { margin: 6px 0 2px; }
.co-p-mseg button { padding: 6px 2px; font-size: 12.5px; }
.co-p-fact { font-size: 12.5px; line-height: 1.6; color: var(--ink2); }
.co-p-stat .st-head { font-size: 12px; }
.co-p-stat .st-tip { top: 26px; }
.co-p-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.co-p-chips span { padding: 2px 7px; border-radius: 8px; background: var(--lav); font-size: 11.5px; color: var(--ink2); }
.co-p-chips b { color: var(--ink); }
.co-p-chips i { margin-left: 3px; font-style: normal; font-weight: 700; }
.co-p-chips i.up { color: var(--good); }
.co-p-chips i.down { color: var(--bad); }
.co-p-note { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
@media (max-width: 640px) { .co-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.co-ipseg { margin: 8px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.co-tired { display: block; margin-top: 3px; color: var(--bad); }
.co-buzz { margin-top: 6px; }
.co-prog { margin: 0 0 8px; padding-left: 18px; font-size: 13px; color: var(--ink2); line-height: 1.8; }
.co-holi-desc { margin-top: 6px; }
.co-perk { padding: 10px 0; border-top: 1px solid var(--line); }
.co-perk p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 6px; }
.co-perk p small { font-size: 12px; color: var(--muted); }
.co-filter { margin: 6px 0 10px; padding: 10px 12px 2px; border-radius: 14px; background: var(--lav); }
.co-fgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.co-fgrid label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 700; color: var(--ink2); }
.co-fgrid input { width: 100%; padding: 5px 6px; border: 2px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-size: 13px; color: var(--ink); }
.co-frow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--ink2); }
.co-frow select { margin-left: 4px; padding: 4px 6px; border: 2px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-size: 13px; color: var(--ink); }
.co-fc { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 640px) { .co-fgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 화면 오른쪽 연습생·멤버 얼굴 아이콘, 마우스를 올리면 오른쪽에서 꺼내듯 열리는 관리 창 */
.co-dock { position: fixed; right: 10px; top: 50%; z-index: 22; display: flex; flex-direction: column; align-items: center; gap: 7px; max-height: calc(100vh - 120px); overflow-y: auto; padding: 10px 6px; border-radius: 28px; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow); transform: translateY(-50%); scrollbar-width: none; }
.co-dock::-webkit-scrollbar { display: none; }
.co-dock[hidden] { display: none; }
.co-dock-g { font-size: 10.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.co-dot { position: relative; flex: none; width: 46px; height: 46px; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.co-dot svg { display: block; width: 100%; height: 100%; }
.co-dot.sued svg { filter: grayscale(1); opacity: .45; }
.co-foot .co-sue { color: var(--bad); }
.co-dot:hover, .co-dot.on, .co-dot:focus-visible { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink2); outline: none; }
.co-sick { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px #fff; }
.co-panel { position: fixed; right: 72px; top: 50%; z-index: 21; width: min(300px, calc(100vw - 92px)); max-height: calc(100vh - 100px); overflow-y: auto; padding: 14px 14px 16px; border-radius: 18px; background: #fff; box-shadow: 0 16px 40px rgba(42, 27, 74, .25); transform: translate(calc(100% + 90px), -50%); opacity: 0; visibility: hidden; transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .25s, visibility 0s .35s; }
.co-panel.open { transform: translate(0, -50%); opacity: 1; visibility: visible; transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.co-p-x { position: absolute; top: 8px; right: 8px; }
.co-p-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-right: 30px; }
.co-p-head small { display: block; font-size: 12px; color: var(--muted); }
.co-p-face { flex: none; width: 56px; height: 56px; }
.co-p-face svg { display: block; width: 100%; height: 100%; }
.co-p-cond, .co-p-st { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 5px 8px; font-size: 12px; color: var(--ink2); }
.co-p-cond { grid-template-columns: 52px 1fr; margin-bottom: 8px; }
.co-p-st b { min-width: 22px; text-align: right; font-size: 12px; }
.co-p-sick { margin: -2px 0 8px; font-size: 12px; font-weight: 700; color: var(--bad); }
.co-p-meta { margin: 10px 0 4px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.co-p-train { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 8px; }
.co-p-train button { padding: 7px 6px; border: 2px solid var(--line); border-radius: 11px; background: #fff; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink2); cursor: pointer; }
.co-p-train button small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.co-p-train button.on { border-color: var(--pink); background: #fff6fa; color: var(--pink); }
.co-p-train button:disabled { opacity: .45; cursor: default; }
.co-p-hosp { width: 100%; }
/* 아이콘이 가리지 않게 패널 격자만 비켜 준다 (위쪽 버튼 줄은 그대로) */
@media (max-width: 1440px) { body.has-dock .life > .grid { margin-right: 58px; } }
@media (max-width: 640px) {
  .co-dock { right: 4px; gap: 5px; padding: 8px 4px; }
  .co-dot { width: 38px; height: 38px; }
  .co-panel { right: 52px; width: min(300px, calc(100vw - 64px)); }
  body.has-dock .life > .grid { margin-right: 36px; }
}
@media (prefers-reduced-motion: reduce) { .co-panel, .co-panel.open { transition: none; } }

/* 왼쪽 아래 유튜브 채널 바로가기 (선택 창·방송 창이 뜨면 그 아래로 들어간다) */
.yt-link { position: fixed; left: 14px; bottom: 14px; z-index: 20; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, .92); box-shadow: 0 6px 16px rgba(42, 27, 74, .22); transition: transform .15s; }
.yt-link svg { display: block; width: 30px; height: 21px; }
.yt-link:hover { transform: translateY(-2px); }
.yt-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .yt-link { transition: none; } .yt-link:hover { transform: none; } }

/* 엔딩 연출 */
.end-fx { position: fixed; inset: 0; z-index: 60; overflow: hidden; }
.end-fx.pass, .end-fx.out { pointer-events: none; }
.end-fx.cut { background: #000; }
.end-fx.cut canvas { opacity: 0; }
.end-fx.out { opacity: 0; transition: opacity .7s; }
.end-fx canvas, .end-glow { position: absolute; inset: 0; width: 100%; height: 100%; }
.end-fx canvas.noise { image-rendering: pixelated; }
.end-glow { background: radial-gradient(circle at 50% 45%, #fff 0 45%, #fffbe8 100%); opacity: 0; }
.end-glow.fade { transition: opacity 1.6s ease-out; }

/* 다른 플랫폼 자동 진행: 인생 화면 위를 덮어 조작을 막는다 (선택 창·방송 창은 그 위에 뜬다) */
.auto-veil { position: fixed; inset: 0; z-index: 25; cursor: not-allowed; background: rgba(42, 27, 74, .08); }
.auto-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px); padding: 10px 14px 10px 20px; border-radius: 999px; background: #2a1b4a; color: #fff; box-shadow: 0 10px 28px rgba(42, 27, 74, .35); cursor: default; }
.auto-banner small { color: #d9ccff; font-size: 12.5px; }
.auto-banner .snd { flex: none; color: #fff; border-color: rgba(255, 255, 255, .4); }
.modal.auto .mopts, .modal.auto .mmin { pointer-events: none; }
.modal.auto .mcard::after { content: '자동 선택 중…'; position: absolute; top: 16px; right: 18px; font-size: 12px; font-weight: 700; color: var(--purple); }
.modal.auto .mmin { display: none; }
@media (max-width: 640px) { .auto-banner { flex-wrap: wrap; border-radius: 18px; } .auto-banner small { flex-basis: 100%; } }

/* 시작 화면 오른쪽 아래 패치 내역 (좁은 화면에서는 카드 아래로) */
#title { position: relative; }
.patch-note { position: absolute; right: 20px; bottom: 20px; width: 300px; padding: 14px 18px 12px; border-radius: 18px; background: rgba(255, 255, 255, .88); box-shadow: 0 10px 28px rgba(42, 27, 74, .18); font-size: 13px; color: var(--ink2); }
.patch-note b { display: block; margin-bottom: 6px; font-size: 13.5px; color: var(--purple); }
.patch-note ul { margin: 0; padding-left: 16px; }
.patch-note ul + b { margin-top: 10px; }
.patch-note li { margin: 3px 0; line-height: 1.45; }
@media (max-width: 1100px) { .patch-note { position: static; width: min(100%, 440px); margin-top: 14px; } #title { padding-bottom: 80px; } }
