/* */
/* character chip: avatar with bond-level badge, "等級 N" pill after a level-up */
.char-avatar-wrap { position: relative; flex: none; }
.lvl-badge { position: absolute; right: -3px; bottom: -3px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; display: grid; place-items: center; font-size: 10px; font-weight: 900; color: #fff; background: rgb(var(--chat)); box-shadow: 0 0 0 2px #000; }
.lvl-pill { flex: none; height: 22px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff; background: rgb(var(--chat)); }
.char-chip.leveled { box-shadow: 0 0 0 1.5px rgba(var(--chat), .9), 0 0 18px rgba(var(--chat), .55); animation: lvl-glow 1.6s ease-out 2; }
@keyframes lvl-glow { 50% { box-shadow: 0 0 0 2px rgba(var(--chat), 1), 0 0 30px rgba(var(--chat), .9); } }

/* transcript = vertical timeline */
.rounds { position: relative; gap: 12px; padding: 4px 2px 16px 22px; }
.rounds::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 24px; border-left: 1.5px dashed rgba(255,255,255,.22); }
.tl { position: relative; }
.tl::before { content: ""; position: absolute; left: -20px; top: 16px; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.55); background: #000; }
.tl.now::before { width: 12px; height: 12px; left: -21px; border: 0; background: #f5f5f5; box-shadow: 0 0 0 4px rgba(255,255,255,.15); }

/* opening: plain panel while it plays, compact card afterwards */
.round-open { gap: 14px; padding-top: 6px; }
.round-open .round-name { font-size: 32px; font-weight: 800; font-stretch: 100%; text-transform: none; line-height: 1.15; }
.round-tags li { padding: 3px 9px; border-radius: 6px; font-size: 12px; background: rgba(255,255,255,.1); color: var(--text-1); }
.round-open .pill-btn[data-skip] { height: 40px; border-radius: 12px; background: rgba(255,255,255,.1); }
.open-card { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 10px; padding: 12px; border-radius: 16px; background: #202020; overflow: hidden; }
.open-card .oc-text { display: grid; gap: 8px; min-width: 0; align-content: start; }
.open-card .oc-label { font-size: 11px; font-weight: 800; color: var(--text-3); }
.open-card h2 { margin: 0; font-size: 18px; font-weight: 800; }
.open-card p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.open-card .oc-pic { position: relative; border-radius: 12px; overflow: hidden; background: #111; min-height: 150px; }
.open-card .oc-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.open-card .oc-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.open-card .oc-actions .spacer { flex: 1; }

/* round card (roundHistory.card) */
.round { border-top: 0; padding: 0; }
.rcard { display: grid; gap: 10px; padding: 14px 16px 10px; border-radius: 16px; background: #202020; }
.rhead { display: flex; align-items: center; gap: 6px; }
.rhead b { font-size: 14px; font-weight: 800; }
.rhead .now { font-size: 12px; font-weight: 800; color: var(--text-3); }
.rhead .sp { flex: 1; }
.rhead .share { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; color: var(--text-2); }
.rhead .share svg { width: 16px; height: 16px; }
.answer { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-1); }
.msg { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; }
.msg .face { width: 24px; height: 24px; border-radius: 50%; overflow: hidden; background: #333; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.msg .face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.msg .mname { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.reply { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 10px; align-items: start; }
.reply.noposter { grid-template-columns: 1fr; }
.rposter { position: relative; width: 78px; aspect-ratio: 78 / 138; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.08); }
.rposter img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }
.rcap { display: grid; gap: 6px; min-width: 0; }
.rcap .say { margin: 0; font-size: 15px; line-height: 1.5; font-weight: 600; color: var(--text-1); }
.rcap .narr { margin: 0; font-size: 13px; line-height: 1.5; font-style: italic; color: var(--text-3); }
.playing { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--text-2); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.eq i { width: 2px; background: currentColor; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(1) { height: 5px; } .eq i:nth-child(2) { height: 10px; animation-delay: .2s; } .eq i:nth-child(3) { height: 7px; animation-delay: .4s; }
@keyframes eq { 50% { transform: scaleY(.4); } }
.racts { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.rate { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--text-2); }
.rate:hover { background: rgba(255,255,255,.08); }
.rate[aria-pressed="true"] { color: #f04a7c; }
.rate svg { width: 20px; height: 20px; }
.racts .sep { width: 1px; height: 16px; margin: 0 6px; background: rgba(255,255,255,.14); }
.regen { height: 36px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 12px; font-weight: 700; }
.regen:hover { background: rgba(255,255,255,.08); }
.regen svg { width: 18px; height: 18px; }
.regen .bell { width: 13px; height: 13px; stroke: none; }
.typing { display: inline-flex; gap: 4px; padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,.08); }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-2); animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.next-node b { display: block; font-size: 14px; font-weight: 800; padding-top: 10px; }
.next-node small { font-size: 12px; color: var(--text-3); }

/* decisions (decision-card list) */
.decide h3 { margin: 4px 0 12px; font-size: 22px; font-weight: 700; }
.decide-list { display: grid; gap: 8px; }
.dcard { position: relative; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: #1b1b1b; color: var(--text-1); text-align: left; font-size: 14px; font-weight: 700; line-height: 1.45; animation: fade-up .25s var(--ease) both; animation-delay: calc(var(--i) * 50ms); }
.dcard:hover { border-color: rgba(255,255,255,.28); }
.dcard.on { border-color: rgba(255,255,255,.85); background: #262626; }
.dcard.ticket { padding: 0 14px 0 0; overflow: hidden; border-color: rgba(var(--chat), .55); background: linear-gradient(90deg, rgba(var(--chat), .22), rgba(var(--chat), .08)); }
.dcard.ticket.on { border-color: var(--chat-name); }
.dcard .stub { flex: none; align-self: stretch; width: 56px; display: grid; place-content: center; justify-items: center; gap: 2px; background: rgb(var(--chat)); font-size: 10px; font-weight: 800; color: #fff; }
.dcard .stub svg { width: 18px; height: 18px; }
.confirm { height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; background: linear-gradient(100deg, var(--acc-a), var(--acc-b)); color: var(--dusk-ink); font-size: 15px; font-weight: 800; animation: fade-up .2s var(--ease) both; }
.confirm svg { width: 18px; height: 18px; }

/* composer: input on top, cost/mode chip + send underneath */
.composer { height: auto; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 10px 8px 14px; border-radius: 16px; background: rgba(28,28,28,.92); }
.composer input { height: 30px; }
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-row .mode-chip { margin-left: auto; height: 34px; display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--text-1); font-size: 13px; }
.composer-row .mode-chip .cost { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; }
.composer-row .mode-chip .cost svg { width: 14px; height: 14px; stroke: none; }
.composer-row .mode-chip .d { color: var(--text-3); }
.composer-row .mode-chip #modeLabel { color: var(--acc-name); }
.composer-row .mode-chip .chev { width: 14px; height: 14px; color: var(--text-3); }
.composer-row kbd { order: -1; margin-right: auto; }
.composer .send { width: 36px; height: 34px; padding: 0; justify-content: center; border-radius: 10px; }
.composer .send svg { width: 18px; height: 18px; }

/* hotspots on the stage */
.hotspots { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.hotspot { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: #fff; pointer-events: auto; animation: hs-in .4s var(--ease) both; animation-delay: calc(var(--i) * 120ms); }
.hotspot .ring { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); background: rgba(var(--chat), .25); box-shadow: 0 0 0 4px rgba(var(--chat), .25); }
.hotspot .ring::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.hotspot .ring::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.5); animation: ring 1.8s ease-out infinite; }
.hotspot .tag { padding: 5px 10px; border-radius: 999px; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); font-size: 13px; font-weight: 800; white-space: nowrap; }
.hotspot.flip { flex-direction: row-reverse; }
.hotspot.on .ring { background: rgb(var(--chat)); border-color: #fff; }
@keyframes ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes hs-in { from { opacity: 0; } }
.pick-chip { position: absolute; left: 50%; bottom: 28px; z-index: 5; transform: translateX(-50%); height: 36px; display: inline-flex; align-items: center; gap: 4px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(0,0,0,.62); backdrop-filter: blur(8px); color: #fff; font-size: 14px; font-weight: 800; }
.pick-chip svg { width: 15px; height: 15px; stroke: none; }
.room[data-phase="opening"] .hotspots, .room[data-phase="opening"] .pick-chip { display: none; }

@media (max-width: 767px) {
  .decide h3 { display: none; }
  .decide-list { grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scrollbar-width: none; }
  .dcard { min-height: 56px; background: rgba(20,20,20,.7); backdrop-filter: blur(12px); }
  .composer { background: rgba(40,40,40,.55); backdrop-filter: blur(20px) saturate(1.4); }
  .pick-chip { bottom: calc(190px + env(safe-area-inset-bottom)); }
  .lvl-pill { display: none !important; }
}

/* ending card */
.ending-layer { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 50% at 50% 40%, rgba(var(--chat), .25), rgba(0,0,0,.85)); backdrop-filter: blur(10px); animation: fade .4s both; }
.ending-card { width: min(460px, 100%); padding: 32px 28px 24px; border-radius: 24px; background: linear-gradient(rgba(255,255,255,.05), rgba(255,255,255,0) 180px), #141414; border: 1px solid rgba(255,255,255,.1); text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: sheet-in .5s var(--ease) both; }
.ending-eyebrow { margin: 0 0 10px; font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--chat-name); }
.ending-card h2 { margin: 0 0 14px; font-size: 30px; font-weight: 800; }
.ending-epi { margin: 0 0 24px; font-size: 16px; line-height: 1.7; color: var(--text-2); font-style: italic; }
.ending-actions { display: flex; gap: 10px; }

/* relationship stages (rel card) */
.rel-level { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; margin-top: 10px; font-size: 13px; font-weight: 800; }
.rel-level .bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.rel-level .bar i { display: block; height: 100%; width: 0; background: rgb(var(--chat)); transition: width .6s var(--ease); }
.rel-level small { grid-column: 2; font-size: 11px; font-weight: 600; color: var(--text-3); }
.rel-stages-h { margin: 14px 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--text-3); }
.rel-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; }
.rel-stages li { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: rgba(255,255,255,.04); color: var(--text-3); opacity: .55; }
.rel-stages li.on { opacity: 1; color: var(--text-1); }
.rel-stages li.cur { background: rgba(var(--chat), .22); box-shadow: inset 0 0 0 1px rgba(var(--chat), .6); }
.rel-stages .ic svg { width: 18px; height: 18px; }
.rel-stages b { font-size: 13px; }
.rel-stages small { font-size: 10px; color: var(--text-3); }

/* full-screen "新階段" celebration (covers the stage like the reference room) */
.stage-celebrate { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; text-align: center; cursor: pointer; background: radial-gradient(60% 45% at 50% 40%, rgba(var(--chat), .18), rgba(0,0,0,.78) 70%); backdrop-filter: blur(3px); animation: fade .5s both; }
body > .stage-celebrate { position: fixed; z-index: 130; }
.sc-inner { display: grid; justify-items: center; gap: 12px; padding: 24px; }
.sc-eyebrow { margin: 0 0 18px; font-size: 15px; font-weight: 800; color: var(--text-2); letter-spacing: .08em; animation: fade-up .5s .1s both; }
.sc-icon { width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid rgb(var(--chat)); box-shadow: 0 0 40px rgba(var(--chat), .35), inset 0 0 30px rgba(var(--chat), .15); color: var(--chat-name); animation: sc-pop .7s .2s var(--ease) both; }
.sc-icon svg { width: 64px; height: 64px; stroke-width: 1.4; }
@keyframes sc-pop { from { opacity: 0; transform: scale(.7); } }
.sc-path { display: flex; align-items: center; gap: 10px; margin: 26px 0 0; font-size: 15px; font-weight: 800; color: var(--text-2); animation: fade-up .5s .5s both; }
.sc-path svg { width: 14px; height: 14px; }
.sc-title { margin: 0; font-size: clamp(56px, 7vw, 88px); font-weight: 300; line-height: 1.1; animation: fade-up .6s .6s both; }
.sc-line { margin: 0; font-size: 17px; color: var(--text-1); animation: fade-up .5s .8s both; }
.sc-level { margin: 8px 0 0; font-size: 14px; font-weight: 800; color: var(--text-3); animation: fade-up .5s .9s both; }
.sc-gift { margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(var(--chat), .25); color: var(--chat-name); font-size: 13px; font-weight: 800; animation: fade-up .5s 1s both; }
.sc-go { margin-top: 18px; height: 52px; padding: 0 36px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: var(--text-1); font-size: 16px; font-weight: 800; animation: fade-up .5s 1.1s both; }

/* rewards */
.rewards-layer { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.66); backdrop-filter: blur(10px); animation: fade .2s both; }
.rewards-card { width: min(640px, 100%); max-height: 86dvh; overflow-y: auto; padding: 16px 18px 20px; border-radius: 22px; background: #141414; border: 1px solid var(--line); }
.rw-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rw-head strong { font-size: 18px; }
.rw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rw-grid figure { margin: 0; border-radius: 14px; overflow: hidden; background: #1d1d1d; }
.rw-grid img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; object-position: 50% 15%; display: block; }
.rw-grid figcaption { display: grid; gap: 4px; padding: 8px 10px 10px; font-size: 12px; color: var(--text-3); }
.rw-grid figcaption b { color: var(--chat-name); }
.rw-grid figcaption span { color: var(--text-1); font-size: 13px; line-height: 1.45; }
.rw-empty { margin: 20px 0; text-align: center; color: var(--text-3); font-size: 14px; }

/* hotspots glide onto the object once the vision model has located it */
.hotspot { transition: left .6s var(--ease), top .6s var(--ease); }
.hotspot:not(.located) .ring::before { animation-duration: 1s; }

/* ---------- title card while entering a room (/enter/<slug>) ---------- */
.title-card { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-columns: 1fr 1fr; background: #0a0a0a; transition: opacity .55s ease; }
.title-card.out { opacity: 0; pointer-events: none; }
.tc-art { position: relative; overflow: hidden; }
.tc-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; animation: tcZoom 8s ease-out both; }
.tc-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 35%, #0a0a0a 98%), linear-gradient(0deg, rgba(10,10,10,.6), transparent 40%); }
.tc-copy { align-self: center; padding: 0 9vw 0 4vw; max-width: 640px; animation: tcIn .7s .15s cubic-bezier(.2,.8,.2,1) both; }
.tc-eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 13px; font-weight: 800; letter-spacing: .08em; color: #fffb; }
.tc-eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: #e8487a; box-shadow: 0 0 12px #e8487a; }
.tc-copy h1 { margin: 0 0 16px; font-size: clamp(40px, 6vw, 76px); font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.tc-intro { margin: 0 0 30px; font-size: 16px; line-height: 1.7; color: #fffc; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.tc-dots { display: inline-flex; gap: 8px; }
.tc-dots i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: tcDot 1.2s ease-in-out infinite; }
.tc-dots i:nth-child(2) { animation-delay: .18s; } .tc-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes tcDot { 0%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
@keyframes tcZoom { from { transform: scale(1.08); } }
@keyframes tcIn { from { opacity: 0; transform: translateY(14px); } }
@media (max-width: 760px) {
  .title-card { grid-template-columns: 1fr; grid-template-rows: 58% 1fr; }
  .tc-art::after { background: linear-gradient(180deg, transparent 40%, #0a0a0a 98%); }
  .tc-copy { align-self: start; padding: 0 22px; margin-top: -40px; position: relative; }
  .tc-intro { font-size: 14px; -webkit-line-clamp: 3; margin-bottom: 20px; }
}

/* ---------- 第 N 回合 title at the start of each round ---------- */
.round-title { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; pointer-events: none; background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent); animation: rtIn .45s cubic-bezier(.2,.8,.2,1) both; transition: opacity .5s; }
.round-title.out { opacity: 0; }
.round-title span { position: relative; padding-bottom: 12px; font-size: clamp(30px, 4.4vw, 52px); font-weight: 900; letter-spacing: .06em; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.6); }
.round-title span::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 56%; height: 4px; border-radius: 2px; background: #e0336b; transform: translateX(-50%) scaleX(0); animation: rtLine .5s .2s ease-out forwards; }
@keyframes rtIn { from { opacity: 0; transform: scale(1.06); } }
@keyframes rtLine { to { transform: translateX(-50%) scaleX(1); } }

/* screenshot flash */
.stage-frame.flash::after { content: ""; position: absolute; inset: 0; z-index: 30; background: #fff; pointer-events: none; animation: shotFlash .45s ease-out forwards; }
@keyframes shotFlash { from { opacity: .85; } to { opacity: 0; } }
