:root{
  --subtitle-font-size:17px;
  --color-origin:rgba(255,255,255,.88);
  --color-latest:#2dd4bf;
}
*{margin:0;padding:0;box-sizing:border-box}
body{
  font-family:'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans SC',system-ui,sans-serif;
  background:#0d1117;color:#fff;min-height:100vh;
}
.container{width:100%;min-height:100vh;display:flex;flex-direction:column;position:relative}

/* ===== Status bar (replaces old topbar + toast) ===== */
.status-bar{
  display:flex;align-items:center;justify-content:space-between;
  padding:0 16px;height:36px;
  background:rgba(13,17,23,.95);
  border-bottom:1px solid rgba(255,255,255,.05);
  flex-shrink:0;z-index:10;
}
.status-left{display:flex;align-items:center;gap:6px;min-width:70px}
.status-dot{width:8px;height:8px;border-radius:50%;background:rgba(255,255,255,.2);transition:all .3s ease}
.status-dot.good{background:#2dd4bf;box-shadow:0 0 6px rgba(45,212,191,.6),0 0 12px rgba(45,212,191,.3);animation:statusPulse 2s ease infinite}
.status-dot.ok{background:#fbbf24;box-shadow:0 0 6px rgba(251,191,36,.5)}
.status-dot.bad{background:#f87171;box-shadow:0 0 6px rgba(248,113,113,.5)}
@keyframes statusPulse{
  0%,100%{box-shadow:0 0 6px rgba(45,212,191,.6),0 0 12px rgba(45,212,191,.3)}
  50%{box-shadow:0 0 10px rgba(45,212,191,.8),0 0 20px rgba(45,212,191,.4)}
}
.status-latency{font-size:11px;color:rgba(255,255,255,.35);font-family:monospace}
.status-slow-warn{
  font-size:10px;color:#f87171;background:rgba(248,113,113,.15);
  padding:1px 6px;border-radius:6px;font-weight:600;
  animation:slowBlink 1.5s ease infinite;
}
@keyframes slowBlink{0%,100%{opacity:1}50%{opacity:.4}}

.status-center{flex:1;overflow:hidden;height:100%;display:flex;align-items:center;justify-content:center;gap:10px}
.status-logo{height:20px;width:auto;object-fit:contain;flex-shrink:0}
.status-toast-scroll{
  display:flex;align-items:center;gap:20px;
  white-space:nowrap;overflow:hidden;
  font-size:12px;color:rgba(255,255,255,.3);
}
.toast-item{
  animation:toastSlide 6s linear forwards;
  opacity:0;
}
@keyframes toastSlide{
  0%{opacity:0;transform:translateY(8px)}
  8%{opacity:1;transform:translateY(0)}
  75%{opacity:1}
  100%{opacity:0}
}

.status-right{display:flex;align-items:center;min-width:36px;justify-content:flex-end}
.control-link{
  color:rgba(255,255,255,.3);display:flex;align-items:center;
  text-decoration:none;transition:color .2s;
}
.control-link:hover{color:rgba(255,255,255,.6)}

/* Hide old toast container */
.toast-container{display:none}

/* ===== Join ===== */
.join-section{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;gap:14px}
.logo-join{width:72px;height:auto;margin-bottom:8px}
.join-title{font-size:24px;font-weight:600}
.join-desc{font-size:14px;color:rgba(255,255,255,.4)}
.join-form{width:100%;max-width:300px;display:flex;flex-direction:column;gap:14px;margin-top:12px}
.room-input{
  width:100%;padding:15px;border-radius:14px;
  border:1.5px solid rgba(255,255,255,.1);background:rgba(255,255,255,.04);
  color:#fff;font-size:20px;text-align:center;letter-spacing:3px;outline:none;
}
.room-input::placeholder{color:rgba(255,255,255,.2);font-size:14px;letter-spacing:0}
.room-input:focus{border-color:#6C5CE7}
.join-btn{padding:15px;border-radius:14px;border:none;background:linear-gradient(135deg,#6C5CE7,#a855f7);color:#fff;font-size:16px;font-weight:600;cursor:pointer}
.join-btn:active{opacity:.85}
.join-error{color:#ff6b6b;font-size:13px;display:none;text-align:center}

/* ===== Room ===== */
.room-section{flex:1;display:flex;flex-direction:column;background:#0d1117}

/* ===== Subtitle area ===== */
.subtitle-area{
  position:fixed;top:36px;left:0;right:0;bottom:0;
  display:flex;flex-direction:column;
}
.subtitle-half{
  flex:1;min-height:0;
  padding:12px 28px;
  overflow-y:auto;overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  min-height:calc(var(--subtitle-font-size, 17px) * 2 + 24px);
  line-height:1.85;
  font-size:var(--subtitle-font-size);
  mask-image:linear-gradient(to bottom, transparent 0%, #000 8%, #000 88%, transparent 100%);
  -webkit-mask-image:linear-gradient(to bottom, transparent 0%, #000 8%, #000 88%, transparent 100%);
}
.subtitle-divider{height:1px;background:none;flex-shrink:0;position:relative;margin:0 28px}
.subtitle-divider::after{
  content:'';position:absolute;top:0;left:60px;right:0;height:1px;
  background:rgba(255,255,255,.08);
}
.divider-top{height:0;margin:0}
.divider-top::after{display:none}
.divider-label{
  position:absolute;left:-16px;top:50%;transform:translateY(-50%);
  font-size:10px;padding:1px 8px;border-radius:4px;
  font-weight:500;letter-spacing:.3px;
  background:rgba(255,255,255,.06);color:rgba(255,255,255,.3);
  font-family:'Inter',sans-serif;
  white-space:nowrap;z-index:2;
  line-height:16px;
}
.divider-top .divider-label{top:4px;transform:none;left:0}

.sub-line{
  font-size:inherit;
  line-height:inherit;
  color:var(--color-origin);
  transition:color .6s ease, opacity .3s ease;
  position:relative;
  display:inline;
  word-break:break-word;
}
.sub-line.latest{
  color:var(--color-latest);
  animation:latestPulse .8s ease;
}
@keyframes latestPulse{
  0%{opacity:.4}
  40%{opacity:.85}
  100%{opacity:1}
}

/* Bubble latest text also gets the pulse */
.bubble.latest .bubble-zh{
  animation:latestPulse .8s ease;
}

.char-new{
  color:rgba(255,255,255,.15);
  animation:charReveal .8s cubic-bezier(0.25,0.1,0.25,1) forwards;
}
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@keyframes charReveal{0%{color:rgba(255,255,255,.15)}50%{color:var(--color-latest)}100%{color:var(--color-latest)}}

.empty-state{flex:1;display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,.2);font-size:15px}

/* Disclaimer footer */
.disclaimer{
  position:fixed;bottom:0;left:0;right:0;
  padding:8px 20px;
  text-align:center;
  font-size:11px;
  color:rgba(255,255,255,.25);
  background:linear-gradient(transparent,var(--color-bg,#0d1117) 40%);
  z-index:5;
}
.theme-arxiv .disclaimer,.theme-un .disclaimer,.theme-jpm .disclaimer{
  color:rgba(0,0,0,.3);
  background:linear-gradient(transparent,var(--color-bg,#fff) 40%);
}

/* ===== Bubble view ===== */
.bubble-area{
  position:fixed;top:36px;left:0;right:0;bottom:0;
  padding:16px 20px;overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  display:flex;flex-direction:column;gap:12px;
  mask-image:linear-gradient(to bottom,transparent 0%,#000 6%,#000 100%);
  -webkit-mask-image:linear-gradient(to bottom,transparent 0%,#000 6%,#000 100%);
}
.bubble{
  background:linear-gradient(135deg,rgba(108,92,231,.08),rgba(45,212,191,.04));
  border:1px solid rgba(108,92,231,.12);border-radius:16px;
  padding:14px 18px;max-width:85%;flex-shrink:0;
  position:relative;overflow:hidden;
  transition:min-height .4s cubic-bezier(0.25,0.1,0.25,1);
  min-height:50px;
}
.bubble::before{
  content:'';position:absolute;top:0;left:10%;right:10%;height:1px;
  background:linear-gradient(90deg,transparent,rgba(108,92,231,.3),rgba(45,212,191,.3),transparent);
}
.bubble-zh{
  font-size:var(--subtitle-font-size);line-height:1.8;
  color:var(--color-origin);word-break:break-word;
  transition:color .6s ease;
}
.bubble.latest .bubble-zh{color:var(--color-latest)}
.bubble-en{
  font-size:calc(var(--subtitle-font-size) - 2px);line-height:1.7;
  color:rgba(255,255,255,.35);margin-top:6px;word-break:break-word;
  transition:opacity .5s ease, color .6s ease;overflow:hidden;
}
.bubble-en.delayed{opacity:0}
.bubble-en.delayed.reveal{opacity:1}
.bubble-en.reveal{color:var(--color-origin)}
.bubble-en2{
  font-size:calc(var(--subtitle-font-size) - 4px);
  color:rgba(255,255,255,.25);
  margin-top:4px;
}
.bubble-en2.reveal{color:rgba(255,255,255,.5)}
.bubble.latest{border-color:color-mix(in srgb, var(--color-latest) 25%, transparent);box-shadow:0 0 20px color-mix(in srgb, var(--color-latest) 6%, transparent)}
.bubble.latest .bubble-zh{color:var(--color-latest)}
.bubble.latest::before{background:linear-gradient(90deg,transparent,color-mix(in srgb, var(--color-latest) 50%, transparent),transparent)}

/* ===== Arcade / Pop Punk Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

.theme-arcade .sub-line{
  font-family:var(--subtitle-font, inherit);
  text-shadow:var(--arcade-glow, none);
  letter-spacing:1px;
}
.theme-arcade .sub-line.latest{
  text-shadow:0 0 8px var(--color-latest), 0 0 25px rgba(255,60,172,.4), 0 0 50px rgba(255,60,172,.15);
}

/* Arcade scanline overlay */
.theme-arcade .subtitle-area::after,
.theme-arcade .bubble-area::after{
  content:'';position:fixed;top:0;left:0;right:0;bottom:0;
  pointer-events:none;z-index:5;
  background:repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.08) 2px,
    rgba(0,0,0,.08) 4px
  );
}

/* Arcade status bar */
.theme-arcade .status-bar{
  background:rgba(10,0,21,.95);
  border-bottom:var(--arcade-border, 1px solid rgba(255,255,255,.05));
  box-shadow:0 2px 12px rgba(255,60,172,.1);
}

/* Arcade bubbles */
.theme-arcade .bubble{
  background:var(--arcade-bg, linear-gradient(135deg,rgba(108,92,231,.08),rgba(45,212,191,.04)));
  border:var(--arcade-border, 1px solid rgba(108,92,231,.12));
  box-shadow:0 0 12px rgba(255,60,172,.08), inset 0 0 20px rgba(255,60,172,.03);
}
.theme-arcade .bubble::before{
  background:linear-gradient(90deg,transparent,#ff3cac,#784ba0,#00ffaa,transparent);
  height:2px;opacity:.6;
}
.theme-arcade .bubble.latest{
  border-color:rgba(255,60,172,.5);
  box-shadow:0 0 15px rgba(255,60,172,.15), 0 0 40px rgba(255,60,172,.06), inset 0 0 20px rgba(255,60,172,.04);
}
.theme-arcade .bubble-zh{
  font-family:var(--subtitle-font, inherit);
  text-shadow:var(--arcade-glow, none);
  letter-spacing:1px;
}
.theme-arcade .bubble.latest .bubble-zh{
  text-shadow:0 0 8px var(--color-latest), 0 0 25px rgba(255,60,172,.4);
}

/* Arcade char animation — neon flicker */
.theme-arcade .char-new{
  color:rgba(255,60,172,.2);
  animation:arcadeCharReveal .6s steps(3) forwards;
}
@keyframes arcadeCharReveal{
  0%{color:rgba(255,60,172,.2);text-shadow:none}
  33%{color:rgba(255,60,172,.6);text-shadow:0 0 4px rgba(255,60,172,.3)}
  66%{color:var(--color-latest);text-shadow:0 0 6px rgba(255,60,172,.4)}
  100%{color:var(--color-latest);text-shadow:0 0 8px rgba(255,60,172,.3)}
}

/* Arcade divider — neon line */
.theme-arcade .subtitle-divider::after{
  height:2px;
  background:linear-gradient(90deg,transparent 5%,#ff3cac 20%,#784ba0 50%,#00ffaa 80%,transparent 95%);
  box-shadow:0 0 8px rgba(255,60,172,.3);
}

/* Arcade join screen */
.theme-arcade .join-btn{
  background:linear-gradient(135deg,#ff3cac,#784ba0);
  text-shadow:0 0 10px rgba(255,60,172,.5);
  font-family:var(--subtitle-font, inherit);
  letter-spacing:2px;
}
.theme-arcade .room-input{
  border-color:rgba(255,60,172,.3);
  font-family:var(--subtitle-font, inherit);
}
.theme-arcade .room-input:focus{
  border-color:#ff3cac;
  box-shadow:0 0 12px rgba(255,60,172,.2);
}

/* Arcade cursor — MUD terminal style */
.theme-arcade .sub-line.latest::after,
.theme-arcade .bubble.latest .bubble-zh::after{
  content:'█';
  color:var(--color-latest);
  animation:cursorBlink .8s steps(2) infinite;
  margin-left:2px;
  text-shadow:0 0 6px var(--color-latest), 0 0 15px rgba(255,60,172,.4);
}
@keyframes cursorBlink{
  0%,100%{opacity:1}
  50%{opacity:0}
}

/* ===== Bubble status indicator ===== */
.bubble-status{
  position:absolute;
  left:-22px;top:50%;transform:translateY(-50%);
  width:12px;height:12px;
  border-radius:50%;
  opacity:0;
  transition:opacity .3s ease, background .4s ease, border-color .4s ease, box-shadow .4s ease;
}
/* Hidden on latest bubble, visible on finalized */
.bubble.latest .bubble-status{opacity:0}
.bubble:not(.latest) .bubble-status{opacity:1}
.bubble-status.state-pending{opacity:0 !important}

/* State 1: white hollow — draws in with animation */
.bubble-status.state-initial{
  background:transparent;
  border:2px solid rgba(255,255,255,.5);
  box-shadow:none;
  animation:ringAppear .6s ease forwards;
}
@keyframes ringAppear{
  0%{clip-path:polygon(50% 50%,50% 0%,50% 0%,50% 0%,50% 0%,50% 0%)}
  12.5%{clip-path:polygon(50% 50%,50% 0%,100% 0%,100% 0%,100% 0%,100% 0%)}
  25%{clip-path:polygon(50% 50%,50% 0%,100% 0%,100% 50%,100% 50%,100% 50%)}
  37.5%{clip-path:polygon(50% 50%,50% 0%,100% 0%,100% 50%,100% 100%,100% 100%)}
  50%{clip-path:polygon(50% 50%,50% 0%,100% 0%,100% 50%,100% 100%,50% 100%)}
  62.5%{clip-path:polygon(50% 50%,50% 0%,100% 0%,100% 50%,100% 100%,50% 100%,0% 100%)}
  75%{clip-path:polygon(50% 50%,50% 0%,100% 0%,100% 50%,100% 100%,50% 100%,0% 100%,0% 50%)}
  87.5%{clip-path:polygon(50% 50%,50% 0%,100% 0%,100% 50%,100% 100%,50% 100%,0% 100%,0% 50%,0% 0%)}
  100%{clip-path:none}
}

/* State 2: white solid */
.bubble-status.state-refined{
  background:rgba(255,255,255,.8);
  border:2px solid rgba(255,255,255,.8);
  box-shadow:0 0 6px rgba(255,255,255,.2);
  animation:none;clip-path:none;
}

/* State 3: green solid */
.bubble-status.state-final{
  background:#4ade80;
  border:2px solid #4ade80;
  box-shadow:0 0 8px rgba(74,222,128,.3);
  animation:none;clip-path:none;
}

/* Bubble border states */
.bubble.status-initial{border-color:rgba(255,255,255,.15);transition:border-color .4s ease}
.bubble.status-refined{border-color:rgba(255,255,255,.3);transition:border-color .4s ease}
.bubble.status-final{border-color:rgba(74,222,128,.3);transition:border-color .4s ease}

/* Make room for the indicator */
.bubble-area{padding-left:36px !important}
.bubble{position:relative;overflow:visible !important}

/* ===== Cursor (all modes) ===== */
.show-cursor .sub-line.latest::after,
.show-cursor .bubble.latest .bubble-zh::after{
  content:'▎';
  color:var(--color-latest);
  animation:cursorPulse 1s ease infinite;
  margin-left:1px;
  display:inline;
}
/* Custom image cursor — replaces text cursor with image */
.cursor-custom.show-cursor .sub-line.latest::after,
.cursor-custom.show-cursor .bubble.latest .bubble-zh::after{
  content:'';
  display:inline-block;
  width:20px;height:20px;
  vertical-align:middle;
  background:var(--cursor-img) center/contain no-repeat;
  margin-left:4px;
}
@keyframes cursorPulse{
  0%,100%{opacity:1}
  50%{opacity:.2}
}

/* ===== arXiv Academic Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;1,400&family=Source+Code+Pro&display=swap');

.theme-arxiv{color:#1a1a1a}
.theme-arxiv .status-bar{
  background:#fefefe;
  border-bottom:1px solid #ddd;
}
.theme-arxiv .status-latency{color:#888}
.theme-arxiv .status-dot.good{background:#16a34a;box-shadow:0 0 6px rgba(22,163,74,.5)}
.theme-arxiv .control-link{color:#888}
.theme-arxiv .status-slow-warn{color:#dc2626;background:rgba(220,38,38,.08)}

.theme-arxiv .sub-line{
  font-family:'Source Serif 4', Georgia, 'Times New Roman', serif;
  color:var(--arxiv-text, #1a1a1a);
  font-size:calc(var(--subtitle-font-size) + 1px);
  line-height:2;
  letter-spacing:-.2px;
}
.theme-arxiv .sub-line.latest{
  color:var(--color-latest);
  font-weight:600;
}
.theme-arxiv .char-new{
  color:#ccc;
  animation:arxivCharReveal .6s ease forwards;
}
@keyframes arxivCharReveal{
  0%{color:#ccc}
  100%{color:var(--color-latest)}
}

.theme-arxiv .subtitle-divider::after{
  background:#ddd;
}

/* arXiv bubbles */
.theme-arxiv .bubble{
  background:#fff;
  border:1px solid #e5e5e5;
  border-radius:8px;
  box-shadow:0 1px 3px rgba(0,0,0,.06);
}
.theme-arxiv .bubble::before{display:none}
.theme-arxiv .bubble.latest{
  border-color:var(--color-latest);
  border-left:3px solid var(--color-latest);
  box-shadow:0 1px 4px rgba(185,28,28,.08);
}
.theme-arxiv .bubble-zh{
  font-family:'Source Serif 4', Georgia, serif;
  color:#1a1a1a;
  line-height:1.9;
}
.theme-arxiv .bubble.latest .bubble-zh{
  color:var(--color-latest);
  font-weight:600;
}
.theme-arxiv .bubble-en{
  font-family:'Source Serif 4', Georgia, serif;
  color:#666;
  font-style:italic;
}
.theme-arxiv .bubble-en.reveal{color:#333;font-style:italic}

/* arXiv status dots */
.theme-arxiv .bubble-status.state-initial{border-color:#999}
.theme-arxiv .bubble-status.state-refined{background:#666;border-color:#666}
.theme-arxiv .bubble-status.state-final{background:#16a34a;border-color:#16a34a}
.theme-arxiv .bubble.status-initial{border-color:#ddd}
.theme-arxiv .bubble.status-refined{border-color:#999}
.theme-arxiv .bubble.status-final{border-color:#16a34a;border-left:3px solid #16a34a}

/* arXiv cursor */
.theme-arxiv.show-cursor .sub-line.latest::after,
.theme-arxiv.show-cursor .bubble.latest .bubble-zh::after{
  color:var(--color-latest);
}

/* arXiv toast */
.theme-arxiv .toast-item{color:#666}

/* ===== United Nations Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500&display=swap');

.theme-un{color:#1a2a3a}

/* Status bar — white with navy accent */
.theme-un .status-bar{
  background:#fff;
  border-bottom:2px solid #002b5c;
  position:relative;
}
.theme-un .status-bar::after{
  content:'';position:absolute;bottom:-2px;left:0;right:0;height:2px;
  background:linear-gradient(90deg,#002b5c 0%,#002b5c 70%,#d4a843 70%,#d4a843 100%);
}
.theme-un .status-latency{color:#666}
.theme-un .status-dot.good{background:#002b5c;box-shadow:0 0 6px rgba(0,43,92,.5)}
.theme-un .control-link{color:#999}
.theme-un .toast-item{color:#666}
.theme-un .status-slow-warn{color:#b91c1c;background:rgba(185,28,28,.08)}

/* Subtitle lines */
.theme-un .sub-line{
  font-family:'Playfair Display', Georgia, serif;
  color:#1a2a3a;
  font-size:calc(var(--subtitle-font-size) + 1px);
  line-height:2;
  letter-spacing:.3px;
}
.theme-un .sub-line.latest{
  color:#002b5c;
  font-weight:600;
}
.theme-un .char-new{
  color:rgba(0,43,92,.1);
  animation:unCharReveal .8s cubic-bezier(0.25,0.1,0.25,1) forwards;
}
@keyframes unCharReveal{
  0%{color:rgba(0,43,92,.1)}
  50%{color:rgba(0,43,92,.5)}
  100%{color:#002b5c}
}

/* Divider — navy + gold */
.theme-un .subtitle-divider::after{
  height:2px;
  background:linear-gradient(90deg,#002b5c 0%,#002b5c 60%,#d4a843 60%,#d4a843 100%);
}

/* Bubbles */
.theme-un .bubble{
  background:#fff;
  border:1px solid #e0e4e8;
  border-left:3px solid #002b5c;
  border-radius:2px;
  box-shadow:0 1px 4px rgba(0,0,0,.06);
  max-width:90%;
}
.theme-un .bubble::before{display:none}
.theme-un .bubble.latest{
  border-color:#002b5c;
  border-left:3px solid #d4a843;
  box-shadow:0 2px 8px rgba(0,43,92,.08);
}
.theme-un .bubble-zh{
  font-family:'Playfair Display', Georgia, serif;
  color:#1a2a3a;
  font-size:calc(var(--subtitle-font-size) + 1px);
  line-height:1.9;
  letter-spacing:.3px;
}
.theme-un .bubble.latest .bubble-zh{
  color:#002b5c;
  font-weight:600;
}
.theme-un .bubble-en{
  font-family:'Inter', 'Helvetica Neue', sans-serif;
  color:#888;
  font-weight:300;
  letter-spacing:.2px;
}
.theme-un .bubble-en.reveal{color:#444}

/* Status dots */
.theme-un .bubble-status.state-initial{border-color:#002b5c;background:transparent}
.theme-un .bubble-status.state-refined{border-color:#002b5c;background:rgba(0,43,92,.5)}
.theme-un .bubble-status.state-final{border-color:#d4a843;background:#d4a843;box-shadow:0 0 6px rgba(212,168,67,.3)}
.theme-un .bubble.status-initial{border-color:#e0e4e8}
.theme-un .bubble.status-refined{border-color:#002b5c}
.theme-un .bubble.status-final{border-color:#d4a843;border-left:3px solid #d4a843}

/* Cursor */
.theme-un.show-cursor .sub-line.latest::after,
.theme-un.show-cursor .bubble.latest .bubble-zh::after{color:#002b5c}

/* Scrollbar */
.theme-un .subtitle-half::-webkit-scrollbar,
.theme-un .bubble-area::-webkit-scrollbar{width:3px}
.theme-un .subtitle-half::-webkit-scrollbar-thumb,
.theme-un .bubble-area::-webkit-scrollbar-thumb{background:rgba(0,43,92,.15);border-radius:3px}

/* Force background for light themes */
.theme-un,
.theme-un body,
.theme-un .room-section,
.theme-un .subtitle-area,
.theme-un .subtitle-half,
.theme-un .bubble-area{background:#fff !important}

.theme-arxiv,
.theme-arxiv body,
.theme-arxiv .room-section,
.theme-arxiv .subtitle-area,
.theme-arxiv .subtitle-half,
.theme-arxiv .bubble-area{background:#fefefe !important}

/* ===== JPMorgan Financial Theme ===== */
.theme-jpm,
.theme-jpm .room-section,
.theme-jpm .subtitle-area,
.theme-jpm .subtitle-half,
.theme-jpm .bubble-area{background:#f8f8f8 !important}

.theme-jpm{color:#1a1a1a}

.theme-jpm .status-bar{
  background:#fff;
  border-bottom:none;
  box-shadow:0 1px 0 #e5e5e5;
  height:44px;
}
.theme-jpm .status-logo{height:22px}
.theme-jpm .status-latency{color:#999;font-size:10px}
.theme-jpm .status-dot.good{background:#0a3d6b;box-shadow:0 0 6px rgba(10,61,107,.5)}
.theme-jpm .control-link{color:#bbb}
.theme-jpm .toast-item{color:#888}
.theme-jpm .status-slow-warn{color:#dc2626;background:rgba(220,38,38,.06)}

/* Subtitle area offset for taller status bar */
.theme-jpm .subtitle-area{top:44px !important}
.theme-jpm .bubble-area{top:44px !important}

.theme-jpm .sub-line{
  font-family:'Inter', -apple-system, 'Helvetica Neue', sans-serif;
  color:#222;
  font-weight:400;
  line-height:2;
  letter-spacing:-.1px;
}
.theme-jpm .sub-line.latest{
  color:#0a3d6b;
  font-weight:500;
}
.theme-jpm .char-new{
  color:rgba(10,61,107,.1);
  animation:jpmCharReveal .7s ease forwards;
}
@keyframes jpmCharReveal{
  0%{color:rgba(10,61,107,.1)}
  60%{color:rgba(10,61,107,.7)}
  100%{color:#0a3d6b}
}

.theme-jpm .subtitle-divider::after{
  height:1px;
  background:#e0e0e0;
}

/* JPM Bubbles — clean financial card */
.theme-jpm .bubble{
  background:#fff;
  border:1px solid #e8e8e8;
  border-radius:6px;
  box-shadow:0 1px 3px rgba(0,0,0,.04);
  max-width:92%;
}
.theme-jpm .bubble::before{
  background:linear-gradient(90deg,transparent,rgba(10,61,107,.08),transparent);
  height:1px;
}
.theme-jpm .bubble.latest{
  border-color:#0a3d6b;
  box-shadow:0 1px 6px rgba(10,61,107,.06);
}
.theme-jpm .bubble-zh{
  font-family:'Inter', -apple-system, sans-serif;
  color:#222;
  font-weight:400;
  line-height:1.85;
}
.theme-jpm .bubble.latest .bubble-zh{
  color:#0a3d6b;
  font-weight:500;
}
.theme-jpm .bubble-en{
  font-family:'Inter', sans-serif;
  color:#999;
  font-weight:300;
  font-size:calc(var(--subtitle-font-size) - 2px);
}
.theme-jpm .bubble-en.reveal{color:#555}

/* JPM Status dots — navy to gold */
.theme-jpm .bubble-status.state-initial{border-color:#0a3d6b;background:transparent}
.theme-jpm .bubble-status.state-refined{border-color:#0a3d6b;background:rgba(10,61,107,.4)}
.theme-jpm .bubble-status.state-final{border-color:#b8860b;background:#b8860b;box-shadow:0 0 4px rgba(184,134,11,.2)}
.theme-jpm .bubble.status-initial{border-color:#e8e8e8}
.theme-jpm .bubble.status-refined{border-color:#0a3d6b}
.theme-jpm .bubble.status-final{border-color:#b8860b}

/* JPM Cursor */
.theme-jpm.show-cursor .sub-line.latest::after,
.theme-jpm.show-cursor .bubble.latest .bubble-zh::after{color:#0a3d6b}

/* JPM Scrollbar */
.theme-jpm .subtitle-half::-webkit-scrollbar,
.theme-jpm .bubble-area::-webkit-scrollbar{width:2px}
.theme-jpm .subtitle-half::-webkit-scrollbar-thumb,
.theme-jpm .bubble-area::-webkit-scrollbar-thumb{background:rgba(10,61,107,.1);border-radius:2px}

/* JPM Empty state */
.theme-jpm .empty-state{color:#ccc}

/* Pause overlay */
.pause-overlay{
  position:fixed;top:36px;left:0;right:0;bottom:0;z-index:8;
  display:flex;align-items:center;justify-content:center;
  background:var(--color-bg,#0d1117);
  animation:pauseFadeIn .4s ease;
}
.theme-arxiv .pause-overlay,
.theme-un .pause-overlay,
.theme-jpm .pause-overlay{background:#fff}
.pause-content{
  text-align:center;
  color:rgba(255,255,255,.3);
  font-size:20px;
  max-width:80%;
}
.theme-arxiv .pause-content,
.theme-un .pause-content,
.theme-jpm .pause-content{color:rgba(0,0,0,.2)}
.pause-content img{max-width:60vw;max-height:50vh;object-fit:contain}
@keyframes pauseFadeIn{from{opacity:0}to{opacity:1}}

/* ===== Caption bar mode ===== */
.caption-bar{
  position:fixed;bottom:0;left:0;right:0;z-index:6;
  background:var(--cap-bg, rgba(0,0,0,.75));
  backdrop-filter:blur(12px);
  padding:8px 32px 12px;
  display:flex;flex-direction:column;
  gap:2px;
}
/* Each language lane: fixed height, scrolls independently */
.caption-lane{
  overflow:hidden;
  position:relative;
  mask-image:linear-gradient(to bottom, transparent 0%, #000 20%, #000 100%);
  -webkit-mask-image:linear-gradient(to bottom, transparent 0%, #000 20%, #000 100%);
}
.caption-lane-inner{
  display:flex;flex-direction:column;justify-content:flex-end;
  min-height:100%;
  transition:transform .4s cubic-bezier(0.25,0.1,0.25,1);
}
.caption-lane-1{height:calc(var(--cap1-lines, 2) * var(--cap1-size, 22px) * 1.6)}
.caption-lane-2{height:calc(var(--cap2-lines, 2) * var(--cap2-size, 18px) * 1.5)}
.caption-lane-3{height:calc(var(--cap3-lines, 1) * var(--cap3-size, 14px) * 1.4)}
.caption-seg{
  flex-shrink:0;
  word-break:break-word;
}
.caption-lane-1 .caption-seg{
  font-size:var(--cap1-size, 22px);
  font-family:var(--cap1-font, inherit);
  color:var(--cap1-color, var(--color-latest));
  font-weight:500;
  line-height:1.6;
}
.caption-lane-2 .caption-seg{
  font-size:var(--cap2-size, 18px);
  font-family:var(--cap2-font, inherit);
  color:var(--cap2-color, rgba(255,255,255,.7));
  line-height:1.5;
}
.caption-lane-3 .caption-seg{
  font-size:var(--cap3-size, 14px);
  font-family:var(--cap3-font, inherit);
  color:var(--cap3-color, rgba(255,255,255,.4));
  line-height:1.4;
}
.caption-seg.latest{color:var(--cap1-color, var(--color-latest))}
.caption-lane:empty{display:none}

/* ===== Inline status dot (split + caption modes) ===== */
.inline-status{
  display:inline-block;
  width:5px;height:5px;
  border-radius:50%;
  vertical-align:super;
  margin:0 1px;
  transition:all .4s ease;
  flex-shrink:0;
}
/* Prevent line break caused by dot */
.inline-status{
  display:inline-block;
  width:5px;height:5px;
  position:relative;
  top:-0.6em;
  margin:0 1px;
}

/* Fade out older dots: 3rd from last = 30% opacity, beyond = hidden */
.sub-line .inline-status{opacity:1}
.sub-line:nth-last-of-type(4) .inline-status{opacity:.3}
.sub-line:nth-last-of-type(n+5) .inline-status{opacity:0}
.inline-status.state-initial{
  background:transparent;
  border:1.5px solid rgba(255,255,255,.4);
  animation:ringAppear .6s ease forwards;
}
.inline-status.state-refined{
  background:rgba(255,255,255,.7);
  border:1.5px solid rgba(255,255,255,.7);
}
.inline-status.state-final{
  background:#4ade80;
  border:1.5px solid #4ade80;
  box-shadow:0 0 4px rgba(74,222,128,.3);
}
/* Light theme variants */
.theme-arxiv .inline-status.state-initial,
.theme-un .inline-status.state-initial,
.theme-jpm .inline-status.state-initial{border-color:rgba(0,0,0,.2)}
.theme-arxiv .inline-status.state-refined,
.theme-un .inline-status.state-refined,
.theme-jpm .inline-status.state-refined{background:rgba(0,0,0,.4);border-color:rgba(0,0,0,.4)}

/* ===== Language label tags (now on dividers) ===== */
.area-lang-label{display:none !important}
.theme-arxiv .divider-label,.theme-un .divider-label,.theme-jpm .divider-label{
  background:rgba(0,0,0,.04);color:rgba(0,0,0,.25);
}
.theme-arxiv .subtitle-divider::after{left:60px}
.theme-un .subtitle-divider::after{left:60px}
.theme-jpm .subtitle-divider::after{left:60px}
.theme-light .divider-label{background:rgba(0,0,0,.04);color:rgba(0,0,0,.25)}
.theme-light .subtitle-divider::after{background:#e0e0e0}

/* Toggle visibility of lang labels and status dots */
.hide-lang-label .area-lang-label{display:none !important}
.hide-lang-label .divider-label{display:none !important}
.hide-status-dot .inline-status{display:none !important}
.hide-status-dot .bubble-status{display:none !important}

/* Caption line animations */
.cap-slide-in{animation:capSlideIn .4s ease}
.cap-fade-out{animation:capFadeOut .5s ease forwards}
@keyframes capSlideIn{
  from{transform:translateY(100%);opacity:.5}
  to{transform:translateY(0);opacity:1}
}
@keyframes capFadeOut{
  from{opacity:.4}
  to{opacity:0;max-height:0;padding:0;margin:0}
}

/* ===== Light / Eye-care themes ===== */
.theme-light,
.theme-light .room-section,
.theme-light .subtitle-area,
.theme-light .subtitle-half,
.theme-light .bubble-area{background:var(--color-bg,#f5f5f5) !important}
.theme-light{color:#222}
.theme-light .status-bar{background:#fff;border-bottom:1px solid #e5e5e5}
.theme-light .status-latency{color:#999}
.theme-light .status-dot.good{background:#6C5CE7;box-shadow:0 0 6px rgba(108,92,231,.5)}
.theme-light .control-link{color:#bbb}
.theme-light .toast-item{color:#888}
.theme-light .status-slow-warn{color:#dc2626;background:rgba(220,38,38,.08)}
.theme-light .sub-line{color:#222}
.theme-light .char-new{color:rgba(0,0,0,.1);animation:lightCharReveal .7s ease forwards}
@keyframes lightCharReveal{0%{color:rgba(0,0,0,.1)}100%{color:var(--color-latest)}}
.theme-light .subtitle-divider::after{background:#e0e0e0}
.theme-light .bubble{background:#fff;border-color:#e8e8e8;box-shadow:0 1px 3px rgba(0,0,0,.04)}
.theme-light .bubble::before{display:none}
.theme-light .bubble-zh{color:#222}
.theme-light .bubble-en{color:#888}
.theme-light .bubble-en.reveal{color:#444}
.theme-light .bubble.latest{border-color:var(--color-latest)}
.theme-light .bubble.latest .bubble-zh{color:var(--color-latest)}
.theme-light .inline-status.state-initial{border-color:rgba(0,0,0,.2)}
.theme-light .inline-status.state-refined{background:rgba(0,0,0,.4);border-color:rgba(0,0,0,.4)}
.theme-light .area-lang-label{display:none !important}
.theme-light .disclaimer{color:rgba(0,0,0,.3);background:linear-gradient(transparent,var(--color-bg,#f5f5f5) 40%)}
.theme-light .pause-overlay{background:var(--color-bg,#f5f5f5)}
.theme-light .pause-content{color:rgba(0,0,0,.2)}
.theme-light .empty-state{color:rgba(0,0,0,.15)}
