:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #0d9488;
  --accent2: #4f46e5;
  --line: #e2e8f0;
  --danger: #dc2626;
  --amtb-red: #e11d48;
  --amtb-red-soft: rgba(225, 29, 72, 0.10);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(13,148,136,0.12), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(79,70,229,0.10), transparent 50%),
    var(--bg);
  padding: 28px 20px 48px;
}
.wrap { width: min(980px, 100%); margin: 0 auto; }
.hidden { display: none !important; }
.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.badge {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(13,148,136,0.10);
  border: 1px solid rgba(13,148,136,0.28);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 16px;
}
h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.2;
  margin-bottom: 12px;
}
h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 46em;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 20px;
  color: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  font: inherit;
  width: 100%;
}
.card:hover, .card:focus-visible {
  background: var(--card-hover);
  border-color: rgba(13,148,136,0.45);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.09);
  outline: none;
}
.card h2 {
  font-size: 1.2rem;
  line-height: 1.35;
}
.meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.meta strong { color: var(--accent); font-weight: 600; }
.chip {
  align-self: flex-start;
  font-size: 12px;
  color: var(--accent2);
  background: rgba(79,70,229,0.08);
  border: 1px solid rgba(79,70,229,0.22);
  border-radius: 999px;
  padding: 4px 10px;
}
.back {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.back:hover { color: var(--text); border-color: var(--accent); }
.series-head {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.series-head h2 {
  font-size: 1.55rem;
  margin-bottom: 10px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
#ep-search {
  flex: 1;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  box-shadow: var(--shadow);
}
#ep-search::placeholder { color: #94a3b8; }
#ep-search:focus {
  outline: none;
  border-color: rgba(13,148,136,0.55);
}
.page-meta { color: var(--muted); font-size: 0.9rem; }
.ep-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ep {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.ep .idx {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
}
.ep .title { line-height: 1.45; font-size: 0.98rem; }
.ep-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.ep-actions a {
  font-size: 12px;
  text-decoration: none;
  color: #ffffff;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}
.ep-actions a.audio {
  background: linear-gradient(90deg, var(--accent2), #6366f1);
  color: #ffffff;
}
.ep-actions a.ext {
  background: #ffffff;
  color: var(--muted);
  border: 1px solid var(--line);
}
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.pager button {
  font: inherit;
  min-width: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.pager button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(13,148,136,0.08);
}
.pager button:disabled { opacity: 0.4; cursor: default; }
.loading, .empty {
  color: var(--muted);
  padding: 28px;
  text-align: center;
}
.foot {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
  text-align: center;
}
.foot a { color: var(--accent); }
@media (max-width: 640px) {
  .ep { grid-template-columns: 40px 1fr; }
  .ep-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
  min-height: 40px;
}
.user-create {
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.user-create:hover { filter: brightness(1.05); }
.user-chip {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.user-chip:hover { border-color: rgba(13,148,136,0.45); }
.user-chip.holding {
  border-color: var(--danger);
  background: #fef2f2;
  color: var(--danger);
}
.user-label {
  font-size: 12px;
  color: var(--muted);
}
.user-chip.holding .user-label { color: var(--danger); }
.user-name {
  font-weight: 700;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-hint {
  font-size: 12px;
  color: var(--muted);
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}
.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
.modal-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.modal-desc {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 14px;
}
#user-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  margin-bottom: 16px;
}
#user-input:focus {
  outline: none;
  border-color: rgba(13,148,136,0.55);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-ghost, .btn-primary {
  font: inherit;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}
.btn-primary {
  border: none;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  font-weight: 600;
}
@media (max-width: 640px) {
  .user-hint { display: none; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  min-height: 40px;
}
.user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}
.user-chip {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.user-chip:hover { border-color: rgba(13,148,136,0.45); }
.user-chip.active {
  border-color: rgba(13,148,136,0.55);
  background: rgba(13,148,136,0.08);
}
.user-chip.holding {
  border-color: var(--danger);
  background: #fef2f2;
  color: var(--danger);
}
.user-chip .user-label {
  font-size: 12px;
  color: var(--muted);
}
.user-chip.active .user-label { color: var(--accent); }
.user-chip.holding .user-label { color: var(--danger); }
.user-chip .user-name {
  font-weight: 700;
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- series playback layout (AMTB-like: video top, catalog below) ---- */

body.is-series .hero { display: none; }
body.is-series {
  padding: 8px 0 28px;
}
body.is-series .wrap {
  width: min(980px, 100%);
  padding: 0 12px;
}
body.is-series .topbar {
  padding: 0 4px;
  margin-bottom: 8px;
}
body.is-series .series-chrome {
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 4px;
  padding-right: 4px;
  background: #fff;
  border-bottom: 1px solid #f3f4f6;
}
body.is-series .foot {
  margin-top: 24px;
}

.series-chrome {
  display: grid;
  grid-template-columns: 44px 1fr 56px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-bottom: 0;
  padding: 4px 0 8px;
  position: sticky;
  top: 0;
  z-index: 35;
  background: #fff;
}
.series-back {
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.series-back:hover { background: rgba(15, 23, 42, 0.06); }
.series-chrome-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  padding: 0 4px;
}
.series-close-player {
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  justify-self: end;
}
.series-close-player:hover { color: var(--text); border-color: var(--accent); }
.series-close-player.hidden { display: none !important; }

.player-panel {
  position: relative;
  z-index: 30;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-bottom: 0;
  background: #000;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
}
body.is-playing .player-panel {
  position: sticky;
  top: 48px; /* under series-chrome when scrolling catalog */
}
#site-player {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(56vw, 420px);
  min-height: 200px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 0;
  background: #000;
  display: block;
  vertical-align: top;
}

/* ---- AMTB videoplay lower UI ---- */

.now-playing-info {
  padding: 16px 12px 12px;
  border-bottom: none;
  margin-bottom: 0;
  background: #fff;
}
.play-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.now-ep-title {
  flex: 1;
  min-width: 0;
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.35;
  color: #111827;
  margin: 0;
  letter-spacing: 0.01em;
}
.subscribe-pill {
  flex-shrink: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--amtb-red);
  background: #fff;
  border: 1px solid var(--amtb-red);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: default;
  opacity: 0.85;
  line-height: 1.2;
  margin-top: 2px;
}
.subscribe-pill:disabled {
  opacity: 0.7;
  cursor: default;
}

.play-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #6b7280;
}
.play-total {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
}
.pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 0.85em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.play-date {
  color: #6b7280;
  white-space: nowrap;
}
.play-place {
  font-size: 0.88rem;
  color: #9ca3af;
  line-height: 1.5;
  margin-bottom: 10px;
}
.play-place:empty { display: none; }
.play-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 6px;
}
.play-stats[hidden] { display: none !important; }
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 5px 12px;
}
.stat-pill strong {
  color: #374151;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.now-ep-meta { display: none !important; }

.series-catalog {
  padding: 0 0 72px;
  background: #fff;
}

/* Tab bar: 文字 + 第N頁 with red underline */
.amtb-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  padding: 0 8px;
}
.tab-text-label {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 12px 14px 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  user-select: none;
}
.tab-pages.pager {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  justify-content: flex-start;
  margin-top: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  flex: 1;
  min-width: 0;
}
.tab-pages.pager button {
  font: inherit;
  flex-shrink: 0;
  min-width: 0;
  padding: 12px 14px 10px;
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  box-shadow: none;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}
.tab-pages.pager button:hover {
  color: #111827;
}
.tab-pages.pager button.active {
  color: var(--amtb-red);
  font-weight: 700;
  border-bottom-color: var(--amtb-red);
  background: transparent;
}
.tab-pages.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.toolbar-subtle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 12px 4px;
}
.toolbar-subtle #ep-search {
  flex: 1;
  min-width: 140px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: none;
  padding: 8px 12px;
  font-size: 0.9rem;
}
.toolbar-subtle .page-meta {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Episode list — simple rows, circular play icon */
.ep-list.amtb-ep-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
.amtb-ep-list .ep {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  grid-template-columns: none;
  background: transparent;
  border: none;
  border-bottom: 1px solid #f3f4f6;
  border-radius: 0;
  border-left: none;
  padding: 14px 16px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.12s ease;
  width: 100%;
  text-align: left;
  font: inherit;
  color: #1f2937;
}
.amtb-ep-list .ep:last-child { border-bottom: 1px solid #f3f4f6; }
.amtb-ep-list .ep:hover { background: #fafafa; }
.amtb-ep-list .ep-play-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid #d1d5db;
  color: #9ca3af;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  background: #fff;
}
.amtb-ep-list .ep-play-icon::before {
  content: "▶";
  margin-left: 1px;
}
.amtb-ep-list .ep .title {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
  font-size: 0.98rem;
  color: #1f2937;
  font-weight: 500;
}
.amtb-ep-list .ep .idx,
.amtb-ep-list .ep-actions {
  display: none !important;
}

/* Current playing = red icon + red title */
.amtb-ep-list .ep.ep-playing {
  background: transparent;
  border-left: none;
  padding-left: 16px;
}
.amtb-ep-list .ep.ep-playing .ep-play-icon {
  border-color: var(--amtb-red);
  color: var(--amtb-red);
  background: var(--amtb-red-soft);
}
.amtb-ep-list .ep.ep-playing .title {
  color: var(--amtb-red);
  font-weight: 700;
}
.amtb-ep-list .ep.ep-resume {
  box-shadow: inset 0 0 0 2px rgba(225, 29, 72, 0.25);
  border-radius: 8px;
}

/* Bottom fixed action bar */
.bottom-action-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: stretch;
  max-width: 980px;
  margin: 0 auto;
}
body.is-series .bottom-action-bar {
  display: flex;
  width: min(980px, 100%);
  left: 50%;
  transform: translateX(-50%);
}
.bab-btn {
  font: inherit;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 10px;
  min-width: 0;
}
.bab-btn:not(:disabled):hover {
  background: #f9fafb;
  color: var(--amtb-red);
}
.bab-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.bab-btn.is-active {
  color: var(--amtb-red);
}
.bab-ico {
  font-size: 1.15rem;
  line-height: 1.2;
}
.bab-label {
  font-size: 11px;
  font-weight: 600;
}

body.is-series .now-playing-info,
body.is-series .series-catalog {
  background: #fff;
}
body.is-series .wrap {
  background: transparent;
}
body.is-series {
  background: #f3f4f6;
  padding-bottom: 0;
}
body.is-series .foot {
  margin-bottom: 64px;
}

@media (max-width: 640px) {
  .now-ep-title { font-size: 1.1rem; }
  .amtb-ep-list .ep { padding: 13px 12px; }
  body.is-playing .player-panel { top: 44px; }
}

.action-sheet-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-sheet-btns > button {
  width: 100%;
  text-align: center;
}
.btn-danger {
  font: inherit;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: #fef2f2;
  color: var(--danger);
  font-weight: 600;
}
.btn-danger:hover { background: #fee2e2; }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}
.continue-meta {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 2px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.top-btn {
  font: inherit;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.top-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary.top-btn {
  border: none;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  font-weight: 600;
}
.btn-danger.top-btn {
  border: 1px solid #fecaca;
  color: var(--danger);
  background: #fff;
  font-weight: 600;
}
.btn-danger.top-btn:not(:disabled):hover {
  background: #fef2f2;
}
#btn-continue-play .continue-meta {
  display: inline;
  margin-left: 6px;
  font-weight: 500;
  opacity: 0.92;
  font-size: 0.85em;
}
@media (max-width: 720px) {
  #btn-continue-play .continue-meta { display: none; }
}

/* Topbar layout: users first, then buttons */
.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 0;
}
.user-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}
.user-list:empty {
  display: none;
}
.top-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
}
.user-hint {
  margin-left: 4px;
}
@media (max-width: 640px) {
  .user-hint { display: inline; }
  .ep { grid-template-columns: 40px 1fr; }
  .ep-actions { grid-column: 1 / -1; justify-content: flex-start; }
  body.is-playing .player-panel { top: 44px; }
  #site-player { min-height: 180px; max-height: 56vw; }
}

/* Play history */
.btn-secondary.top-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  font-weight: 600;
}
.btn-secondary.top-btn:not(:disabled):hover {
  background: #f8fafc;
  border-color: rgba(13, 148, 136, 0.35);
}
.modal-card-wide {
  width: min(560px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
}
.history-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.history-modal-head h3 {
  margin-bottom: 0;
}
.history-close {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 0.9rem;
}
.history-list {
  overflow-y: auto;
  margin: 0 -4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}
.history-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  font-size: 0.95rem;
}
.history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.history-item:hover {
  border-color: rgba(13, 148, 136, 0.45);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.history-item-main {
  min-width: 0;
  flex: 1;
}
.history-item-series {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item-title {
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item-meta {
  font-size: 0.82rem;
  color: var(--muted);
}
.history-item-pct {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  min-width: 3.2em;
  text-align: right;
}
