/* Sploot's ink, blue shelf, and favorite pink stay in the controls.
   The unframed original is the only hero. */
:root {
  color-scheme: light dark;
  --ink: #1c1547;
  --shelf: #e9f3ff;
  --surface: #ffffff;
  --blue: #0868a4;
  --cyan: #39b1ff;
  --favorite: #ed58bd;
  --muted: #615e78;
  --line: #c5cbdb;
  --wash: #f4f8ff;
  --danger: #b81d3a;
  --success: #176c46;
  --focus: #4a25c7;
  --chrome-height: calc(106px + env(safe-area-inset-top));
  --body-type: "Avenir Next", "Trebuchet MS", ui-rounded, system-ui, sans-serif;
  font-family: var(--body-type);
  color: var(--ink);
  background: var(--shelf);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--chrome-height) + 10px); }
body { margin: 0; min-width: 280px; font-size: 16px; line-height: 1.5; }
a { color: var(--blue); text-underline-offset: 3px; }
button, input { font: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; color: var(--ink); background: var(--surface); font-size: 16px; }
input:read-only { background: var(--wash); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blue); flex: 0 0 auto; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus, article:focus { outline: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); line-height: 1.18; letter-spacing: -.04em; font-weight: 800; }
h2 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
p { max-width: 65ch; }
button, a { touch-action: manipulation; }
.icon { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: -100px; left: 12px; padding: 12px 18px; background: var(--surface); border: 2px solid var(--ink); border-radius: 8px; }
.skip-link:focus { top: calc(8px + env(safe-area-inset-top)); }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-weight: 650; line-height: 1.2; text-decoration: none; padding: 10px 15px; }
.button-primary { color: #fff; background: var(--blue); border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
.button-danger { color: var(--danger); border-color: currentColor; }
.icon-button { min-width: 44px; padding: 10px; border-color: transparent; background: transparent; }
.button:active, .icon-button:active { transform: translateY(1px); box-shadow: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.help-text, .muted { color: var(--muted); }
.help-text { margin: 10px 0 0; font-size: .875rem; line-height: 1.5; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chrome { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 52px 44px; align-items: center; gap: 0 10px; padding: calc(6px + env(safe-area-inset-top)) 12px 4px; background: var(--shelf); border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 7px; width: fit-content; color: var(--ink); text-decoration: none; }
.wordmark span { font-family: ui-rounded, "Arial Rounded MT Bold", var(--body-type); font-size: 25px; font-weight: 900; letter-spacing: -.065em; line-height: 1; }
.brand-mark { display: none; width: 32px; height: 32px; fill: none; stroke-width: 2.8; }
.brand-mark circle:first-child { stroke: var(--cyan); }
.brand-mark circle:last-child { stroke: var(--favorite); }
.search-form { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); min-width: 0; height: 42px; }
.search-form > .icon { margin-left: 10px; width: 18px; height: 18px; color: var(--muted); }
.search-form input { border: 0; padding: 8px; background: transparent; outline-offset: -3px; }
.search-submit { display: none; flex: 0 0 auto; width: 44px; min-height: 42px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.library-nav { grid-row: 2; grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; }
.library-nav a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; border-radius: 10px; padding: 7px 18px; color: var(--muted); text-decoration: none; font-weight: 650; }
.library-nav a[aria-current] { color: var(--ink); background: var(--surface); }
.library-nav a[aria-current][data-feed-nav="favorites"] .icon { fill: var(--favorite); color: var(--ink); }
.library-nav .shuffle-control { margin-left: auto; padding: 8px 10px; }
.chrome-actions { display: flex; align-items: center; gap: 3px; }
.save-control { min-width: 42px; min-height: 42px; padding: 8px; }
.save-control span, .desktop-label, .rail-note { display: none; }
.settings-control { padding: 8px; min-width: 40px; }
.signed-out-link { grid-column: 3; grid-row: 1; }
.rail-account { display: none; }
.chrome:has(.signed-out-link) { grid-template-rows: 52px; }
.app-main { width: 100%; max-width: 940px; min-height: calc(100svh - var(--chrome-height)); margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.feed-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 13px 16px 8px; }
.feed-heading h1 { margin: 0; font-size: .9rem; font-weight: 650; letter-spacing: 0; }
.feed-heading > span { color: var(--muted); font-size: .8rem; }
.media-feed { overflow-anchor: none; }
.media-card { margin: 0 0 32px; scroll-margin-top: calc(var(--chrome-height) + 8px); }
.media-stage { display: flex; align-items: center; justify-content: center; position: relative; width: 100%; height: calc(100svh - var(--chrome-height) - 118px); min-height: 240px; background: var(--surface); }
.media-open { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--ink); }
.original-media { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.media-open .original-media { pointer-events: none; }
.media-error { position: absolute; max-width: 28ch; padding: 20px; background: var(--surface); text-align: center; }
.media-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; min-height: 62px; }
.media-caption { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.filename-button { max-width: 100%; min-height: 44px; border: 0; padding: 6px 0; color: var(--muted); background: transparent; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size: .8rem; text-align: left; }
.media-kind { display: none; color: var(--muted); font-size: .8rem; flex: 0 0 auto; }
.media-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.share-button { border-color: transparent; background: transparent; padding: 10px; }
[data-action="favorite"][aria-pressed="true"] .icon { fill: var(--favorite); color: var(--ink); }
[data-action="sound"][aria-pressed="false"] { color: var(--muted); }
[data-action="sound"][aria-pressed="false"] .icon { opacity: .65; }
[data-action="sound"][aria-pressed="true"] { background: var(--surface); color: var(--blue); }
.page-loader { display: flex; flex-direction: column; align-items: center; padding: 14px 20px 40px; }
.loading-label { display: none; }
.htmx-request .loading-label { display: inline; }
.htmx-request .load-label { display: none; }
.htmx-request .load-more-button { pointer-events: none; opacity: .65; }
.feed-end { margin: 12px auto 50px; padding: 0 20px; text-align: center; color: var(--muted); font-size: .9rem; }
.search-heading { padding: 18px 20px 8px; }
.search-heading h1 { margin: 15px 0 7px; overflow-wrap: anywhere; }
.search-heading p { color: var(--muted); margin-bottom: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; color: var(--muted); font-size: .9rem; text-decoration: none; }
.back-link .icon { width: 17px; }
.empty-state, .signed-out-state { padding: clamp(46px, 10vh, 100px) 24px; max-width: 600px; margin: 0 auto; }
.empty-state h2 { max-width: 20ch; font-size: 1.8rem; }
.empty-state p, .signed-out-state p { color: var(--muted); }
.inline-error { padding: 20px; margin: 16px; border-left: 3px solid var(--danger); background: var(--surface); }
.inline-error p:last-child { margin-bottom: 0; }
.search-status { margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--blue); background: var(--surface); font-size: .9rem; }
.form-error { color: var(--danger); margin: 8px 0 0; }
.settings-main { max-width: 720px; padding: 18px 22px 70px; }
.settings-main > h1 { margin: 24px 0 10px; }
.settings-section { padding: 26px 0; border-bottom: 1px solid var(--line); }
.settings-section h2 { margin-bottom: 12px; }
.settings-section > p { color: var(--muted); }
.settings-section:last-child { border: 0; }
.account-email { overflow-wrap: anywhere; }
.account-password { margin-top: 24px; }
.account-password summary { cursor: pointer; padding: 10px 0; font-weight: 650; }
.account-password .stack-form { margin-top: 12px; }
.account-password .stack-form > .button { justify-self: start; margin-top: 8px; }
.text-button { border: 0; padding: 0; min-height: 44px; background: transparent; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.connection-code { width: fit-content; padding: 12px 18px; border: 2px solid var(--ink); border-radius: 9px; font-size: clamp(1.5rem, 6vw, 2rem); font-weight: 750; letter-spacing: .12em; background: var(--surface); }
#device-user-code { text-transform: uppercase; letter-spacing: .08em; }
.connect-main { max-width: 680px; }
.stack-form { display: grid; gap: 8px; margin: 22px 0 0; }
.stack-form > label { font-weight: 650; }
.input-action { display: flex; gap: 8px; align-items: stretch; }
.input-action .button { flex: 0 0 auto; }
.metadata { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 24px; font-size: .9rem; }
.metadata dt { color: var(--muted); }
.metadata dd { margin: 0; overflow-wrap: anywhere; }
.storage-meter { width: 100%; height: 8px; border: 0; border-radius: 8px; accent-color: var(--blue); }
.token-list { margin: 20px 0; }
.token-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.token-row strong { font-weight: 650; overflow-wrap: anywhere; }
.token-row p { margin: 3px 0 0; font-size: .85rem; color: var(--muted); }
.token-row .button { grid-row: 1; grid-column: 2; }
.token-secret { padding: 20px; margin-top: 20px; background: var(--surface); border: 2px solid var(--blue); border-radius: 12px; }
.token-secret p { font-size: .9rem; }
.token-secret input { font-family: ui-monospace, monospace; font-size: .9rem; }
.check-label { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.keyboard-help { margin-top: 22px; }
.keyboard-help summary { cursor: pointer; padding: 10px 0; }
kbd { font-family: ui-monospace, monospace; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 1px 5px; }
.sign-in-main { max-width: 480px; padding: 65px 22px; }
.sign-in-intro h1 { max-width: 12ch; font-size: 2.65rem; }
.sign-in-intro p, .sign-in-note { color: var(--muted); }
.sign-in-note { font-size: .85rem; margin-top: 30px; }
.auth-form { margin-top: 30px; }
.auth-form > .button { width: 100%; margin-top: 8px; }
.auth-form .help-text { margin-top: 0; }
.auth-form .check-label { color: var(--muted); font-weight: 400; }
.sheet { width: min(100% - 24px, 520px); max-height: calc(100svh - 48px - env(safe-area-inset-top)); padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(14 9 43 / 48%); }
.sheet-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: -8px -8px 14px 0; }
.sheet-heading h2 { margin: 0; }
.sheet > p { color: var(--muted); }
.filename { overflow-wrap: anywhere; }
.share-actions { display: flex; flex-direction: column; gap: 10px; }
.share-actions > * { width: 100%; }
.file-picker { width: 100%; cursor: pointer; }
.file-picker:has(+ input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.receipt-section { margin-top: 26px; }
.receipt-list { padding: 0; list-style: none; margin: 0; }
.receipt { padding: 12px 0; border-top: 1px solid var(--line); }
.receipt strong, .receipt span { display: block; }
.receipt strong { overflow-wrap: anywhere; font-size: .9rem; }
.receipt span { color: var(--muted); font-size: .85rem; }
.receipt[data-status="saved"] span { color: var(--success); }
.receipt[data-status="failed"] span { color: var(--danger); }
.receipt .button { margin-top: 8px; }
.public-link-section, .delete-section, .tags-section, .indexing-section { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.public-link-section .help-text { margin-bottom: 14px; }
.tag-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); }
.tag-chip { display: inline-flex; align-items: center; gap: 2px; padding-left: 12px; color: var(--ink); background: var(--wash); border: 1px solid var(--line); border-radius: 9px; overflow-wrap: anywhere; }
.tag-chip .icon-button { font-size: 1.25rem; }
.viewer { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: var(--surface); color: var(--ink); overflow: hidden; }
.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.viewer-heading h2 { margin: 0; font-size: .9rem; font-weight: 500; color: var(--muted); }
.viewer-stage { display: flex; align-items: center; justify-content: center; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.viewer-stage img, .viewer-stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.viewer-stage.is-zoomed { display: block; }
.viewer-stage.is-zoomed img { width: auto; height: auto; min-width: 100%; max-width: none; object-fit: initial; }
.viewer-stage img { cursor: zoom-in; }
.viewer-stage.is-zoomed img { cursor: zoom-out; }
.viewer-actions { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 10px 8px calc(12px + env(safe-area-inset-bottom)); }
.viewer-actions [data-action="previous"] { margin-right: auto; }
.viewer-actions [data-action="next"] { margin-left: auto; }
.viewer-actions .button { border-color: transparent; }
body:has(dialog[open]) { overflow: hidden; }
.notifications { position: fixed; z-index: 40; bottom: calc(18px + env(safe-area-inset-bottom)); left: 12px; right: 12px; display: grid; gap: 8px; pointer-events: none; }
.notification { display: flex; align-items: center; justify-content: space-between; gap: 14px; max-width: 520px; width: 100%; margin: 0 auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 4px 16px rgb(28 21 71 / 12%); pointer-events: auto; }
.notification p { margin: 0; font-size: .9rem; }
.notification .button { flex: 0 0 auto; }
.sheet > .notification { margin-top: 16px; }
.viewer > .notification { position: absolute; bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px; width: calc(100% - 24px); }
.session-notice { position: fixed; z-index: 35; bottom: 0; left: 0; right: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 2px solid var(--blue); font-size: .9rem; text-align: center; }
.session-lock { position: fixed; z-index: 50; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: max(24px, env(safe-area-inset-left)); background: var(--shelf); }
.session-lock > * { width: min(100%, 480px); margin-left: auto; margin-right: auto; }
.session-lock .button { width: auto; min-width: 200px; }
.drop-target { position: fixed; z-index: 70; inset: 12px; display: grid; place-items: center; border: 3px dashed var(--blue); border-radius: 18px; background: var(--shelf); pointer-events: none; }
.drop-target span { padding: 24px; font-size: 1.8rem; font-weight: 800; text-align: center; }
.noscript-note { padding: 16px 22px; background: var(--surface); font-size: .9rem; margin: 0; }
@media (hover: hover) {
  .button:not(:disabled):hover, .icon-button:not(:disabled):hover { border-color: var(--ink); }
  .button-primary:not(:disabled):hover { background: var(--blue); box-shadow: 0 3px 0 var(--ink); }
  .library-nav a:hover, .filename-button:hover { color: var(--ink); }
  .media-open:hover { cursor: zoom-in; }
}
@media (min-width: 760px) {
  :root { --chrome-height: 24px; }
  .chrome { position: fixed; inset: 0 auto 0 0; width: 238px; height: 100svh; display: flex; flex-direction: column; align-items: stretch; padding: 32px 20px; border-right: 1px solid var(--line); border-bottom: 0; }
  .wordmark { margin-bottom: 34px; gap: 9px; }
  .wordmark span { font-size: 35px; }
  .brand-mark { display: block; }
  .search-form { flex: 0 0 auto; height: 46px; }
  .search-form > .icon { display: none; }
  .search-form input { padding-left: 11px; }
  .search-submit { display: flex; }
  .library-nav { margin: 28px 0; display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
  .library-nav a { justify-content: flex-start; min-height: 46px; padding-left: 14px; }
  .library-nav .shuffle-control { margin: 15px 0 0; padding-left: 14px; }
  .chrome-actions { flex-direction: column; align-items: stretch; gap: 16px; }
  .save-control { min-height: 46px; }
  .save-control span, .desktop-label { display: inline; }
  .mobile-label { display: none; }
  .settings-control { justify-content: flex-start; padding-left: 14px; font-weight: 500; color: var(--muted); }
  .rail-account { display: grid; gap: 10px; margin-top: 28px; font-size: .8rem; }
  .chrome { overflow-y: auto; }
  .rail-account a { color: var(--muted); overflow-wrap: anywhere; }
  .rail-account .button { justify-self: start; min-height: 36px; padding: 8px 12px; font-size: .8rem; }
  .rail-note { display: block; margin: auto 0 0; padding-top: 32px; color: var(--muted); font-size: .85rem; line-height: 1.7; }
  .app-shell { padding-left: 238px; }
  .app-main { padding: 14px 28px 40px; }
  .feed-heading { padding: 10px 0 18px; }
  .media-stage { height: calc(100svh - 150px); max-height: 850px; min-height: 400px; border-radius: 5px; }
  .media-footer { padding: 10px 0; }
  .media-caption { max-width: 50%; }
  .media-kind { display: inline; }
  .media-card { margin-bottom: 45px; }
  .search-heading { padding: 15px 0; }
  .search-heading h1 { font-size: 1.8rem; }
  .settings-main { padding: 32px 40px 70px; }
  .sign-in-main { padding: 100px 26px; }
  .sheet { padding: 28px; }
  .viewer { inset: 22px; width: calc(100% - 44px); height: calc(100% - 44px); border-radius: 12px; }
  .notifications, .session-notice { left: 238px; }
}
@media (min-width: 1200px) {
  .app-main { padding-right: 52px; padding-left: 52px; }
  .media-stage { height: calc(100svh - 150px); }
  .settings-main { padding-left: 40px; padding-right: 40px; }
}
@media (max-width: 359px) {
  .input-action { flex-wrap: wrap; }
  .input-action input { flex-basis: 100%; }
  .token-row { grid-template-columns: minmax(0, 1fr); }
  .token-row .button { grid-column: 1; grid-row: auto; justify-self: start; }
  .chrome { gap: 0 6px; padding-left: 8px; padding-right: 8px; }
  .wordmark span { font-size: 22px; }
  .search-form > .icon { display: none; }
  .settings-control { min-width: 34px; padding: 6px; }
  .media-footer { padding-left: 8px; padding-right: 8px; }
  .media-caption { max-width: 20%; }
  .media-actions { gap: 0; }
  .share-button { padding: 10px 8px; }
  .viewer-actions { gap: 0; }
  .viewer-actions .button { padding: 10px 8px; }
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #f0ecff; --shelf: #19143d; --surface: #241d50; --blue: #8ed2ff; --cyan: #8ed2ff; --favorite: #ff8ed7; --muted: #b8b1d0; --line: #49416b; --wash: #30285b; --danger: #ff9aac; --success: #7addae; --focus: #ffe45c; }
  .button-primary { color: #1c1547; border-color: #090720; box-shadow: 0 2px 0 #090720; }
  .media-stage, .viewer { background: #120e29; }
  .notification { box-shadow: 0 4px 18px rgb(0 0 0 / 25%); }
  .brand-mark circle:first-child { stroke: #8ed2ff; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  .button:active, .icon-button:active { transform: none; }
}
