:root {
  --bg: #0a0a0f;
  --bg2: #12121a;
  --card: #17171f;
  --line: #26262f;
  --text: #f2f0f5;
  --dim: #9a97a5;
  --accent: #7052fb;
  --accent2: #b399ff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Pretendard', 'Noto Sans KR', -apple-system, sans-serif;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; }

#app { display: flex; min-height: 100vh; }

/* 사이드바 */
.sidebar {
  width: 92px; flex-shrink: 0; padding: 22px 10px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 30px; align-items: center;
  position: sticky; top: 0; height: 100vh;
}
.logo-img { width: 44px; height: 44px; border-radius: 13px; display: block; margin: 0 auto 8px; }
.logo { font-weight: 900; font-size: 15px; letter-spacing: -0.5px; text-align: center; line-height: 1.2; }
.logo span { color: var(--accent2); }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.sidebar nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 4px; border-radius: 12px; font-size: 11px; color: var(--dim);
}
.sidebar nav a .ic { font-size: 18px; line-height: 0; display: flex; align-items: center; justify-content: center; height: 20px; }
.sidebar nav a.active { color: var(--text); background: linear-gradient(180deg, rgba(123,91,255,.22), rgba(123,91,255,.06)); }
.sidebar nav a:hover { color: var(--text); }

main { flex: 1; min-width: 0; padding: 20px 32px 80px; }

/* 상단바 */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.topbar .hello { font-size: 13px; color: var(--dim); }
.topbar .hello b { display: block; font-size: 19px; color: var(--text); }
.topbar .right { display: flex; gap: 10px; align-items: center; }
.topbar .slogan { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding-left: 22px; border-left: 1px solid var(--line); }
.topbar .slogan .wm { display: none; font-size: 11px; font-weight: 900; letter-spacing: .08em; color: var(--dim); }
.topbar .slogan .wm span { color: var(--accent2); }
.topbar .slogan b { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.2; }
.topbar .slogan small { font-size: 13px; color: var(--dim); margin-top: 2px; }
.chip {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.chip.balance { border-color: rgba(123,91,255,.5); }
.chip.balance em { font-style: normal; color: var(--accent2); }
.btn {
  background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700; transition: transform .1s, opacity .2s;
}
.btn:hover { opacity: .9; } .btn:active { transform: scale(.97); }
.btn.ghost { background: var(--card); border: 1px solid var(--line); color: var(--text); }
.btn.big { padding: 14px 28px; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: default; }

.chip.balance.clickable { cursor: pointer; }
/* 칩 전체를 플렉스 중앙 정렬 — em(inline-flex)과 +(baseline)의 세로 기준이 달라 어긋나던 것 */
.chip.balance { display: inline-flex; align-items: center; }
.chip.balance .bal-plus { margin-left: 7px; color: var(--accent2); font-weight: 800; line-height: 1; }

/* 라인 아이콘 공통 (벨·계정·스탯) */
.sic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.chip.bell .sic, .acct-wrap .chip .sic { width: 17px; height: 17px; display: block; }
.chip.bell, .acct-wrap > .chip { display: inline-flex; align-items: center; justify-content: center; }
.stat-chip .sic { color: var(--sc, var(--accent2)); }

/* 계정 메뉴 (언어 변경·로그아웃) */
.acct-wrap { position: relative; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 10px); max-width: calc(100vw - 24px); background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-width: 210px; z-index: 80; box-shadow: 0 12px 34px rgba(0,0,0,.45); }
.acct-menu .am-who { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.acct-menu .am-l { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.acct-menu select.chip.lang { width: 100%; }

/* 스탯 아이콘 피커 */
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick .ip-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--dim); cursor: pointer; }
.icon-pick .ip-btn .sic { width: 17px; height: 17px; }
.icon-pick .ip-btn.on { border-color: var(--accent); color: var(--accent2); background: rgba(123,91,255,.1); }

/* 팔로우 버튼 — 팔로잉 상태 */
.btn.following { border-color: rgba(123,91,255,.55); color: var(--accent2); }
.hero { transition: background .5s ease; }
.hero-dots { display: flex; gap: 7px; margin-top: 18px; }
.hero-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.25); cursor: pointer; transition: all .2s; }
.hero-dots i.on { width: 20px; border-radius: 4px; background: var(--accent2); }

/* 히어로 */
.hero {
  position: relative; border-radius: 20px; overflow: hidden; margin-bottom: 36px;
  padding: 46px 44px; min-height: 320px; display: flex; flex-direction: column; justify-content: flex-end;
  border: 1px solid var(--line);
}
.hero .glyph { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); font-size: 200px; opacity: .16; pointer-events: none; }
.hero .genre { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--accent2); margin-bottom: 10px; }
.hero h1 { font-size: 40px; font-weight: 900; letter-spacing: -1px; margin-bottom: 10px; max-width: 640px; }
.hero p { color: var(--dim); font-size: 15px; max-width: 560px; line-height: 1.6; margin-bottom: 22px; }
.hero .meta { font-size: 13px; color: var(--dim); margin-bottom: 20px; }
.hero .meta b { color: #f5c542; }
.hero .actions { display: flex; gap: 10px; }

/* 스토리 그리드 */
.section-title { font-size: 20px; font-weight: 800; margin: 34px 0 16px; letter-spacing: -0.4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.card { cursor: pointer; transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.cover {
  aspect-ratio: 1; border-radius: 14px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; padding: 14px;
  border: 1px solid var(--line);
}
.cover .glyph { position: absolute; right: -14px; bottom: -20px; font-size: 110px; opacity: .22; }
.cover .plays { font-size: 11px; font-weight: 700; background: rgba(0,0,0,.45); align-self: flex-start; padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(4px); }
.cover .cover-title { font-size: 19px; font-weight: 900; line-height: 1.25; letter-spacing: -0.5px; text-shadow: 0 2px 12px rgba(0,0,0,.5); position: relative; }
.cover .live { position: relative; margin-top: 8px; font-size: 10px; font-weight: 800; letter-spacing: 1px; color: #7dffb0; }
.cover.has-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover.has-img .cover-grad { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(5,5,9,.88)); }
.cover .cover-bottom { position: relative; z-index: 2; margin-top: auto; }
.cover.has-img .plays { position: relative; z-index: 2; }
.card .card-meta { margin-top: 10px; }
.card .card-meta .t { font-size: 14px; font-weight: 700; }
.card .card-meta .s { font-size: 12px; color: var(--dim); margin-top: 3px; }
.card .card-meta .r { color: #f5c542; font-weight: 700; }

/* 스토리 상세 */
.detail { display: grid; grid-template-columns: 340px 1fr; gap: 36px; align-items: start; }
.detail .cover { aspect-ratio: 1; border-radius: 20px; padding: 22px; }
.detail .cover .cover-title { font-size: 30px; }
.detail h1 { font-size: 32px; font-weight: 900; letter-spacing: -0.8px; margin-bottom: 8px; }
.detail .meta { color: var(--dim); font-size: 14px; margin-bottom: 16px; }
.detail .meta b { color: #f5c542; }
.detail .desc { color: var(--dim); line-height: 1.75; font-size: 15px; margin-bottom: 28px; max-width: 620px; }
.char-card {
  display: flex; align-items: center; gap: 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 12px; max-width: 620px;
}
.char-card .avatar.img { padding: 0; overflow: hidden; }
.char-card .avatar.img img { width: 100%; height: 100%; object-fit: cover; }
.char-card .avatar {
  width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; color: #fff;
}
.char-card .info { flex: 1; min-width: 0; }
.char-card .info .n { font-weight: 800; font-size: 16px; }
.char-card .info .n small { color: var(--accent2); font-weight: 600; margin-left: 8px; font-size: 12px; }
.char-card .info .d { color: var(--dim); font-size: 13px; margin-top: 4px; }
.back { display: inline-block; color: var(--dim); font-size: 13px; margin-bottom: 18px; }
.back:hover { color: var(--text); }

/* 대화 화면 */
.chat {
  position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center;
  background-color: var(--bg);
  padding: 32px 20px calc(28px + env(safe-area-inset-bottom));
}
.chat .chat-head { text-align: center; }
.chat .chat-head .st { font-size: 12px; color: var(--dim); letter-spacing: 1px; }
.chat .chat-head .cn { font-size: 24px; font-weight: 900; margin-top: 4px; }
.chat .orb-wrap { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; }
.orb {
  width: 190px; height: 190px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 56px; font-weight: 900; color: #fff;
  box-shadow: 0 0 90px rgba(123,91,255,.35);
  transition: transform .3s;
}
.orb.img { overflow: hidden; border: 3px solid rgba(255,255,255,.25); }
.orb.img img { width: 100%; height: 100%; object-fit: cover; }
.orb.speaking { animation: pulse 1.4s ease-in-out infinite; }
.orb.listening { box-shadow: 0 0 90px rgba(77,214,168,.4); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.chat .status { margin-top: 18px; font-size: 14px; color: var(--dim); min-height: 20px; text-align: center; }
.captions {
  width: 100%; max-width: 640px; height: 150px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; margin: 18px 0; padding: 4px 14px 4px 8px;
  mask-image: linear-gradient(to bottom, transparent, black 22%);
  scrollbar-width: thin; scrollbar-color: rgba(179,153,255,.35) transparent;
}
.captions::-webkit-scrollbar { width: 4px; }
.captions::-webkit-scrollbar-track { background: transparent; }
.captions::-webkit-scrollbar-thumb { background: rgba(179,153,255,.35); border-radius: 4px; }
.captions::-webkit-scrollbar-thumb:hover { background: rgba(179,153,255,.6); }
.captions .line { font-size: 14px; line-height: 1.55; }
.captions .line.user { color: var(--dim); text-align: right; }
.captions .line.ai { color: var(--text); }
.captions .line b { color: var(--accent2); font-weight: 700; margin-right: 6px; }
.chat .controls { display: flex; gap: 14px; align-items: center; }
.round {
  width: 58px; height: 58px; border-radius: 50%; background: var(--card); border: 1px solid var(--line);
  color: var(--text); display: flex; align-items: center; justify-content: center; padding: 0; line-height: 0;
}
.ctl { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ctl-label { font-size: 11px; color: var(--dim); }
.round.danger { background: #e5484d; border-color: #e5484d; }
.round.muted { background: #3a2b2b; border-color: #6c3b3b; }
.chat .timer { font-size: 13px; color: var(--dim); margin-top: 14px; }
.chat .timer em { font-style: normal; color: var(--accent2); font-weight: 700; }

/* 스토어 */
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; max-width: 860px; }
.pack {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.pack.best { border-color: var(--accent); position: relative; }
.pack.best::before { content: attr(data-best); position: absolute; top: -11px; left: 20px; background: var(--accent); font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.pack .mins { font-size: 26px; font-weight: 900; }
.pack .mins small { font-size: 13px; color: var(--dim); font-weight: 500; }
.pack .price { font-size: 18px; font-weight: 700; color: var(--accent2); margin-bottom: 8px; }
.pack .per { font-size: 12px; color: var(--dim); }
@media (max-width: 480px) { .pack .mins small { display: block; margin-top: 2px; } } /* 「300 Carat · ≈ talk time 30min」 이 낱말 중간에서 접히던 것 */

/* 내 기록 */
.table { width: 100%; max-width: 760px; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--dim); font-size: 12px; font-weight: 600; }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
/* 화면보다 긴 모달은 모달 자체가 스크롤 — margin:auto 는 flex 가운데 정렬에서 위쪽이 잘리는 것을 막는다 */
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 32px; width: 100%; max-width: 400px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; margin: auto; }
.modal h2 { font-size: 22px; font-weight: 900; margin-bottom: 6px; }
.modal .sub { color: var(--dim); font-size: 13px; margin-bottom: 22px; line-height: 1.5; }
.modal label { display: block; font-size: 12px; color: var(--dim); margin: 14px 0 6px; }
.modal input {
  width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 10px; font-size: 14px; font-family: inherit;
}
.modal input:focus { outline: none; border-color: var(--accent); }
.modal .btn { width: 100%; margin-top: 22px; padding: 13px; }
.modal .switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--dim); }
.modal .switch a { color: var(--accent2); cursor: pointer; }

select.chip.lang, .studio-form select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b399ff' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  padding: 9px 36px 9px 16px; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--text);
}
select.chip.lang:focus, .studio-form select:focus { outline: none; border-color: var(--accent); }
.studio-form select { border-radius: 10px; padding: 12px 40px 12px 14px; font-size: 14px; }
.file-wrap { display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; }
.file-wrap input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px dashed rgba(179,153,255,.5); color: var(--accent2);
  padding: 11px 18px; border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.file-btn:hover { border-color: var(--accent); background: rgba(123,91,255,.08); }
.file-name { font-size: 12px; color: var(--dim); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.avatar-fb { position: absolute; }
.char-card .avatar { position: relative; overflow: hidden; }
.char-card .avatar img { position: relative; z-index: 1; }
.btn.social { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 13px; border-radius: 10px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.btn.social.kakao { background: #FEE500; color: #191919; }
.btn.social.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.btn.social.google:hover { background: #f5f6f8; opacity: 1; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; margin: 18px 0 4px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#google-btn { display: flex; justify-content: center; margin-top: 4px; }
.table-wrap { overflow-x: auto; }

/* 스튜디오 */
.studio-form { max-width: 640px; }
.studio-form label { display: block; font-size: 12px; color: var(--dim); margin: 14px 0 6px; }
.studio-form input, .studio-form textarea {
  width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 10px; font-size: 14px; font-family: inherit; resize: vertical;
}
.studio-form input:focus, .studio-form textarea:focus { outline: none; border-color: var(--accent); }
.studio-form select.chip.lang { width: auto; border-radius: 10px; }
.ep-row { justify-content: space-between; }

.studio-form .help { font-size: 12px; color: var(--dim); margin-top: 6px; }

.enter-world { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; background: linear-gradient(90deg, var(--accent), #4d8fd6); }

/* 전역 플레이어 */
.player-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 80;
  width: min(680px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px;
  background: rgba(18,18,26,.92); border: 1px solid var(--line); border-radius: 16px;
  padding: 10px 14px; backdrop-filter: blur(14px); box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.player-bar .p-art { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: #241a2e; color: var(--accent2); }
.player-bar .p-art img { width: 100%; height: 100%; object-fit: cover; }
.player-bar .p-info { flex: 1; min-width: 0; cursor: pointer; }
.player-bar .p-t { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .p-s { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .p-time { font-size: 11px; color: var(--dim); }
.player-bar .p-btn { background: none; border: 0; color: var(--text); font-size: 15px; padding: 6px; cursor: pointer; display: inline-flex; align-items: center; }
.player-bar .p-btn.big { font-size: 20px; }
.player-bar .p-progress { position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; }
.player-bar .p-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #4dd6a8); border-radius: 2px; }
@media (max-width: 760px) {
  .player-bar { bottom: calc(76px + env(safe-area-inset-bottom)); width: calc(100% - 16px); }
}

.ibar { position: relative; background: rgba(255,255,255,.06); border-radius: 6px; height: 22px; min-width: 120px; overflow: hidden; }
.ibar-fill { height: 100%; border-radius: 6px; opacity: .75; }
.ibar span { position: absolute; right: 8px; top: 3px; font-size: 11px; color: var(--text); }

.gem { width: .95em; height: .95em; vertical-align: -0.08em; margin-right: .18em; filter: drop-shadow(0 0 3px rgba(179,153,255,.45)); }
/* 유색(액센트) 버튼 위에서는 흰 젬으로 반전 */
.btn:not(.ghost) .gem path:first-child { fill: #fff; }
.btn:not(.ghost) .gem path:last-child { fill: rgba(90,60,200,.5); }
.btn:not(.ghost) .gem { filter: none; }
.chip.balance em { display: inline-flex; align-items: center; gap: 5px; } .chip.balance .gem { vertical-align: 0; }

.btn.btn-sm { padding: 7px 13px; font-size: 12px; white-space: nowrap; }

.ref-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer;
  background: var(--card); border: 1px dashed rgba(179,153,255,.5); border-radius: 10px; padding: 9px 9px 9px 13px; font-size: 12px; color: var(--accent2); margin: 14px 0; }
.ref-link span { word-break: break-all; text-align: left; }
.ref-copy { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; background: rgba(123,91,255,.18); border: 1px solid rgba(123,91,255,.5); color: var(--text); border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.ref-copy:hover { background: rgba(123,91,255,.32); }
.ref-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; max-width: 860px;
  background: linear-gradient(90deg, rgba(123,91,255,.14), rgba(77,214,168,.08)); border: 1px solid rgba(123,91,255,.4);
  border-radius: 14px; padding: 14px 18px; margin-bottom: 18px; font-size: 14px; }
.ref-card .ref-sub { color: var(--dim); font-size: 12px; margin-top: 3px; }

/* 토스트 */
#toast-root { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #24242e; border: 1px solid var(--line); padding: 12px 20px; border-radius: 12px;
  font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4); animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.empty { color: var(--dim); font-size: 14px; padding: 40px 0; text-align: center; }

@media (max-width: 760px) {
  #app { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; min-height: 0; max-height: 72px;
    flex-direction: row; align-items: center; justify-content: space-around; gap: 0;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
    background: rgba(10,10,15,.94); backdrop-filter: blur(10px); z-index: 60;
  }
  .sidebar .logo { display: none; }
  .sidebar nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .sidebar nav a { padding: 6px 4px; flex: 1; }
  main { padding: 14px 14px 120px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar .slogan { order: 3; flex-basis: 100%; border-left: 0; padding: 10px 0 0; border-top: 1px solid var(--line); }
  .topbar .slogan .wm { display: block; margin-bottom: 2px; }
  .topbar .slogan b { font-size: 17px; }
  .topbar .right { flex-wrap: wrap; }
  .hero { padding: 24px 18px; min-height: 240px; border-radius: 16px; }
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 13px; }
  .hero .actions .btn.big { padding: 12px 18px; font-size: 14px; }
  .section-title { font-size: 17px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cover .cover-title { font-size: 15px; }
  .detail { grid-template-columns: 1fr; gap: 20px; }
  .detail .cover { max-width: none; }
  .detail h1 { font-size: 24px; }
  .char-card { padding: 14px; gap: 12px; flex-wrap: wrap; }
  .char-card .btn { flex-basis: 100%; }
  .packs { grid-template-columns: 1fr; }
  .chat { padding: 20px 16px calc(88px + env(safe-area-inset-bottom)); }
  .orb { width: 150px; height: 150px; font-size: 44px; }
  .captions { height: 120px; }
  .modal { padding: 24px 20px; }
}

/* ================= v4 — 미국향 텍스트 스토리 플랫폼 ================= */
/* 홈 장르 탭 */
.home-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; }
/* 스코프 해제 — 빌더(시나리오 탭 등)에서 브라우저 기본 버튼으로 그려지던 것 */
.htab { padding: 8px 15px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); color: var(--dim); font-size: 13px; font-weight: 600; cursor: pointer; }
.htab.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 가로 스크롤 행 (이어하기·커뮤니티) */
.row-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.row-scroll::-webkit-scrollbar { height: 7px; }
.row-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 999px; }
.row-scroll::-webkit-scrollbar-thumb { background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; border: 1px solid rgba(0,0,0,.35); }
.row-scroll::-webkit-scrollbar-thumb:hover { filter: brightness(1.2); }
.cont-card { flex: 0 0 300px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: border-color .15s; }
.cont-card:hover { border-color: var(--accent); }
.cont-card .cc-t { font-weight: 700; font-size: 14px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.cont-card .cc-turn { color: var(--accent2); font-size: 12px; white-space: nowrap; }
.cont-card .cc-line { color: var(--dim); font-size: 12.5px; line-height: 1.5; max-height: 3em; overflow: hidden; }

/* 세로(3:4) 표지 카드 — 텍스트 스토리 */
.cover.p34 { aspect-ratio: 3 / 4; height: auto; }
.badge-orig { position: absolute; top: 8px; left: 8px; background: var(--accent2); color: #14102a; font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 3px 7px; border-radius: 6px; z-index: 2; } /* 옛 형광노랑+✳ 는 OOC 로고와 겹쳐 폐기(09-03) */
.badge-orig b { font-weight: 900; margin-right: 1px; }
.badge-draft { position: absolute; top: 8px; left: 8px; background: #444; color: #eee; font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 6px; z-index: 2; }
.card .s .creator { color: var(--accent2); }

/* 스토리 상세 v2 */
.tdetail { display: grid; grid-template-columns: 300px 1fr; gap: 34px; margin-top: 18px; }
@media (max-width: 860px) { .tdetail { grid-template-columns: 1fr; } .tdetail .cover.p34 { max-width: 260px; } }
.tdetail .meta-row { display: flex; gap: 14px; align-items: center; color: var(--dim); font-size: 13.5px; margin: 10px 0 14px; flex-wrap: wrap; }
.tag-chip { display: inline-block; background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 14px; padding: 4px 11px; font-size: 12px; margin: 0 6px 6px 0; }
.world-md { color: var(--text); font-size: 16px; line-height: 1.75; opacity: .92; white-space: pre-wrap; max-height: 420px; overflow: auto; padding-right: 8px; }
.world-md.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; max-height: none; overflow: hidden; padding-right: 0; }
.show-more { color: var(--accent2); font-size: 13px; background: none; padding: 6px 0; }
.cast-strip { display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 10px; }
.cast-card { flex: 0 0 172px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.cast-card img { width: 86px; height: 86px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; }
.cast-card .cn2 { font-weight: 700; font-size: 15px; }
.cast-card .cr2 { color: var(--dim); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.guide-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; font-size: 15px; color: var(--dim); line-height: 1.7; white-space: pre-wrap; }

/* ---------- 텍스트 대화(플레이) 화면 ---------- */
.tchat { max-width: 700px; margin: 0 auto; padding-bottom: 150px; }
.tchat-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 4px; background: linear-gradient(var(--bg) 75%, transparent); }
.tchat-head .th-art { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.tchat-head .th-t { font-weight: 800; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 한 줄+말줄임 — 좁은 폭에서 서너 줄로 접혀 본문을 덮던 것 */
.tchat-head .th-btn { background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; }
.tier-pick { position: relative; }
.tier-menu { position: fixed; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 8px; width: 250px; z-index: 40; box-shadow: 0 12px 40px rgba(0,0,0,.5); overflow-y: auto; } /* 좌표는 toggleMenu() 가 화면 안으로 클램프해 준다 */
.tier-menu .tm-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; color: var(--text); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.tier-menu .tm-item:hover, .tier-menu .tm-item.on { background: var(--card); }
.tier-menu small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }
.tm-cost { color: var(--accent2); font-weight: 700; white-space: nowrap; font-size: 12.5px; }

.tmsg { margin: 22px 0; }
.tmsg.user { display: flex; justify-content: flex-end; }
.tmsg.user .bubble { background: var(--accent); color: #fff; border-radius: 16px 16px 4px 16px; padding: 11px 15px; max-width: 82%; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.tmsg.ai { font-family: 'Lora', 'Noto Sans KR', Georgia, serif; font-size: 15.5px; line-height: 1.85; color: #e7e4ee; }
.tmsg.ai p { margin: 0 0 14px; }
.tmsg.ai em { color: #b7b2c6; }
.status-chip { display: inline-block; font-family: 'Inter', sans-serif; font-size: 12px; color: var(--dim); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; margin-bottom: 14px; letter-spacing: .3px; }
.dialog-line { margin: 0 0 14px; }
.dialog-line b { color: var(--accent2); font-family: 'Inter', sans-serif; font-size: 14px; }
.sprite-img { display: block; width: 132px; height: 132px; border-radius: 16px; object-fit: cover; margin: 6px 0 14px; border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.scene-img { display: block; width: 100%; border-radius: 14px; margin: 8px 0 14px; border: 1px solid var(--line); }
.info-card { font-family: 'Inter', 'Noto Sans KR', sans-serif; background: #14141c; border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; overflow: hidden; font-size: 13px; }
.info-card .ic-head { background: #1d1d28; padding: 7px 14px; font-weight: 800; font-size: 11px; letter-spacing: 2px; color: var(--dim); }
.info-card .ic-body { padding: 12px 16px; line-height: 1.8; color: #cfcbdc; white-space: pre-wrap; }
.msg-actions { display: flex; gap: 8px; margin-top: 4px; }
.msg-actions button { background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 9px; padding: 6px 11px; font-size: 12px; font-family: 'Inter', sans-serif; }
.msg-actions button:hover { color: var(--text); border-color: var(--accent); }
.stream-cursor::after { content: '▍'; color: var(--accent2); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }

.sugg-row { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 6px; }
.sugg { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px 4px 4px; }
.sugg .sg-edit { flex-shrink: 0; background: none; color: var(--dim); padding: 8px; border-radius: 8px; }
.sugg .sg-text { flex: 1; text-align: left; background: none; color: #cfcbdc; font-size: 13.5px; line-height: 1.5; padding: 8px 4px; }
.sugg:hover { border-color: var(--accent); }
.sugg.glow { animation: sugg-glow 1.6s ease-in-out 2; }
@keyframes sugg-glow { 50% { border-color: var(--accent2); box-shadow: 0 0 14px rgba(179,153,255,.35); } }

.tchat-input { position: fixed; bottom: 0; left: 92px; right: 0; padding: 10px 18px 18px; background: linear-gradient(transparent, var(--bg) 32%); z-index: 25; }
@media (max-width: 760px) { .tchat-input { left: 0; padding-bottom: 76px; } }
.tchat-input .ti-box { max-width: 700px; margin: 0 auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.tchat-input textarea { width: 100%; background: none; border: 0; color: var(--text); font-size: 14.5px; font-family: inherit; resize: none; outline: none; min-height: 42px; max-height: 140px; line-height: 1.5; }
.ti-row { display: flex; align-items: center; gap: 8px; }
.ti-row .ti-tool { background: var(--card); border: 1px solid var(--line); color: var(--dim); width: 34px; height: 34px; border-radius: 50%; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.ti-row .ti-send { margin-left: auto; background: var(--accent); color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.ti-row .ti-send:disabled { opacity: .4; cursor: default; }
.ti-cost { color: var(--dim); font-size: 11.5px; margin-left: 4px; white-space: nowrap; }
#tp-exit .ic-ex { display: none; }
/* 좁은 폰: 헤더 「이야기 나가기」는 아이콘만(제목이 두 글자만 남던 것) · 비용 칩은 숫자만 */
@media (max-width: 520px) {
  .tchat-head { gap: 8px; }
  #tp-exit .tx { display: none; }
  #tp-exit .ic-ex { display: block; }
  #tp-exit { display: inline-flex; align-items: center; padding: 8px 10px; color: var(--text); opacity: .85; }
}
@media (max-width: 430px) { .ti-cost .pm { display: none; } }
.tool-help { max-width: 700px; margin: 0 auto 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; max-height: min(55vh, 480px); overflow-y: auto; }
.tool-help .thp-head { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; padding: 2px 2px 6px; }
.tool-help .thp-sec { color: var(--accent2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 10px 2px 3px; }
.tool-help .thp-row { display: flex; gap: 10px; align-items: flex-start; padding: 5px 2px; font-size: 13px; line-height: 1.55; color: var(--dim); }
.tool-help .thp-row b { color: var(--text); font-weight: 600; }
.tool-help .thp-ic { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text); }
.ti-tool.pulse { border-color: var(--accent); color: var(--accent2); animation: tp-pulse 2s ease-out 4; }
.ai-edit { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); color: var(--dim); font-size: 13px; margin-top: 2px; opacity: .55; transition: opacity .15s, color .15s; }
.ai-edit:hover { opacity: 1; color: var(--accent2); border-color: var(--accent); }
.ai-edit-ta { width: 100%; min-height: 180px; background: var(--card); border: 1px solid var(--accent); border-radius: 12px; color: var(--text); font-family: inherit; font-size: 14.5px; line-height: 1.7; padding: 12px 14px; resize: vertical; outline: none; }
.ai-edit-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.un-modal, .vz-modal { max-width: 480px; }
.un-modal textarea { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-family: inherit; font-size: 14px; line-height: 1.6; padding: 11px 13px; resize: vertical; outline: none; }
.un-modal textarea:focus { border-color: var(--accent); }
.un-help { color: var(--dim); font-size: 13px; line-height: 1.6; margin: 4px 0 10px; }
.vz-skip { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 12.5px; margin-top: 10px; cursor: pointer; }
.up-toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; align-items: center; gap: 12px; background: var(--bg2); border: 1px solid var(--accent); border-radius: 999px; padding: 9px 10px 9px 18px; font-size: 13.5px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.tm-sec { color: var(--accent2); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 10px 12px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.av-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; max-height: 40vh; overflow-y: auto; }
.av-item { position: relative; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 40px 11px 14px; color: var(--text); }
.av-item b { display: block; font-size: 14px; }
.av-item small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; line-height: 1.5; }
.av-item.on { border-color: var(--accent); background: rgba(112, 82, 251, .1); }
.av-item .av-del { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); opacity: .45; font-size: 13px; }
.av-item .av-del:hover { opacity: 1; }
.av-new { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.av-new input, .av-new textarea { background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-family: inherit; font-size: 13.5px; padding: 9px 12px; outline: none; resize: vertical; }
.av-new input:focus, .av-new textarea:focus { border-color: var(--accent); }
.av-new .btn { align-self: flex-end; }
.gl-modal { max-width: 640px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; }
.gal-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); transition: transform .15s; }
.gal-grid a:hover img { transform: scale(1.03); border-color: var(--accent); }
.thp-kbd { flex: none; min-width: 84px; display: inline-flex; gap: 3px; align-items: center; }
.thp-kbd kbd { background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-family: inherit; color: var(--text); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.lib-card { display: flex; gap: 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; cursor: pointer; transition: border-color .15s, transform .15s; }
.lib-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lib-card .lc-cover { flex: none; width: 76px; height: 101px; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.lib-card .lc-cover img { width: 100%; height: 100%; object-fit: cover; }
.lib-card .lc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lib-card .lc-t { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 14.5px; }
.lib-card .lc-t > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card .lc-line { color: var(--dim); font-size: 12.5px; line-height: 1.55; margin: 5px 0 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-card .lc-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; } /* 좁은 폰에서 버튼이 카드 밖으로 넘치지 않게 */
@keyframes tp-pulse { 0% { box-shadow: 0 0 0 0 rgba(112, 82, 251, .55); } 70% { box-shadow: 0 0 0 8px rgba(112, 82, 251, 0); } 100% { box-shadow: 0 0 0 0 rgba(112, 82, 251, 0); } }
.cmd-pal { max-width: 700px; margin: 0 auto 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.cmd-pal button { display: block; width: 100%; text-align: left; background: none; color: var(--text); padding: 9px 12px; border-radius: 9px; font-size: 13.5px; }
.cmd-pal button:hover { background: var(--card); }
.cmd-pal small { color: var(--dim); display: block; font-size: 11.5px; }
.cmd-pal .cmd-ro { display: block; text-align: left; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; } /* 모달용 — 누르는 버튼이 아니라 설명 행 */

/* 크리에이터 배너·넛지 */
.creator-banner { background: linear-gradient(120deg, #221a3a, #10101a 70%); border: 1px solid #3a2f5f; border-radius: 18px; padding: 26px 28px; margin: 30px 0; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.creator-banner h3 { font-size: 19px; margin-bottom: 6px; }
.creator-banner p { color: var(--dim); font-size: 13.5px; max-width: 520px; line-height: 1.6; }
.creator-banner .btn { margin-left: auto; }
.nudge-card { background: linear-gradient(120deg, #221a3a, #14141c 70%); border: 1px solid #3a2f5f; border-radius: 14px; padding: 18px 20px; margin: 20px 0; font-family: 'Inter', sans-serif; }
.nudge-card b { display: block; margin-bottom: 6px; font-size: 15px; }
.nudge-card span { color: var(--dim); font-size: 13px; line-height: 1.6; display: block; margin-bottom: 12px; }

/* 온보딩 */
.ob-genres { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 20px; }
.ob-g { background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 20px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; }
.ob-g.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 빌더 */
.wizard-sec { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-bottom: 18px; }
.wizard-sec h3 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.wizard-sec h3 .step-n { background: var(--accent); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.wizard-sec .ws-sub { color: var(--dim); font-size: 12.5px; margin-bottom: 14px; }
.ai-btn { background: linear-gradient(120deg, #3a2f5f, #232038); border: 1px solid #4a3f7f; color: #d9ccff; border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 600; }
.ai-btn:disabled { opacity: .5; }
.char-block { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 12px; position: relative; }
.char-block .cb-del { position: absolute; top: 10px; right: 10px; background: none; color: var(--dim); font-size: 15px; }
.studio-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.kpi .k-v { font-size: 22px; font-weight: 800; }
.kpi .k-l { color: var(--dim); font-size: 12px; margin-top: 4px; }
.title-row { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; flex-wrap: wrap; }
.title-row .tr-t { font-weight: 700; font-size: 14.5px; }
.title-row .tr-meta { color: var(--dim); font-size: 12.5px; }
.title-row .tr-actions { margin-left: auto; display: flex; gap: 8px; }
.status-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 10px; }
.status-pill.published { background: rgba(77,214,168,.15); color: #4dd6a8; }
.status-pill.draft { background: rgba(232,181,74,.15); color: #e8b54a; }
.status-pill.blocked { background: rgba(229,72,77,.18); color: #e5484d; }

/* HQ(관리자) */
.hq-tabs { display: flex; gap: 8px; margin: 10px 0 20px; flex-wrap: wrap; }
.hq-tabs button { background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 10px; padding: 9px 15px; font-size: 13px; font-weight: 600; }
.hq-tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.hq-actions button { background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 8px; padding: 5px 9px; font-size: 11.5px; margin: 0 3px 3px 0; }
.hq-actions button:hover { color: var(--text); border-color: var(--accent); }

/* HQ 대시보드 — 일간 시계열·추세 */
.hq-range { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0 18px; }
.hq-range button { background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 8px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; }
.hq-range button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.hq-note { color: var(--dim); font-size: 12px; margin-left: 6px; }
.hq-kpi .k-l { margin-top: 0; margin-bottom: 6px; }
.hq-kpi .k-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hq-kpi .k-s { color: var(--dim); font-size: 11.5px; margin-top: 4px; }
.hq-kpi .k-spark { display: block; margin-top: 8px; }
.hq-delta { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.hq-delta.good { color: #37b24d; }
.hq-delta.bad { color: #e05d5d; }
.hq-delta.flat { color: var(--dim); font-weight: 600; }
.hq-sub { color: var(--dim); font-size: 11.5px; }
.hq-kind { font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 2px 6px; vertical-align: 1px; }
.hq-kind.st { background: rgba(144,133,233,.16); color: #b3aaf2; }
.hq-kind.ch { background: rgba(217,89,38,.16); color: #e88a63; }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: 14px; margin-bottom: 26px; }
.viz-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; min-width: 0; }
.viz-plot { overflow: hidden; }
.viz-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.viz-head figcaption { font-size: 13px; font-weight: 700; color: var(--text); }
.viz-tbl-btn { background: none; border: 1px solid var(--line); color: var(--dim); border-radius: 7px; padding: 3px 9px; font-size: 11px; }
.viz-tbl-btn:hover { color: var(--text); border-color: var(--accent); }
.viz-ax { fill: #9a97a5; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--dim); }
.viz-legend i { display: inline-block; margin-right: 5px; vertical-align: middle; }
.viz-legend .lg-rect { width: 9px; height: 9px; border-radius: 2px; }
.viz-legend .lg-line { width: 12px; height: 2px; border-radius: 1px; }
.viz-table { display: none; }
.viz-card.show-tbl .viz-plot, .viz-card.show-tbl .viz-legend { display: none; }
.viz-card.show-tbl .viz-table { display: block; }
.viz-table-scroll { max-height: 262px; overflow-y: auto; }
.viz-table .table, .viz-table-scroll .table { max-width: none; font-size: 12.5px; }
.viz-table .table td, .viz-table-scroll .table td { font-variant-numeric: tabular-nums; padding: 7px 10px; }
.viz-tip { position: absolute; z-index: 5; pointer-events: none; background: #1f1f2b; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; font-size: 12px; box-shadow: 0 6px 22px rgba(0,0,0,.45); min-width: 130px; }
.viz-tip .tip-d { color: var(--dim); font-size: 11px; margin-bottom: 5px; }
.viz-tip .tip-r { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.viz-tip .tip-r i { width: 10px; height: 2px; border-radius: 1px; flex-shrink: 0; }
.viz-tip .tip-r b { font-variant-numeric: tabular-nums; }
.viz-tip .tip-r span { color: var(--dim); font-size: 11px; }

.hq-daily td, .hq-daily th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hq-daily tr.today td { background: rgba(112,82,251,.10); }
.hq-daily tr.today td:first-child { color: var(--accent2); font-weight: 700; }

/* HQ 대화 열람 */
.hq-chat-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.hq-chat-sum { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--dim); margin-bottom: 14px; max-width: 820px; }
.hq-chat-sum b { color: var(--text); margin-right: 6px; }
.hq-chatlog { display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.hq-msg { border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px; background: var(--card); }
.hq-msg.u { background: rgba(112,82,251,.12); border-color: rgba(112,82,251,.35); margin-left: 48px; }
.hq-msg.a { margin-right: 48px; }
.hq-msg-h { font-size: 11.5px; font-weight: 700; color: var(--accent2); margin-bottom: 6px; }
.hq-msg.a .hq-msg-h { color: var(--dim); }
.hq-msg-h span { font-weight: 500; color: var(--dim); margin-left: 6px; }
.hq-msg-b { font-size: 13.5px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: break-word; }
.hq-link { background: none; color: var(--accent2); font-size: inherit; padding: 0; text-align: left; }
.hq-link:hover { text-decoration: underline; }
.hq-msg.feed { cursor: pointer; margin-left: 0; margin-right: 0; transition: border-color .12s; }
.hq-msg.feed:hover { border-color: var(--accent); }
.hq-msg-b.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }

/* HQ 대화 2단 — 좌 목록 · 우 내역 (플레이 화면과 같은 렌더링) */
.hq-split { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 16px; align-items: start; }
.hq-split-list { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 250px); overflow-y: auto; padding-right: 4px; }
.hq-crow { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; color: var(--text); transition: border-color .15s, background .15s, transform .15s; }
.hq-crow:hover { border-color: rgba(112,82,251,.55); transform: translateY(-1px); }
.hq-crow.on { border-color: var(--accent); background: linear-gradient(135deg, rgba(112,82,251,.16), rgba(112,82,251,.05)); }
.cr-thumb { width: 46px; height: 46px; border-radius: 11px; position: relative; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.06); }
.cr-thumb span { font-size: 21px; opacity: .8; }
.cr-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cr-thumb.sm { width: 38px; height: 38px; border-radius: 9px; }
.cr-thumb.sm span { font-size: 16px; }
.hq-crow .cr-body { flex: 1; min-width: 0; }
.hq-crow .cr-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.hq-crow .cr-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hq-crow .cr-top span { color: var(--dim); font-size: 10.5px; flex-shrink: 0; }
.hq-crow .cr-mid { color: var(--accent2); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hq-crow .cr-sub { color: var(--dim); font-size: 11px; margin-top: 3px; }
.hq-split-view { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 0 26px 26px; max-height: calc(100vh - 250px); overflow-y: auto; transition: opacity .15s; }
.hq-split-view.loading { opacity: .45; }
.hq-split-list::-webkit-scrollbar, .hq-split-view::-webkit-scrollbar { width: 8px; }
.hq-split-list::-webkit-scrollbar-thumb, .hq-split-view::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }
.hq-split-list::-webkit-scrollbar-track, .hq-split-view::-webkit-scrollbar-track { background: transparent; }
.hq-pane-head { display: flex; gap: 12px; align-items: center; padding: 15px 0 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg2); z-index: 5; }
.hq-pane-head .ph-txt { min-width: 0; }
.hq-pane-head .ph-t { font-size: 14.5px; }
.hq-pane-head .ph-s { color: var(--dim); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hq-pane-thread { max-width: 700px; }
.hq-m { margin: 26px 0; }
.hq-m .hq-msg-meta { font-size: 10.5px; color: var(--dim); margin-bottom: 6px; }
.hq-m .tmsg { margin: 0; }
.hq-m.u { display: flex; flex-direction: column; align-items: flex-end; }
.hq-m.u .tmsg.user { width: 100%; }
.hq-chat-sum { margin-top: 14px; }
.hq-input { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 14px; font-size: 13px; }
.hq-input::placeholder { color: var(--dim); }
.hq-input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 900px) {
  .hq-split { grid-template-columns: 1fr; }
  .hq-split-list { max-height: 300px; }
  .hq-split-view { max-height: none; }
}

/* ===== 전역 마이크로 인터랙션 · 접근성 ===== */
/* main 안에 fixed 요소(플레이 입력창 등)가 있어 transform 은 금지 — opacity 만 */
.view-in { animation: viewIn .3s ease both; }
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.btn:active { transform: scale(.97); }
.chip, .hq-tabs button, .hq-range button, .viz-tbl-btn, .hq-actions button { transition: border-color .15s, background .15s, color .15s; }
.hq-tabs button:hover, .hq-range button:hover { color: var(--text); border-color: var(--accent); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(255,255,255,.03); }
.modal { animation: modalIn .22s ease both; }
.modal-bg { animation: fadeIn .2s ease both; }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } }
.kpi { transition: border-color .15s; }
.kpi:hover { border-color: rgba(112,82,251,.45); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* 세로 표지의 랭크 배지 — 절대 배치(ORIGINAL 배지와 겹침 방지) */
.cover.p34 .plays { position: absolute; top: 8px; left: 8px; z-index: 2; }

/* ================= v5 — ooc 파리티: 타이포·빌더·스탯·엔딩 ================= */
/* 로케일별 표준 본문 크기 — 웹 표준 16px 기준, CJK는 행간을 더 준다.
   폰트는 이미 로드된 Inter/Lora/Noto Sans KR + 시스템 CJK 스택만 사용(추가 다운로드 없음). */
html { font-size: 16px; }
body { font-size: 16px; }
html[lang="ja"] body { font-family: 'Inter', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif; }
html[lang="zh"] body { font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; }

/* 플레이 화면 — 내러티브를 책처럼 크고 편안하게 */
.tmsg.ai { font-size: 17px; line-height: 1.9; }
html[lang="ko"] .tmsg.ai { font-family: 'Noto Sans KR', 'Pretendard', 'Apple SD Gothic Neo', sans-serif; font-size: 16.5px; line-height: 1.95; }
html[lang="ja"] .tmsg.ai { font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif; font-size: 16.5px; line-height: 2; }
html[lang="zh"] .tmsg.ai { font-family: 'Songti SC', 'STSong', 'SimSun', serif; font-size: 16.5px; line-height: 2; }
.tmsg.user .bubble { font-size: 15.5px; }
.tchat-input textarea { font-size: 16px; }
.sugg .sg-text { font-size: 14.5px; }
.dialog-line b { font-size: 15px; }
.info-card { font-size: 13.5px; }
/* 인라인 이미지 — 상세히 식별 가능하게 대폭 확대 (ooc 파리티) */
.sprite-img { width: min(500px, 94%); height: auto; aspect-ratio: 1; border-radius: 18px; }
.scene-img { width: 100%; max-width: 800px; }

/* 오프닝 연출 — 블록 순차 등장 */
.tmsg.ai > *, #tp-suggs, .sugg-row { scroll-margin-bottom: 160px; }
@media (max-width: 760px) { .tmsg.ai > *, #tp-suggs, .sugg-row { scroll-margin-bottom: 240px; } }
.reveal-hide { opacity: 0; }
.reveal-in { animation: revealIn .7s ease both; }
@keyframes revealIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 스탯 HUD */
.stat-hud { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; position: sticky; top: 58px; z-index: 19; }
.stat-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--sc, var(--accent2)); border-radius: 10px; padding: 6px 12px; font-size: 12.5px; color: var(--dim); }
.stat-chip b { color: var(--text); font-weight: 700; }
.stat-chip em { font-style: normal; color: var(--sc, var(--accent2)); font-weight: 800; font-size: 13.5px; }
.stat-chip.bump { animation: bump .5s ease; }
@keyframes bump { 30% { transform: scale(1.12); } }
.stat-delta { position: absolute; right: 6px; top: -14px; font-size: 12px; font-weight: 900; animation: deltaFloat 1.5s ease forwards; pointer-events: none; }
@keyframes deltaFloat { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-16px); } }

/* 엔딩 카드 — 희귀도 컬러 */
.rar-N { --rar: #7ea0c9; } .rar-R { --rar: #e8b54a; } .rar-SR { --rar: #4dd6a8; } .rar-SSR { --rar: #b399ff; }
.tmsg.ending { display: flex; justify-content: center; }
.ending-card { position: relative; width: min(340px, 92%); background: linear-gradient(160deg, #17141f, #0c0a12); border: 1.5px solid var(--rar); border-radius: 18px; padding: 20px; text-align: center; box-shadow: 0 0 40px color-mix(in srgb, var(--rar) 25%, transparent); animation: endingIn .8s ease both; }
@keyframes endingIn { from { opacity: 0; transform: scale(.92) translateY(10px); } }
.ending-card .ec-badge { position: absolute; top: 12px; left: 12px; background: var(--rar); color: #0a0a0f; font-size: 11px; font-weight: 900; padding: 3px 9px; border-radius: 7px; letter-spacing: 1px; }
.ending-card .ec-label { font-size: 11px; letter-spacing: 3px; color: var(--rar); font-weight: 800; margin-bottom: 12px; }
.ending-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--line); }
.ending-card .ec-name { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.ending-card .ec-epi { font-size: 13.5px; color: var(--dim); line-height: 1.75; white-space: pre-wrap; text-align: left; }
/* 상세 페이지 엔딩 컬렉션 */
.ending-strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; }
.ending-tile { flex: 0 0 176px; border: 1px solid var(--line); border-top: 3px solid var(--rar); border-radius: 12px; padding: 12px; background: var(--card); }
.ending-tile .et-rar { font-size: 10px; font-weight: 900; color: var(--rar); letter-spacing: 1px; }
.ending-tile .et-name { font-size: 15px; font-weight: 800; margin: 6px 0 4px; }
.ending-tile .et-hint { font-size: 13px; color: var(--dim); line-height: 1.5; }
.ending-tile.locked { opacity: .55; }
.ending-tile.got { box-shadow: 0 0 18px color-mix(in srgb, var(--rar) 20%, transparent); }

/* 만들기 선택 모달 */
.ct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.ct-card { border: 1px solid var(--line); border-radius: 16px; padding: 18px 16px; text-align: left; color: var(--text); display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, transform .15s; }
.ct-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.ct-card .ct-ic { font-size: 26px; }
.ct-card .ct-t { font-size: 16px; font-weight: 800; }
.ct-card .ct-d { font-size: 12.5px; color: var(--dim); line-height: 1.55; }
@media (max-width: 560px) { .ct-grid { grid-template-columns: 1fr; } }

/* 빌더 v2 */
.studio-form.wide { max-width: 1180px; }
.bd-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.bd-steps { display: flex; align-items: center; gap: 2px; overflow-x: auto; padding: 6px 2px 12px; border-bottom: 1px solid var(--line); margin-bottom: 20px; scrollbar-width: thin; }
.bd-step { background: none; color: var(--dim); font-size: 14px; font-weight: 700; padding: 7px 10px; border-radius: 9px; white-space: nowrap; }
.bd-step.on { color: var(--text); background: var(--card); outline: 1px solid var(--accent); }
.bd-step .req { color: #d8ff3e; font-style: normal; margin-left: 1px; }
.bd-sep { color: var(--line); }
.req { color: #d8ff3e; font-style: normal; }
.bd-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 30px; align-items: start; }
@media (max-width: 980px) { .bd-cols { grid-template-columns: 1fr; } .bd-preview { display: none; } }
.bd-form { min-width: 0; }
.bd-form h3 { font-size: 17px; }
.bd-l { display: block; font-size: 14.5px; font-weight: 700; color: var(--text); margin: 20px 0 4px; }
.bd-h { font-size: 13px; color: var(--dim); line-height: 1.6; margin-bottom: 8px; }
.bd-form input:not([type=file]):not([type=radio]), .bd-form textarea, .bd-form select {
  width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 13px 15px; border-radius: 12px; font-size: 15px; font-family: inherit; resize: vertical;
}
.bd-form input:focus, .bd-form textarea:focus, .bd-form select:focus { outline: none; border-color: var(--accent); }
.bd-count { display: block; text-align: right; font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.bd-note { font-size: 11.5px; color: var(--dim); margin-top: 18px; line-height: 1.6; }
.bd-nav { display: flex; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.bd-adv-toggle { width: 100%; margin-top: 18px; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 12px; font-size: 14px; font-weight: 700; }
.sb-plot { margin-bottom: 14px; }
.sb-plot::placeholder { color: var(--dim); opacity: .75; }
.bd-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bd-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.cb-head { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; font-weight: 800; color: var(--dim); margin-bottom: 4px; }
.cb-head .cb-del { position: static; }
.scen-note { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: var(--dim); line-height: 1.6; }
.scen-note span { font-size: 22px; }
.lv-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; margin-top: 8px; align-items: center; }
.rarity-row { display: flex; gap: 8px; margin: 6px 0 2px; }
.rarity-row .rar { width: 46px; height: 34px; border-radius: 9px; background: var(--card); border: 1px solid var(--line); color: var(--dim); font-weight: 800; font-size: 12.5px; }
.rarity-row .rar.on { border-color: var(--rar); color: var(--rar); box-shadow: 0 0 10px color-mix(in srgb, var(--rar) 30%, transparent); }
.rarity-status { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.rarity-status b { display: block; font-size: 14px; margin-bottom: 2px; }
.rs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.rs-tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.rs-tile span { display: block; font-size: 11px; font-weight: 900; color: var(--rar); letter-spacing: 1px; }
.rs-tile b { font-size: 14px; margin-top: 4px; display: block; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 10px 0; }
.media-item { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.media-item img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.media-item .mi-kw { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(5,5,9,.75); font-size: 11px; padding: 5px 8px; color: var(--text); }
.media-item .mi-del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; width: 24px; height: 24px; font-size: 11px; }
.hash-box { display: flex; flex-wrap: wrap; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.hash-box input { flex: 1; min-width: 140px; background: none !important; border: 0 !important; padding: 6px 4px !important; }
.hash-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(123,91,255,.16); border: 1px solid rgba(123,91,255,.45); color: var(--accent2); border-radius: 9px; padding: 5px 10px; font-size: 13px; font-weight: 700; }
.hash-chip button { background: none; color: var(--dim); font-size: 11px; padding: 0; }
.radio-cards { display: flex; flex-direction: column; gap: 10px; }
/* 플렉스 행 — 전역 input{width:100%}·.studio-form label{display:block} 이 라디오 레이아웃을 무너뜨리던 것 */
.studio-form label.radio-card, .radio-card { display: flex; align-items: flex-start; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; color: var(--text); font-size: 14px; margin: 0; }
.radio-card.on { border-color: var(--accent); background: rgba(123,91,255,.06); }
.radio-card input { width: auto; flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--accent); }
.radio-card .rc-txt b { font-size: 14.5px; display: inline-flex; align-items: center; gap: 8px; }
.radio-card .rc-txt > span { display: block; font-size: 12.5px; color: var(--dim); margin-top: 4px; }
.rc-badge { font-style: normal; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.rc-badge.ok { color: #4dd6a8; background: rgba(77,214,168,.12); }
.rc-badge.adult { color: #e5484d; background: rgba(229,72,77,.12); }
/* 빌더 우측 라이브 프리뷰 */
.bd-preview { position: sticky; top: 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.bd-pv-head { font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--dim); margin-bottom: 14px; }
.bd-preview .pv-line { font-size: 13.5px; color: var(--text); margin-top: 12px; line-height: 1.6; }
.bd-preview .pv-by { font-size: 12px; color: var(--accent2); margin-top: 6px; }
.pv-play { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: 60vh; overflow-y: auto; }
.pv-play .tmsg.ai { font-size: 14px; line-height: 1.8; }
.pv-media { display: flex; flex-direction: column; gap: 10px; max-height: 64vh; overflow-y: auto; }
.pv-media figure { margin: 0; }
.pv-media img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.pv-media figcaption { font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.bd-preview .ending-card { width: 100%; }

/* ---------- 스토리 정보 모달 (ooc 파리티) ---------- */
.smodal-bg { align-items: center; padding: 24px 16px; }
.smodal .btn { width: auto; margin-top: 0; padding: 9px 16px; }
.sm-foot .btn { padding: 12px 28px; }
.modal.smodal { max-width: 720px; padding: 0; display: flex; flex-direction: column; max-height: min(88vh, 920px); overflow: hidden; }
.sm-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.sm-head h2 { font-size: 17px; font-weight: 800; }
.sm-x { background: none; color: var(--dim); font-size: 16px; padding: 6px 10px; border-radius: 8px; }
.sm-x:hover { color: var(--text); background: var(--card); }
.sm-body { overflow-y: auto; padding: 22px 24px; min-height: 0; }
.sm-top { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.sm-top .cover { margin: 0; }
.sm-meta h3 { font-size: 22px; font-weight: 900; margin-bottom: 10px; }
.sm-chips { margin-bottom: 10px; }
.sm-tagline { font-size: 15.5px; line-height: 1.65; color: var(--text); opacity: .95; margin-bottom: 10px; }
.sm-tags { margin-bottom: 10px; }
.sm-stats { display: flex; align-items: center; gap: 14px; color: var(--dim); font-size: 13px; flex-wrap: wrap; }
.sm-sec { font-size: 15px; font-weight: 800; margin: 22px 0 10px; letter-spacing: .3px; }
.sm-select { width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 14px; font-family: inherit; }
.sm-banner { width: 100%; border-radius: 14px; border: 1px solid var(--line); margin-top: 12px; }
.sm-media { margin-top: 12px; }
.sm-media-img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--card); border-radius: 14px; border: 1px solid var(--line); margin: 0 0 12px; }
.sm-media-stack { display: none; }
.sm-media-stack.open { display: block; }
.sm-media-btn { display: block; width: 100%; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 13px; font-size: 14px; font-weight: 600; }
.sm-media-btn:hover { border-color: var(--accent2); }
.sm-last { color: var(--dim); font-size: 12px; margin-top: 22px; }
.sm-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); flex-shrink: 0; flex-wrap: wrap; }
@media (max-width: 640px) {
  .smodal-bg { padding: 12px 8px; align-items: flex-end; }
  .modal.smodal { max-height: 92vh; border-radius: 20px 20px 12px 12px; }
  .sm-top { grid-template-columns: 130px minmax(0, 1fr); gap: 14px; }
  .sm-meta h3 { font-size: 18px; }
  .sm-body { padding: 16px; }
  .sm-foot { padding: 12px 16px; }
}

/* ---------- 문서 마크다운(설명·플레이 가이드) ---------- */
.guide-box.md { white-space: normal; color: var(--text); opacity: .92; font-size: 16px; line-height: 1.7; } /* 09-03 사장님 「읽어야 참여하는데 글씨가 작다」 → 14→16 */
.guide-box.md p { margin: 0 0 10px; }
.guide-box.md p:last-child { margin-bottom: 0; }
.md-h { font-size: 12.5px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent2); margin: 16px 0 8px; }
.guide-box.md .md-h:first-child { margin-top: 0; }
.md-ul { margin: 0 0 10px; padding-left: 18px; }
.md-ul li { margin-bottom: 6px; }
.md-ul li::marker { color: var(--accent2); }
.guide-box.md code { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; color: var(--accent2); }
.md-hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* ---------- 스토어 정비 (ooc 참조) ---------- */
.store-bal { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-bottom: 20px; max-width: 640px; font-size: 18px; }
.store-bal b { font-weight: 900; }
.store-bal .sb-lbl { color: var(--dim); font-size: 13px; margin-left: auto; }
.packs.store-list { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.store-list .pack { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; }
.store-list .pack .mins { font-size: 19px; }
.store-list .pack .per { margin-top: 4px; }
.store-list .pack .price { margin-bottom: 0; }
.store-list .pk-buy { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.refund-list { max-width: 640px; color: var(--dim); font-size: 13px; line-height: 1.8; padding-left: 18px; }
.refund-list li { margin-bottom: 4px; }

/* ---------- 알림 벨 + 패널 ---------- */
.chip.bell { position: relative; cursor: pointer; padding: 8px 10px; line-height: 1; }
.bell-dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; border: 2px solid var(--bg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.nf-checkin { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(120deg, rgba(112,82,251,.18), rgba(179,153,255,.08)); border: 1px solid rgba(112,82,251,.45); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.nf-checkin.claimed { background: var(--card); border-color: var(--line); }
.nf-checkin .nfc-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nf-checkin .nfc-txt b { font-size: 14px; }
.nf-checkin .nfc-txt span { font-size: 12.5px; color: var(--dim); line-height: 1.45; }
/* .modal .btn 이 width:100%·margin-top 을 강제하므로 스코프로 되돌린다 */
.nf-checkin .btn { width: auto; margin-top: 0; padding: 9px 14px; white-space: nowrap; flex: none; font-size: 13px; }
.nf-checkin .nfc-done { color: var(--accent2); font-size: 18px; font-weight: 800; padding: 0 8px; }
.nf-list { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.nf-item { border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--card); }
.nf-item.unread { border-color: rgba(112,82,251,.5); }
.nf-item.clickable { cursor: pointer; }
.nf-item.clickable:hover { background: var(--bg2); }
.nf-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.nf-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; color: var(--accent2); background: rgba(112,82,251,.14); border-radius: 6px; padding: 2px 7px; }
.nf-time { font-size: 11px; color: var(--dim); margin-left: auto; }
.nf-t { font-size: 13.5px; font-weight: 700; }
.nf-b { font-size: 12.5px; color: var(--dim); margin-top: 3px; line-height: 1.5; }

/* ---------- 플레이 히스토리 드로어 ---------- */
.hist-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); background: var(--bg2); border-left: 1px solid var(--line); z-index: 90; display: flex; flex-direction: column; padding: 16px; box-shadow: -18px 0 40px rgba(0,0,0,.45); }
.hd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hd-head b { font-size: 15px; }
.hd-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.hd-item { border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--card); cursor: pointer; }
.hd-item:hover { border-color: rgba(112,82,251,.5); }
.hd-item.on { border-color: var(--accent); background: rgba(112,82,251,.10); cursor: default; }
.hd-t { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; font-weight: 700; }
.hd-t span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-turn { font-size: 11px; color: var(--dim); flex: none; }
.hd-line { font-size: 12px; color: var(--dim); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-all { display: block; text-align: center; margin-top: 12px; font-size: 13px; color: var(--accent2); }

/* ================= v13 — 상태줄·INFO 가독화 · 커스텀 드랍다운 · 토스트·확인 모달 ================= */
/* 상태줄: 날씨 | 턴 | 장소 | 날짜·시간 세그먼트 */
.status-line { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; font-family: 'Inter', 'Noto Sans KR', sans-serif; }
.sl-seg { display: inline-flex; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--dim); letter-spacing: .2px; line-height: 1.4; }
.sl-seg.sl-w { font-size: 13px; padding: 5px 9px; }
.sl-seg.sl-turn { color: var(--accent2); border-color: rgba(123,91,255,.4); background: rgba(123,91,255,.08); font-weight: 700; }
.sl-seg.sl-loc { color: var(--text); }
.sl-ic { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .75; flex: none; }

/* INFO 카드 v2 — 구조화 본문 */
.info-card .ic-body2 { padding: 12px 16px; line-height: 1.7; color: #cfcbdc; font-size: 13.5px; }
.ic-hr { border: 0; border-top: 1px dashed var(--line); margin: 10px 0; }
.ic-me b { color: var(--text); font-weight: 800; margin-right: 8px; }
.ic-me span { color: var(--dim); font-size: 12.5px; }
.ic-sec { font-size: 10.5px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent2); margin: 2px 0 6px; }
.ic-line { margin: 4px 0; }
.ic-line b { color: var(--text); font-weight: 700; margin-right: 8px; }
.ic-tags { display: inline-flex; flex-wrap: wrap; gap: 5px; vertical-align: middle; }
.ic-tags em { font-style: normal; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; color: var(--dim); }
.ic-note { background: rgba(123,91,255,.07); border-left: 3px solid rgba(123,91,255,.5); border-radius: 0 8px 8px 0; padding: 7px 11px; margin-top: 8px; font-size: 12.5px; color: #b7b2c6; }

/* 커스텀 드랍다운 — 네이티브 select 는 숨겨진 정본 */
.csel { position: relative; }
.csel > select { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; margin: 0; padding: 0 !important; border: 0; }
.cs-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 14.5px; transition: border-color .15s; }
.cs-btn:hover { border-color: rgba(123,91,255,.45); }
.cs-btn .cs-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chev { width: 14px; height: 14px; color: var(--accent2); flex: none; transition: transform .15s; }
.csel.open .cs-chev { transform: rotate(180deg); }
.csel.open .cs-btn, .cs-btn:focus-visible { border-color: var(--accent); }
.cs-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 95; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 6px; max-height: 280px; overflow-y: auto; box-shadow: 0 14px 40px rgba(0,0,0,.5); animation: modalIn .16s ease both; }
.cs-opt { display: block; width: 100%; text-align: left; background: none; color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.cs-opt:hover { background: var(--card); }
.cs-opt.on { background: rgba(123,91,255,.14); color: var(--accent2); font-weight: 700; }
.csel-chip .cs-btn { border-radius: 999px; padding: 9px 14px; font-size: 13px; }
.acct-menu .csel { width: 100%; }

/* 토스트 v2 — 아이콘·퇴장 애니메이션 */
.toast { display: flex; align-items: center; gap: 9px; background: rgba(26,26,34,.94); backdrop-filter: blur(10px); border-radius: 13px; max-width: min(420px, 88vw); }
.toast.success { border-color: rgba(77,214,168,.45); }
.toast.error { border-color: rgba(229,72,77,.5); }
.toast .tic { width: 18px; height: 18px; flex: none; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast.success .tic { stroke: #4dd6a8; }
.toast.error .tic { stroke: #e5484d; }
.toast.out { animation: toastOut .25s ease both; }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* 공용 확인·입력 모달 (window.confirm/prompt 대체) */
.ov-bg { z-index: 260; }
.ov-modal { max-width: 380px; }
.ov-modal .ov-t { font-size: 18px; }
.ov-b { color: var(--dim); font-size: 13.5px; line-height: 1.65; margin: 6px 0 4px; }
.ov-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.ov-modal .btn { width: auto; margin-top: 0; padding: 10px 20px; }
.btn.danger { background: #e5484d; }

/* 커스텀 툴팁 — 아이콘 버튼의 정체를 첫 유저도 바로 알게 */
#uitip { position: fixed; z-index: 400; pointer-events: none; max-width: 280px;
  background: rgba(24,24,32,.97); border: 1px solid rgba(123,91,255,.4); border-radius: 11px;
  padding: 9px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: tipIn .14s ease both; backdrop-filter: blur(8px); }
#uitip b { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); }
#uitip span { display: block; font-size: 11.5px; color: var(--dim); line-height: 1.55; margin-top: 3px; }
#uitip kbd { display: inline-block; margin-top: 6px; font: 600 10.5px/1 ui-monospace, Menlo, monospace; color: var(--dim); background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; letter-spacing: .04em; }
.ic-reroll, .ic-hd { display: block; }
.tchat-head .th-btn:has(.ic-hd) { display: inline-flex; align-items: center; justify-content: center; padding: 8px 10px; color: var(--text); opacity: .85; }
.tchat-head .th-btn.pulse { border-color: var(--accent); color: var(--accent2); opacity: 1; animation: tp-pulse 2s ease-out 4; }
/* 히스토리 첫 안내 말풍선 — 버튼 아래, 화면 안으로 클램프, 꼬리는 버튼 중앙 */
.hd-coach { position: fixed; z-index: 95; max-width: min(260px, calc(100vw - 16px)); background: var(--bg2); border: 1px solid rgba(123,91,255,.45); border-radius: 12px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: modalIn .22s ease-out; --tail-x: 50%; }
.hd-coach b { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); }
.hd-coach span { display: block; font-size: 11.5px; color: var(--dim); line-height: 1.55; margin-top: 3px; word-break: keep-all; overflow-wrap: anywhere; }
.hd-coach::after { content: ''; position: absolute; left: var(--tail-x); top: -5px; width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg); background: var(--bg2); border-left: 1px solid rgba(123,91,255,.45); border-top: 1px solid rgba(123,91,255,.45); }
#uitip::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px; background: rgba(24,24,32,.97); border-right: 1px solid rgba(123,91,255,.4); border-bottom: 1px solid rgba(123,91,255,.4); }
#uitip.below::after { bottom: auto; top: -5px; border: 0; border-left: 1px solid rgba(123,91,255,.4); border-top: 1px solid rgba(123,91,255,.4); }
@keyframes tipIn { from { opacity: 0; transform: translateY(3px); } }

/* ================= v19 — 홈 갈래(스토리/캐릭터)·태그 줄·18+ ================= */
.badge-18 { background: rgba(230, 57, 70, .92); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .3px; padding: 3px 6px; border-radius: 6px; z-index: 2; }
.htab.mature { border-color: rgba(230,57,70,.55); color: #ff8a93; }
.htab.mature.on { background: #e63946; border-color: #e63946; color: #fff; }
.section-title.tags-title { margin: 22px 0 10px; font-size: 17px; }
.tags-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.tag-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.tag-btn svg { color: var(--dim); }
.tag-btn:hover { border-color: rgba(179,153,255,.6); }
.tag-btn.on { background: rgba(123,91,255,.18); border-color: var(--accent); }
@media (max-width: 760px) { .tags-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; } .tag-btn { flex-shrink: 0; } }

/* ================= v19.5 — 배지 레이아웃 · 전역 커스텀 스크롤바 · 팝오버 통일 ================= */
/* 카드: 순위는 항상 좌상단, 18+/ORIGINAL 은 우상단 세로 열 — 어떤 조합이든 자리가 안 바뀐다 */
.card .cover-badges { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.card .cover-badges .badge-orig, .card .cover-badges .badge-draft { position: static; }
.card .cover-badges .badge-18 { position: static; }
.cover.p34 .plays.rank { top: 8px; left: 8px; right: auto; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0 7px; font-size: 11.5px; background: rgba(0,0,0,.62); border: 1px solid rgba(255,255,255,.14); }
.smodal .cover .badge-orig { position: absolute; top: 8px; left: 8px; }
/* 전역 스크롤바 — 어디든 같은 얇은 다크 스크롤바 (모달·드로어·메뉴·페이지) */
* { scrollbar-width: thin; scrollbar-color: rgba(179,153,255,.32) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(179,153,255,.28); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(179,153,255,.55); background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }
html::-webkit-scrollbar { width: 10px; }
.modal, .sm-body, .hist-drawer .hd-list, .nf-list, .tier-menu, .cs-menu, textarea, pre, .world-md, .cmd-pal { scrollbar-gutter: stable; }
/* 체크박스·라디오·넘버 — 브라우저 기본색 대신 액센트 */
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* 팝오버 통일 — 유리 배경·같은 그림자·튀어나오는 애니메이션 */
.acct-menu, .tier-menu, .cs-menu, .cmd-pal, .hd-coach, .uitip { background: rgba(22,22,31,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 14px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(179,153,255,.08); }
.acct-menu, .tier-menu, .cs-menu { animation: popIn .16s cubic-bezier(.2,.9,.3,1.2) both; transform-origin: top; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.hist-drawer { animation: drawerIn .22s cubic-bezier(.2,.8,.2,1) both; }
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.cs-opt, .tm-item, .cmd-pal button { transition: background .12s; }
@media (prefers-reduced-motion: reduce) { .acct-menu, .tier-menu, .cs-menu, .hist-drawer { animation: none; } }

/* 스토리 정보 모달의 명령어 행만 키움(플레이 화면 팔레트는 그대로) */
.smodal .cmd-pal .cmd-ro { font-size: 15px; }
.smodal .cmd-pal small { font-size: 13px; margin-top: 2px; }

/* 약관·개인정보 링크 */
.modal .agree { color: var(--dim); font-size: 12px; line-height: 1.5; margin-top: 14px; text-align: center; }
.modal .agree a, .am-legal a { color: var(--dim); text-decoration: underline; text-underline-offset: 2px; }
.modal .agree a:hover, .am-legal a:hover { color: var(--text); }
.am-legal { margin-top: 12px; font-size: 11.5px; color: var(--dim); text-align: center; }
