:root {
  --bg: #fbf7f0;
  --card: #ffffff;
  --ink: #2a211b;
  --muted: #8b7f74;
  --line: #eee5d8;
  --red: #d7263d;
  --red-deep: #b01a30;
  --gold: #e9a23b;
  --gold-soft: #fff3dc;
  --jade: #1f8a70;
  --draft: #a3978b;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --fs: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151311;
    --card: #211e1b;
    --ink: #f3ece4;
    --muted: #9c9187;
    --line: #322d28;
    --gold-soft: #3a2c15;
    --draft: #7f756c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

svg { fill: currentColor; }
svg .stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

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

.logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: block;
  flex: none;
}

.name { font-weight: 700; font-size: 17px; line-height: 1.15; }
.sub { font-size: 12.5px; color: var(--muted); }

.tools { display: flex; gap: 4px; }

.tool {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--ink);
}
.tool:active { background: var(--line); }
.tool svg { width: 24px; height: 24px; }
.tool .ic-on { display: none; color: var(--jade); }
.tool[aria-pressed="true"] { background: color-mix(in srgb, var(--jade) 14%, transparent); }
.tool[aria-pressed="true"] .ic-on { display: block; }
.tool[aria-pressed="true"] .ic-off { display: none; }
.aa { font-weight: 700; font-size: 19px; letter-spacing: -1px; }
.aa small { font-size: 13px; }

.banner {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--gold-soft);
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner button {
  flex: none;
  background: var(--ink);
  color: var(--bg);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}
.banner.install { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px 8px 8px 10px; }
.banner.install span { flex: 1; font-weight: 600; font-size: 14px; }
.banner.install #installBtn { background: var(--red); color: #fff; }
.banner .x { background: none; color: var(--muted); font-size: 22px; padding: 2px 6px; line-height: 1; }
.install-ic { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.steps { list-style: none; padding: 0; margin: 6px 0 16px; text-align: left; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 1.45; }
.steps .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.ios-share { width: 22px; height: 22px; vertical-align: -5px; color: #0a84ff; }
.tiny-ic { width: 22px; height: 22px; border-radius: 6px; vertical-align: -5px; }
.btn.wide { width: 100%; flex: none; }
.banner.soft { background: color-mix(in srgb, var(--jade) 12%, var(--bg)); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--jade); flex: none; animation: blink 1.4s infinite; }

main { padding: 6px 14px 0; }

.empty { text-align: center; padding: 6vh 12px 0; }
.empty .art svg { width: 210px; height: auto; }
.empty .b1 { fill: var(--card); stroke: var(--line); stroke-width: 2; }
.empty .b2 { fill: var(--red); }
.empty .t1 { font-size: 22px; fill: var(--muted); font-family: "PingFang SC", "Noto Sans SC", sans-serif; }
.empty .t2 { font-size: 20px; fill: #fff; font-weight: 700; }
.empty h1 { font-size: 24px; margin: 14px 0 8px; }
.empty p { color: var(--muted); font-size: 16.5px; line-height: 1.55; margin: 0; }

#list { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  animation: rise .25s ease-out;
}
.card.latest { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }

.vi {
  font-size: var(--fs);
  line-height: 1.42;
  font-weight: 600;
  letter-spacing: -.005em;
  word-wrap: break-word;
}
.card.draft .vi { color: var(--draft); font-weight: 500; }
.vi:empty::before { content: "…"; color: var(--draft); }

.zh {
  margin-top: 6px;
  font-size: calc(var(--fs) * .66);
  line-height: 1.45;
  color: var(--muted);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.meta .time { margin-right: auto; }
.meta button { padding: 4px 8px; border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.meta button:active { background: var(--line); }
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); animation: dots 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

.spacer { height: calc(104px + var(--safe-b)); }

.jump {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + var(--safe-b));
  z-index: 6;
  background: var(--ink);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}

.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  padding: 18px 16px calc(12px + var(--safe-b));
  display: flex;
  justify-content: center;
  background: linear-gradient(to bottom, transparent, var(--bg) 40%);
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.mic {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  max-width: 100%;
  height: 64px;
  padding: 0 24px 0 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e53950, var(--red) 60%, var(--red-deep));
  color: #fff;
  box-shadow: 0 8px 22px rgba(215, 38, 61, .34), inset 0 -3px 0 rgba(0, 0, 0, .12);
  transition: transform .12s, background .2s;
  outline: none;
  text-align: left;
}
.mic:focus-visible { box-shadow: 0 0 0 3px var(--gold); }
.mic:active { transform: scale(.97); }
.mic-ic {
  position: relative;
  width: 48px; height: 48px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: grid; place-items: center;
}
.mic svg { width: 26px; height: 26px; position: relative; z-index: 1; }
.mic .ic-stop { display: none; width: 22px; height: 22px; }
.mic-text { display: flex; flex-direction: column; min-width: 0; }
.mic .l1 { font-size: 17px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.mic .l2 { font-size: 13px; opacity: .85; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.mic .l2:empty { display: none; }
.mic .rec { width: 7px; height: 7px; border-radius: 50%; background: #ff6b7d; animation: blink 1.2s infinite; flex: none; }
.mic .ring {
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .7);
  transform: scale(var(--lvl, 1));
  opacity: 0;
  transition: transform .09s linear, opacity .2s;
}
.mic .spin {
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--gold);
  display: none;
  animation: spin .8s linear infinite;
}
body.on .mic { background: linear-gradient(180deg, #3b3430, #2a211b); box-shadow: 0 8px 22px rgba(0, 0, 0, .26); }
@media (prefers-color-scheme: dark) { body.on .mic { background: linear-gradient(180deg, #fff, #e9e1d8); color: var(--ink); } body.on .mic .ring { border-color: var(--red); } body.on .mic-ic { background: rgba(215, 38, 61, .12); color: var(--red); } }
body.on .mic .ic-mic { display: none; }
body.on .mic .ic-stop { display: block; }
body.on .mic .ring { opacity: 1; }
body.connecting .mic .spin { display: block; }

.toast {
  position: fixed;
  left: 16px; right: 16px;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  z-index: 20;
  margin: 0 auto;
  max-width: 460px;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: rise .2s ease-out;
}

.sheet-bg { position: fixed; inset: 0; background: rgba(20, 12, 6, .45); z-index: 30; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 31;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(18px + var(--safe-b));
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
  animation: up .22s ease-out;
}
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 6px; font-size: 21px; }
.sheet p { margin: 0 0 14px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.qr { background: #fff; border-radius: 18px; padding: 14px; width: 232px; height: 232px; margin: 0 auto; display: grid; place-items: center; }
.qr img, .qr svg { width: 204px; height: 204px; image-rendering: pixelated; }
.link { margin: 12px auto; font-size: 14px; color: var(--muted); word-break: break-all; }
.row { display: flex; gap: 10px; }
.btn {
  flex: 1;
  padding: 14px 10px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 15.5px;
}
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { width: 100%; margin-top: 10px; background: none; border: 0; color: var(--muted); font-weight: 600; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes dots { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 640px) {
  main { max-width: 640px; margin: 0 auto; }
}
