/* 胖虎音乐台 — 深色主题，视觉对齐 PanghuDSH pm-* 面板 */
:root {
  --pm-accent: #aaa2ff;
  --pm-accent-2: #8c81f0;
  --pm-soft: rgba(170, 162, 255, .12);
  --pm-text: #f5f5f8;
  --pm-text-2: #c0c2cf;
  --pm-text-3: #9b9eaf;
  --pm-line: rgba(226, 225, 255, .12);
  --pm-card: #22232a;
  --pm-sunk: #1b1c23;
  --pm-hover: #30313b;
  --pm-bg: #18191f;
  --pm-green: #6bd3a6;
  --pm-red: #ef8d8d;
  --pm-amber: #e2b66d;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--pm-bg);
  color: var(--pm-text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--pm-accent); }
:focus-visible { outline: 2px solid var(--pm-accent); outline-offset: 2px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 15% -10%, rgba(124, 116, 221, .18), transparent 60%),
    radial-gradient(700px 420px at 90% 110%, rgba(154, 90, 208, .14), transparent 60%),
    var(--pm-bg);
}
.login-card {
  width: min(100%, 400px);
  padding: 36px 34px 30px;
  border: 1px solid var(--pm-line);
  border-radius: 18px;
  background: var(--pm-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.login-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: linear-gradient(140deg, #746df0, #a168db);
  color: #fff;
  box-shadow: 0 8px 24px rgba(93, 79, 221, .3);
}
.login-mark svg { width: 26px; height: 26px; }
.login-card h1 { margin: 0; font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.login-sub { margin: 6px 0 24px; color: var(--pm-text-3); font-size: 13px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; margin-bottom: 6px; color: var(--pm-text-2); font-size: 12px; font-weight: 600; }
.login-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--pm-line);
  border-radius: 11px;
  background: var(--pm-sunk);
  color: var(--pm-text);
  font-size: 14px;
}
.login-field input:focus-visible { border-color: var(--pm-accent); outline: none; }
.login-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--pm-red);
  border-radius: 8px;
  background: rgba(239, 111, 111, .1);
  color: var(--pm-red);
  font-size: 13px;
}
.login-hint { margin: 16px 0 0; color: var(--pm-text-3); font-size: 12px; line-height: 1.6; }

/* ---------- 主框架 ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 10px clamp(16px, 3.2vw, 52px);
  border-bottom: 1px solid var(--pm-line);
  background: #1b1c22;
}
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: linear-gradient(140deg, #746df0, #a168db);
  color: #fff;
}
.mark svg { width: 18px; height: 18px; }
.title { margin: 0; font-size: 16px; font-weight: 730; }
.sub { margin: 2px 0 0; color: var(--pm-text-3); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.who { color: var(--pm-text-2); font-size: 13px; white-space: nowrap; }
.who b { color: var(--pm-text); }

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 1480px);
  margin: 16px auto 0;
  padding: 0 clamp(16px, 3.2vw, 52px);
}
.tabs button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--pm-line);
  border-radius: 13px;
  background: var(--pm-card);
  color: var(--pm-text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
  transition: border-color .15s, background .15s;
}
.tabs button strong { font-size: 14px; font-weight: 700; }
.tabs button span { color: var(--pm-text-3); font-size: 11px; }
.tabs button:hover { border-color: rgba(170, 162, 255, .4); }
.tabs button[data-active="true"] {
  border-color: rgba(170, 162, 255, .63);
  background: linear-gradient(110deg, rgba(112, 103, 209, .25), rgba(66, 62, 105, .19));
  box-shadow: inset 3px 0 var(--pm-accent), 0 6px 18px rgba(40, 35, 87, .16);
}
.tabs button[data-active="true"] span { color: #c8c3ff; }

.workspace { width: min(100%, 1480px); margin: 0 auto; padding: 20px clamp(16px, 3.2vw, 52px) 64px; }
.heading { margin-bottom: 16px; }
.heading h2 { margin: 0; font-size: 25px; font-weight: 750; letter-spacing: -.02em; }
.heading p { margin: 5px 0 0; color: var(--pm-text-2); font-size: 13px; line-height: 1.5; }

/* ---------- 面板/控件 ---------- */
.surface {
  padding: 22px;
  border: 1px solid var(--pm-line);
  border-radius: 16px;
  background: var(--pm-card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .08);
}
.flow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(295px, .72fr); gap: 20px; align-items: start; }
.flow-main, .flow-side { min-width: 0; }
.flow-side {
  padding: 19px;
  border: 1px solid var(--pm-line);
  border-radius: 13px;
  background: var(--pm-sunk);
}
.step { margin: 0 0 12px; font-size: 15px; font-weight: 710; }
.step-caption { margin: 0 0 16px; color: var(--pm-text-2); font-size: 13px; line-height: 1.6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid rgba(226, 225, 255, .16);
  border-radius: 10px;
  background: transparent;
  color: var(--pm-text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:not(:disabled):hover { background: var(--pm-hover); border-color: rgba(170, 162, 255, .5); }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn:disabled { opacity: .44; filter: saturate(.45); cursor: not-allowed; }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(105deg, #6768de, #8665d7);
  color: #fff;
  font-weight: 730;
  box-shadow: 0 7px 18px rgba(67, 55, 158, .18);
}
.btn.primary:not(:disabled):hover { background: linear-gradient(105deg, #7879ee, #9875e6); }
.btn.primary:disabled { background: #55536f; color: #dedde8; box-shadow: none; }
.btn.block { width: 100%; min-height: 46px; margin-top: 18px; font-size: 15px; }
.btn.copied { background: var(--pm-green); border-color: var(--pm-green); color: #10131a; }

.input, .search-input, select.input {
  min-width: 0;
  border: 1px solid var(--pm-line);
  border-radius: 11px;
  background: var(--pm-sunk);
  color: var(--pm-text);
  font-size: 14px;
}
.search-input { height: 40px; padding: 0 14px; }
.input:focus-visible, .search-input:focus-visible, select.input:focus-visible { border-color: var(--pm-accent); outline: none; }
textarea.input {
  display: block;
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 14px 15px;
  line-height: 1.6;
}
.char-count { padding: 3px 13px 10px; color: var(--pm-text-3); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.toolbar .search-input { flex: 1 1 230px; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.chip-label { flex: none; color: var(--pm-text-3); font-size: 12px; font-weight: 700; margin-right: 2px; }
.chip {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--pm-hover);
  color: var(--pm-text-2);
  font-size: 12px;
  cursor: pointer;
}
.chip:hover { border-color: rgba(170, 162, 255, .4); color: var(--pm-text); }
.chip.on { border-color: var(--pm-accent); background: var(--pm-soft); color: var(--pm-text); }

.mode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.mode button {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 12px 36px 12px 14px;
  border: 1px solid var(--pm-line);
  border-radius: 11px;
  background: var(--pm-sunk);
  text-align: left;
  cursor: pointer;
}
.mode button strong { font-size: 14px; font-weight: 680; }
.mode button small { color: var(--pm-text-2); font-size: 12px; line-height: 1.4; }
.mode button::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 15px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--pm-text-3);
  border-radius: 50%;
}
.mode button[data-selected="true"] {
  border-color: var(--pm-accent);
  background: linear-gradient(110deg, rgba(125, 116, 221, .22), rgba(125, 116, 221, .09));
  box-shadow: inset 0 0 0 1px rgba(170, 162, 255, .18);
}
.mode button[data-selected="true"]::after { border: 4px solid var(--pm-accent); background: #fff; }
.mode button:disabled { opacity: .44; cursor: not-allowed; }
.mode button:disabled::after { opacity: .45; }
.mode button:not(:disabled):hover { border-color: var(--pm-accent); }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pm-soft);
  color: var(--pm-accent);
  font-size: 12px;
  font-weight: 650;
}
.tag.green { background: rgba(107, 211, 166, .14); color: var(--pm-green); }
.tag.amber { background: rgba(226, 182, 109, .14); color: var(--pm-amber); }
.tag.dim { background: var(--pm-hover); color: var(--pm-text-3); font-weight: 500; }

.status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0 15px;
  color: var(--pm-text-2);
  font-size: 13px;
}
.status-line::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pm-text-3); }
.status-line[data-state="ready"]::before { background: var(--pm-green); }
.status-line[data-state="busy"]::before { background: var(--pm-amber); animation: pulse 1.2s infinite; }
.status-line[data-state="off"]::before { background: var(--pm-red); }

.error-box {
  display: flex;
  gap: 8px;
  margin: 14px 0 0;
  padding: 11px 13px;
  border-left: 3px solid #ed8383;
  border-radius: 8px;
  background: rgba(239, 111, 111, .1);
  color: var(--pm-red);
  font-size: 13px;
  line-height: 1.5;
}
.hint { margin: 10px 0 0; color: var(--pm-text-3); font-size: 12px; line-height: 1.5; }
.action-hint { margin: 7px 0 0; color: var(--pm-text-3); font-size: 12px; }
.loading-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--pm-text-2);
  font-size: 13px;
}
.loading-line::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--pm-line);
  border-top-color: var(--pm-accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 115px;
  padding: 20px;
  border: 1px dashed rgba(170, 162, 255, .22);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(170, 162, 255, .09), rgba(170, 162, 255, .025));
  color: var(--pm-text-2);
  font-size: 13px;
  line-height: 1.55;
}
.empty strong { display: block; margin-bottom: 4px; color: var(--pm-text); font-size: 15px; }

.result-card {
  margin-top: 12px;
  padding: 15px;
  border: 1px solid rgba(170, 162, 255, .16);
  border-radius: 11px;
  background: rgba(170, 162, 255, .08);
}
.result-card strong { display: block; overflow-wrap: anywhere; font-size: 15px; }
.result-card audio { width: 100%; height: 42px; margin: 12px 0 6px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.feedback { margin: 10px 0 0; color: var(--pm-green); font-size: 13px; }

/* ---------- 卡片网格（音效素材 / 云端库） ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}
.card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  align-content: start;
  min-height: 65px;
  padding: 11px 12px;
  border: 1px solid rgba(226, 225, 255, .05);
  border-radius: 10px;
  background: var(--pm-sunk);
  transition: background .15s, border-color .15s;
}
.card:hover { background: var(--pm-hover); }
.card[data-preview="true"] { border-color: var(--pm-accent); background: var(--pm-soft); box-shadow: inset 3px 0 var(--pm-accent); }
.card-name {
  grid-column: 1;
  overflow: hidden;
  color: var(--pm-text);
  font-size: 14px;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-name small { display: block; color: var(--pm-text-3); font-size: 11px; font-weight: 500; }
.card-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.card-dur { grid-column: 2; grid-row: 1; color: var(--pm-amber); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.card-actions .btn { min-height: 30px; padding: 3px 10px; font-size: 12px; }
.card-actions audio { flex: 1; height: 30px; min-width: 0; }

/* ---------- 音色列表 ---------- */
.voice-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.voice-head .search-input { flex: 1 1 180px; height: 36px; }
.voice-count { color: var(--pm-text-3); font-size: 12px; white-space: nowrap; }
.voice-list {
  max-height: 330px;
  overflow: auto;
  border: 1px solid var(--pm-line);
  border-radius: 12px;
  background: var(--pm-sunk);
  padding: 6px;
}
.voice-group { margin: 8px 6px 3px; color: var(--pm-text-3); font-size: 12px; font-weight: 700; }
.voice-row { display: flex; align-items: center; gap: 6px; padding: 3px; border-radius: 9px; }
.voice-row:hover { background: var(--pm-hover); }
.voice-row[data-selected="true"] { background: var(--pm-soft); }
.voice-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pm-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.voice-pick small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pm-text-3); font-size: 11px; font-weight: 500; }
.voice-actions { display: flex; flex: none; gap: 4px; }
.voice-actions .btn { min-height: 28px; padding: 2px 9px; font-size: 12px; }
.voice-fav[data-fav="true"] { color: #f4c95d; }
.voice-note-edit { display: flex; gap: 5px; margin: 2px 6px 6px; }
.voice-note-edit input {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--pm-line);
  border-radius: 8px;
  background: var(--pm-bg);
  font-size: 12px;
}
.voice-current { margin: 0 0 8px; color: var(--pm-text-2); font-size: 12px; }
.voice-current b { color: var(--pm-text); }

/* ---------- BGM 会话/作品 ---------- */
.pending {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid rgba(226, 182, 109, .42);
  border-radius: 12px;
  background: rgba(226, 182, 109, .07);
}
.pending strong { font-size: 14px; color: var(--pm-amber); }
.pending p { margin: 0; color: var(--pm-text-2); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.pending-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pending-check { display: flex; align-items: flex-start; gap: 8px; color: var(--pm-text-2); font-size: 12px; line-height: 1.5; }
.pending-check input { margin-top: 2px; accent-color: var(--pm-accent); }

.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 3px 0 15px; }
.results-head h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 20px; }
.results-head p { margin: 5px 0 0; color: var(--pm-text-2); font-size: 13px; }
.count-badge { padding: 2px 8px; border-radius: 999px; background: var(--pm-soft); color: var(--pm-accent); font-size: 12px; }

.session { padding: 17px; margin-bottom: 14px; border: 1px solid var(--pm-line); border-radius: 16px; background: var(--pm-card); }
.session-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.session-prompt { margin: 11px 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { color: var(--pm-text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.clips { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.clip {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--pm-line);
  border-radius: 11px;
  background: var(--pm-sunk);
}
.clip-disc {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(145deg, #5a54dc, #9a5ad0);
  color: #fff;
  font-size: 19px;
}
.clip[data-status="failed"] .clip-disc { background: var(--pm-hover); color: var(--pm-text-3); }
.clip-main { min-width: 0; }
.clip-title { overflow: hidden; font-size: 14px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.clip-status { display: inline-flex; align-items: center; gap: 7px; margin-top: 5px; color: var(--pm-text-2); font-size: 12px; }
.clip-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pm-accent); animation: pulse 1.4s ease-in-out infinite; }
.clip[data-status="complete"] .clip-status::before { background: var(--pm-green); animation: none; }
.clip[data-status="failed"] .clip-status::before { background: var(--pm-red); animation: none; }
.clip-embed { grid-column: 1 / -1; width: 100%; height: 170px; border: 0; border-radius: 9px; background: var(--pm-card); }
.clip-audio { grid-column: 1 / -1; width: 100%; height: 42px; }
.clip-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }

.wave { display: flex; align-items: center; gap: 4px; height: 25px; margin-bottom: 14px; }
.wave i { width: 4px; height: 22px; border-radius: 4px; background: var(--pm-accent); opacity: .75; transform: scaleY(.45); animation: wave 2.4s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .2s; } .wave i:nth-child(3) { animation-delay: .4s; }
.wave i:nth-child(4) { animation-delay: .6s; } .wave i:nth-child(5) { animation-delay: .8s; }
.wave i:nth-child(6) { animation-delay: 1s; } .wave i:nth-child(7) { animation-delay: 1.2s; }

/* ---------- 云端音效库分类 ---------- */
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-tab {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 13px;
  border: 1px solid var(--pm-line);
  border-radius: 20px;
  background: var(--pm-card);
  color: var(--pm-text-2);
  font-size: 13px;
  cursor: pointer;
}
.cat-tab .n { font-size: 11px; color: var(--pm-text-3); background: var(--pm-bg); border-radius: 9px; padding: 0 6px; }
.cat-tab:hover { border-color: var(--pm-accent); color: var(--pm-text); }
.cat-tab.on { background: var(--pm-accent); border-color: var(--pm-accent); color: #18191f; font-weight: 600; }
.cat-tab.on .n { color: #18191f; background: rgba(255, 255, 255, .3); }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  display: grid;
  gap: 8px;
  max-width: min(92vw, 380px);
}
.toast {
  padding: 11px 15px;
  border: 1px solid var(--pm-line);
  border-radius: 11px;
  background: var(--pm-card);
  color: var(--pm-text);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  animation: toast-in .2s ease-out;
}
.toast.error { border-color: rgba(239, 111, 111, .5); color: var(--pm-red); }
.toast.success { border-color: rgba(107, 211, 166, .5); color: var(--pm-green); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes wave { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

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

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .flow { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .tabs button { min-height: 52px; padding: 8px 12px; }
  .heading h2 { font-size: 22px; }
  .surface { padding: 16px; }
  .flow-side { padding: 15px; }
  .toolbar > * { flex: 1 1 100%; width: 100%; }
  .mode { grid-template-columns: 1fr; }
  .voice-list { max-height: 250px; }
  .top { padding-inline: 14px; }
  .sub { display: none; }
}
