:root {
  color-scheme: light dark;
  --background: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #eeede7;
  --text: #232b28;
  --muted: #63706a;
  --border: #dddfd7;
  --accent: #265c43;
  --accent-hover: #1d4934;
  --accent-text: #ffffff;
  --accent-soft: #e7eee5;
  --warning: #795620;
  --warning-bg: #f7efdf;
  --shadow: 0 8px 32px rgb(31 46 35 / 4%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #141716;
    --surface: #1e2320;
    --surface-soft: #262d28;
    --text: #ecefe7;
    --muted: #a6b1a7;
    --border: #343d35;
    --accent: #bbd7ab;
    --accent-hover: #cce4bf;
    --accent-text: #1c3020;
    --accent-soft: #29372a;
    --warning: #e3c491;
    --warning-bg: #342d20;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); line-height: 1.5; }
button, input { font: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
button, summary { touch-action: manipulation; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent-soft); color: var(--text); }
.app-shell { max-width: 1200px; min-height: 100svh; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 22px; font-weight: 800; letter-spacing: -.8px; }
.brand img { border-radius: 12px; }
.brand-quiet { margin-left: 5px; font-weight: 450; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.private-badge { color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .035em; white-space: nowrap; }
.private-badge::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
main { flex: 1; padding: 36px 0 48px; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 10; padding: 12px 18px; background: var(--accent); color: var(--accent-text); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.eyebrow { margin: 0 0 16px; color: var(--accent); font-size: 11px; line-height: 1.4; font-weight: 750; text-transform: uppercase; letter-spacing: .15em; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 6vw, 60px); font-weight: 400; line-height: 1.09; letter-spacing: -.045em; }
.welcome-panel { max-width: 660px; padding: 36px 0 28px; }
.welcome-panel h1 { font-size: clamp(48px, 8.5vw, 82px); }
.welcome-copy, .muted { margin: 24px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
#session-retry { margin-top: 24px; }
.login-form { margin-top: 38px; max-width: 520px; }
.login-form label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 650; }
.password-row { display: flex; flex-wrap: wrap; gap: 10px; }
.password-row input { flex: 1 1 190px; min-width: 0; width: 100%; min-height: 50px; padding: 11px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 17px; box-shadow: var(--shadow); }
.password-row input[aria-invalid="true"] { border-color: var(--warning); }
.button { min-height: 46px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; font-weight: 650; white-space: nowrap; transition: background .15s ease, border-color .15s ease; }
.button-primary { background: var(--accent); color: var(--accent-text); }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button-quiet { padding-inline: 10px; background: transparent; border-color: var(--border); color: var(--muted); }
.button-quiet:hover:not(:disabled) { background: var(--surface-soft); color: var(--text); }
.input-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.form-message { margin: 12px 0 0; color: var(--warning); font-size: 14px; min-height: 21px; }
.connection-banner, .feed-status { margin: 0 0 24px; border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; color: var(--warning); background: var(--warning-bg); font-size: 13px; line-height: 1.6; }
.feed-heading-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 24px; margin: 12px 0 28px; }
.feed-heading-row .eyebrow { margin-bottom: 12px; }
.feed-description { margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.refresh-button { min-width: 123px; }
.refresh-symbol { font-size: 24px; font-weight: 400; line-height: 1; }
.refresh-button[disabled] .refresh-symbol { animation: turn 1.5s linear infinite; }
.feed-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-bottom: 22px; padding: 15px 0; border-block: 1px solid var(--border); color: var(--muted); font-size: 12px; }
#story-count { font-weight: 650; color: var(--text); }
.feed-status.is-loading { background: var(--accent-soft); color: var(--text); }
.feed-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.story-card { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.story-media { overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-soft); }
.story-media img, .story-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-media video { object-fit: contain; }
.story-body { display: flex; flex: 1; flex-direction: column; padding: 23px; }
.story-kicker { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.story-kicker span:first-child { color: var(--accent); }
.story-title { margin: 14px 0 11px; font-size: 21px; line-height: 1.32; letter-spacing: -.025em; font-weight: 700; }
.story-title a { text-decoration: none; }
.story-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.story-summary { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.7; white-space: pre-line; }
.story-footer { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 14px; margin-top: auto; padding-top: 17px; border-top: 1px solid var(--border); font-size: 12px; }
.story-reactions { color: var(--muted); }
.story-links { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.story-link { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--accent); font-weight: 650; text-decoration: none; }
.story-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.source-link { color: var(--muted); font-weight: 450; }
.empty-state { padding: 55px 24px 65px; text-align: center; border: 1px dashed var(--border); border-radius: 18px; }
.empty-symbol { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 13px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 26px; }
.empty-state h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 400; letter-spacing: -.03em; }
.empty-state p { max-width: 340px; margin: 12px auto 0; color: var(--muted); font-size: 14px; }
.site-footer { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px 26px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.site-footer > p { margin: 0; }
.footer-dot { margin: 0 4px; }
.install-help { max-width: 400px; }
.install-help summary { display: flex; align-items: center; gap: 16px; min-height: 36px; font-size: 12px; cursor: pointer; list-style: none; }
.install-help summary::-webkit-details-marker { display: none; }
.install-help[open] summary { color: var(--accent); }
.install-copy { font-size: 12px; line-height: 1.7; }
.install-copy p { margin: 12px 0 0; }

@keyframes turn { to { transform: rotate(360deg); } }

@media (min-width: 650px) {
  .app-shell { padding: max(32px, env(safe-area-inset-top)) max(36px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(36px, env(safe-area-inset-left)); }
  main { padding-top: 48px; padding-bottom: 64px; }
  .welcome-panel { padding-top: 52px; padding-bottom: 58px; }
  .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .private-badge { font-size: 12px; }
  .header-actions { gap: 22px; }
}

@media (min-width: 1040px) {
  .feed-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 370px) {
  .private-badge { display: none; }
  .wide-only { display: none; }
  .password-row .button { width: 100%; }
}

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