@font-face {
  font-family: "Cinzel Decorative";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/cinzel-decorative-700.woff2") format("woff2");
}

:root {
  --display: "Cinzel Decorative", "Didot", "Bodoni 72", "Playfair Display", Georgia, serif;
  --ink: #0b1220;
  --ink-soft: #3a4456;
  --muted: #6b7484;
  --faint: #9aa2af;
  --blue: #1e6fd9;
  --blue-deep: #0b3c8c;
  --sky: #6fb1f2;
  --silver: #c9ced6;
  --mist: #f4f6fa;
  --line: rgba(11, 18, 32, 0.08);
  --card: rgba(255, 255, 255, 0.78);
  --radius: 22px;
  --shadow: 0 1px 2px rgba(11, 18, 32, 0.04), 0 12px 40px rgba(11, 60, 140, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "Charter", "Iowan Old Style", "Palatino Linotype", "Georgia", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.aura {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 36rem at 50% -12rem, rgba(111, 177, 242, 0.22), transparent 70%),
    radial-gradient(40rem 30rem at 100% 30%, rgba(201, 206, 214, 0.25), transparent 70%),
    radial-gradient(36rem 28rem at 0% 80%, rgba(30, 111, 217, 0.07), transparent 70%);
}

/* Brand */
.brand { text-align: center; padding: clamp(2rem, 6vw, 3.5rem) 1.25rem 1.25rem; }
.brand-logo {
  width: clamp(180px, 31vw, 260px);
  height: auto;
  display: block;
  margin: 0 auto 0.6rem;
  filter: drop-shadow(0 14px 28px rgba(11, 60, 140, 0.18));
  animation: rise 0.9s var(--ease) both;
}
.brand-name {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.7rem, 7.5vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, var(--blue-deep) 0%, var(--blue) 70%, #5a9ce8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.9s 0.05s var(--ease) both;
}
.brand-tagline {
  margin: 0.4rem 0 0;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--muted);
  font-weight: 400;
  animation: rise 0.9s 0.1s var(--ease) both;
}

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 0.75rem 1.25rem 3rem; }
.view { display: none; }
.view.is-active { display: block; animation: rise 0.6s var(--ease) both; }

/* Card & form */
.card {
  background: var(--card);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.4rem, 4vw, 2.4rem);
}
.card.center { text-align: center; }
.field { margin-bottom: 1.5rem; }
label, .label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.55rem;
}
.optional { margin-left: 0.4rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--faint); }
input, textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(11, 18, 32, 0.12);
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 7.5rem; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #a8afba; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(30, 111, 217, 0.14); }
.is-invalid { border-color: #d93a3a !important; box-shadow: 0 0 0 4px rgba(217, 58, 58, 0.1) !important; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.period { display: flex; align-items: center; gap: 0.75rem; }
.period-box { flex: 1; position: relative; }
.period-box label {
  position: absolute; top: 0.55rem; left: 1.05rem; margin: 0;
  font-size: 0.68rem; color: var(--faint); letter-spacing: 0.06em;
}
.period-box input { padding-top: 1.45rem; padding-bottom: 0.6rem; font-variant-numeric: tabular-nums; font-weight: 500; }
.period-dash { width: 14px; height: 1.5px; background: var(--silver); border-radius: 2px; flex: none; }
.hint { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--faint); }
.word-count { margin: 0.4rem 0.2rem 0 0; text-align: right; font-size: 0.78rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.word-count.is-over { color: #c62f2f; }
.field-error { margin: 0.45rem 0 0; font-size: 0.86rem; color: #c62f2f; min-height: 0; }
.field-error:empty { display: none; }
.form-error { text-align: center; margin-top: 0.9rem; }

.button-primary, .button-secondary, .button-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 600; letter-spacing: -0.01em; text-decoration: none;
  border-radius: 999px; cursor: pointer; border: 0;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), opacity 0.2s;
}
.button-primary {
  width: 100%; padding: 1.05rem 1.5rem; font-size: 1.08rem; color: #fff;
  background: linear-gradient(180deg, #2a7ee6 0%, var(--blue) 55%, #1a62c4 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 10px 26px rgba(30, 111, 217, 0.32);
}
.button-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 16px 34px rgba(30,111,217,.38); }
.button-primary:active { transform: translateY(0) scale(0.99); }
.button-primary[disabled] { opacity: 0.55; cursor: default; transform: none; }
.button-secondary { padding: 0.8rem 1.3rem; color: var(--blue-deep); background: rgba(30, 111, 217, 0.08); }
.button-secondary:hover { background: rgba(30, 111, 217, 0.14); }
.button-ghost { padding: 0.75rem 1.3rem; color: var(--muted); background: transparent; font-weight: 500; }
.button-ghost:hover { color: var(--ink); background: rgba(11, 18, 32, 0.04); }
.small { width: auto; padding: 0.78rem 1.45rem; font-size: 0.98rem; }

.notice {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin: 1.1rem 0 0; font-size: 0.9rem; color: var(--muted); text-align: center;
}
.notice svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--blue); stroke-width: 1.6; stroke-linecap: round; }

.price-note { margin: 0.7rem 0 0; text-align: center; font-size: 0.84rem; color: var(--muted); }
.price-note:empty { display: none; }

/* Authors */
.authors { display: grid; gap: 0.85rem; }
.author {
  border: 1px solid var(--line); border-radius: 16px; padding: 0.8rem 0.85rem 0.9rem;
  background: rgba(244, 246, 250, 0.6); animation: pop 0.35s var(--ease) both;
}
.author-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin: 0 0.15rem 0.55rem; }
.author-index { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.author-remove {
  border: 0; width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  font-size: 1.05rem; line-height: 1; color: var(--muted); background: rgba(11, 18, 32, 0.05);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.author-remove:hover { color: #c62f2f; background: rgba(217, 58, 58, 0.1); }
.author-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.author-grid .author-email { grid-column: 1 / -1; }
.author-grid input { padding: 0.8rem 0.95rem; font-size: 1rem; }
.add-author {
  display: inline-flex; align-items: center; gap: 0.55rem; margin-top: 0.8rem; padding: 0.35rem 0.9rem 0.35rem 0.35rem;
  font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--blue-deep);
  background: transparent; border: 0; border-radius: 999px; cursor: pointer;
  transition: background 0.2s var(--ease);
}
.add-author:hover { background: rgba(30, 111, 217, 0.07); }
.add-author-icon {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-size: 1.25rem; font-weight: 500; line-height: 1; color: #fff;
  background: linear-gradient(180deg, #2a7ee6 0%, var(--blue) 100%);
  box-shadow: 0 6px 14px rgba(30, 111, 217, 0.28);
  transition: transform 0.25s var(--ease);
}
.add-author:hover .add-author-icon { transform: rotate(90deg); }

/* Account */
.account-bar {
  position: absolute; top: calc(0.9rem + env(safe-area-inset-top)); right: max(1rem, env(safe-area-inset-right)); z-index: 20;
  display: flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.35rem 0.3rem 0.9rem;
  background: rgba(255, 255, 255, 0.78); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 6px 20px rgba(11, 60, 140, 0.08);
  max-width: calc(100vw - 2rem);
}
.account-name { font-size: 0.86rem; font-weight: 500; color: var(--ink-soft); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-signout {
  border: 0; border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer;
  font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--blue-deep); background: rgba(30, 111, 217, 0.08);
}
.account-signout:hover { background: rgba(30, 111, 217, 0.14); }

.auth-card { max-width: 460px; margin: 0 auto; }
.auth-title { margin: 0; text-align: center; font-size: clamp(1.45rem, 4vw, 1.75rem); letter-spacing: -0.035em; }
.auth-subtitle { margin: 0.4rem 0 1.4rem; text-align: center; color: var(--muted); font-size: 0.98rem; }
.segmented {
  display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 1.3rem;
  background: rgba(11, 18, 32, 0.05); border-radius: 999px;
}
.segment {
  border: 0; border-radius: 999px; padding: 0.6rem 0.8rem; cursor: pointer;
  font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--muted); background: transparent;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.segment.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(11, 18, 32, 0.08), 0 4px 12px rgba(11, 18, 32, 0.06); }
.button-google {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem; width: 100%;
  padding: 0.9rem 1.2rem; border-radius: 999px; text-decoration: none;
  font-weight: 600; font-size: 1rem; color: var(--ink); background: #fff;
  border: 1px solid rgba(11, 18, 32, 0.14); box-shadow: 0 1px 2px rgba(11, 18, 32, 0.04);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.button-google:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(11, 18, 32, 0.08); }
.button-google svg { width: 20px; height: 20px; }
.divider { display: flex; align-items: center; gap: 0.8rem; margin: 1.2rem 0; color: var(--faint); font-size: 0.82rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-info { margin: 0.9rem 0 0; text-align: center; font-size: 0.9rem; color: var(--blue-deep); line-height: 1.5; }
.link-button {
  display: block; margin: 0.9rem auto 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 0.88rem; color: var(--blue); padding: 0.3rem 0.5rem;
}
.link-button:hover { text-decoration: underline; }

/* History */
.history { margin-top: 2rem; }
.history-title { margin: 0 0 0.7rem 0.3rem; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-soft); }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%;
  padding: 0.9rem 1.1rem; text-align: left; cursor: pointer; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.history-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.history-text { display: grid; min-width: 0; }
.history-name { font-weight: 600; font-size: 0.96rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-date { font-size: 0.8rem; color: var(--faint); }
.history-status { flex: none; font-size: 0.76rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 999px; color: var(--muted); background: rgba(11, 18, 32, 0.05); }
.history-status.is-done { color: #127a43; background: rgba(24, 160, 88, 0.1); }
.history-status.is-queued, .history-status.is-running { color: var(--blue-deep); background: rgba(30, 111, 217, 0.1); }
.history-status.is-error { color: #a23a3a; background: rgba(217, 58, 58, 0.08); }

/* Working */
.working { text-align: center; padding: 0.5rem 0 1rem; }
.thinking {
  width: clamp(190px, 46vw, 250px); aspect-ratio: 1; margin: 0 auto 1.6rem;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(111, 177, 242, 0.18), transparent 70%);
}
.thinking img { width: 100%; height: auto; filter: drop-shadow(0 18px 36px rgba(11, 60, 140, 0.2)); }
.stage { margin: 0 0 1rem; font-size: clamp(1.35rem, 3.6vw, 1.7rem); font-weight: 650; letter-spacing: -0.03em; }
.progress { width: min(420px, 86%); height: 4px; margin: 0 auto 1.6rem; border-radius: 4px; background: rgba(11, 18, 32, 0.07); overflow: hidden; }
.progress-bar {
  width: 2%; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--sky), var(--blue), var(--blue-deep));
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
  transition: width 0.9s var(--ease);
}
.log { max-width: 600px; margin: 0 auto 1.6rem; min-height: 3.4rem; }
.log p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity 0.35s var(--ease); }
.log-line1 { font-family: var(--serif); font-size: 1.06rem; font-style: italic; color: var(--ink); line-height: 1.6; }
.log-line2 { font-size: 0.92rem; color: var(--muted); line-height: 1.6; }
.log.is-fading p { opacity: 0.15; }
.meta { margin: 0 0 0.35rem; font-size: 0.86rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta.subtle { color: var(--faint); margin-bottom: 1.2rem; }

/* Result */
.result-head { text-align: center; margin-bottom: 1.8rem; }
.eyebrow { margin: 0 0 0.45rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue); }
.eyebrow.muted { color: var(--muted); }
.result-title { margin: 0 auto 0.6rem; max-width: 640px; font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.2; letter-spacing: -0.035em; }
.result-stats { margin: 0 0 1.3rem; color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.downloads { display: flex; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }

.paper {
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: clamp(1.5rem, 6vw, 3.6rem) clamp(1.25rem, 6vw, 3.8rem);
  max-height: 78vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.72; color: #1b2230;
}
.paper h1 { font-family: var(--sans); text-align: center; color: var(--blue-deep); font-size: clamp(1.4rem, 4vw, 1.85rem); line-height: 1.25; letter-spacing: -0.03em; margin: 0 0 0.5rem; }
.paper .authors-line { text-align: center; font-family: var(--sans); font-size: 1rem; font-weight: 500; color: var(--ink); margin: 0.6rem 0 0.35rem; }
.paper .affiliation-line { text-align: center; font-family: var(--sans); font-size: 0.84rem; color: var(--ink-soft); margin: 0; line-height: 1.5; }
.paper sup { font-size: 0.7em; margin-left: 0.05em; }
.paper .byline { text-align: center; font-family: var(--sans); color: var(--muted); font-size: 0.86rem; margin: 0.8rem 0 2rem; }
.paper .abstract { background: var(--mist); border-radius: 14px; padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.paper .abstract h4 { font-family: var(--sans); margin: 0 0 0.4rem; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue); }
.paper .abstract p { margin: 0; }
.paper .keywords { font-size: 0.92rem; color: var(--ink-soft); margin: 0 0 2rem; }
.paper h2 { font-family: var(--sans); font-size: 1.28rem; letter-spacing: -0.02em; color: var(--blue-deep); margin: 2.2rem 0 0.7rem; }
.paper h3 { font-family: var(--sans); font-size: 1.06rem; letter-spacing: -0.015em; color: var(--blue); margin: 1.6rem 0 0.5rem; }
.paper p { margin: 0 0 1rem; text-align: justify; hyphens: auto; }
.paper .cite { color: var(--blue); font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper .table-wrap { overflow-x: auto; margin: 1.1rem 0 1.6rem; }
.paper table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.84rem; line-height: 1.45; }
.paper caption { caption-side: top; text-align: left; font-size: 0.82rem; color: var(--muted); padding-bottom: 0.5rem; }
.paper th { text-align: left; font-weight: 600; border-bottom: 1.5px solid var(--blue); padding: 0.5rem 0.6rem; white-space: nowrap; }
.paper td { border-bottom: 1px solid var(--line); padding: 0.5rem 0.6rem; vertical-align: top; }
.paper ol.refs { padding-left: 0; list-style: none; font-size: 0.88rem; line-height: 1.55; }
.paper ol.refs li { display: grid; grid-template-columns: 3rem 1fr; margin-bottom: 0.45rem; }
.paper ol.refs a { color: var(--blue); text-decoration: none; word-break: break-all; }
.again { text-align: center; margin-top: 1.4rem; }

.error-message { font-size: 1.05rem; color: var(--ink-soft); line-height: 1.6; margin: 0.4rem auto 1.4rem; max-width: 460px; }

/* Footer */
.footer { display: flex; align-items: center; justify-content: center; gap: 0.6rem; padding: 1.6rem 1.25rem calc(1.6rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.footer img { width: 26px; height: 26px; object-fit: contain; opacity: 0.9; }
.footer p { margin: 0; font-size: 0.8rem; color: var(--muted); text-align: center; }

.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--ink); }
.legal-consent { margin: 1.1rem 0 0; text-align: center; font-size: 0.8rem; line-height: 1.5; color: var(--faint); }
.legal-consent a { color: var(--muted); }

/* Legal pages */
.legal-brand { display: flex; justify-content: center; padding: clamp(1.6rem, 5vw, 2.6rem) 1.25rem 1rem; }
.legal-home { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.legal-home img { width: 42px; height: auto; filter: drop-shadow(0 6px 14px rgba(11, 60, 140, 0.18)); }
.legal-home span {
  font-family: var(--display); font-size: 1.6rem; font-weight: 700; letter-spacing: 0.04em;
  background: linear-gradient(180deg, var(--blue-deep) 0%, var(--blue) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.legal { line-height: 1.65; }
.legal-back { display: inline-block; margin-bottom: 1.4rem; font-size: 0.9rem; color: var(--blue); text-decoration: none; }
.legal-back:hover { text-decoration: underline; }
.legal h1 { margin: 0 0 0.3rem; font-size: clamp(1.7rem, 5vw, 2.1rem); letter-spacing: -0.04em; color: var(--blue-deep); }
.legal-updated { margin: 0 0 1.6rem; font-size: 0.84rem; color: var(--faint); }
.legal h2 { margin: 1.8rem 0 0.6rem; font-size: 1.12rem; letter-spacing: -0.02em; color: var(--ink); }
.legal p, .legal li { font-size: 0.98rem; color: var(--ink-soft); }
.legal p { margin: 0 0 0.8rem; }
.legal ul { margin: 0 0 0.8rem; padding-left: 1.2rem; }
.legal li { margin-bottom: 0.45rem; }
.legal a { color: var(--blue); }
.legal strong { color: var(--ink); font-weight: 600; }

/* Spend analysis (debug only) */
.spend-bubble {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 30;
  display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.7rem 1.1rem;
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 0.95rem; color: var(--ink);
  background: rgba(255, 255, 255, 0.82); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 10px 30px rgba(11, 60, 140, 0.16); cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.spend-bubble:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(11, 60, 140, 0.22); }
.spend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 0 rgba(30, 111, 217, 0.5); }
.spend-bubble.is-live .spend-dot { animation: pulse 1.8s var(--ease) infinite; }
.spend-bubble.is-bump { animation: bump 0.4s var(--ease); }
.spend-panel {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 31;
  width: min(420px, calc(100vw - 2rem)); max-height: 72vh; overflow-y: auto;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px rgba(11, 18, 32, 0.18);
  padding: 1.2rem 1.3rem 1rem; animation: pop 0.35s var(--ease) both;
}
.spend-panel[hidden] { display: none; }
.spend-panel-head { display: flex; justify-content: space-between; align-items: flex-start; }
.spend-panel h3 { margin: 0; font-size: 1.15rem; letter-spacing: -0.02em; }
.spend-close { border: 0; background: rgba(11, 18, 32, 0.05); width: 30px; height: 30px; border-radius: 50%; font-size: 1.1rem; color: var(--muted); cursor: pointer; }
.spend-scope { margin: 0.35rem 0 0.9rem; font-size: 0.82rem; color: var(--muted); }
.spend-row { padding: 0.85rem 0; border-top: 1px solid var(--line); }
.spend-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-bottom: 0.45rem; }
.spend-model { font-weight: 650; font-size: 0.95rem; }
.spend-alias { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.spend-cost { font-weight: 650; font-variant-numeric: tabular-nums; }
.spend-grid { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 0.2rem 0.7rem; font-size: 0.78rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.spend-grid .h { color: var(--faint); font-weight: 500; }
.spend-grid .r { text-align: right; }
.spend-total-row { display: flex; justify-content: space-between; padding: 0.85rem 0 0.2rem; border-top: 1.5px solid var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.spend-note { margin: 0.5rem 0 0; font-size: 0.74rem; color: var(--faint); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(30,111,217,.5); } 70% { box-shadow: 0 0 0 8px rgba(30,111,217,0); } 100% { box-shadow: 0 0 0 0 rgba(30,111,217,0); } }
@keyframes bump { 50% { transform: scale(1.06); } }

@media (max-width: 560px) {
  .period { gap: 0.5rem; }
  .author-grid { grid-template-columns: 1fr; }
  .account-bar { position: static; margin: 0.8rem auto 0; width: fit-content; }
  .account-name { max-width: 160px; }
  .downloads .small { flex: 1; min-width: 0; padding-left: 0.6rem; padding-right: 0.6rem; }
  .paper { max-height: none; border-radius: 14px; font-size: 1rem; }
  .paper p { text-align: left; }
  .spend-panel { left: 0.75rem; right: 0.75rem; width: auto; bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
  .footer { flex-direction: column; gap: 0.45rem; }
}

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