.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }

.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 28px; height: 60px; }
.logo { display: inline-flex; align-items: center; font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.logo img { display: block; width: 118px; height: auto; }
.logo:hover { text-decoration: none; }
.logo span { margin-left: 7px; font-weight: 400; font-size: 13px; color: var(--text-3); }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { padding: 6px 10px; border-radius: 6px; font-size: 14px; color: var(--text-2); white-space: nowrap; }
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a[aria-current=page] { color: var(--accent); background: #edf3fb; font-weight: 600; }
.account { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.account a { color: var(--text-2); }
.account-name { max-width: clamp(6ch, 12vw, 16ch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name[aria-current=page] { color: var(--accent); font-weight: 600; }
.account .link-btn { color: var(--text-3); }
.account .announcement-launcher { color: var(--accent); white-space: nowrap; }
.public-nav { margin-left: auto; }
.skip-link { position: absolute; left: 12px; top: 8px; z-index: 30; transform: translateY(-150%); padding: 8px 12px; background: var(--bg); }
.skip-link:focus { transform: none; }

main.wrap { padding-top: 52px; padding-bottom: 72px; min-height: calc(100vh - 124px); }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title h1 { font-size: 24px; }
.page-title p { margin-top: 6px; font-size: 14px; color: var(--text-2); }

.section { margin-top: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-head h2 { font-size: 15px; }
.section-head span { font-size: 13px; color: var(--text-3); }

/* daily report */
.issue-title { margin: 0 0 36px; }
.back + .issue-title { margin-top: 16px; }
.issue-title h1 { font-size: clamp(27px, 4vw, 36px); font-weight: 650; overflow-wrap: anywhere; }
.issue-title p { margin-top: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.meta-separator { margin: 0 8px; color: var(--text-3); }
.text-action { font-size: 14px; white-space: nowrap; }
.issue-topics { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.issue-topics span { margin-right: 4px; font-size: 13px; color: var(--text-3); }
.issue-topics a { padding: 4px 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; overflow-wrap: anywhere; }
.issue-topics a[aria-current=page] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.section-empty { margin: 14px 0; color: var(--text-2); }
.first-issue-row, .first-issue-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.first-issue-row { justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.first-issue-state { font-size: 14px; color: var(--text-2); }
.empty .first-issue-state { justify-content: center; }
.first-issue-card {
  margin: 0 0 28px; padding: clamp(16px, 4vw, 24px);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-inline-start: 4px solid var(--accent); border-radius: 10px;
}
.first-issue-card h2 { font-size: clamp(18px, 4vw, 22px); color: var(--text); }
.first-issue-date { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.first-issue-card .first-issue-state { margin-top: 14px; }
.first-issue-steps { display: none; }
.first-issue-card .first-issue-steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  width: 100%; margin: 0 0 6px; padding: 0; list-style: none;
  font-size: .8125rem; line-height: 1.5;
}
.first-issue-steps li::before { content: ''; display: block; height: 6px; margin-bottom: 6px; border-radius: 6px; background: var(--line-strong); }
.first-issue-steps .step-done { color: var(--accent); }
.first-issue-steps .step-done::before { background: var(--accent); }
.first-issue-steps .step-current { color: var(--accent); font-weight: 650; }
.first-issue-steps .step-current::before { background: var(--accent); }
.first-issue-state:is([data-state="pending"], [data-state="preparing"]) .step-current::before {
  animation: issue-pulse 1.8s ease-in-out infinite;
}
.pending-dots { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; color: #383838; }
.pending-dots i { height: 4px; width: 4px; border-radius: 50%; background: currentColor; animation: issue-pulse 1.2s ease-in-out infinite; }
.pending-dots i:nth-child(2) { animation-delay: .15s; }
.pending-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes issue-pulse { 0%, 65%, 100% { opacity: .35; } 32% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pending-dots i, .first-issue-state:is([data-state="pending"], [data-state="preparing"]) .step-current::before { animation: none; }
}
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.refs { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.refs a { margin-right: 6px; }

.paper { padding: 20px 0; border-bottom: 1px solid var(--line-soft); }
.paper-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.paper h3 { font-family: var(--sans); font-size: 19px; line-height: 1.45; overflow-wrap: anywhere; }
.original-title { display: block; margin-top: 4px; font: 15px/1.5 var(--serif); color: var(--text-2); }
.paper h3 a { color: var(--text); }
.paper h3 a:hover { color: var(--accent); text-decoration: none; }
.meta { margin-top: 6px; font-size: 13px; color: var(--text-3); }
.meta > span + span::before { content: "·"; margin: 0 6px; }
.correction { color: var(--danger); }
.summary { margin-top: 10px; font-size: 14px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.reason { margin-top: 8px; font-size: 13px; color: var(--text-3); }
.footnote { margin-top: 40px; font-size: 12px; line-height: 1.8; color: var(--text-3); }

.empty { padding: 56px 0; text-align: center; color: var(--text-2); font-size: 14px; }
.empty h1, .empty h2 { margin-bottom: 8px; font-size: 18px; color: var(--text); }
.empty .btn { margin-top: 18px; }

/* paper detail */
.back { font-size: 13px; color: var(--text-3); }
.detail { max-width: 760px; }
.paper-detail-title { margin-top: 18px; }
.detail h1 { overflow-wrap: anywhere; font-family: var(--sans); font-size: 26px; line-height: 1.4; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 20px 0 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg form + form button { border-left: 1px solid var(--line-strong); }
.seg button { height: 32px; padding: 0 12px; border: 0; background: #fff; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg button:hover { background: var(--bg-soft); }
.seg button[aria-pressed=true] { background: var(--text); color: #fff; }
.block { margin-top: 28px; }
.block h2 { margin-bottom: 8px; font-size: 15px; }
.block p { line-height: 1.85; }
.reading-paragraph { white-space: pre-line; }
.reading-paragraph + .reading-paragraph { margin-top: 10px; }
.translation-source { margin-top: 7px; font-size: 13px; color: var(--text-3); }
.facts { display: grid; grid-template-columns: 96px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; word-break: break-all; }

/* lists */
.history-views { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.history-views a { padding: 5px 12px; border-radius: 5px; color: var(--text-2); font-size: 14px; }
.history-views a[aria-current=page] { background: #edf3fb; color: var(--accent); font-weight: 600; }
.rows { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.row-main { flex: 1; min-width: 0; }
.row-main h2 { font-size: 16px; }
.row-title { font-weight: 500; color: var(--text); }
.row-link:hover { text-decoration: none; }
.row-link:hover .row-title { color: var(--accent); text-decoration: underline; }
.row-title.serif { font-family: var(--serif); font-size: 16px; }
.row-sub { margin-top: 2px; font-size: 13px; color: var(--text-3); }
.journal-metrics { display: flex; flex-wrap: wrap; gap: 3px 14px; margin: 5px 0 0; font-size: .8125rem; color: var(--text-3); }
.journal-metrics b { color: var(--text-2); font-weight: 600; }
.upgrade-preview { padding: 18px 20px; border: 1px solid #dce5f0; border-radius: 8px; background: #f7f9fc; }
.upgrade-preview .section-head { padding: 0 0 6px; border: 0; gap: 10px; }
.upgrade-preview .section-empty { margin-block: 14px; color: var(--text); }
.upgrade-preview .section-empty strong { color: var(--accent); }
.upgrade-preview .notes li:last-child { border-bottom: 0; padding-bottom: 0; }
.row-side { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-3); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 0 8px; border-radius: 4px; background: var(--bg-soft); font-size: 12px; line-height: 20px; color: var(--text-2); }

/* forms */
.form-narrow { max-width: 560px; }
.auth { max-width: 360px; margin: 32px auto 0; }
.auth h1 { margin-bottom: 24px; font-size: 22px; }
.auth .alt { margin-top: 20px; font-size: 14px; color: var(--text-2); }
.panel { padding: 24px 0; border-top: 1px solid var(--line); }
.panel h2 { margin-bottom: 14px; font-size: 15px; }
.panel p { margin-bottom: 14px; font-size: 14px; color: var(--text-2); }
.panel.danger h2 { color: var(--danger); }
.topic-query + .topic-query { margin-top: 20px; }
.topic-query h3 { margin-bottom: 8px; font-size: 14px; }
.topic-query-expression { display: grid; gap: 5px; }
.topic-query-expression code { padding: 7px 10px; border-radius: 4px; background: var(--bg-soft); font: inherit; overflow-wrap: anywhere; }
.topic-query-operator { margin-left: 10px; color: var(--accent); font-weight: 700; }
.topic-query + .alert { margin-top: 12px; }

.topic-preview {
  width: min(680px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  margin: auto; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--text); box-shadow: 0 18px 50px rgba(31, 35, 40, .24);
}
.topic-preview::backdrop { background: rgba(31, 35, 40, .48); }
.topic-preview-layout { display: flex; flex-direction: column; max-height: min(740px, calc(100dvh - 34px)); }
.topic-preview header { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.topic-preview h2 { font-size: 18px; }
.topic-preview-body { min-height: 0; overflow-y: auto; padding: 18px 22px; overflow-wrap: anywhere; }
.topic-preview-body p + p { margin-top: 10px; }
.topic-preview-body .alert { margin-bottom: 0; }
.topic-preview-loading:not([hidden]) { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.topic-preview-spinner {
  width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid var(--line-strong);
  border-top-color: var(--accent); border-radius: 50%; animation: topic-preview-spin .8s linear infinite;
}
@keyframes topic-preview-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .topic-preview-spinner { animation: none; } }
.topic-preview footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); }
.topic-preview button:disabled { opacity: .55; cursor: default; }

.prose { max-width: 680px; }
.prose h1 { margin-bottom: 8px; font-size: 24px; }
.prose h2 { margin: 28px 0 8px; font-size: 16px; }
.prose p { line-height: 1.85; color: var(--text-2); }

.starter-guide { margin-bottom: 26px; padding: clamp(18px, 3vw, 28px); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 10px; background: var(--bg-soft); }
.starter-guide h2 { font-size: 20px; }
.starter-guide ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 24px; margin: 18px 0; padding-inline-start: 20px; }
.starter-guide li::marker { color: var(--accent); font-weight: 650; }
.starter-guide li span { display: block; margin-top: 4px; font-size: 14px; color: var(--text-2); }
.starter-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.announcement-dialog {
  position: fixed; inset: 0; margin: auto; padding: 0;
  width: min(552px, calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px);
  border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 14px;
  background: var(--bg); color: var(--text); box-shadow: 0 18px 64px rgba(20, 34, 54, .28);
}
.announcement-dialog[open] { display: flex; flex-direction: column; }
.announcement-dialog::backdrop { background: rgba(20, 34, 54, .48); }
.announcement-header, .announcement-actions {
  display: flex; flex: none; align-items: center; gap: 8px; padding: 10px clamp(14px, 4vw, 24px);
}
.announcement-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.announcement-header h2 { font-size: 17px; }
.announcement-close {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-size: 26px; cursor: pointer;
}
.announcement-close:hover { background: var(--bg-soft); }
.announcement-actions { justify-content: flex-end; border-top: 1px solid var(--line); background: var(--bg-soft); }

.feedback-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 15;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 76px; height: 76px; border-radius: 50%; background: var(--accent); color: #fff;
  box-shadow: 0 7px 22px rgba(20, 34, 54, .24); font-size: 14px; font-weight: 650;
}
.feedback-launcher:hover { text-decoration: none; box-shadow: 0 8px 24px rgba(20, 34, 54, .37); }
.feedback-launch-icon { position: relative; display: grid; place-items: center; width: 23px; height: 16px; border: 2px solid; border-radius: 6px; font: 9px/1 var(--sans); letter-spacing: 1px; padding-left: 1px; }
.feedback-launch-icon::after { content: ''; position: absolute; left: 3px; bottom: -4px; width: 5px; height: 5px; background: var(--accent); border-inline-start: 2px solid; border-block-end: 2px solid; transform: skewY(-32deg); }
.feedback-dialog {
  position: fixed; inset: auto 24px 112px auto; margin: 0; padding: 0;
  width: min(445px, calc(100% - 48px)); max-height: calc(100dvh - 136px); overflow: auto;
  border: 1px solid var(--line); border-radius: 15px; background: var(--bg); color: var(--text);
  box-shadow: 0 14px 48px rgba(20, 34, 54, .24);
}
.feedback-dialog::backdrop { background: rgba(20, 34, 54, .20); }
.feedback-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 8px 18px; background: var(--accent); color: #fff; }
.feedback-dialog-header h2 { font-size: 18px; }
.feedback-close { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; font-size: 27px; cursor: pointer; }
.feedback-close:hover { background: rgba(255, 255, 255, .14); }
.feedback-close:focus-visible { outline-color: #fff; }
.feedback-dialog-content { padding: 18px; }
.feedback-contacts { min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.feedback-contacts legend { padding-inline: 5px; font-weight: 650; }
.feedback-contacts legend span, .feedback-contacts > p { font-size: 13px; color: var(--text-2); }
.feedback-contact { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 8px; margin-block: 6px; }
.feedback-contact label { cursor: pointer; }
.feedback-contact-value { grid-column: 2; }
.feedback-contact > input[type="checkbox"]:not(:checked) ~ .feedback-contact-value { display: none; }
.feedback-form .form-actions { margin-top: 16px; justify-content: flex-end; }
.feedback-status { margin: 12px 0 0; }
.feedback-form button:disabled { opacity: .65; cursor: wait; }

@media (max-width: 800px) {
  .workspace-with-feedback { height: 100vh; height: 100dvh; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
  .workspace-scroll { overflow-y: auto; }
  .feedback-dock { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); background: var(--bg); padding: 4px max(12px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) 12px; }
  .feedback-launcher { position: static; width: 50px; height: 50px; gap: 3px; font-size: 11px; box-shadow: none; }
  .feedback-launch-icon { width: 19px; height: 13px; font-size: 7px; }
  .feedback-dialog { inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px; width: auto; max-width: none; max-height: calc(100dvh - 32px); }
  .feedback-form textarea, .feedback-contact-value { font-size: 16px; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 4px; gap: 4px 16px; }
  .account { margin-left: auto; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; margin: 0 -4px; padding-bottom: 4px; }
  .nav a { padding-inline: 7px; }
  main.wrap { padding-top: 32px; }
  .page-title { flex-direction: column; align-items: flex-start; }
  .row { flex-wrap: wrap; }
  .detail h1 { font-size: 22px; }
  .starter-guide ol { grid-template-columns: 1fr; }
}
