:root {
  --bg: #0f1116;
  --surface: #181b24;
  --surface-2: #232735;
  --border: #2c3142;
  --text: #e6e8ef;
  --muted: #8b91a4;
  --accent: #ff6b6b;
  --accent-2: #4ea1ff;
  --a-color: #ff7ab6;
  --b-color: #4ea1ff;
  --live: #ff3b3b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  line-height: 1.6;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
  gap: 12px;
}
.site-header .brand { font-size: 18px; font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-header .brand img { width: 39px; height: 39px; border-radius: 9px; }
.site-header .brand .jr-logo { width: 34px; height: 34px; filter: drop-shadow(0 2px 8px rgba(255,138,170,0.25)); }
.site-header .brand .brand-text {
  color: #fff;
  letter-spacing: 0.02em;
}
.nav-desktop { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }
.nav-desktop a { color: var(--muted); padding: 8px 14px; font-size: 14px; border-radius: 8px; font-weight: 600; }
.nav-desktop a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-login { color: var(--text); background: var(--surface-2); padding: 6px 16px; border-radius: 999px; font-size: 14px; }
.nav-login:hover { background: var(--border); text-decoration: none; }
.hamburger {
  display: none; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); width: 40px; height: 40px; border-radius: 10px;
  align-items: center; justify-content: center; cursor: pointer;
}
.hamburger.is-open { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Drawer (mobile slide-down menu) */
.nav-drawer {
  position: fixed; top: 64px; left: 0; right: 0; z-index: 49;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.nav-drawer a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; color: var(--text); font-size: 15px; font-weight: 500;
  border-radius: 10px;
}
.nav-drawer a:hover { background: var(--surface-2); text-decoration: none; }

@media (max-width: 768px) {
  .nav-desktop { display: none; }
  .hamburger { display: inline-flex; }
}
@media (max-width: 480px) {
  .site-header { padding: 10px 14px; }
  .site-header .brand { font-size: 16px; }
  .nav-drawer { top: 56px; }
}

/* Mobile bottom navigation */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px;
  justify-content: space-around;
  backdrop-filter: blur(12px);
}
.mobile-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; color: var(--muted); font-size: 10px;
  text-decoration: none; text-align: center; font-weight: 600;
}
.mobile-nav a:hover { text-decoration: none; color: var(--text); }
.mobile-nav .mobile-nav-primary {
  color: var(--accent);
}
.mobile-nav .mobile-nav-primary .ic {
  background: var(--accent); color: #fff;
  width: 36px; height: 36px; border-radius: 50%;
  padding: 6px; margin-top: -10px;
  box-shadow: 0 4px 12px rgba(255,107,107,0.4);
}
@media (max-width: 768px) {
  .mobile-nav { display: flex; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  #mini-player { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

.container { max-width: none; margin: 0 auto; padding: 32px 24px 100px; }
@media (max-width: 600px) { .container { padding: 20px 14px 110px; } }

.site-footer { color: var(--muted); padding: 48px 24px 24px; border-top: 1px solid var(--border); margin-top: 60px; }
.footer-inner {
  max-width: 920px; margin: 0 auto;
  display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 40px;
}
.footer-brand .footer-logo { display: flex; align-items: center; gap: 12px; color: var(--text); }
.footer-brand .footer-logo:hover { text-decoration: none; }
.footer-brand .footer-logo img { width: 36px; height: 36px; border-radius: 8px; }
.footer-brand .footer-logo .jr-logo { width: 44px; height: 44px; filter: drop-shadow(0 3px 12px rgba(255,138,170,0.22)); }
.footer-brand .footer-logo b { display: block; font-size: 16px; background: linear-gradient(135deg, #fff 0%, #ffb6c8 60%, #ff9a5a 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.footer-brand .footer-logo small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.footer-brand .footer-blurb { font-size: 12px; line-height: 1.7; margin: 14px 0 0; color: var(--muted); }
.footer-nav h4 { color: var(--text); font-size: 13px; margin: 0 0 12px; font-weight: 700; }
.footer-nav a { display: block; color: var(--muted); font-size: 13px; padding: 4px 0; }
.footer-nav a:hover { color: var(--accent); text-decoration: none; }
.footer-bottom { max-width: 920px; margin: 32px auto 0; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; font-size: 11px; }
@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .site-footer { padding: 32px 14px 24px; }
}

.hero { padding: 64px 16px 32px; text-align: center; }
.hero-tag {
  display: inline-block; background: var(--live);
  color: #fff !important; font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  padding: 4px 14px; border-radius: 999px; margin: 0 0 16px;
  animation: heroTagPulse 1.6s infinite;
}
@keyframes heroTagPulse {
  0%, 100% { background-color: var(--live); box-shadow: 0 0 0 0 rgba(255,59,59,0.4); }
  50%      { background-color: #e63333;     box-shadow: 0 0 0 8px rgba(255,59,59,0); }
}
.hero h1 {
  font-size: 38px; margin: 0 auto 16px; max-width: 880px; line-height: 1.35;
  background: linear-gradient(135deg, #fff 0%, #b6c4ff 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero .hero-lead { color: var(--muted); margin: 0 auto 24px; max-width: 720px; font-size: 15px; line-height: 1.9; text-align: center; }
.hero-count {
  display: inline-block; color: #fff; font-weight: 800; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), #ff9a5a);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  padding: 0 2px;
}
.hero-steps {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin: 0 auto 28px; max-width: 720px;
}
.hero-steps span {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 16px; font-size: 13px; color: var(--muted);
}
.hero-steps b { color: var(--accent); margin-right: 6px; }
.hero p { color: var(--muted); margin: 0 0 24px; }
@media (max-width: 600px) {
  .hero { padding: 28px 4px 16px; }
  .hero h1 { font-size: 22px; line-height: 1.4; }
  .hero-lead { font-size: 13px; line-height: 1.7; }
  .hero-count { font-size: 18px; }
  .hero-steps { gap: 6px; }
  .hero-steps span { font-size: 11px; padding: 4px 10px; }
}

/* Search box */
.search-section { margin: 8px 0 20px; }
.search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 20px;
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-icon { color: var(--muted); }
#search-box {
  flex: 1; background: transparent; border: 0; outline: 0; color: var(--text);
  font-size: 16px; min-width: 0;
}
.search-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-submit {
  background: var(--accent); color: #fff; border: 0;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-weight: 700;
}
.search-submit:hover { opacity: .9; }

/* Hero actions block (top page) */
.hero-actions {
  display: grid; gap: 14px; margin: 0 auto 32px; max-width: 640px;
}
.hero-action-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-align: center; font-size: 16px; padding: 14px 24px;
}
.hero-action-primary small { font-size: 11px; opacity: 0.85; }
.hero-search { display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 18px;
}
.hero-search:focus-within { border-color: var(--accent); }
.hero-search input {
  flex: 1; background: transparent; border: 0; outline: 0; color: var(--text);
  font-size: 16px; min-width: 0;
}
.hero-actions-foot { text-align: center; font-size: 12px; margin: 0; }

/* Search results page header */
.search-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: 8px 0 16px; flex-wrap: wrap;
}
.search-header h1 { margin: 0; font-size: 20px; }
.search-header small { font-size: 13px; font-weight: 400; margin-left: 6px; }

/* User chip in header */
.user-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.user-chip:hover { text-decoration: none; border-color: var(--accent); }
.user-credits { font-size: 13px; color: var(--text); }
.user-credits b { color: var(--accent); font-weight: 800; }
.user-credits small { color: var(--muted); margin-left: 2px; font-size: 10px; }
.user-chip .avatar { width: 24px; height: 24px; }

.credit-chip { gap: 6px; padding: 3px; }
.credit-donut { position: relative; width: 36px; height: 36px; flex-shrink: 0; }
.credit-donut svg { width: 100%; height: 100%; }
.credit-donut-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.credit-donut-fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
.credit-donut-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: var(--text); line-height: 1;
}
@media (max-width: 600px) {
  .credit-donut { width: 32px; height: 32px; }
  .credit-donut-num { font-size: 10px; }
}

/* SVG icons */
.ic { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; color: inherit; }
button .ic, a .ic { pointer-events: none; }
.btn-primary .ic, .btn-secondary .ic { margin-right: 6px; vertical-align: -0.22em; }
h1 .ic, h2 .ic, h3 .ic { vertical-align: -0.18em; margin-right: 8px; }
.hero-tag .ic { margin-right: 4px; vertical-align: -0.22em; }
.search-icon .ic { vertical-align: -0.28em; }
.messages-title .ic { margin-right: 6px; }
.tile-plays .ic, .play-count .ic, .history-plays .ic { vertical-align: -0.18em; margin-right: 2px; opacity: .8; }

/* Auth modal */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); cursor: pointer; }
.modal-content {
  position: relative; z-index: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; max-width: 400px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  max-height: calc(100vh - 32px); overflow-y: auto;
}
.modal-close {
  position: absolute; top: 10px; right: 12px; background: transparent; border: 0;
  color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 6px;
}
.modal-close:hover { color: var(--text); }
.modal-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.modal-tabs .tab {
  background: transparent; border: 0; color: var(--muted); padding: 10px 16px;
  cursor: pointer; font-size: 14px; font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.modal-tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }
.modal small { color: var(--muted); margin-left: 4px; font-weight: 400; }
.modal-hint { font-size: 12px; margin: 12px 0; }
.code-sent-msg { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.code-sent-msg b { color: var(--text); }
.code-back { margin-top: 8px; }

/* Auth pages */
.auth-card {
  max-width: 420px; margin: 24px auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
}
.auth-card h1 { margin: 0 0 8px; font-size: 24px; }
.auth-card-inline { margin: 16px 0; max-width: none; }
.auth-form { display: grid; gap: 12px; margin: 16px 0; }
.auth-form label { display: block; color: var(--muted); font-size: 13px; }
.auth-form input {
  width: 100%; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 15px; margin-top: 4px;
}
.auth-form button { margin-top: 8px; }
.auth-or { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0; position: relative; }
.auth-or::before, .auth-or::after {
  content: ''; position: absolute; top: 50%; width: 35%; height: 1px; background: var(--border);
}
.auth-or::before { left: 0; } .auth-or::after { right: 0; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px 16px; }
.g-mark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background: #fff; color: #4285F4; font-weight: 800; border-radius: 50%; font-size: 13px; }
.auth-foot { text-align: center; font-size: 13px; margin-top: 18px; }
.auth-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Profile page */
.profile-head {
  display: flex; align-items: center; gap: 18px;
  padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  flex-wrap: wrap; margin-bottom: 24px;
}
.profile-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; }
.profile-info strong { display: block; font-size: 17px; }
.profile-credits {
  display: flex; flex-direction: column; align-items: center; padding: 6px 18px;
  background: var(--surface-2); border-radius: 10px;
}
.profile-credits strong { font-size: 28px; color: var(--accent); }

/* Plans page */
.plans-hero { text-align: center; padding: 24px 0 16px; }
.plans-hero h1 { font-size: 32px; margin: 0 0 8px; }
.plans-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px; margin: 24px 0;
}
.plan {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px 20px 18px; position: relative; display: flex; flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}
.plan:hover { transform: translateY(-3px); }
.plan-recommended { border-color: var(--accent); box-shadow: 0 8px 24px rgba(255,107,107,0.15); }
.plan-current { border-color: var(--accent-2); }
.plan-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 14px; border-radius: 999px;
}
.plan-badge-current { background: var(--accent-2); }
.plan h2 { margin: 4px 0; font-size: 22px; }
.plan-tagline { margin: 0 0 16px; font-size: 13px; }
.plan-price strong { font-size: 32px; font-weight: 800; color: var(--text); }
.plan-price small { color: var(--muted); margin-left: 4px; }
.plan-features { list-style: none; padding: 0; margin: 18px 0; }
.plan-features li {
  font-size: 13px; padding: 6px 0; color: var(--text); border-bottom: 1px dashed var(--border);
  padding-left: 22px; position: relative;
}
.plan-features li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 800; }
.plan-features li:last-child { border-bottom: 0; }
.plan-per-credit { font-size: 11px; margin: 6px 0 12px; }
.plan-cta { margin-top: auto; text-align: center; }
.plan-cta .btn-primary { width: 100%; }
.plans-foot { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); max-width: 720px; }
.plans-foot h3 { font-size: 14px; margin: 16px 0 6px; }

/* Static informational pages */
.static-page { max-width: 720px; margin: 0 auto; padding: 8px 0 32px; }
.static-page h1 { font-size: 26px; margin: 8px 0 12px; }
.static-page h2 { font-size: 17px; margin: 28px 0 8px; }
.static-page .lead { font-size: 16px; line-height: 1.8; color: var(--text); }
.static-page p { line-height: 1.85; }
.static-page ul { padding-left: 22px; line-height: 1.9; }
.static-page .contact-block { background: var(--surface); border: 1px solid var(--border); padding: 14px 18px; border-radius: 10px; }
.static-page h3 { font-size: 15px; margin: 16px 0 6px; color: var(--text); }
.static-page ol { padding-left: 22px; line-height: 1.9; }
.static-page code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

/* about.php — feature grid */
.about-feature-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 16px 0 8px; }
@media (min-width: 700px) { .about-feature-grid { grid-template-columns: 1fr 1fr 1fr; } }
.about-feature { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.about-feature h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.about-feature p { margin: 0; font-size: 13px; line-height: 1.75; color: var(--muted); }
.about-feature p b { color: var(--text); }

.about-steps { padding-left: 22px; margin: 8px 0 4px; }
.about-steps li { margin: 6px 0; line-height: 1.85; }
.about-steps b { color: var(--accent); }

.about-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0; }
.about-stats > div { flex: 1; min-width: 160px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.about-stats b { display: block; font-size: 22px; color: var(--accent); }
.about-stats span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.about-cta { display: flex; gap: 12px; margin: 28px 0 8px; flex-wrap: wrap; }

/* news.php — announcement list */
.news-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
.news-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.news-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.news-meta time { font-feature-settings: "tnum"; }
.news-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.news-tag-release     { background: rgba(255,107,107,0.15); color: var(--accent); }
.news-tag-feature     { background: rgba(78,161,255,0.15); color: var(--accent-2); }
.news-tag-maintenance { background: rgba(255,154,90,0.18); color: #ff9a5a; }
.news-tag-info        { background: var(--surface-2); color: var(--muted); }
.news-title { font-size: 15px; margin: 4px 0 6px; }
.news-body { font-size: 13px; line-height: 1.8; color: var(--muted); }
.news-body a { color: var(--accent-2); }

/* tokushoho.php — definition list table */
.tokushoho { display: grid; grid-template-columns: 180px 1fr; gap: 8px 24px; margin: 16px 0; }
.tokushoho dt { font-weight: 700; color: var(--muted); font-size: 13px; padding: 12px 0; border-top: 1px solid var(--border); }
.tokushoho dd { margin: 0; padding: 12px 0; border-top: 1px solid var(--border); line-height: 1.75; font-size: 14px; }
.tokushoho dd ul { padding-left: 18px; margin: 4px 0; }
.tokushoho dd li { font-size: 13px; line-height: 1.7; }
@media (max-width: 600px) {
  .tokushoho { grid-template-columns: 1fr; gap: 0; }
  .tokushoho dt { padding-bottom: 0; border-top: 1px solid var(--border); }
  .tokushoho dd { padding-top: 4px; border-top: 0; }
}

/* Contact form */
.cf-page { max-width: 760px; margin: 0 auto; padding: 8px 0 40px; }
.cf-head h1 { margin: 0 0 8px; font-size: 28px; }
.cf-head { margin-bottom: 24px; }
.cf-error {
  background: rgba(255,107,107,0.08); border: 1px solid rgba(255,107,107,0.4);
  color: #ff8b8b; padding: 12px 16px; border-radius: 10px; margin-bottom: 18px;
}
.cf-form { display: grid; gap: 28px; }
.cf-section { display: grid; gap: 14px; }
.cf-section h2 {
  font-size: 14px; margin: 0; color: var(--text); font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.cf-section h2::before {
  content: ''; display: inline-block; width: 4px; height: 16px;
  background: var(--accent); border-radius: 2px;
}
.cf-optional { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.cf-section-optional { opacity: 0.95; }
.cf-section-optional h2::before { background: var(--muted); }

/* Category picker grid */
.cf-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cf-cat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px 14px 12px; background: var(--surface); border: 2px solid var(--border);
  border-radius: 12px; cursor: pointer; text-align: left; color: var(--text);
  font-family: inherit; transition: all 0.15s;
}
.cf-cat:hover { border-color: var(--accent); background: var(--surface-2); }
.cf-cat.is-selected { border-color: var(--accent); background: rgba(255,107,107,0.08); }
.cf-cat-emoji { display: inline-flex; align-items: center; justify-content: center; line-height: 1; color: var(--accent); }
.cf-cat-label { font-size: 13px; font-weight: 700; }
.cf-cat-desc { font-size: 11px; color: var(--muted); }

/* Fields */
.cf-field { display: flex; flex-direction: column; gap: 6px; }
.cf-field-wide { grid-column: 1 / -1; }
.cf-field label {
  font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px;
}
.cf-req { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 4px; }
.cf-field input[type=text], .cf-field input[type=email], .cf-field select, .cf-field textarea {
  width: 100%; padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 15px; font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.cf-field input:focus, .cf-field select:focus, .cf-field textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
}
.cf-field textarea { resize: vertical; min-height: 140px; line-height: 1.7; }
.cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.cf-hint { text-align: right; font-size: 11px; color: var(--muted); }
.cf-counter { color: var(--text); font-weight: 700; }

/* Pills (radio-as-buttons) */
.cf-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cf-pill { position: relative; cursor: pointer; }
.cf-pill input { position: absolute; opacity: 0; pointer-events: none; }
.cf-pill span {
  display: inline-block; padding: 8px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--text);
  transition: all 0.12s;
}
.cf-pill:hover span { border-color: var(--accent); }
.cf-pill input:checked + span {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700;
}

/* On-air toggle */
.cf-toggle {
  display: grid; grid-template-columns: auto auto 1fr; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; user-select: none;
}
.cf-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.cf-toggle-vis {
  width: 44px; height: 24px; background: var(--surface-2); border-radius: 999px;
  position: relative; transition: background 0.18s;
}
.cf-toggle-vis::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; transition: transform 0.18s;
}
.cf-toggle input:checked ~ .cf-toggle-vis { background: var(--accent); }
.cf-toggle input:checked ~ .cf-toggle-vis::before { transform: translateX(20px); }
.cf-toggle-text strong { display: block; font-size: 14px; }
.cf-toggle-text small { color: var(--muted); font-size: 11px; }

.cf-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }
.cf-submit { padding: 14px 32px; font-size: 16px; min-width: 220px; }
.cf-actions p { margin: 0; font-size: 12px; text-align: center; }

/* Thank-you screen */
.cf-thanks { text-align: center; padding: 40px 16px; }
.cf-thanks-icon { display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; color: var(--accent); }
.cf-thanks h1 { margin: 0 0 8px; }

/* Responsive */
@media (max-width: 600px) {
  .cf-page { padding: 0 0 32px; }
  .cf-head h1 { font-size: 22px; }
  .cf-grid { grid-template-columns: 1fr; gap: 12px; }
  .cf-cat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cf-cat { padding: 10px 12px 8px; }
  .cf-cat-label { font-size: 12px; }
  .cf-cat-desc { font-size: 10px; }
  .cf-field input[type=text], .cf-field input[type=email], .cf-field select, .cf-field textarea { font-size: 16px; padding: 11px 12px; }
  .cf-toggle { grid-template-columns: auto 1fr; gap: 10px; }
  .cf-submit { width: 100%; }
}

/* Inline new-program creation */
.new-program-section {
  background: linear-gradient(180deg, rgba(255,107,107,0.06), transparent);
  border: 1px solid var(--border); border-radius: 16px; padding: 18px 18px 14px;
  margin: 0 0 28px;
}
.np-title { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.np-title span { color: var(--accent); font-weight: 800; }
.np-form { display: grid; gap: 12px; }
.np-field { display: block; }
.np-label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.np-form textarea, .np-form select {
  width: 100%; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 15px; font-family: inherit;
}
.np-form textarea { resize: vertical; }
.np-cast { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.np-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .new-program-section { padding: 14px; }
  .np-title { font-size: 14px; }
  .np-cast { grid-template-columns: 1fr; gap: 8px; }
}

/* Personality picker button + modal */
.np-picker {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: inherit; font-size: 14px;
  cursor: pointer; transition: all 0.15s; min-height: 50px;
}
.np-picker:hover { border-color: var(--accent); background: var(--surface); }
.np-picker.is-set { border-color: var(--accent); }
.np-picker .np-picker-avatar { width: 32px; height: 32px; flex-shrink: 0; }
.np-picker .np-picker-name { flex: 1; text-align: left; font-weight: 600; }
.np-picker .np-picker-chevron { color: var(--muted); display: flex; }
.np-picker-modal-content { max-width: 720px; width: 92vw; max-height: 84vh; display: flex; flex-direction: column; }
.np-picker-title { margin: 0 0 12px; font-size: 18px; padding-right: 40px; }
.np-picker-filter-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 14px; margin-bottom: 14px;
  transition: border-color 0.15s;
}
.np-picker-filter-wrap:focus-within { border-color: var(--accent); }
.np-picker-filter-icon { color: var(--muted); display: flex; align-items: center; }
.np-picker-filter {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 14px; padding: 8px 0;
}
.np-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; overflow-y: auto; padding: 2px;
}
.np-picker-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: 12px;
  color: var(--text); font-family: inherit; cursor: pointer;
  transition: all 0.15s; text-align: center;
}
.np-picker-card:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(255,107,107,0.18);
}
.np-picker-card.is-disabled, .np-picker-card:disabled {
  opacity: 0.35; cursor: not-allowed;
}
.np-picker-card-avatar { width: 56px; height: 56px; }
.np-picker-card-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.np-picker-card-desc { font-size: 11px; color: var(--muted); line-height: 1.3; }
.np-picker-card-auto {
  background: linear-gradient(135deg, rgba(255,107,107,0.18), rgba(255,154,90,0.08));
  border-color: var(--accent);
}
.np-picker-card-auto .np-picker-card-avatar { background: var(--accent); color: #fff; }
@media (max-width: 600px) {
  .np-picker-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .np-picker-card { padding: 10px 6px; }
  .np-picker-card-avatar { width: 48px; height: 48px; }
}

.library-count { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 6px; }

/* Breadcrumbs */
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  margin: 10px 0 18px;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); text-decoration: none; }
.breadcrumbs .breadcrumb-sep { color: var(--border); }
.breadcrumbs .breadcrumb-current { color: var(--text); font-weight: 600; }
@media (max-width: 600px) {
  .breadcrumbs { font-size: 12px; margin: 6px 0 12px; }
}

.library-section { margin-top: 48px; }
.library-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.library-header h2 { margin: 0; }
.library-more { color: var(--accent); font-size: 14px; font-weight: 700; }
.library-more:hover { text-decoration: none; opacity: .85; }
.library-more-row { text-align: center; margin: 32px 0 8px; }
.library-more-row .btn-secondary { padding: 12px 28px; }

/* ON AIR section */
.onair-section { margin-top: 32px; }
.onair-section h2 { display: flex; align-items: center; gap: 10px; }
.onair-section h2 small { font-weight: 400; font-size: 14px; }
.onair-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--live); animation: pulse 1.6s infinite;
  box-shadow: 0 0 0 0 var(--live);
}
.onair-section .tile-cover { box-shadow: 0 6px 24px rgba(255,59,59,0.18); }

/* History list (compact) */
.history-section { margin-top: 32px; }
.history-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.history-row {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center;
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); text-decoration: none;
}
.history-row:hover { border-color: var(--accent); text-decoration: none; }
.history-cover { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.history-cover img, .history-cover .tile-cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; object-fit: cover; }
.history-cover .tile-cover-fallback-text { font-size: 18px; }
.history-body { min-width: 0; overflow: hidden; }
.history-body strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-cast { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.history-when { font-weight: 600; color: var(--muted); }
.history-plays { font-size: 11px; color: var(--accent); }
@media (max-width: 480px) {
  .history-row { padding: 6px 10px; gap: 10px; }
  .history-body strong { font-size: 13px; }
}

.btn-primary, .btn-secondary {
  display: inline-block; padding: 10px 20px; border-radius: 999px; border: 0;
  font-weight: 700; cursor: pointer; font-size: 15px;
}
.btn-primary small, .btn-secondary small { font-size: 11px; font-weight: 500; opacity: 0.85; margin-left: 4px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-primary:hover { opacity: .9; }
.btn-secondary:hover { background: var(--border); }

.muted { color: var(--muted); }

.page-head { display:flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.program-list { list-style: none; padding: 0; margin: 16px 0; }
.program-list li { margin-bottom: 8px; }
.program-list a {
  display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text);
}
.program-list a:hover { border-color: var(--accent); text-decoration: none; }
.program-list strong { display: block; margin: 4px 0; font-size: 17px; }
.program-list .cast { color: var(--muted); margin-right: 12px; }
.program-list .theme { color: var(--muted); font-size: 13px; display: block; }

/* Program tiles (podcast-style grid) */
.program-tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px; margin: 20px 0;
}
@media (max-width: 480px) {
  .program-tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tile-meta strong { font-size: 13px; }
  .tile-cast, .tile-theme { font-size: 11px; }
}
.tile { display: block; color: var(--text); text-decoration: none; transition: transform 0.15s ease; }
.tile:hover { text-decoration: none; transform: translateY(-3px); }
.tile-cover {
  aspect-ratio: 1; position: relative; border-radius: 12px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.tile:hover .tile-cover { box-shadow: 0 8px 24px rgba(0,0,0,0.6); }
.tile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-cover-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}
.tile-cover-fallback-text { color: rgba(255,255,255,0.7); font-size: 48px; font-weight: 800; letter-spacing: -0.04em; }
.tile-cover > .status {
  position: absolute; top: 8px; left: 8px; font-size: 11px;
  backdrop-filter: blur(6px); background: rgba(255, 59, 59, 0.85);
}
.tile-cover > .status-ended { background: rgba(40, 44, 60, 0.85); }
.tile-hosts {
  position: absolute; bottom: 8px; right: 8px; display: flex;
}
.tile-hosts .avatar { width: 28px; height: 28px; border: 2px solid var(--surface); margin-left: -8px; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.tile-meta { padding: 10px 4px 0; }
.tile-meta strong { display: block; font-size: 14px; line-height: 1.35; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-cast { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.tile-theme { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-plays { display: inline-block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.tile-duration {
  display: inline-block;
  margin-left: 8px; margin-top: 4px;
  font-size: 11px; font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 8px; border-radius: 999px;
}
.play-count { display: inline-block; margin-left: 10px; font-size: 12px; color: var(--muted); padding: 1px 8px; background: var(--surface-2); border-radius: 999px; }

/* Hashtags */
.program-hashtags { margin: 4px 0 8px; }
.hashtag { display: inline-block; color: var(--accent-2); font-size: 13px; margin-right: 6px; font-weight: 600; }
.hashtag:hover { text-decoration: underline; }

/* Category cloud (categories.php / index section) */
.category-cloud {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0;
}
.category-cloud-compact { gap: 8px; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  text-decoration: none; transition: all 0.15s;
}
.cat-pill:hover { border-color: var(--accent); background: var(--surface-2); text-decoration: none; transform: translateY(-1px); }
.cat-pill .cat-name { color: var(--accent-2); font-weight: 700; }
.cat-pill .cat-count {
  background: var(--surface-2); color: var(--muted); font-size: 11px;
  padding: 1px 8px; border-radius: 999px; font-weight: 600;
}
.cat-pill:hover .cat-count { background: var(--border); }

/* Category filter search box */
.cat-filter-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 999px;
  padding: 4px 18px 4px 18px;
  margin: 12px 0 20px;
  transition: border-color 0.15s;
  max-width: 720px;
}
.cat-filter-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255,107,107,0.12);
}
.cat-filter-icon { color: var(--muted); display: flex; align-items: center; }
.cat-filter-wrap input {
  flex: 1; background: transparent; border: 0; outline: 0; color: var(--text);
  font-size: 16px; padding: 12px 0; min-width: 0;
}
.cat-filter-wrap input::placeholder { color: var(--muted); }
.cat-filter-clear {
  background: var(--surface-2); border: 0; color: var(--muted);
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cat-filter-clear:hover { background: var(--border); color: var(--text); }
.cat-filter-count {
  background: var(--surface-2); color: var(--muted); padding: 4px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
@media (max-width: 600px) {
  .cat-filter-wrap { padding: 4px 14px; gap: 8px; }
  .cat-filter-wrap input { font-size: 16px; padding: 10px 0; }
  .cat-filter-count { font-size: 11px; padding: 3px 10px; }
}

/* Spotify-style category visual grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.category-card {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  aspect-ratio: 1.7;
  padding: 16px 18px 0;
  border-radius: 14px;
  color: #fff; text-decoration: none;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.category-card:hover {
  transform: translateY(-4px);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(0,0,0,0.5);
}
.category-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 50%, rgba(0,0,0,0.25) 100%);
  pointer-events: none;
}
.category-card-head { position: relative; z-index: 1; }
.category-card-head strong {
  display: block; font-size: 22px; font-weight: 800; line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
  letter-spacing: 0.01em;
}
.category-count {
  display: inline-block; margin-top: 6px;
  background: rgba(0,0,0,0.35); padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; backdrop-filter: blur(4px);
}
.category-card-covers {
  display: flex; gap: 4px; justify-content: flex-end;
  margin: 0 -8px -8px 30px;
  transform: rotate(15deg) translateX(20px);
  position: relative; z-index: 1;
}
.category-card-covers img {
  width: 54px; height: 54px; object-fit: cover; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.1);
}
.category-card-covers img:nth-child(2) { margin-top: 8px; }
.category-card-covers img:nth-child(3) { margin-top: 16px; }

@media (max-width: 600px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .category-card { padding: 12px 14px 0; }
  .category-card-head strong { font-size: 18px; }
  .category-card-covers img { width: 42px; height: 42px; }
}
.category-card-wrap { position: relative; }
.cat-follow-btn {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: rgba(0,0,0,0.55); color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px; cursor: pointer;
  transition: all 0.15s; backdrop-filter: blur(4px);
  z-index: 2;
}
.cat-follow-btn:hover { background: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.cat-follow-btn.is-following { background: var(--accent); border-color: var(--accent); }
.cat-follow-btn:disabled { opacity: 0.5; cursor: wait; }

/* Horizontal scroll row for category cards on top page */
.category-row {
  display: flex; flex-direction: row; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  gap: 12px; padding-bottom: 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  margin: 16px 0 0;
}
.category-row::-webkit-scrollbar { height: 8px; }
.category-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.category-row::-webkit-scrollbar-track { background: transparent; }
.category-card-row {
  flex: 0 0 calc((100% - 9 * 12px) / 10);
  max-width: 180px; min-width: 110px;
  aspect-ratio: 1;
  padding: 12px 14px 0;
  scroll-snap-align: start;
}
.category-card-row .category-card-head strong { font-size: 15px; }
.category-card-row .category-count { font-size: 10px; padding: 1px 8px; }
.category-card-row .category-card-covers { margin: 0 -6px -6px 14px; transform: rotate(15deg) translateX(8px); }
.category-card-row .category-card-covers img { width: 36px; height: 36px; }
@media (max-width: 768px) {
  .category-card-row {
    flex: 0 0 calc(32% - 6px);
    min-width: 0; max-width: none;
  }
  .category-card-row .category-card-head strong { font-size: 13px; }
  .category-card-row .category-card-covers img { width: 28px; height: 28px; }
}

/* Horizontal-scroll tile row (used on top page) — fits within full-width container */
.program-tiles-row {
  display: flex !important; flex-direction: row; flex-wrap: nowrap !important;
  grid-template-columns: none !important;
  overflow-x: auto; overflow-y: hidden;
  gap: 12px; padding: 6px 0 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.program-tiles-row::-webkit-scrollbar { height: 8px; }
.program-tiles-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.program-tiles-row::-webkit-scrollbar-track { background: transparent; }
/* Desktop: 8.5 cards visible across parent */
.program-tiles-row .tile {
  flex: 0 0 calc((100% - 8 * 12px) / 8.5);
  max-width: 240px; min-width: 120px;
  scroll-snap-align: start;
}
.program-tiles-row .tile-meta strong { font-size: 13px; }
/* Tablet: 5.5 cards visible */
@media (max-width: 1100px) {
  .program-tiles-row .tile {
    flex: 0 0 calc((100% - 5 * 12px) / 5.5);
    max-width: none;
  }
}
/* Mobile: 2.5 cards visible */
@media (max-width: 768px) {
  .program-tiles-row { gap: 10px; }
  .program-tiles-row .tile {
    flex: 0 0 calc((100% - 2 * 10px) / 2.5);
    min-width: 0; max-width: none;
  }
}

/* Horizontal scroll arrow controls */
.scroll-arrows-wrap { position: relative; }
.scroll-arrow {
  position: absolute; top: 50%;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  background: rgba(20, 20, 28, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  cursor: pointer;
  z-index: 5;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, background 0.15s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}
.scroll-arrow:hover { background: rgba(40, 40, 52, 0.95); }
.scroll-arrow:active { transform: translateY(-50%) scale(0.94); }
.scroll-arrow-prev { left: -8px; }
.scroll-arrow-next { right: -8px; }
.scroll-arrows-wrap.can-prev .scroll-arrow-prev,
.scroll-arrows-wrap.can-next .scroll-arrow-next {
  opacity: 1;
  pointer-events: auto;
}
@media (max-width: 768px) {
  .scroll-arrow { display: none; }
}

.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-right: 8px; }
.status-live { background: var(--live); color: #fff; animation: pulse 1.6s infinite; }
.status-ended { background: var(--surface-2); color: var(--muted); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.card-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
@media (max-width: 480px) {
  .card-list { grid-template-columns: 1fr; }
}
.card-clickable { position: relative; padding: 0; }
.card-link { display: block; padding: 16px; color: var(--text); }
.card-link:hover { text-decoration: none; }
.card-clickable:hover { border-color: var(--accent); }
.card-edit {
  position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--accent-2);
  background: var(--surface-2); padding: 2px 8px; border-radius: 10px; z-index: 2;
}

/* Personality detail page */
.persona-hero { display: flex; gap: 24px; align-items: center; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.persona-cover { flex-shrink: 0; width: 160px; height: 160px; border-radius: 50%; overflow: hidden; background: var(--surface); border: 2px solid var(--border); }
.persona-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.persona-cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 56px; color: var(--muted); }
.persona-info h1 { margin: 0 0 6px; font-size: 28px; }
.persona-bio { margin: 0 0 14px; font-size: 13px; }
.persona-stats { display: flex; gap: 28px; margin-bottom: 14px; }
.persona-stats span { display: flex; flex-direction: column; align-items: flex-start; }
.persona-stats b { font-size: 22px; color: var(--text); }
.persona-stats small { color: var(--muted); font-size: 11px; }
.persona-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.persona-tags h3 { font-size: 14px; margin: 20px 0 8px; color: var(--muted); }
@media (max-width: 600px) {
  .persona-hero { flex-direction: column; text-align: center; gap: 14px; }
  .persona-cover { width: 120px; height: 120px; }
  .persona-stats { justify-content: center; }
  .persona-stats span { align-items: center; }
  .persona-actions { justify-content: center; }
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.card h3 { margin: 0; }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: 12px; margin: 2px 4px 2px 0; color: var(--muted); }

.avatar { display: inline-block; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); flex-shrink: 0; }
.avatar-sm { width: 40px; height: 40px; }
.avatar-md { width: 56px; height: 56px; }
.avatar-lg { width: 120px; height: 120px; }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.avatar-md.avatar-fallback { font-size: 22px; }
.avatar-lg.avatar-fallback { font-size: 48px; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h3 { margin: 0; flex: 1; }

.icon-section { display: flex; gap: 18px; align-items: center; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 18px; }
.icon-preview img, .icon-preview .icon-fallback { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 48px; font-weight: 700; color: var(--muted); }
.icon-actions { flex: 1; display: grid; gap: 8px; }
.icon-actions select { padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.icon-actions .error { color: #ff6b6b; }
.note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.link { color: var(--accent-2); font-size: 13px; }

.form { display: grid; gap: 16px; }
.form label { display: block; font-size: 14px; color: var(--muted); }
.form input[type=text], .form select, .form textarea {
  width: 100%; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 15px; margin-top: 6px;
}
.form textarea { font-family: inherit; resize: vertical; }
.form fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.form legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.form .chk { display: inline-flex; align-items: center; gap: 6px; margin: 4px 12px 4px 0; color: var(--text); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.form-msg { color: var(--muted); font-size: 14px; min-height: 18px; }
.form-msg.error { color: #ff6b6b; }

/* Radio page */
.radio-head { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.radio-head h1 { margin: 8px 0; font-size: 26px; }
.radio-hero { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 12px; }
.radio-cover {
  flex-shrink: 0; width: 200px; height: 200px; border-radius: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.radio-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.radio-cover .tile-cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.radio-info { flex: 1; min-width: 0; }
.radio-share { margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cast-chips { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; }
.cast-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); font-size: 13px; font-weight: 600;
  transition: all 0.15s;
}
.cast-chip:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.cast-chip .avatar-sm { width: 28px; height: 28px; }
.cast-x { color: var(--muted); font-size: 14px; }
.cast-group { display: inline-flex; align-items: center; gap: 6px; }
.follow-mini {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; font-size: 11px; font-weight: 700;
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
  white-space: nowrap;
}
.follow-mini:hover { background: rgba(255,107,107,0.1); }
.follow-mini.is-following {
  background: var(--accent); color: #fff;
}
.follow-mini.is-following:hover {
  background: transparent; color: var(--accent);
  border-color: var(--accent);
}
.follow-mini:disabled { opacity: 0.5; cursor: wait; }
@media (max-width: 600px) {
  .follow-mini { padding: 3px 8px; font-size: 10px; }
}

.btn-follow-program {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; font-size: 14px; font-weight: 700;
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 999px; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
  white-space: nowrap;
}
.btn-follow-program:hover { background: rgba(255,107,107,0.1); transform: translateY(-1px); }
.btn-follow-program.is-following {
  background: var(--accent); color: #fff;
}
.btn-follow-program.is-following:hover {
  background: transparent; color: var(--accent);
}
.btn-follow-program:disabled { opacity: 0.5; cursor: wait; }
.btn-mail {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 14px; font-weight: 700;
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 999px;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-mail:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-mail .mail-badge {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 6px;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--accent); color: #fff;
  border-radius: 999px;
  font-size: 11px; font-weight: 800; line-height: 1;
}
.btn-mail .mail-badge[hidden] { display: none; }
@media (max-width: 600px) {
  .btn-mail { padding: 6px 12px; font-size: 12px; }
  .btn-mail .mail-badge { min-width: 18px; height: 18px; font-size: 10px; }
}

.mail-modal-content { max-width: 560px; width: 92vw; }
.mail-modal-content h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; padding-right: 40px; }
.mail-modal-hint { font-size: 12px; line-height: 1.6; margin-bottom: 16px; }
.mail-modal-notice {
  display: flex; align-items: flex-start; gap: 6px;
  background: rgba(255,154,90,0.12); border: 1px solid rgba(255,154,90,0.4);
  color: #ffb784;
  border-radius: 8px; padding: 10px 12px;
  font-size: 13px; line-height: 1.6;
  margin: 0 0 12px;
}
.mail-modal-content label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
.mail-modal-content input[type=text], .mail-modal-content textarea {
  width: 100%; box-sizing: border-box;
  margin-top: 4px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 14px;
}
.mail-modal-content textarea { resize: vertical; min-height: 100px; }
.mail-modal-content input:focus, .mail-modal-content textarea:focus {
  outline: 0; border-color: var(--accent);
}
.mail-form-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

.profile-name-row { display: inline-flex; align-items: center; gap: 8px; }
.profile-edit-btn { width: 28px; height: 28px; }
.profile-edit-modal-content { max-width: 480px; width: 92vw; }
.profile-edit-modal-content h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; padding-right: 40px; }
.profile-edit-modal-content p { margin: 0 0 12px; font-size: 12px; }
.profile-edit-modal-content label { display: block; font-size: 13px; color: var(--muted); }
.profile-edit-modal-content input {
  width: 100%; box-sizing: border-box; margin-top: 4px;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 14px;
}
.profile-edit-modal-content input:focus { outline: 0; border-color: var(--accent); }
.profile-edit-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* Admin */
.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin: 16px 0 24px;
}
.admin-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px;
}
.admin-stat .muted { font-size: 11px; }
.admin-stat strong { font-size: 22px; font-weight: 800; }
.admin-stat small { font-size: 12px; font-weight: 400; color: var(--muted); }
.admin-menu h2 { margin: 22px 0 10px; font-size: 18px; }
.admin-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.admin-card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 16px; text-decoration: none; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); cursor: pointer; font-family: inherit; font-size: 14px;
  transition: all 0.15s;
}
.admin-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.admin-card:disabled { opacity: 0.5; cursor: wait; }
.admin-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--surface-2); border-radius: 8px; color: var(--accent);
}
.admin-card strong { font-size: 14px; }
.admin-card .muted { font-size: 12px; line-height: 1.5; }
.admin-action-result {
  margin-top: 18px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; white-space: pre-wrap; line-height: 1.55;
  max-height: 320px; overflow: auto;
}
.admin-action-result.running { border-color: var(--accent); color: var(--accent); }
.admin-action-result.ok  { border-color: #4ea1ff; }
.admin-action-result.err { border-color: #ff6b6b; color: #ff9a9a; }
.nav-desktop a.nav-exit-admin { color: var(--accent); }
.nav-desktop a.nav-exit-admin:hover { color: var(--text); }
.balance-table strong { font-size: 16px; }
.balance-table td:nth-child(2) { font-size: 18px; text-align: right; min-width: 120px; }
.balance-table a { color: var(--accent); margin-left: 8px; font-size: 12px; }

.follows-section-title { margin: 28px 0 14px; display: flex; align-items: center; gap: 8px; font-size: 18px; }
.follows-section-title small { font-weight: 400; font-size: 13px; }
.follow-persona-stats { font-size: 12px; margin: 4px 0; }

/* Series episode list on radio.php */
.series-section { margin-top: 32px; }
.series-ep-num {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.75); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.series-now-badge {
  position: absolute; bottom: 8px; left: 8px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800;
  padding: 3px 9px; border-radius: 999px;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px rgba(255,107,107,0.5);
}
.tile-current { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.btn-follow-program .follow-count {
  font-size: 12px; font-weight: 600;
  opacity: 0.8; margin-left: 2px;
}
.btn-follow-program .follow-count:empty { display: none; }
@media (max-width: 600px) {
  .btn-follow-program { padding: 6px 14px; font-size: 12px; }
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: all 0.15s;
}
.icon-btn:hover { background: var(--border); border-color: var(--accent); color: var(--accent); }

/* Collapsible flow details */
.flow-details { margin-top: 12px; }
.flow-details summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); padding: 4px 0;
}
.flow-details summary::-webkit-details-marker { display: none; }
.flow-details summary small { font-size: 12px; }
.flow-details summary .ic { transition: transform 0.18s; }
.flow-details[open] summary .ic { transform: rotate(180deg); }
.flow-details .flow-bar { margin-top: 8px; }

/* Pop-in entrance for newly appended message bubbles */
@keyframes msgPopIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.msg-pop { animation: msgPopIn 0.32s cubic-bezier(0.2, 0.7, 0.3, 1.4); }

/* Progressive character reveal (during live playback) */
.msg-ch { transition: opacity 0.28s ease-out; }
.msg-body.progressive .msg-ch { opacity: 0.18; }
.msg-body.progressive .msg-ch.revealed { opacity: 1; }
@media (max-width: 700px) {
  .radio-cover { width: 140px; height: 140px; }
}
@media (max-width: 520px) {
  .radio-hero { flex-direction: column; gap: 14px; align-items: center; text-align: center; }
  .radio-cover { width: 100%; max-width: 280px; height: auto; aspect-ratio: 1; margin: 0 auto; }
  .radio-info { width: 100%; }
  .radio-head h1 { font-size: 20px; line-height: 1.35; }
  .status-row { justify-content: center; flex-wrap: wrap; }
  .radio-share { justify-content: center; }
  .theme-line { font-size: 13px; }
  .chat-controls { justify-content: center; }
}
.radio-page { max-width: 960px; margin: 0 auto; }
.status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .radio-head h1 { font-size: 20px; }
  .flow-bar { gap: 4px; }
  .flow-item { padding: 3px 8px; font-size: 11px; }
}
.radio-head .status-row { display: flex; align-items: center; gap: 12px; }
.theme-line { color: var(--muted); margin: 6px 0; font-size: 14px; }
.flow-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.flow-item { padding: 4px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--muted); }
.flow-item.done { opacity: .4; }
.flow-item.current { background: var(--accent); color: #fff; border-color: var(--accent); }

.chat { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.messages-header {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; color: var(--text); cursor: pointer; font-family: inherit;
  margin-bottom: 8px; transition: background 0.15s, border-color 0.15s;
}
.messages-header:hover { background: var(--border); border-color: var(--accent); }
.messages-header .messages-title { flex: 1; text-align: left; font-size: 14px; font-weight: 700; }
.messages-header .messages-count {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; min-width: 24px; text-align: center;
}
.messages-header .messages-chevron { transition: transform 0.2s; color: var(--muted); }
.messages-header[aria-expanded="false"] .messages-chevron { transform: rotate(-90deg); }
.messages { max-height: 60vh; overflow-y: auto; padding: 8px; transition: max-height 0.3s ease; }
.messages[hidden] { display: none; }
.msg { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; max-width: 88%; background: transparent; border: 0; padding: 0; }
.msg-a { margin-right: auto; flex-direction: row; }
.msg-b { margin-left: auto; flex-direction: row-reverse; }
.msg .msg-content {
  flex: 1; min-width: 0;
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
}
/* Speech-bubble tail */
.msg .msg-content::before,
.msg .msg-content::after {
  content: ''; position: absolute; top: 14px;
  width: 0; height: 0;
  border-style: solid;
}
.msg-a .msg-content::before {
  left: -10px;
  border-width: 6px 10px 6px 0;
  border-color: transparent var(--border) transparent transparent;
}
.msg-a .msg-content::after {
  left: -8px;
  border-width: 6px 10px 6px 0;
  border-color: transparent var(--surface-2) transparent transparent;
}
.msg-b .msg-content::before {
  right: -10px;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent var(--border);
}
.msg-b .msg-content::after {
  right: -8px;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent var(--surface-2);
}
.msg-b .msg-meta { justify-content: flex-end; }
.msg-b .msg-body { text-align: right; }
@media (max-width: 600px) {
  .msg { max-width: 100%; gap: 8px; }
  .msg .avatar-sm { width: 32px; height: 32px; }
  .msg .msg-content { padding: 10px 12px; border-radius: 14px; }
  .msg .msg-content::before, .msg .msg-content::after { top: 12px; }
}
.msg-meta { display: flex; gap: 12px; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg-a .speaker { color: var(--a-color); font-weight: 700; }
.msg-b .speaker { color: var(--b-color); font-weight: 700; }
.msg-body { white-space: pre-wrap; }
.msg-action { color: var(--muted); font-style: italic; font-size: 0.88em; opacity: 0.7; }
.msg-avatar-link { display: inline-block; flex-shrink: 0; transition: transform 0.15s; }
.msg-avatar-link:hover { transform: scale(1.1); text-decoration: none; }

.thinking { display: flex; align-items: center; gap: 6px; padding: 8px 16px; color: var(--muted); font-size: 13px; }
.thinking .dot { width: 6px; height: 6px; background: var(--muted); border-radius: 50%; animation: bounce 1.2s infinite; }
.thinking .dot:nth-child(2) { animation-delay: .15s; }
.thinking .dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-4px); opacity: 1; } }

.chat-controls { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 12px; flex-wrap: wrap; }

/* Mini-player */
#mini-player {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 100; max-width: calc(100vw - 16px);
}
@media (max-width: 600px) {
  #mini-player { gap: 6px; padding: 6px 10px; }
  #mini-player .mp-link { max-width: 140px; padding-right: 6px; }
  #mini-player .mp-title { max-width: 100px; font-size: 12px; }
  #mini-player .mp-now { display: none; }
  #mini-player .mp-speed { padding: 3px 6px; font-size: 11px; }
  #mini-player .mp-btn { width: 28px; height: 28px; font-size: 13px; }
}
#mini-player[hidden] { display: none; }
#mini-player .mp-link {
  display: inline-flex; align-items: center; gap: 8px; color: var(--text);
  text-decoration: none; padding-right: 8px; border-right: 1px solid var(--border);
  max-width: 360px; overflow: hidden;
}
#mini-player .mp-link:hover { color: var(--accent); text-decoration: none; }
#mini-player .mp-mark { display: inline-flex; align-items: center; color: var(--accent); }
#mini-player .mp-title { font-weight: 700; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 180px; }
#mini-player .mp-now { font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 120px; }
#mini-player .mp-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
#mini-player .mp-btn:hover { background: var(--border); }
#mini-player .mp-speed {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 4px 8px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
#mini-player .mp-menu { position: relative; }
#mini-player .mp-menu-popup {
  position: absolute; bottom: 38px; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: 13px;
}
#mini-player .mp-menu-popup[hidden] { display: none; }
#mini-player .mp-menu-popup label { display: block; color: var(--muted); margin-bottom: 6px; }
#mini-player .mp-menu-popup select {
  width: 100%; padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px;
}

/* Unread bubbles (not yet listened to) — grayed out until played */
.msg-unread .msg-content {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
.msg-unread .msg-body,
.msg-unread .msg-meta,
.msg-unread .speaker { color: var(--muted); opacity: 0.6; }
.msg-unread .avatar { opacity: 0.5; filter: grayscale(0.7); }
.msg-unread .msg-content::after {
  border-color: transparent rgba(255,255,255,0.03) transparent transparent;
}
.msg-b.msg-unread .msg-content::after {
  border-color: transparent transparent transparent rgba(255,255,255,0.03);
}
.msg-unread .msg-content::before {
  border-color: transparent rgba(255,255,255,0.06) transparent transparent;
}
.msg-b.msg-unread .msg-content::before {
  border-color: transparent transparent transparent rgba(255,255,255,0.06);
}

/* Per-message progress bar — only visible while the bubble is actively speaking */
.msg-progress { display: none; position: relative; height: 3px; margin-top: 6px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.msg.speaking .msg-progress { display: block; }
.msg-progress > i { display: block; height: 100%; background: var(--text); width: 0%; transition: width 0.1s linear; opacity: 0.75; }
.msg-duration { font-size: 11px; color: var(--muted); margin-left: 8px; }
.speech-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.speech-toggle select { padding: 4px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.card.stat { padding: 14px 16px; }
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; }

.usage-table { width: 100%; border-collapse: collapse; margin: 12px 0 32px; font-size: 13px; }
.usage-table th, .usage-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
.usage-table th:first-child, .usage-table td:first-child,
.usage-table th:nth-child(2), .usage-table td:nth-child(2) { text-align: left; }
.usage-table th { color: var(--muted); font-weight: 600; background: var(--surface-2); }
.usage-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.usage-table code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

.msg.speaking .msg-content { box-shadow: 0 0 0 3px var(--accent); animation: speakingPulse 1.4s ease-in-out infinite; }
.msg-a.speaking .msg-content { box-shadow: 0 0 0 3px var(--a-color); }
.msg-b.speaking .msg-content { box-shadow: 0 0 0 3px var(--b-color); }
/* Tail outline matches the speaking ring color and thickness so the ヒゲ stays connected */
.msg-a.speaking .msg-content::before { border-color: transparent var(--a-color) transparent transparent; }
.msg-b.speaking .msg-content::before { border-color: transparent transparent transparent var(--b-color); }
.msg-a.speaking .msg-content::after { left: -7px; }
.msg-b.speaking .msg-content::after { right: -7px; }
@keyframes speakingPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
