/* 安安直播间。夜墨底、金色点缀、宋体做标题，像一部正在连载的恋爱视觉小说。 */
:root {
  --ink: #0d0b07; --ink-2: #16130d; --smoke: #2b261c; --line: rgba(240, 185, 11, .18);
  --gold: #f0b90b; --champagne: #f6e3a1; --rouge: #e2557a; --paper: #f4eee2; --muted: #a59a82;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --side: 380px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ink); color: var(--paper); font: 14px/1.6 var(--sans); display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.test-band { background: repeating-linear-gradient(-45deg, #3a2f0a 0 14px, #2a2208 14px 28px); color: var(--champagne); text-align: center; font-size: 13px; padding: 5px 12px; letter-spacing: .04em; border-bottom: 1px solid var(--line); }

/* top bar */
.top { display: flex; align-items: center; gap: 24px; padding: 10px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(var(--ink-2), var(--ink)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.brand-name { font: 600 24px/1 var(--serif); color: var(--gold); letter-spacing: .12em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rouge); box-shadow: 0 0 0 0 rgba(226, 85, 122, .6); animation: pulse 1.8s infinite; }
body.offline .live-dot { background: var(--muted); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(226, 85, 122, 0); } 100% { box-shadow: 0 0 0 0 rgba(226, 85, 122, 0); } }
.top-stats { display: flex; gap: 22px; color: var(--muted); flex: 1; }
.top-stats b { color: var(--champagne); font-weight: 600; margin-left: 2px; }
.top-actions { display: flex; gap: 10px; }
.btn-gold { background: var(--gold); color: #1a1405; border: 0; border-radius: 6px; padding: 7px 16px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn-gold:hover { background: #ffcb2b; }
.btn-ghost { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 6px 14px; color: var(--champagne); white-space: nowrap; }
.btn-ghost:hover, .btn-ghost[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }

/* layout */
.room { flex: 1; display: grid; grid-template-columns: 1fr var(--side); min-height: 0; }

/* scene: blurred stage picture behind, 2:3 figure centred at full height */
.scene { position: relative; overflow: hidden; background: #000; }
.scene-bg { position: absolute; inset: -40px; background: center / cover no-repeat; filter: blur(28px) brightness(.45) saturate(1.1); transition: background-image .9s; }
.scene::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, transparent 40%, rgba(13, 11, 7, .75)); pointer-events: none; }
.figure-wrap { position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-end; }
.figure { position: relative; height: 100%; aspect-ratio: 2 / 3; transform-origin: 50% 100%; animation: breathe 4.6s ease-in-out infinite; z-index: 1; }
@keyframes breathe { 50% { transform: scale(1.008, 1.012); } }
.layer { position: absolute; display: block; user-select: none; -webkit-user-drag: none; }
.base { inset: 0; width: 100%; height: 100%; object-fit: cover; box-shadow: 0 0 80px rgba(0, 0, 0, .6); }
.face { transition: opacity .06s; }
.face.talk, .face.blink { opacity: 0; }
.face.talk.on, .face.blink.on { opacity: 1; }
.face.blink.on { z-index: 2; }
img:not([src]) { visibility: hidden; }

/* galgame dialogue box */
.dialog { position: absolute; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(860px, calc(100% - 40px)); min-height: 128px;
  padding: 26px 30px 18px; background: linear-gradient(rgba(13, 11, 7, .82), rgba(13, 11, 7, .92)); border: 1px solid rgba(240, 185, 11, .45); border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(13, 11, 7, .5), 0 18px 50px rgba(0, 0, 0, .55); backdrop-filter: blur(6px); }
.nameplate { position: absolute; top: -17px; left: 22px; display: flex; align-items: stretch; font-family: var(--serif); }
.nameplate span { background: var(--gold); color: #1a1405; font-weight: 700; font-size: 17px; padding: 4px 18px; letter-spacing: .2em; }
.nameplate em { font-style: normal; background: var(--ink); border: 1px solid var(--gold); border-left: 0; color: var(--champagne); font-size: 13px; padding: 5px 12px; }
.line { margin: 0; font: 20px/1.75 var(--serif); color: var(--paper); min-height: 2.6em; white-space: pre-wrap; }
.dialog.long .line { font-size: 16px; line-height: 1.7; max-height: 20vh; overflow-y: auto; }
.line-meta { margin-top: 8px; font-size: 12px; color: var(--muted); }
.line-meta b { color: var(--champagne); font-weight: 500; }
body[data-mood="angry"] .dialog { border-color: rgba(226, 85, 122, .7); }
body[data-mood="excited"] .dialog { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(13, 11, 7, .5), 0 0 40px rgba(240, 185, 11, .25); }

/* evolution: dark stage, the old card glows and flickers with the new one, white flash, gold burst reveal */
.evolve { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(29, 23, 9, .92), rgba(5, 4, 2, .97) 70%); animation: ev-in .8s ease both; }
.evolve.out { animation: ev-out .7s ease both; }
.ev-lead { margin: 0; font: 18px var(--serif); color: var(--champagne); letter-spacing: .2em; transition: opacity .4s; }
.evolve.reveal .ev-lead { opacity: 0; height: 0; }
.ev-card { position: relative; height: min(62vh, 640px, calc(100% - 190px)); aspect-ratio: 2 / 3; border-radius: 10px; transition: transform .6s cubic-bezier(.2, 1.4, .4, 1); }
.ev-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 10px; transition: opacity .05s, filter .3s; }
.ev-card #evNew { opacity: 0; }
.evolve.glow .ev-card img { filter: brightness(2.6) saturate(0) blur(2px); box-shadow: 0 0 60px 20px rgba(255, 246, 214, .7); }
.evolve.glow .ev-card.alt #evOld { opacity: 0; }
.evolve.glow .ev-card.alt #evNew { opacity: 1; }
.evolve.reveal .ev-card { transform: scale(1.04); box-shadow: 0 0 0 2px var(--gold), 0 0 90px rgba(240, 185, 11, .55); }
.evolve.reveal #evOld { opacity: 0; }
.evolve.reveal #evNew { opacity: 1; filter: none; }
.ev-flash { position: absolute; inset: 0; background: #fffbea; opacity: 0; pointer-events: none; }
.evolve.flash .ev-flash { animation: ev-flash .9s ease-out both; }
.ev-rays { position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(240, 185, 11, .22) 0 6deg, transparent 6deg 18deg); mask: radial-gradient(circle, #000 0, transparent 45%); -webkit-mask: radial-gradient(circle, #000 0, transparent 45%); }
.evolve.reveal .ev-rays { opacity: 1; transition: opacity .5s; animation: ev-spin 18s linear infinite; }
.ev-sparks { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.evolve.reveal .ev-sparks { opacity: 1; }
.ev-sparks i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff3c4; box-shadow: 0 0 10px 3px rgba(240, 185, 11, .8); animation: ev-spark 2s ease-in-out infinite; }
.ev-title { display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0; transform: translateY(14px); transition: opacity .6s .3s, transform .6s .3s; }
.evolve.reveal .ev-title { opacity: 1; transform: none; }
.ev-title small { font: 14px var(--serif); color: var(--muted); letter-spacing: .6em; }
.ev-title strong { font: 700 clamp(40px, 6vw, 72px)/1 var(--serif); color: var(--gold); letter-spacing: .25em; text-shadow: 0 0 40px rgba(240, 185, 11, .5); }
.ev-title span { font-size: 13px; color: var(--champagne); letter-spacing: .3em; }
@keyframes ev-in { from { opacity: 0; } }
@keyframes ev-out { to { opacity: 0; } }
@keyframes ev-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ev-spin { to { transform: rotate(360deg); } }
@keyframes ev-spark { 0%, 100% { opacity: 0; transform: scale(.3); } 50% { opacity: 1; transform: scale(1); } }

/* full picture of an unlocked stage */
.lightbox { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(5, 4, 2, .92); cursor: zoom-out; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-height: 86vh; max-width: 94vw; border: 1px solid var(--line); border-radius: 6px; }
.lightbox figcaption { font: 16px var(--serif); color: var(--gold); letter-spacing: .3em; }

/* side panel */
.side { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--ink-2); min-height: 0; overflow-y: auto; }
.side h2 { font: 600 15px var(--serif); color: var(--champagne); margin: 0 0 10px; letter-spacing: .1em; }
.ladder-box { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.side h2 small { font: 12px var(--sans); color: #7d735c; letter-spacing: 0; margin-left: 6px; }
.ladder li { border: 1px solid var(--smoke); border-radius: 4px; padding: 4px 4px 5px; text-align: center; color: #6b634f; background: var(--ink); cursor: pointer; }
.card { position: relative; display: block; aspect-ratio: 3 / 4; margin-bottom: 4px; border-radius: 3px; overflow: hidden; background: var(--smoke); }
.card img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; display: block; }
.card img.locked { filter: blur(3px) brightness(.28) saturate(.4); transform: scale(1.15); }
.card b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 26px var(--serif); color: rgba(240, 185, 11, .55); }
.ladder li.lock:hover .card b { color: var(--gold); }
.next.nudge { animation: nudge .5s; }
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.rung-name { display: block; font: 600 14px var(--serif); }
.rung-usd { display: block; font-size: 11px; }
.ladder li.done { color: var(--champagne); border-color: rgba(240, 185, 11, .35); }
.ladder li.now { color: #1a1405; background: var(--gold); border-color: var(--gold); box-shadow: 0 0 18px rgba(240, 185, 11, .35); }
.ticker { font: 600 13px ui-monospace, Menlo, monospace; color: var(--champagne); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.next { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.next b { color: var(--gold); }
.bar { display: block; height: 4px; background: var(--smoke); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--rouge), var(--gold)); transition: width .6s; }

.bf { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.bf-card { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; padding: 10px 14px; border-radius: 6px;
  background: linear-gradient(120deg, rgba(226, 85, 122, .16), rgba(240, 185, 11, .08)); border: 1px solid rgba(226, 85, 122, .35); }
.bf-label { font: 600 13px var(--serif); color: var(--rouge); grid-row: span 2; align-self: center; writing-mode: vertical-rl; letter-spacing: .2em; }
.bf-card strong { font: 600 18px/1.3 ui-monospace, Menlo, monospace; color: var(--paper); }
.bf-card span:last-child { color: var(--muted); font-size: 12px; }
.exes { margin-top: 8px; font-size: 12px; color: var(--muted); }
.exes span { font-family: ui-monospace, Menlo, monospace; text-decoration: line-through; margin-left: 8px; color: #7d735c; }

.tabs-box { flex: 1; display: flex; flex-direction: column; min-height: 340px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 10px 0; color: var(--muted); border-bottom: 2px solid transparent; font-family: var(--serif); font-size: 15px; }
.tabs button[aria-selected="true"] { color: var(--gold); border-bottom-color: var(--gold); }
.tab-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat, .feed { list-style: none; margin: 0; padding: 8px 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.chat li { padding: 6px 10px; border-radius: 6px; background: rgba(255, 255, 255, .025); }
.chat li p { margin: 2px 0 0; word-break: break-word; }
.chat li em { font-style: normal; font-size: 11px; color: var(--rouge); }
.chat li.replied { border-left: 2px solid var(--rouge); }
.who { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--champagne); }
.tier { font-size: 11px; margin-left: 6px; padding: 0 6px; border-radius: 3px; background: var(--smoke); color: var(--muted); }
.tier-whale .tier { background: var(--gold); color: #1a1405; }
.tier-fan .tier { background: rgba(240, 185, 11, .2); color: var(--champagne); }
.empty { color: #6b634f; text-align: center; padding: 20px 0; background: none !important; }
.feed li { display: flex; gap: 6px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--smoke); font-size: 13px; flex-wrap: wrap; }
.feed li time { margin-left: auto; color: #6b634f; font-size: 11px; }
.feed li small { color: var(--muted); }
.feed li.buy b { color: #4fd18b; }
.feed li.sell b { color: var(--rouge); }
.feed li.stage, .feed li.boyfriend { color: var(--gold); font-family: var(--serif); }

.say { padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.me:not(:empty) { margin-bottom: 8px; }
.me b { color: var(--rouge); }
.me button { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; }
.say-row, .login-row { display: flex; gap: 8px; }
.say-row input { flex: 1; min-width: 0; background: var(--ink); border: 1px solid var(--smoke); border-radius: 6px; padding: 7px 10px; }
.say-row input:focus { outline: none; border-color: var(--gold); }
.login-row .btn-gold { flex: 1; }
.hint { margin: 8px 0 0; font-size: 12px; color: #7d735c; }
.hint.bad { color: var(--rouge); }

.diary-dates { display: flex; gap: 6px; padding: 10px 14px 0; overflow-x: auto; }
.diary-dates button { background: none; border: 1px solid var(--smoke); border-radius: 4px; padding: 2px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.diary-dates button.on { border-color: var(--gold); color: var(--gold); }
.diary { flex: 1; overflow-y: auto; margin: 10px 14px 14px; padding: 18px 20px; background: var(--paper); color: #2a2418; border-radius: 3px;
  font: 15px/1.9 var(--serif); background-image: repeating-linear-gradient(transparent 0 28px, rgba(43, 38, 28, .08) 28px 29px); }
.diary h3 { margin: 0 0 8px; font-size: 13px; color: #8a7a55; font-weight: 500; }
.diary p { margin: 0 0 .6em; text-indent: 2em; }
.diary .empty { text-indent: 0; color: #8a7a55; }

/* footer */
.foot { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 8px 22px; border-top: 1px solid var(--line); font-size: 12px; color: #7d735c; }
.route { margin-right: 10px; }
.route::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; background: #4fd18b; }
.route.down::before { background: var(--rouge); }
.route.off::before { background: #4a4334; }
#testTools button { background: none; border: 1px dashed rgba(240, 185, 11, .4); color: var(--champagne); border-radius: 4px; padding: 1px 8px; margin-left: 6px; font-size: 12px; }

/* phones and narrow windows: picture on top, cropped to her upper body; panels stack below */
@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 8px 16px; padding: 8px 14px; }
  .top-stats { order: 3; flex-basis: 100%; gap: 14px; font-size: 13px; }
  body { height: auto; min-height: 100vh; }
  .room { display: block; }
  .scene { height: 70vh; min-height: 460px; }
  .figure-wrap { align-items: flex-start; }
  .figure { height: auto; width: 100%; }
  .dialog { bottom: 12px; width: calc(100% - 20px); padding: 22px 16px 12px; min-height: 0; }
  .line { font-size: 17px; }
  .dialog.long .line { font-size: 14px; }
  .side { border-left: 0; }
  .ladder { display: flex; overflow-x: auto; }
  .ladder li { flex: 0 0 76px; }
  .ev-card { height: 52vh; }
  .chat, .feed { max-height: 50vh; }
  .diary { max-height: 60vh; }
}
@media (prefers-reduced-motion: reduce) { .figure, .live-dot { animation: none; } .evolve, .ev-rays, .ev-sparks i { animation-duration: .01s; } }
