:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-2: #f3ede4;
  --ink: #1e1a4d;
  --ink-2: #5d5870;
  --ink-3: #8f8a9e;
  --line: #e6dfd3;
  --accent: #e8502f;
  --accent-ink: #ffffff;
  --accent-soft: #fde8df;
  --focus: #3b5bdb;
  --danger: #c92a2a;
  --ok: #2b8a3e;
  --shadow: 0 1px 2px rgba(31, 27, 46, .06), 0 8px 24px rgba(31, 27, 46, .06);
  --radius: 16px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15131c;
    --surface: #1e1b28;
    --surface-2: #262232;
    --ink: #f2eff7;
    --ink-2: #b6b0c6;
    --ink-3: #8a849b;
    --line: #322d40;
    --accent: #f07a52;
    --accent-ink: #1a1014;
    --accent-soft: #3a2420;
    --focus: #8ea6ff;
    --danger: #ff8787;
    --ok: #69db7c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  padding-bottom: 120px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg .fill, .i-play path, .i-pause path, .brand-mark path { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { max-width: 1120px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.wordmark { display: block; line-height: 0; }
.wordmark img { height: 32px; width: auto; display: block; }
.tagline { font-size: 12px; color: var(--ink-3); padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--line); line-height: 1.2; white-space: nowrap; }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); }
.header-cta { flex: none; }
.bell-wrap { margin-left: auto; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; }
#create, #discover, .anchor { scroll-margin-top: 84px; }
.anchor { display: block; height: 0; }
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px 6px; }
  .brand { margin-right: auto; }
  .site-nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; }
  .site-nav::-webkit-scrollbar { display: none; }
  .tagline { display: none; }
  .wordmark img { height: 28px; }
  #create, #discover, .anchor { scroll-margin-top: 110px; }
}

main { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- account menu ---------- */
.user-wrap { position: relative; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 190px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.user-menu button { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.user-menu button:hover { background: var(--surface-2); }
.user-menu .danger { color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.btn-google { width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-google:hover { background: var(--surface-2); }
.btn-google svg { width: 20px; height: 20px; }
.login-legal { font-size: 12px !important; color: var(--ink-3) !important; margin: 14px 0 0 !important; }
.login-legal a { color: var(--ink-2); }
#deleteDialog input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 14px; }

/* ---------- avatars ---------- */
.avatar-slot { --size: 28px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; font-size: calc(var(--size) * .58); line-height: 1; background: var(--surface-2); }
.avatar-slot { position: relative; }
.avatar-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
a.user-chip { text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 500; }
a.user-chip:hover { border-color: var(--accent); }
.avatar-sm { --size: 22px; }
.avatar-lg { --size: 72px; }
.avatar-xl { --size: 112px; box-shadow: 0 0 0 4px var(--surface), var(--shadow); }

/* ---------- notifications ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; }
.bell .badge { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--accent); color: #fff; font: 700 10px/17px var(--sans); text-align: center; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: min(360px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.notif-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { list-style: none; margin: 0; padding: 4px; max-height: 420px; overflow-y: auto; }
.notif-list li button { display: flex; gap: 10px; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left;
  padding: 10px; border-radius: 10px; font-size: 14px; color: var(--ink); }
.notif-list li button:hover { background: var(--surface-2); }
.notif-list li.unread button { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notif-list .when { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.notif-empty { padding: 22px 14px; color: var(--ink-3); font-size: 14px; text-align: center; }

/* ---------- profile ---------- */
.profile-view { padding: 20px 0 32px; }
.back-link { display: inline-block; color: var(--ink-2); text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.back-link:hover { color: var(--accent); }
.profile-card { display: flex; gap: 24px; align-items: center; padding: 24px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 28px; }
.profile-main { flex: 1; min-width: 0; }
.profile-main h1 { font: 700 30px/1.15 var(--serif); margin: 0; }
.profile-main .handle { color: var(--ink-3); margin: 2px 0 10px; }
.profile-main .bio { margin: 0 0 10px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-main .stats { margin: 0; color: var(--ink-2); font-size: 14px; }
.profile-main .stats strong { color: var(--ink); }
.pending-note { margin: 10px 0 0; font-size: 13px; color: #a35f00; background: color-mix(in srgb, #e8a33c 16%, transparent);
  padding: 8px 10px; border-radius: 8px; }
.profile-actions { flex: none; display: flex; gap: 8px; }
.pv-title { font: 600 24px var(--serif); margin: 0 0 14px; }
.btn.following { background: var(--surface); color: var(--ink); border-color: var(--line); }
@media (max-width: 640px) {
  .profile-card { flex-direction: column; text-align: center; }
  .profile-actions { width: 100%; justify-content: center; }
}

/* story card author */
.story-author { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--ink-2);
  font-size: 13px; cursor: pointer; max-width: 100%; }
.story-author:hover span { color: var(--accent); text-decoration: underline; }
.story-author span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* feed tabs */
.library-head { flex-wrap: wrap; }
.feed-tabs { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-right: auto; margin-left: 8px; }
.feed-tabs button { border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.feed-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* edit profile dialog */
dialog.wide { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.avatar-edit { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.avatar-edit-actions { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.avatar-edit-actions .hint { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--ink-3); }
.field-label { margin: 6px 0 8px !important; font-size: 13px; font-weight: 500; color: var(--ink-2) !important; }
.preset-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 14px; }
.preset-grid button { aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; font-size: 24px; display: grid; place-items: center; padding: 0; }
.preset-grid button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#profileForm .field { margin-bottom: 12px; }
#profileForm input, #profileForm textarea { width: 100%; margin: 0; }
#profileForm textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.handle-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding-left: 12px; }
.handle-input span { color: var(--ink-3); }
.handle-input input { border: 0 !important; height: 44px !important; padding-left: 4px !important; }
#profileForm .field em { font-style: normal; color: var(--ink-3); font-weight: 400; float: right; }

.ds-options { display: grid; gap: 8px; margin: 0 0 16px; }
.ds-options label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--ink); }
.ds-options input { width: auto; height: auto; margin: 0; flex: none; accent-color: var(--danger); }
.ds-options label:has(input:checked) { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, transparent); }
.btn-text-danger { color: var(--danger); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; background: var(--surface-2); }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 28px 24px 32px; display: grid; gap: 14px; }
.footer-brand { display: flex; flex-direction: column; gap: 4px; }
.footer-brand .wordmark img { height: 24px; margin-bottom: 4px; }
.footer-brand span, .footer-legal { color: var(--ink-3); font-size: 13px; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { color: var(--ink-2); font-size: 14px; text-decoration: none; }
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
mark.todo { background: #fff3bf; color: #7c5a00; padding: 0 4px; border-radius: 4px; }
@media (max-width: 560px) { .footer-inner { padding: 24px 16px 28px; } }

/* ---------- hero / convert ---------- */
.hero { display: grid; grid-template-columns: 1fr 1.35fr; gap: 40px; align-items: center; padding: 28px 0 40px; }
.hero h1 { font: 700 clamp(32px, 4.4vw, 48px)/1.08 var(--serif); letter-spacing: -.01em; margin: 0 0 14px; }
.hero p { color: var(--ink-2); font-size: 17px; margin: 0; max-width: 32ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 28px 16px; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.drop-icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: 4px; }
.drop-title { font-weight: 600; word-break: break-word; }
.drop-title u { text-decoration-color: var(--accent); text-underline-offset: 3px; }
.drop-hint { color: var(--ink-3); font-size: 13px; }

.options { display: flex; gap: 12px; align-items: flex-end; margin-top: 16px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field-narrow { flex: 0 1 150px; }
.field em { font-style: normal; color: var(--ink-3); font-weight: 400; }
.field input, .field select {
  height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 15px; color: var(--ink); min-width: 0;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; white-space: nowrap; transition: transform .05s, opacity .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
a.btn { text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost:disabled { opacity: .6; cursor: default; }
.btn-link { background: none; color: var(--ink-2); padding: 0 8px; }
.btn-link:hover { color: var(--ink); }

.job { margin-top: 18px; }
.job-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; margin-bottom: 8px; }
.job-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-pct { color: var(--accent); font-variant-numeric: tabular-nums; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.progress.indeterminate span { width: 30%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.job-stage { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }

.result { display: flex; gap: 16px; align-items: flex-start; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.result-body { min-width: 0; flex: 1; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); }
.result h3 { font: 600 20px/1.25 var(--serif); margin: 2px 0 4px; }
.result p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.form-error { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 14px; }

/* ---------- estimate ---------- */
.estimate { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.est-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.est-grid div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.est-grid small { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.est-grid strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.est-grid span { color: var(--ink-2); font-size: 13px; }
.estimate p { max-width: none; }
.est-parts { margin: 8px 0 0; color: var(--ink-3); font-size: 12px !important; }
.est-verdict { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 13px !important; font-weight: 500; }
.est-verdict.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.est-verdict.warn { background: color-mix(in srgb, #e8a33c 18%, transparent); color: #a35f00; }
.est-verdict.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.est-loading { color: var(--ink-3); }
.estimate .est-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 13px !important; font-weight: 600;
  background: color-mix(in srgb, var(--focus) 12%, transparent); color: var(--focus); }
.estimate .est-note::before { content: "✦ "; }
dialog .estimate { margin: 0 0 16px; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions .btn { flex: 1; }
@media (prefers-color-scheme: dark) { .est-verdict.warn { color: #f0b45a; } }
@media (max-width: 560px) { .est-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- covers ---------- */
.cover {
  position: relative; flex: none; overflow: hidden; border-radius: 12px;
  display: grid; place-items: center; color: rgba(255, 255, 255, .92);
  font: 700 28px var(--serif); background: var(--surface-2);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-lg { width: 96px; height: 96px; }
.cover-sm { width: 48px; height: 48px; border-radius: 8px; font-size: 18px; }

/* ---------- your stories ---------- */
.mine { padding: 0 0 32px; }
.mine-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mine-item { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mine-item .cover { width: 56px; height: 56px; border-radius: 10px; font-size: 22px; }
.mine-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mine-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 500; color: var(--ink); }
button.chip:hover { border-color: var(--accent); }
.chip svg { width: 12px; height: 12px; color: var(--accent); }
.chip.playing { background: var(--accent-soft); border-color: var(--accent); }
.chip.busy { color: var(--ink-3); }
.chip.busy::before { content: ""; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.mine-convert { display: flex; gap: 8px; flex: none; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mine-convert .mine-convert { flex-wrap: nowrap; }
.mine-convert select { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14px; color: var(--ink); max-width: 170px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
.all-done { font-size: 13px; color: var(--ink-3); }
.lang-filter { height: 52px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); font-size: 15px; color: var(--ink); }

/* ---------- search ---------- */
.search { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 0 28px; border-top: 1px solid var(--line); padding-top: 32px; }
.search-box { flex: 1 1 320px; position: relative; }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search-box input {
  width: 100%; height: 52px; padding: 0 16px 0 48px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); font-size: 16px;
}
.search-box input::placeholder { color: var(--ink-3); }
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { border: 0; background: none; height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 500; color: var(--ink-2); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- library ---------- */
.library-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.library-head h2 { font: 600 26px var(--serif); margin: 0; }
.library-sub { color: var(--ink-3); font-size: 14px; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px; }
.story { position: relative; display: flex; flex-direction: column; gap: 10px; }
.story .cover { width: 100%; aspect-ratio: 1; height: auto; border-radius: 14px; font-size: 56px; box-shadow: var(--shadow); }
.rank {
  position: absolute; top: 10px; left: 10px; z-index: 1; min-width: 28px; height: 28px; padding: 0 8px;
  display: grid; place-items: center; border-radius: 99px; background: rgba(20, 16, 30, .62); color: #fff;
  font: 600 13px var(--sans); backdrop-filter: blur(4px);
}
.story-play {
  position: absolute; right: 10px; bottom: 10px; z-index: 1; width: 48px; height: 48px; border-radius: 50%;
  border: 0; display: grid; place-items: center; background: var(--accent); color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s;
}
.story-play svg { width: 20px; height: 20px; margin-left: 2px; }
.story:hover .story-play, .story-play:focus-visible, .story.playing .story-play { opacity: 1; transform: none; }
@media (hover: none) { .story-play { opacity: 1; transform: none; } }
.story.playing .cover { outline: 3px solid var(--accent); outline-offset: 2px; }
.story h3 { font: 600 16px/1.3 var(--sans); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; }
.story-meta span + span::before { content: "·"; margin-right: 6px; }

.skeleton .cover, .skeleton .line { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .line { height: 14px; border-radius: 6px; width: 80%; }
.skeleton .line.short { width: 45%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 48px 16px; color: var(--ink-2); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; font: 600 18px var(--serif); color: var(--ink); margin-bottom: 4px; }

/* ---------- player ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .08);
  animation: rise .2s ease-out;
}
@keyframes rise { from { transform: translateY(100%); } }
.player-inner { max-width: 1120px; margin: 0 auto; padding: 12px 24px; display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 20px; align-items: center; }
.player-meta { display: flex; gap: 12px; align-items: center; min-width: 0; }
.player-text { display: flex; flex-direction: column; min-width: 0; }
.player-text strong, .player-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-text span { color: var(--ink-3); font-size: 13px; }
.player-center { display: flex; flex-direction: column; gap: 4px; }
.player-controls { display: flex; justify-content: center; align-items: center; gap: 16px; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn text { font: 700 7px var(--sans); fill: currentColor; stroke: none; }
.play-btn { position: relative; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.play-btn svg { width: 22px; height: 22px; }
.play-btn .i-pause, .play-btn.is-playing .i-play, .play-btn .spinner { display: none; }
.play-btn.is-playing .i-pause { display: block; }
.play-btn.is-loading svg { display: none; }
.play-btn.is-loading .spinner { display: block; width: 20px; height: 20px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seek-row { display: flex; align-items: center; gap: 10px; }
.time { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 36px; }
.time:last-child { text-align: right; }
.player-side { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.speed-btn { height: 32px; min-width: 48px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: none; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.speed-btn:hover { color: var(--ink); background: var(--surface-2); }
#muteBtn.muted .wave { display: none; }
#volume { width: 90px; }

input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; height: 20px; background: none; --pct: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--pct) 100% no-repeat, var(--line); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 0; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; }

/* ---------- dialog + toast ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 16, 30, .45); backdrop-filter: blur(3px); }
dialog h2 { font: 700 24px var(--serif); margin: 0 0 6px; }
dialog p { color: var(--ink-2); margin: 0 0 16px; }
dialog input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 14px; }
dialog .btn { width: 100%; }
dialog .form-error { margin: 0 0 14px; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 16px; }
  .hero p { max-width: none; }
  .player-inner { grid-template-columns: 1fr auto; grid-template-areas: "meta side" "center center"; gap: 8px 12px; padding: 10px 16px; }
  .player-meta { grid-area: meta; }
  .player-center { grid-area: center; }
  .player-side { grid-area: side; }
  #volume, #muteBtn { display: none; }
  body { padding-bottom: 170px; }
}
@media (max-width: 560px) {
  main { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .story .cover { font-size: 40px; }
  .options .btn { flex: 1 1 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .result { flex-direction: column; }
  .mine-item { flex-wrap: wrap; }
  .mine-convert { width: 100%; }
  .mine-convert select { flex: 1; max-width: none; }
  .lang-filter { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
