@font-face { font-family: "Kanit"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/kanit-thai-500-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B,U+200B-200D,U+25CC; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/kanit-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/kanit-thai-700-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B,U+200B-200D,U+25CC; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/kanit-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/noto-sans-thai-thai-400-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B,U+200B-200D,U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/noto-sans-thai-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/noto-sans-thai-thai-500-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B,U+200B-200D,U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/noto-sans-thai-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/noto-sans-thai-thai-600-normal.woff2") format("woff2"); unicode-range: U+0E01-0E5B,U+200B-200D,U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/noto-sans-thai-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --accent: #ffd23f;
  --ink: #1b1a17;
  --muted: #4a463e;
  --bg: #fbf7f0;
  --card: #fff;
  --danger: #b3261e;
  --shadow: 4px 4px 0 var(--ink);
  --display: "Kanit", "Noto Sans Thai", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 10; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* header */
.site-header { border-bottom: 2px solid var(--ink); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 26px; }
.logo-mark { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 10px; background: var(--accent); box-shadow: 3px 3px 0 var(--ink); }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; font-weight: 500; margin-left: auto; }
.site-header nav a { text-decoration: none; padding: 10px 0; }
.site-header nav a:hover { text-decoration: underline; }
.nav-cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; font-family: var(--display); font-weight: 500; background: var(--accent); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); text-decoration: none; }
.nav-cta:hover { text-decoration: none; transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }

/* buttons + search */
.search { display: flex; flex-wrap: wrap; gap: 12px; max-width: 760px; }
.search input { flex: 1 1 320px; min-width: 0; height: 56px; padding: 0 20px; font: inherit; font-size: 18px; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); }
.search button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; font-family: var(--display); font-weight: 500; font-size: 17px; color: #fff; background: var(--ink); border: 2px solid var(--ink); border-radius: 12px; text-decoration: none; cursor: pointer; }
.search button { height: 56px; font-size: 18px; border-radius: 14px; }
.btn:hover, .search button:hover { background: #000; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.btn-ghost:hover { background: var(--accent); }
.btn-block { width: 100%; }

.draft { background: #fff3cd; color: #664d03; text-align: center; padding: 8px 16px; border-bottom: 1px solid #ecd68a; }
main { min-height: 60vh; }
.page { padding-top: 32px; padding-bottom: 64px; }
h1 { font-family: var(--display); font-weight: 700; font-size: 32px; line-height: 1.25; margin: 8px 0 12px; }
h2 { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.3; margin: 32px 0 12px; }
h3 { font-family: var(--display); font-weight: 500; }
.meta { color: var(--muted); margin-top: 0; }
.page > .meta { max-width: 44em; } /* long notes (dashboard) stay readable */
.center { text-align: center; padding: 48px 0; }
.prose { max-width: 720px; }
.prose a, p a, .note a, .empty a { text-decoration: underline; text-underline-offset: 3px; }

/* hero */
.hero { padding: 32px 0 24px; }
.hero h1 { max-width: 840px; margin: 0; font-size: clamp(36px, 6vw, 64px); line-height: 1.2; text-wrap: balance; }
.pill { display: inline-block; margin: 0 8px; padding: 0 14px; background: var(--accent); border: 2px solid var(--ink); border-radius: 12px; }
.hero > p { margin: 20px 0 0; max-width: 620px; font-size: 20px; color: var(--muted); text-wrap: pretty; }
.hero .search { margin-top: 32px; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 28px 0 0; }
.chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; font-weight: 500; text-decoration: none; background: #fff; border: 2px solid var(--ink); border-radius: 999px; }
.chips a.on, .chips a:hover { background: var(--accent); }
.meme .chips { margin-top: 12px; }

/* grid + cards */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.section-head h2 { margin: 0; }
.section-head span { font-size: 15px; color: var(--muted); }
.grid { margin-top: 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.card-img { position: relative; display: block; flex: none; overflow: hidden; background: #efe9dc; aspect-ratio: 1 / 1; border-bottom: 2px solid var(--ink); }
.card-img img, .card-img video { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 16px; flex: 1; justify-content: space-between; }
.card-body h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.card-body h3 a { text-decoration: none; }
.card-body h3 a:hover { text-decoration: underline; }
.by { font-size: 14px; color: var(--muted); }
.more { text-align: center; margin: 32px 0 0; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 32px 0 0; }
.pager a, .pager .current { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; border: 2px solid var(--ink); border-radius: 12px; text-decoration: none; background: #fff; }
.pager .current { background: var(--accent); font-weight: 600; }

/* meme page */
.meme figure { margin: 0 0 16px; background: #efe9dc; border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; text-align: center; box-shadow: var(--shadow); }
.meme figure img { max-height: 70vh; width: auto; margin: 0 auto; display: block; }
.actions { margin: 20px 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 16px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.note { color: var(--muted); font-size: 14px; }

/* creators band (full width) */
.band { background: var(--accent); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.band-row { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-top: 72px; padding-bottom: 72px; }
.band-copy { flex: 1 1 420px; min-width: 0; }
.band-copy h2 { margin: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1.25; text-wrap: balance; }
.band-copy p { margin: 16px 0 0; max-width: 480px; font-size: 18px; text-wrap: pretty; }
.band-copy .btn { margin-top: 28px; min-height: 52px; font-size: 18px; border-radius: 14px; }
.perks { flex: 1 1 360px; min-width: 0; margin: 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.perks li { padding: 20px; background: #fff; border: 2px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.perks strong { display: block; font-family: var(--display); font-weight: 500; font-size: 20px; }
.perks span { display: block; margin-top: 4px; color: var(--muted); }

/* forms */
.form { max-width: 640px; }
.field { margin: 0 0 16px; border: 0; padding: 0; }
.field > label, fieldset legend { display: block; font-weight: 600; margin-bottom: 4px; padding: 0; }
fieldset label { display: block; font-weight: 400; }
.form input[type="text"], .form input[type="email"], .form input[type="url"], .form input[type="password"], .form textarea {
  width: 100%; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 12px; font: inherit; background: #fff;
}
.err { color: var(--danger); margin: 4px 0 0; font-size: 14px; }
.narrow { max-width: 420px; margin-inline: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 20px; }
.kv dt { font-weight: 600; }
.kv dd { margin: 0; }
.muted { color: #666; font-size: 14px; }

/* list page rhythm */
.page > h1 + .search { margin-top: 20px; }
.search + .meta { margin: 16px 0 0; }
.page > .search + .meta + .grid { margin-top: 20px; }
.results { margin: 8px 0 0; padding-left: 20px; }
.notice p { margin: 0 0 6px; }
.notice .hint { margin-top: 8px; }
.notice { margin: 0 0 16px; }

/* video */
.badge { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 0 10px; font-size: 13px; font-weight: 600; color: #fff; background: var(--ink); border-radius: 999px; }
.meme figure video { display: block; width: 100%; height: auto; max-height: 70vh; background: #000; }

/* upload, my files, admin */
.form-page { max-width: 640px; }
.form select, .form input[type="file"] { width: 100%; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; font: inherit; background: #fff; }
.hint { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.notice { padding: 12px 16px; background: #fff; border: 2px solid var(--ink); border-left: 8px solid var(--accent); border-radius: 12px; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fde8e6; }
.quota { margin: 16px 0 24px; }
.quota p { margin: 0 0 6px; }
.quota progress { width: 100%; max-width: 420px; height: 14px; accent-color: var(--ink); }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.file { display: flex; gap: 16px; padding: 12px; background: #fff; border: 2px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.file-img { position: relative; flex: 0 0 120px; width: 120px; height: 120px; overflow: hidden; border: 2px solid var(--ink); border-radius: 12px; background: #efe9dc; }
.file-img img, .file-img video { width: 100%; height: 100%; object-fit: cover; display: block; }
.blur img { filter: blur(18px); transform: scale(1.1); }
.file-body { flex: 1; min-width: 0; }
.file-body h2 { margin: 0 0 4px; font-size: 20px; overflow-wrap: anywhere; }
.file-body p { margin: 0 0 6px; max-width: 44em; overflow-wrap: anywhere; } /* a 10-tag line wraps instead of running 130+ characters */
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-actions form { margin: 0; }
.status { display: inline-block; padding: 0 10px; border: 2px solid var(--ink); border-radius: 999px; font-size: 14px; font-weight: 600; background: #fff; }
.status-approved { background: #c9f2d5; }
.status-rejected { background: #fde2df; }
.status-pending, .status-needs_review { background: var(--accent); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.tabs a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 999px; text-decoration: none; background: #fff; font-weight: 500; }
.tabs a.on { background: var(--accent); }

/* footer */
.site-footer { color: var(--muted); font-size: 14px; }
.site-footer .wrap { padding-top: 40px; padding-bottom: 40px; }
.site-footer .wrap > p { max-width: 40em; text-wrap: pretty; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 28px; margin-bottom: 8px; font-size: 15px; font-weight: 500; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--ink); }
.site-footer nav a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid #0b5cad; outline-offset: 2px; }
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .header-row { gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  .logo { font-size: 22px; }
  .logo-mark { width: 34px; height: 34px; border-radius: 9px; }
  .logo { order: 1; }
  .nav-cta { order: 2; min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 10px; box-shadow: 2px 2px 0 var(--ink); }
  .site-header nav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; justify-content: space-between; gap: 12px; padding: 2px 0 0; white-space: nowrap; }
  .site-header nav a { padding: 6px 0; font-size: 15px; }
  .nav-wide { display: none; }
  .page { padding-top: 20px; padding-bottom: 40px; }
  .hero { padding: 8px 0 16px; }
  .hero h1 { font-size: 34px; }
  .pill { margin: 0 4px; padding: 0 10px; border-radius: 10px; }
  .hero > p { margin-top: 12px; font-size: 16px; }
  .hero .search { margin-top: 20px; }
  .search { flex-wrap: nowrap; gap: 8px; }
  .search input { flex: 1 1 0; height: 48px; padding: 0 14px; font-size: 16px; border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); }
  .search button { height: 48px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
  .chips { flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; }
  .chips a { min-height: 40px; padding: 0 14px; white-space: nowrap; font-size: 15px; }

  h1 { font-size: 26px; }
  h2 { font-size: 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
  .card { border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); }
  .card-body { padding: 10px; gap: 6px; }
  .card-body h3 { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .by { font-size: 12px; }
  .card .btn { min-height: 38px; padding: 0 8px; font-size: 14px; border-radius: 10px; }
  .card .btn svg { width: 16px; height: 16px; }
  .section-head span { display: none; }
  .band-row { padding-top: 40px; padding-bottom: 40px; gap: 24px; }
  .band-copy p { font-size: 16px; }
  .perks li { padding: 14px; }
  .site-footer .wrap { padding-top: 24px; padding-bottom: 24px; }
  .file { gap: 12px; padding: 10px; }
  .file-img { flex-basis: 88px; width: 88px; height: 88px; }
  .file-body h2 { font-size: 17px; }
}
@media (max-width: 360px) {
  .logo { font-size: 19px; gap: 8px; }
  .logo-mark { width: 30px; height: 30px; }
  .nav-cta { padding: 0 10px; font-size: 14px; }
  .site-header nav a { font-size: 14px; }
}

.edit-img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; }
.loop-play { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; display: grid; place-items: center; font-size: 15px; color: var(--ink); background: var(--accent); border: 2px solid var(--ink); border-radius: 999px; cursor: pointer; }
video.edit-img { width: 240px; height: auto; background: #efe9dc; }

/* upload drop zone: a transparent native file input covers a styled box, so click and
   drag-and-drop work without JavaScript; :valid on the required input means a file was chosen */
.drop { position: relative; display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 28px 20px; text-align: center; background: #fffdf6; border-radius: 20px; transition: background .15s; border: 3px dashed var(--ink); }
.drop:hover { background-color: #fff3bf; }
.drop:has(.drop-input:focus-visible) { box-shadow: 0 0 0 3px var(--accent), 0 0 0 5px var(--ink); }
.drop-input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; font-size: 0; }
.drop-empty, .drop-done { display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.drop strong { font-family: var(--display); font-weight: 600; font-size: 22px; line-height: 1.3; }
.drop-sub { color: var(--muted); }
.drop-icon { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; margin-bottom: 4px; background: var(--accent); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 3px 3px 0 var(--ink); }
.drop-btn { display: inline-flex; align-items: center; min-height: 46px; padding: 0 24px; font-family: var(--display); font-weight: 500; font-size: 17px; color: #fff; background: var(--ink); border-radius: 12px; }
.drop:hover .drop-btn { background: #3a372f; }
.drop-done { display: none; }
.drop:has(.drop-input:valid) { background-color: #e9f7e4; }
.drop:has(.drop-input:valid) .drop-empty { display: none; }
.drop:has(.drop-input:valid) .drop-done { display: flex; }
.drop-icon-ok { background: #7ed67a; }
@media (max-width: 480px) { .drop { min-height: 190px; } .drop strong { font-size: 19px; } }

/* details page: one card per uploaded file */
.details { max-width: 760px; }
.detail-card { display: grid; grid-template-columns: 160px 1fr; gap: 20px; margin: 0 0 20px; padding: 16px; background: #fff; border: 2px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.detail-img { position: relative; align-self: start; aspect-ratio: 1 / 1; overflow: hidden; background: #efe9dc; border: 2px solid var(--ink); border-radius: 12px; }
.detail-img img, .detail-img video { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-fields .field:first-child { margin-top: 0; }
.more summary { cursor: pointer; font-weight: 500; padding: 8px 0; }
@media (max-width: 560px) { .detail-card { grid-template-columns: 1fr; } .detail-img { max-width: 200px; } }
.detail-card, .more, .more .field { text-align: left; }
.more { margin-top: 8px; }
.more .field label { display: block; }

/* counters, popular highlight, sort tabs */
.stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 13px; color: var(--muted); }
.stats span { display: inline-flex; align-items: center; gap: 5px; }
.badge-hot { left: auto; right: 10px; background: #d4351a; color: #fff; border-color: var(--ink); } /* white on this orange-red = 4.9:1 (was 3.1:1 on #ff5a36) */
.sortbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 0; }
.sortbar .meta { margin: 0; }
.tabs { display: flex; gap: 8px; }
.tabs a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; text-decoration: none; background: #fff; border: 2px solid var(--ink); border-radius: 999px; font-weight: 500; }
.tabs a.on, .tabs a:hover { background: var(--accent); }

/* spacing between home sections; "section-head" h2 has no margin of its own */
main section + section, .hero + section { margin-top: 56px; }
.section-head + .grid { margin-top: 20px; }
.chips { margin-top: 20px; }
@media (max-width: 640px) {
  main section + section, .hero + section { margin-top: 32px; }
}

/* favorites */
.card-actions { display: flex; gap: 8px; align-items: stretch; }
.card-actions .btn { flex: 1; width: auto; }
.fav-form { margin: 0; display: flex; }
.fav { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 48px; min-height: 48px; padding: 0; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 14px; cursor: pointer; text-decoration: none; }
.fav svg { fill: none; }
.fav:hover { background: #ffe9e4; }
.fav.on { color: #e5432d; background: #ffe9e4; }
.fav.on svg { fill: currentColor; }
.actions { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.nav-fav { display: inline-flex; align-items: center; }
.nav-fav svg { width: 20px; height: 20px; fill: none; }
@media (max-width: 640px) { .fav { min-width: 42px; min-height: 42px; border-radius: 10px; } }
.card { scroll-margin-top: 90px; }
.card { scroll-margin-top: 90px; }

/* admin dashboard */
.dash-h { font-size: 20px; margin: 28px 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); }
.kpi.alert { background: #ffe9e4; }
.kpi-label { font-size: 14px; color: var(--muted); }
.kpi-value { font-size: 30px; line-height: 1.1; }
.kpi-value a { text-decoration: none; }
.kpi-note { font-size: 13px; color: var(--muted); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 24px; }
.chart { margin: 0; padding: 14px 16px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.chart figcaption { font-weight: 600; margin-bottom: 8px; }
.chart .legend { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.chart .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 8px; border: 1.5px solid var(--ink); }
.chart svg { width: 100%; height: auto; display: block; }
.chart .s1 { fill: var(--accent); stroke: var(--ink); stroke-width: 1; }
.chart .s2 { fill: var(--ink); }
.chart .dot.s1 { background: var(--accent); }
.chart .dot.s2 { background: var(--ink); }
.chart .axis { stroke: var(--ink); stroke-width: 1.5; }
.chart .grid { stroke: #d9d2c3; stroke-width: 1; stroke-dasharray: 3 3; }
.chart .tick { font-size: 11px; fill: var(--muted); }
.tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.tops > section { margin-top: 0; } /* undo the home-page "section + section" spacing inside the grid */
.toplist { list-style: none; margin: 0; padding: 0; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.toplist li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #eee7d8; }
.toplist li:last-child { border-bottom: 0; }
.toplist a, .toplist span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* min-width:0 lets a long title shrink instead of overflowing the flex row */
.toplist b { flex: none; font-weight: 500; color: var(--muted); font-size: 14px; }

/* upload form: second click is ignored while the first upload runs */
.notice[hidden] { display: none; }
.btn.is-busy { opacity: .6; cursor: progress; }
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 14px; }
.bulk .hint { margin: 0; }
.file-pick { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }

.related { margin-top: 48px; }
.related h2 { margin: 0; }

/* ads consent banner */
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; max-width: 720px; margin: 0 auto;
  background: var(--card); border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 14px 16px; }
.consent[hidden] { display: none; }
.consent p { margin: 0 0 10px; font-size: 14px; }
.consent-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.site-footer nav .linklike { min-height: 44px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* auth pages (login / register): one card on the page, same neo-brutalist look as the rest of the site */
.auth { display: flex; flex-direction: column; align-items: center; padding: 40px 16px 64px; }
.auth-card { width: 100%; max-width: 460px; padding: 32px 32px 28px; background: var(--card); border: 2px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink); }
.auth-card h1 { margin: 0; font-size: 30px; text-align: center; }
.auth-lead { margin: 6px 0 24px; text-align: center; color: var(--muted); }
.auth-card .notice { margin-top: 16px; }
.auth-card .form { max-width: none; }
.auth-card .field { margin: 0 0 18px; text-align: left; }
.auth-card .field > label, .field-row label { display: block; margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.field-row label { margin: 0; }
.field-row a { font-size: 14px; color: var(--muted); text-underline-offset: 3px; }
.auth-card .form input[type="text"], .auth-card .form input[type="email"], .auth-card .form input[type="password"] {
  height: 52px; padding: 0 16px; font-size: 16px; border-radius: 12px; transition: box-shadow .12s, background-color .12s;
}
.auth-card .form input:focus { outline: none; background-color: #fffdf2; box-shadow: 4px 4px 0 var(--ink); }
.auth-card .form input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px #fff inset; box-shadow: 0 0 0 100px #fff inset; }
.auth-card .hint { margin: 6px 0 0; }
.auth-card .check label { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-size: 15px; font-weight: 400; line-height: 1.5; }
.auth-card .check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer; }
.auth-card .btn { width: 100%; min-height: 54px; margin-top: 6px; font-size: 18px; border-radius: 14px; }
.btn-accent { color: var(--ink); background: var(--accent); box-shadow: 3px 3px 0 var(--ink); }
.btn-accent:hover { background: var(--accent); transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.err-box { margin: 0 0 18px; padding: 10px 14px; font-size: 15px; text-align: left; background: #fde8e6; border: 2px solid var(--danger); border-radius: 12px; }
.auth-links { margin: 20px 0 0; text-align: center; color: var(--muted); }
.auth-links a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.auth-links-sm { margin-top: 8px; font-size: 14px; }
.auth-links-sm a { font-weight: 500; }
@media (max-width: 480px) {
  .auth { padding: 20px 12px 40px; }
  .auth-card { padding: 22px 18px; border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); }
  .auth-card h1 { font-size: 26px; }
}

/* upload queue (static/upload.js) */
.uq-box { margin: 18px 0; }
.uq-box progress { width: 100%; height: 18px; accent-color: var(--ink); }
.uq-list { list-style: none; margin: 10px 0; padding: 0; max-height: 320px; overflow-y: auto; border: 2px solid var(--ink); border-radius: 12px; background: #fff; }
.uq { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid #e7e1d4; font-size: 15px; }
.uq:last-child { border-bottom: 0; }
.uq-name { overflow-wrap: anywhere; }
.uq-state { white-space: nowrap; color: var(--muted); }
.uq-ok .uq-state { color: #1b6e2c; font-weight: 600; }
.uq-fail .uq-state { color: var(--danger); white-space: normal; text-align: right; }

/* tag box (static/tags.js) */
.tagbox { position: relative; }
.tagbox-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; cursor: text; }
.tagbox-row:focus-within { background: #fffdf2; box-shadow: 4px 4px 0 var(--ink); }
.tagbox-chips { display: contents; list-style: none; margin: 0; padding: 0; }
.tagchip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px; font: inherit; font-size: 15px; font-weight: 500; color: var(--ink); background: var(--accent); border: 2px solid var(--ink); border-radius: 999px; cursor: pointer; }
.tagchip:hover { background: #ffe27a; }
.form .tagbox-input { flex: 1 1 120px; width: auto; min-width: 80px; padding: 6px 4px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.form .tagbox-input:focus { outline: none; box-shadow: none; background: transparent; }
.tagbox-list { position: absolute; z-index: 20; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.tagbox-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.tagbox-list li[aria-selected="true"], .tagbox-list li:hover { background: var(--accent); }
.tagbox-count { color: var(--muted); font-size: 14px; }
.tagbox-note { margin: 6px 0 0; }

/* phone tab bar (templates/base.html "tabbar"); the desktop header is unchanged above 640px */
.tabbar { display: none; }
@media (max-width: 640px) {
  .site-header nav, .site-header .nav-cta { display: none; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .consent { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 2px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; min-height: 60px; padding: 6px 2px 8px; font-size: 12px; font-weight: 500; line-height: 1.2; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; list-style: none; }
  .tab::-webkit-details-marker { display: none; }
  .tab svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .tab[aria-current="page"] { font-weight: 700; box-shadow: inset 0 3px 0 var(--ink); }
  .tab-up { position: relative; }
  .tab-up-btn { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 56px; height: 56px; background: var(--accent); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 3px 3px 0 var(--ink); }
  .tab-up[aria-current="page"] { box-shadow: none; }
  .tab-more { display: block; }
  .tab-more > summary { height: 100%; }
  .tab-panel { position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 45; display: grid; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
  .tab-panel a { display: flex; align-items: center; min-height: 48px; padding: 0 14px; font-size: 17px; font-weight: 500; text-decoration: none; border-radius: 10px; }
  .tab-panel a:active { background: var(--accent); }
}

.sub-h { margin: 24px 0 12px; font-size: 22px; }
