/* 首页、工作区和账号面板共用墨绿底色，主操作用亮绿和深色文字保持对比。 */
:root {
  color-scheme: dark;
  --paper: #06120f;
  --surface: #0d1d17;
  --ink: #faf3e3;
  --muted: #c4cfc7;
  --line: #285346;
  --accent: #30db91;
  --accent-deep: #8de8b8;
  --accent-soft: #143629;
  --field: #091711;
  --danger: #ff9eb0;
  --radius: 14px;
  --display-serif: "Noto Serif SC Home", "Songti SC", SimSun, serif;
  font-family: Geist, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, pre:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.skip { position: absolute; left: 10px; top: 8px; padding: 10px; z-index: 2; background: var(--surface); transform: translateY(-140%); }
.skip:focus { transform: translateY(0); }
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 750; letter-spacing: .08em; flex: none; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
nav { display: flex; gap: clamp(22px, 4vw, 68px); align-self: stretch; align-items: stretch; }
nav a { display: grid; place-items: center; border-bottom: 2px solid transparent; padding: 2px 0 0; color: var(--muted); font-size: 14px; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent-deep); }
nav a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 700; }
#account { margin-left: auto; max-width: 190px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
/* 工具页和用户中心沿用统一的内容留白。 */
main { padding-top: 48px; padding-bottom: 32px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(30px, 4.4vw, 49px); letter-spacing: -.045em; line-height: 1.2; }
h2 { font-size: 18px; line-height: 1.4; letter-spacing: -.025em; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 42px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; font-size: 14px; font-weight: 700; line-height: 1.3; cursor: pointer; }
.primary { background: var(--accent); color: #041b12; }
.primary:hover { background: #69eaaa; }
.subtle { border-color: var(--line); background: var(--surface); color: var(--accent-deep); }
.subtle:hover { border-color: var(--accent); background: var(--accent-soft); }
button:disabled { opacity: .55; cursor: wait; }
.text-button { border: 0; padding: 5px 0; color: var(--accent-deep); background: none; cursor: pointer; font-weight: 700; font-size: 13px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.page-intro { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.page-intro h1 { font-family: var(--display-serif); font-weight: 800; }
.page-intro p { margin-top: 10px; color: var(--muted); line-height: 1.65; }
.quota { flex: none; padding: 8px 12px; background: var(--accent-soft); color: var(--accent-deep); border-radius: 8px; font-size: 13px; font-weight: 700; }
/* 用户中心沿用工具面板，长邮箱和时间在窄屏可换行。 */
.account-email { overflow-wrap: anywhere; }
.account-quotas { margin-bottom: 20px; }
.account-quotas .panel-heading { flex-wrap: wrap; }
.usage-list { list-style: none; padding: 0; }
.usage-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; border-top: 1px solid var(--line); padding: 12px 0; }
.usage-list:not(:empty) { margin-top: 14px; }
.usage-details { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.usage-list time, .usage-unavailable { color: var(--muted); font-size: 14px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); align-items: start; gap: 20px; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-heading.compact { margin-bottom: 0; }
.panel-heading.compact label { margin-bottom: 0; }
label { font-size: 14px; font-weight: 700; display: block; margin: 12px 0 6px; line-height: 1.55; }
input, textarea, select { width: 100%; background: var(--field); color: var(--ink); border: 1px solid #365e50; border-radius: 8px; padding: 10px 11px; line-height: 1.5; min-height: 44px; }
:is(input, textarea)::placeholder { color: #8ca398; }
label input, label select { display: block; margin-top: 5px; }
textarea { display: block; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel form .button, .panel > .button, #episode-editor .button, #voice-output .button { margin-top: 14px; }
.hint, .message { color: var(--muted); font-size: 13px; line-height: 1.65; margin-top: 8px; }
.counter { text-align: right; margin-top: 4px; }
.message:empty { display: none; }
.error, .message.error { color: var(--danger); }
.empty { display: grid; place-items: center; text-align: center; color: var(--muted); min-height: 190px; border: 1px dashed var(--line); background: var(--field); border-radius: 9px; padding: 18px; line-height: 1.6; }
.shot-total { margin: 18px 0 8px; color: var(--muted); font-size: 13px; }
.shot { border-top: 1px solid var(--line); padding: 12px 0; }
.shot b { color: var(--accent-deep); font-size: 14px; }
.shot p { line-height: 1.65; font-size: 14px; margin-top: 5px; overflow-wrap: anywhere; white-space: pre-wrap; }
audio { width: 100%; margin-top: 14px; }
.prompt-output { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 18px; font: inherit; font-size: 15px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { background: var(--accent-soft); border: 1px solid var(--line); color: var(--accent-deep); border-radius: 8px; padding: 9px 13px; margin-bottom: 18px; font-size: 13px; line-height: 1.6; }
.notice.error { color: var(--danger); }
dialog { color: var(--ink); background: var(--surface); width: min(420px, calc(100% - 30px)); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); }
dialog::backdrop { background: #020b08be; }
.dialog-actions { display: flex; align-items: center; gap: 15px; margin-top: 16px; }
.registration-check { margin-top: 14px; }

/* 音色按组分行展示，窄屏自动减少列数，按钮保留触控高度。 */
.voice-library { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.voice-library h2 { font: 800 27px/1.35 var(--display-serif); }
.voice-library h3 { margin: 20px 0 10px; font-size: 15px; color: var(--muted); }
.voice-player {
  position: sticky;
  top: 8px;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(0, 4fr);
  align-items: center;
  gap: 8px 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.voice-player .hint { display: block; margin: 0; }
.voice-player strong { display: block; margin-top: 4px; }
.voice-player audio { display: block; min-width: 0; margin: 0; }
.voice-player .message { grid-column: 1 / -1; margin: 0; }
.voice-library button { scroll-margin-top: 156px; }
.voice-sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 163px), 1fr));
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.voice-sample-grid li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-inline: 12px 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: 14px ui-monospace, monospace;
}
.voice-sample-grid button { min-height: 44px; min-width: 52px; margin-block: 4px; padding-inline: 9px; }
.voice-sample-grid li:has(button[aria-current]) { border-color: var(--accent); background: var(--accent-soft); }
.voice-sample-grid button[aria-current] { border-color: var(--line); }

@media (max-width: 520px) {
  .voice-player { grid-template-columns: 1fr; padding: 10px 12px; }
}

/* 小屏把输出移到输入下面，同时保留三个页面的直接导航。 */
@media (max-width: 730px) {
  .wrap { width: calc(100% - 32px); }
  .brand img { width: 32px; height: 32px; }
  nav a { min-height: 44px; font-size: 13px; white-space: nowrap; }
  #account { max-width: 145px; }
  main { padding-top: 28px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .page-intro { align-items: start; flex-direction: column; gap: 10px; }
  .panel { padding: 17px; }
}

/* 展示字只包含固定标题的字形，其余文案沿用系统字体。 */
@font-face {
  font-family: "Noto Serif SC Home";
  src: url("/ai/home-serif.woff2?v=20261112-voice1") format("woff2");
  font-weight: 700 900;
  font-display: swap;
}

.top-inner,
.home-inner {
  width: min(1320px, calc(100% - clamp(40px, 11.25vw, 164px)));
  margin-inline: auto;
}
.top-inner {
  min-height: 78px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.brand { justify-self: start; }
#account {
  justify-self: end;
  color: var(--ink);
  background: transparent;
  border-color: #43806b;
  min-height: 44px;
}
#account:hover { background: #152b23; }
body:has(#home:not([hidden])) .wrap { width: 100%; padding: 0; }
body:has(#home:not([hidden])) .wrap > .notice {
  width: min(1320px, calc(100% - 40px));
  margin: 12px auto 0;
}

.home-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: clamp(500px, 43vw, 640px);
}
/* 只压暗文字相邻的区域，让右侧的人物和灯光保持清晰。 */
.home-scene {
  position: absolute;
  inset: 0 0 0 25%;
  z-index: -1;
  background:
    linear-gradient(90deg, var(--paper), #06120fbd 16%, #06120f00 53%),
    linear-gradient(0deg, var(--paper), #06120f00 22%),
    url("/ai/home-rainy-station.webp") 59% 54% / cover no-repeat;
}
.home-hero-copy { padding-block: 42px 84px; }
.home-hero h1 {
  font: 900 clamp(54px, 7.2vw, 108px)/1.1 var(--display-serif);
  letter-spacing: -.03em;
}
.home-hero h1 em { font-style: normal; color: var(--accent); }
.home-hero p {
  margin-top: 28px;
  font-size: clamp(16px, 1.45vw, 22px);
  line-height: 1.65;
  max-width: 29em;
  text-shadow: 0 1px 12px var(--paper);
}
.home-hero p span { display: inline-block; }
.home-actions { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 36px; }
.home-actions .button {
  min-height: 56px;
  padding-inline: clamp(20px, 2.35vw, 34px);
  gap: 18px;
  font-size: 17px;
}
.home-primary { background: var(--accent); color: #041b12; }
.home-primary:hover { background: #69eaaa; }
.home-secondary { border-color: #52ac89; color: var(--ink); background: #06120fa8; }
.home-secondary:hover { background: #18392d; }

.home-tools { padding-block: 28px clamp(48px, 7vw, 104px); }
.home-tools h2 {
  display: flex;
  align-items: center;
  gap: 22px;
  font: 800 clamp(28px, 3vw, 44px)/1.25 var(--display-serif);
  scroll-margin-top: 24px;
}
.home-tools h2::after { content: ""; flex: 1; border-top: 1px solid #43806b; }
.home-tool-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0;
  margin: 28px 0 0;
  list-style: none;
}
.home-tool-list li + li { border-left: 1px solid var(--line); }
.home-tool-list a {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 29px);
  min-height: 76px;
  padding: 8px clamp(12px, 2.1vw, 30px);
}
.home-tool-list a:hover { color: var(--accent); background: #10241c; }
.home-tool-list svg {
  width: clamp(28px, 3.55vw, 52px);
  height: auto;
  aspect-ratio: 1;
  flex: none;
  color: #77e7aa;
}
.home-tool-list h3 {
  margin: 0;
  font: 800 clamp(17px, 1.95vw, 29px)/1.45 var(--display-serif);
}
.home-tool-list h3 span { display: inline-block; font-family: system-ui, sans-serif; font-weight: 400; }
.home-tool-list p { margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.55; }

@media (max-width: 840px) {
  .top-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    gap: 0 14px;
    padding-top: 9px;
  }
  nav {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 4px clamp(10px, 4vw, 34px);
    flex-wrap: wrap;
  }
  nav a { min-height: 44px; }
  .home-hero { min-height: 0; align-items: start; }
  .home-hero-copy { padding-block: 35px clamp(208px, 55vw, 350px); }
  .home-hero p { margin-top: 18px; max-width: 25em; text-wrap: balance; }
  .home-actions { margin-top: 24px; gap: 10px; }
  .home-actions .button { min-height: 46px; padding-inline: 14px; font-size: 14px; gap: 8px; }
  /* 手机上把主体放到按钮下方，文案和触控区域不盖住画面。 */
  .home-scene {
    inset: auto 0 0;
    height: clamp(235px, 65vw, 410px);
    background:
      linear-gradient(180deg, var(--paper), #06120f00 30%, #06120f00 75%, var(--paper)),
      url("/ai/home-rainy-station.webp") 66% 54% / cover no-repeat;
  }
  .home-tools { padding-top: 6px; }
  .home-tool-list { grid-template-columns: 1fr; margin-top: 14px; }
  .home-tool-list li + li { border-left: 0; border-top: 1px solid var(--line); }
  .home-tool-list a { padding-inline: 4px; }
}
