:root {
  --bg: #080b0a;
  --surface: #0e1311;
  --surface-raised: #141a17;
  --surface-soft: #101613;
  --ink: #edf4ef;
  --muted: #9aa8a0;
  --dim: #69776f;
  --line: rgba(237, 244, 239, .1);
  --line-strong: rgba(237, 244, 239, .17);
  --accent: #3ade88;
  --accent-soft: rgba(58, 222, 136, .11);
  --accent-ink: #07130c;
  --warn: #e1a75b;
  --danger: #e4776f;
  --shadow: rgba(0, 16, 9, .34);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

#cxj-visit-counter {
  display: none !important;
}

html {
  min-height: 100%;
  color-scheme: dark;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.auth-locked {
  color-scheme: light;
  background: #eef6ef;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body.auth-locked::before {
  opacity: .045;
}

button,
a,
video {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
video:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  min-height: 44px;
  padding: 11px 15px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: var(--radius);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #15241d;
  background:
    radial-gradient(circle at 24% 18%, rgba(58, 222, 136, .28), transparent 32%),
    radial-gradient(circle at 78% 76%, rgba(48, 126, 96, .18), transparent 30%),
    linear-gradient(135deg, #f7fbf6 0%, #e9f3ec 48%, #dfece4 100%);
}

.auth-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background-image: linear-gradient(rgba(21, 36, 29, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(21, 36, 29, .08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, #15241d 0%, transparent 72%);
}

.auth-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  max-width: 430px;
  gap: 20px;
  padding: 30px;
  border: 1px solid rgba(21, 36, 29, .12);
  border-radius: 8px;
  background: rgba(248, 252, 248, .86);
  box-shadow: 0 24px 70px rgba(30, 74, 48, .22), inset 0 1px 0 rgba(248, 252, 248, .72);
  backdrop-filter: blur(18px);
}

.auth-mark {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(33, 110, 71, .2);
  border-radius: 8px;
  color: #14472d;
  background: #dff5e7;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-kicker,
.auth-copy,
.auth-message {
  margin: 0;
}

.auth-kicker {
  color: #4f6c5d;
  font-size: 13px;
  font-weight: 680;
}

.auth-card h1 {
  margin: 7px 0 9px;
  color: #14231c;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-copy {
  color: #536a5d;
  font-size: 14px;
  line-height: 1.7;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: #22372c;
  font-size: 13px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(21, 36, 29, .16);
  border-radius: 7px;
  color: #14231c;
  background: #f7fbf6;
  box-shadow: inset 0 1px 0 rgba(21, 36, 29, .04);
  font: inherit;
  font-size: 17px;
  outline: 0;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.auth-field input:hover {
  border-color: rgba(33, 110, 71, .32);
}

.auth-field input:focus {
  border-color: #238957;
  background: #fbfdfb;
  box-shadow: 0 0 0 4px rgba(35, 137, 87, .14);
}

.auth-submit {
  min-height: 50px;
  border: 1px solid #176a42;
  border-radius: 7px;
  color: #edf7f0;
  background: #176a42;
  font: inherit;
  font-size: 15px;
  font-weight: 760;
  cursor: pointer;
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.auth-submit:hover {
  background: #125b38;
  box-shadow: 0 12px 26px rgba(23, 106, 66, .24);
  transform: translateY(-1px);
}

.auth-submit:disabled {
  opacity: .58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-message {
  min-height: 20px;
  color: #5a6f62;
  font-size: 13px;
  line-height: 1.5;
}

.auth-message[data-state="error"] {
  color: #a54238;
}

.auth-message[data-state="loading"] {
  color: #176a42;
}

.auth-locked .skip-link {
  display: none;
}

.auth-locked .app {
  max-height: 100dvh;
  overflow: hidden;
  opacity: .14;
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.app {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  padding: 0 24px 48px;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(58, 222, 136, .36);
  border-radius: 6px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand small,
.brand strong {
  display: block;
  letter-spacing: 0;
}

.brand small {
  margin-bottom: 2px;
  color: var(--dim);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.brand strong {
  overflow: hidden;
  font-size: 17px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions,
.player-actions,
.recording-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.service-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(58, 222, 136, .09);
}

.service-state.error i {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(228, 119, 111, .09);
}

.button,
.text-button,
.recording-actions button,
.mini-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-raised);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease;
}

.button,
.text-button,
.recording-actions button,
.mini-link {
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
}

.button:hover,
.text-button:hover,
.recording-actions button:hover,
.mini-link:hover {
  border-color: rgba(58, 222, 136, .5);
  background: #17201b;
}

.button:active,
.text-button:active,
.recording-actions button:active,
.mini-link:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: .52;
  cursor: wait;
}

.live-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(520px, .95fr);
  gap: 44px;
  align-items: end;
  padding: 42px 0 34px;
}

.summary-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signal,
.mode-badge,
.recording-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.signal {
  min-height: 30px;
  padding: 0 11px;
  color: var(--muted);
  background: rgba(237, 244, 239, .07);
}

.signal.live {
  color: var(--accent-ink);
  background: var(--accent);
}

.signal.warn {
  color: #211404;
  background: var(--warn);
}

.signal.error {
  color: #240908;
  background: var(--danger);
}

.summary-time {
  color: var(--dim);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.live-summary h1 {
  max-width: 760px;
  margin: 15px 0 8px;
  font-size: 32px;
  line-height: 1.12;
  font-weight: 780;
  letter-spacing: 0;
  text-wrap: balance;
}

.live-summary p,
.surface-head p,
.player-foot,
.recording p,
.empty-state span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metrics > div {
  min-width: 0;
  padding: 17px 18px 18px;
  border-left: 1px solid var(--line);
}

.metrics > div:first-child {
  border-left: 0;
}

.metrics dt,
.metrics span {
  overflow: hidden;
  color: var(--dim);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metrics dd {
  margin: 7px 0 2px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.metrics dd.date-value {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.75;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(360px, .72fr);
  gap: 14px;
  align-items: stretch;
}

.surface {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 22px 60px var(--shadow);
}

.player-surface,
.danmaku-surface,
.archive-surface,
.archive-player {
  padding: 18px;
}

.surface-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.surface-head h2,
.surface-head p {
  margin: 0;
}

.surface-head h2 {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 720;
  letter-spacing: 0;
}

.surface-head p {
  margin-top: 4px;
  color: var(--dim);
  font-size: 12px;
}

.mode-badge {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.mode-badge[data-state="native"],
.mode-badge[data-state="hlsjs"] {
  color: var(--accent);
  border-color: rgba(58, 222, 136, .25);
  background: var(--accent-soft);
}

.mode-badge[data-state="direct"] {
  color: var(--warn);
  border-color: rgba(225, 167, 91, .25);
  background: rgba(225, 167, 91, .08);
}

.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(237, 244, 239, .08);
  border-radius: 6px;
  background: #050807;
}

.player-frame video,
.archive-player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050807;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 28px;
  color: var(--ink);
  background: rgba(5, 8, 7, .9);
  text-align: center;
}

.standby-icon {
  position: relative;
  width: 38px;
  height: 38px;
  margin-bottom: 15px;
  border: 1px solid rgba(58, 222, 136, .34);
  border-radius: 50%;
}

.standby-icon::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 7px rgba(58, 222, 136, .08);
}

.player-overlay strong {
  font-size: 16px;
}

.player-overlay p {
  max-width: 360px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.player-foot {
  display: flex;
  min-height: 36px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-top: 10px;
}

#playerLatency {
  flex: 0 0 auto;
  color: var(--dim);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.danmaku-surface {
  display: flex;
  max-height: 680px;
  flex-direction: column;
}

.feed-head {
  align-items: flex-start;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.segmented button {
  min-width: 50px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  color: var(--dim);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.active {
  color: var(--accent-ink);
  background: var(--accent);
}

.danmaku-list {
  display: grid;
  min-height: 360px;
  margin-top: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
  scrollbar-color: rgba(237, 244, 239, .22) transparent;
}

.danmaku-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}

.danmaku-item.kind-chat {
  background: rgba(58, 222, 136, .025);
}

.message-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(58, 222, 136, .2);
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 750;
}

.kind-like .message-avatar,
.kind-member .message-avatar,
.kind-social .message-avatar,
.kind-system .message-avatar {
  color: var(--muted);
  border-color: var(--line-strong);
  background: rgba(237, 244, 239, .05);
}

.message-body {
  min-width: 0;
}

.message-meta {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.message-meta strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-meta span {
  flex: 0 0 auto;
  color: var(--dim);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.message-body p {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.message-skeleton,
.archive-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(237, 244, 239, .05);
}

.message-skeleton::after,
.archive-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(237, 244, 239, .055), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s ease-in-out infinite;
}

.message-skeleton {
  height: 66px;
  margin-top: 10px;
}

.message-skeleton.short {
  width: 72%;
}

.archive-surface,
.archive-player,
.danmaku-history {
  margin-top: 14px;
}

.updated-at {
  color: var(--dim);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.archive-list {
  display: grid;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.recording {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}

.recording-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.recording-status {
  min-height: 28px;
  padding: 0 9px;
  color: var(--accent);
  border: 1px solid rgba(58, 222, 136, .2);
  background: var(--accent-soft);
}

.recording-main > div {
  min-width: 0;
}

.recording strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording p {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: 12px;
}

.recording-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.recording-actions button {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent);
}

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

.archive-skeleton {
  height: 66px;
  margin-top: 12px;
}

.archive-player video {
  width: 100%;
  max-height: 680px;
  aspect-ratio: 16 / 9;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.history-content {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.history-stat {
  display: grid;
  min-height: 96px;
  align-content: space-between;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.history-stat span,
.history-stat em,
.history-note,
.history-count {
  color: var(--dim);
  font-size: 12px;
  font-style: normal;
}

.history-stat strong {
  color: var(--ink);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.history-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(237, 244, 239, .025);
}

.history-block h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
}

.activity-chart {
  display: flex;
  height: 190px;
  align-items: end;
  gap: 7px;
  overflow-x: auto;
  padding: 16px 4px 4px;
  scrollbar-color: rgba(237, 244, 239, .22) transparent;
}

.activity-bar {
  position: relative;
  flex: 0 0 24px;
  height: 150px;
  border-radius: 5px;
  background: rgba(237, 244, 239, .055);
}

.activity-bar span {
  position: absolute;
  right: 4px;
  left: 4px;
  min-height: 0;
  border-radius: 3px;
}

.activity-bar .bar-chat {
  bottom: 22px;
  height: var(--chat);
  background: var(--accent);
}

.activity-bar .bar-interaction {
  bottom: calc(22px + var(--chat));
  height: var(--interaction);
  background: var(--warn);
}

.activity-bar small {
  position: absolute;
  right: -8px;
  bottom: 0;
  left: -8px;
  overflow: hidden;
  color: var(--dim);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.breakdown-list {
  display: grid;
  gap: 10px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(90px, 1.3fr) 52px;
  align-items: center;
  gap: 10px;
}

.breakdown-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breakdown-row i {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(237, 244, 239, .07);
}

.breakdown-row i::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value);
  border-radius: inherit;
  background: var(--accent);
}

.breakdown-row strong {
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.history-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.history-controls button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-raised);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.history-controls button.active {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent);
}

.history-count {
  margin-left: auto;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.history-event-list {
  display: grid;
  max-height: 560px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(237, 244, 239, .22) transparent;
}

.history-event {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  min-height: 56px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.history-time {
  color: var(--dim);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.history-event-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.history-event-meta strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-event-meta span {
  flex: 0 0 auto;
  color: var(--dim);
  font-size: 11px;
}

.history-event-body p {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.history-loading {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.history-loading strong {
  color: var(--ink);
  font-size: 14px;
}

.history-loading span {
  position: relative;
  height: 16px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(237, 244, 239, .055);
}

.history-loading span.short {
  width: 62%;
}

.history-loading span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(237, 244, 239, .055), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s ease-in-out infinite;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-content: center;
  justify-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state.wide {
  min-height: 140px;
}

.empty-state strong {
  color: var(--ink);
  font-size: 14px;
}

.empty-state span {
  margin-top: 6px;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 1160px) {
  .live-overview {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .danmaku-surface {
    max-height: none;
  }

  .danmaku-list {
    max-height: 480px;
  }

  .history-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 0 16px 32px;
  }

  .topbar {
    min-height: 72px;
  }

  .service-state {
    display: none;
  }

  .live-overview {
    padding: 30px 0 26px;
  }

  .live-summary h1 {
    font-size: 27px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics > div:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .surface-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .player-actions,
  .segmented {
    width: 100%;
  }

  .player-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mode-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .player-actions .text-button {
    width: 100%;
  }

  .feed-head {
    gap: 12px;
  }

  .recording {
    align-items: stretch;
    flex-direction: column;
  }

  .recording-actions {
    justify-content: flex-start;
  }

  .activity-chart {
    height: 170px;
  }

  .history-controls {
    align-items: stretch;
  }

  .history-count {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .auth-gate {
    align-items: start;
    justify-items: start;
    padding: 18px;
    padding-top: 56px;
  }

  .auth-card {
    width: min(100%, 350px);
    max-width: calc(100vw - 36px);
    gap: 18px;
    padding: 22px;
  }

  .auth-card h1 {
    font-size: 26px;
  }

  .app {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-mark {
    display: none;
  }

  .brand strong {
    font-size: 16px;
  }

  .button {
    padding: 0 12px;
  }

  .live-summary h1 {
    font-size: 24px;
  }

  .metrics > div {
    padding-right: 12px;
    padding-left: 12px;
  }

  .metrics dd {
    font-size: 24px;
  }

  .player-surface,
  .danmaku-surface,
  .archive-surface,
  .archive-player {
    padding: 14px;
  }

  .player-frame {
    margin-top: 14px;
  }

  .player-overlay {
    padding: 16px;
  }

  .standby-icon {
    width: 32px;
    height: 32px;
  }

  .player-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .message-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .message-meta span {
    white-space: normal;
  }

  .recording-main {
    align-items: flex-start;
  }

  .recording-status {
    display: none;
  }

  .recording strong,
  .recording p {
    white-space: normal;
  }

  .recording-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recording-actions > * {
    width: 100%;
  }

  .history-stats {
    grid-template-columns: 1fr;
  }

  .breakdown-row {
    grid-template-columns: minmax(74px, 1fr) minmax(72px, 1fr) 44px;
    gap: 8px;
  }

  .history-event {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 9px;
  }

  .history-event-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
