/* =========================================================
   BuddyOS Content API Demo —— 样式
   轻量手写 CSS，无框架、无构建；移动端优先。
   ========================================================= */

:root {
  --brand: #ff6a00;
  --brand-deep: #e25600;
  --brand-soft: #fff2e8;

  --ink: #1b1e26;
  --ink-2: #565c6b;
  --ink-3: #8b92a3;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;

  --line: #e6e8ee;
  --line-strong: #d5d9e2;

  --ok: #12805c;
  --ok-soft: #e5f6ef;
  --warn: #a86400;
  --warn-soft: #fff4dd;
  --danger: #c03434;
  --danger-soft: #fdecec;
  --info: #2159c9;
  --info-soft: #eaf1ff;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 34, 0.05), 0 8px 24px -12px rgba(20, 24, 34, 0.18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

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

.hint {
  color: var(--ink-3);
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

/* ---------------- 布局 ---------------- */

.app {
  min-height: 100vh;
  padding-bottom: 96px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), #ff9a3c);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(255, 106, 0, 0.8);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand-text small {
  color: var(--ink-3);
  font-size: 11.5px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#keyHint {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30vw;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px clamp(14px, 3vw, 28px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 13.5px;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.tab.active {
  background: var(--brand-soft);
  border-color: #ffd9bd;
  color: var(--brand-deep);
  font-weight: 600;
}

.tab svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.view {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px) clamp(14px, 3vw, 28px) 40px;
}

.banner {
  padding: 10px clamp(14px, 3vw, 28px);
  font-size: 12.8px;
  line-height: 1.55;
  border-bottom: 1px solid transparent;
  background: var(--warn-soft);
  color: #7a4d00;
  border-color: #f2ddb4;
}

.banner strong {
  font-weight: 700;
}

.banner .mono {
  opacity: 0.85;
  word-break: break-all;
}

.banner.danger {
  background: var(--danger-soft);
  color: #8e2b2b;
  border-color: #f6cfcf;
}

/* ---------------- 通用元素 ---------------- */

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

.page-head h1 {
  font-size: clamp(20px, 2.6vw, 26px);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
  max-width: 68ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2,
.card-head h3 {
  margin: 0;
  font-size: 15.5px;
}

.card-head .sub {
  color: var(--ink-3);
  font-size: 12.5px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 550;
  transition: all 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: var(--ink-3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--surface-2);
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--ink-2);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  flex: none;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--ink-3);
}

.icon-btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.icon-btn.small {
  width: 28px;
  height: 28px;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn.small svg {
  width: 13px;
  height: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.badge.live {
  background: var(--ok-soft);
  border-color: #bfe7d8;
  color: var(--ok);
}

.badge.mock {
  background: var(--warn-soft);
  border-color: #f3ddb0;
  color: var(--warn);
}

.badge.plain::before {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}

.chip.ok {
  background: var(--ok-soft);
  border-color: #c9ebdd;
  color: var(--ok);
}

.chip.warn {
  background: var(--warn-soft);
  border-color: #f2ddb4;
  color: var(--warn);
}

.chip.danger {
  background: var(--danger-soft);
  border-color: #f6cfcf;
  color: var(--danger);
}

.chip.info {
  background: var(--info-soft);
  border-color: #d3e0fb;
  color: var(--info);
}

.chip.brand {
  background: var(--brand-soft);
  border-color: #ffd9bd;
  color: var(--brand-deep);
}

/* ---------------- 表单 ---------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field > label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.input,
.select {
  appearance: none;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13.5px;
  min-width: 0;
  color: var(--ink);
}

.select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238b92a3' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.input:focus,
.select:focus {
  outline: 2px solid rgba(255, 106, 0, 0.25);
  border-color: var(--brand);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  padding-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

/* ---------------- 列表 / 卡片 ---------------- */

.item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.item:hover {
  border-color: #f0c09a;
  box-shadow: 0 6px 18px -12px rgba(255, 106, 0, 0.5);
}

.thumb {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: none;
}

.thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-size: 20px;
  font-family: Georgia, serif;
}

.item-body {
  min-width: 0;
  flex: 1;
}

.item-title {
  font-weight: 600;
  font-size: 14.5px;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-desc {
  margin: 0;
  font-size: 12.8px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  align-items: center;
}

.cover-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s;
}

.cover-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cover-card .art {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, #eceff5, #dfe3ec);
  display: block;
}

.cover-card .art.placeholder {
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-family: Georgia, serif;
  font-size: 40px;
}

.cover-card .body {
  padding: 11px 12px 13px;
}

.cover-card .body h3 {
  margin: 0 0 3px;
  font-size: 14px;
  line-height: 1.35;
}

.cover-card .body p {
  margin: 0;
  font-size: 12.3px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- 详情 ---------------- */

.detail-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.detail-art {
  width: 176px;
  aspect-ratio: 1;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: none;
}

.detail-art.placeholder {
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 56px;
  color: var(--ink-3);
  background: linear-gradient(135deg, #eceff5, #dfe3ec);
}

.detail-body {
  min-width: 240px;
  flex: 1;
}

.detail-body h1 {
  margin: 2px 0 6px;
  font-size: clamp(19px, 2.4vw, 24px);
  line-height: 1.3;
}

.detail-body .lede {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 18px;
  margin: 14px 0 0;
}

.kv > div {
  min-width: 0;
}

.kv dt {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1px;
}

.kv dd {
  margin: 0;
  font-size: 13px;
  word-break: break-word;
}

.episode {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

.episode:last-child {
  border-bottom: none;
}

.episode .order {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-2);
  flex: none;
  margin-top: 2px;
}

.episode-body {
  flex: 1;
  min-width: 0;
}

.episode-title {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 3px;
}

.episode-text {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0;
}

.episode-text.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 故事正文 */

.story-text {
  font-size: 15.5px;
  line-height: 1.85;
  color: #2a2f3a;
  max-width: 72ch;
}

.story-text h3 {
  font-size: 16px;
  margin: 26px 0 8px;
  padding-top: 4px;
  color: var(--brand-deep);
  letter-spacing: 0.01em;
}

.story-text h3:first-child {
  margin-top: 4px;
}

.story-text p {
  margin: 0 0 12px;
}

.story-text .dialogue {
  margin: 0 0 12px;
  padding-left: 14px;
  border-left: 3px solid #ffd9bd;
}

.story-text .dialogue .speaker {
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-deep);
  display: block;
  letter-spacing: 0.02em;
}

/* ---------------- 指标 / 表格 / 代码 ---------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.metric .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.metric .value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric .value small {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 4px;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: #edeff4;
  overflow: hidden;
  margin-top: 12px;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #ffa14d);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 620px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data th {
  background: var(--surface-2);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  position: sticky;
  top: 0;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tbody tr:hover {
  background: var(--surface-2);
}

table.data tr.clickable {
  cursor: pointer;
}

.code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: #0f1115;
  color: #e8ebf2;
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow: auto;
  max-height: 460px;
  line-height: 1.6;
  white-space: pre;
  tab-size: 2;
}

.code .k {
  color: #7cc7ff;
}

.code .s {
  color: #a5e8a1;
}

.code .n {
  color: #ffc36b;
}

.code .b {
  color: #ff9ec7;
}

.inline-code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}

/* ---------------- 空 / 加载 / 错误 ---------------- */

.empty {
  padding: 46px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

.skeleton {
  height: 74px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #eef0f4 25%, #f7f8fa 37%, #eef0f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.loading-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 10px;
}

.error-box {
  border: 1px solid #f6cfcf;
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: #8e2b2b;
  font-size: 13px;
}

.error-box .type {
  font-family: var(--mono);
  font-weight: 700;
}

.error-box .rid {
  font-family: var(--mono);
  font-size: 11.5px;
  opacity: 0.75;
  word-break: break-all;
}

.note {
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 12.8px;
  color: var(--ink-2);
}

.note.warn {
  border-color: #f2ddb4;
  background: var(--warn-soft);
  color: #7a4d00;
}

.note.brand {
  border-color: #ffd9bd;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

/* ---------------- 播放器 ---------------- */

.player {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(22, 25, 32, 0.96);
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  z-index: 40;
  backdrop-filter: blur(8px);
}

.player-main {
  min-width: 0;
  flex: 1;
}

.player-title {
  color: #fff;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-sub {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-controls {
  display: flex;
  gap: 6px;
  flex: none;
}

.player .icon-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.player .icon-btn.primary {
  background: var(--brand);
  border-color: var(--brand);
}

.player-progress {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  overflow: hidden;
}

.player-progress .bar {
  height: 100%;
  width: 0;
  background: var(--brand);
}

/* ---------------- Toast / Modal ---------------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 92px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  background: #1b1e26;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.8px;
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.7);
  animation: toast-in 0.18s ease-out;
  word-break: break-word;
}

.toast.err {
  background: #7c1f1f;
}

.toast.ok {
  background: #14503c;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.55);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 16px;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 22px;
  width: min(420px, 100%);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.modal-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.modal-card p {
  margin: 0 0 14px;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ---------------- 音色 / 语音合成 ---------------- */

.voice-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-soft), #ffe3cc);
  color: var(--brand-deep);
  font-weight: 700;
  font-size: 17px;
  flex: none;
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.65;
  font-family: inherit;
}

.char-counter {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.char-counter.warn {
  color: var(--warn);
}

.char-counter.danger {
  color: var(--danger);
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}

.tts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.tts-layout > .card {
  margin-top: 0;
}

.tts-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 42px 12px;
}

.pulse {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.85;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.72);
    opacity: 0.45;
  }
  50% {
    transform: scale(1);
    opacity: 0.95;
  }
}

.tts-quote {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

@media (max-width: 900px) {
  .tts-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------- 移动端 ---------------- */

@media (max-width: 640px) {
  body {
    font-size: 14.5px;
  }

  .topbar {
    padding: 10px 14px;
  }

  .brand-text small {
    display: none;
  }

  #keyHint {
    display: none;
  }

  .detail-head {
    gap: 14px;
  }

  .detail-art {
    width: 104px;
  }

  .view {
    padding-bottom: 20px;
  }

  .metric .value {
    font-size: 21px;
  }

  .player {
    bottom: 10px;
    gap: 8px;
    padding: 9px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
