:root {
  --ink: #16143a;
  --ink-soft: #4a4775;
  --yellow: #ffd21f;
  --yellow-deep: #e9a300;
  --blue: #2d7cf6;
  --blue-deep: #1a52c4;
  --purple: #8b3dff;
  --purple-deep: #5d1fd1;
  --sky: #5fd3ff;
  --red: #e0213a;
  --green: #36d67c;
  --green-deep: #1fa65a;
  --paper: #ffffff;
  --paper-soft: #eef1ff;
  --bg-top: #2a4bd0;
  --bg-bottom: #101a5c;
  --text-on-bg: #e3e9ff;
  --radius: 18px;
  --font-display: "Baloo 2", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* scrollbar-gutter keeps a stable page width even when a tab switch changes total height,
   so the layout never nudges sideways as the scrollbar appears or disappears. */
html { color-scheme: dark; background: var(--bg-bottom); scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(98, 140, 255, 0.55), transparent 65%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 22px, transparent 22px 44px),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 70%);
  background-color: var(--bg-bottom);
}

img { max-width: 100%; }
[hidden] { display: none !important; }

.display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.2px;
  /* Game-UI outline built from shadows (-webkit-text-stroke glitches on thin glyphs like "l").
     An 8-direction outline plus an outlined drop step (the same 3 × 3 grid, 1.5px lower) leaves
     no notches between the outline and the drop, where the page background used to show. */
  text-shadow:
    -1.5px -1.5px 0 var(--ink), 0 -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink),
    -1.5px 0 0 var(--ink), 1.5px 0 0 var(--ink),
    -1.5px 1.5px 0 var(--ink), 0 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink),
    -1.5px 3px 0 var(--ink), 0 3px 0 var(--ink), 1.5px 3px 0 var(--ink),
    0 6px 10px rgba(8, 10, 40, 0.35);
}

.hl { color: var(--yellow); }

/* Every section shares this width, so all boxes line up edge to edge. */
.wrap { max-width: 1180px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.page-section { margin-top: 48px; }

/* Drop shadows under bordered boxes use a 1px spread: at fractional screen scaling (e.g. 125%)
   the border and an unspread shadow are rounded to different pixels and a hairline of page
   background shows between them. The spread tucks the shadow under the border's edge. */

/* Header: sticky; hides while scrolling down, slides back in on scroll up (app.js). */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  transition: transform 0.28s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.site-header.is-scrolled {
  background: rgba(14, 22, 84, 0.94);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}
.site-header.is-hidden { transform: translateY(-100%); box-shadow: none; }

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-size: 28px; line-height: 1; text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-actions #push-btn { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* "More" menu: round sliders button next to the alerts button */
.more-menu { position: relative; flex: none; }
.more-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: rgba(10, 14, 60, 0.6);
  color: #fff;
  box-shadow: 0 3px 0 1px var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.more-btn:hover { background: rgba(10, 14, 60, 0.85); }
.more-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.more-btn[aria-expanded="true"] { background: var(--yellow); color: var(--ink); }
.more-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

.more-panel {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  z-index: 45;
  width: 250px;
  max-height: min(500px, calc(100vh - 90px));
  overflow-y: auto;
  padding: 8px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 0 var(--ink), 0 18px 40px rgba(0, 0, 0, 0.35);
}
.more-heading {
  margin: 6px 10px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.more-panel [role="menuitem"] {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 700 15px var(--font-body);
  text-align: start;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.more-panel [role="menuitem"]:hover, .more-panel [role="menuitem"]:focus-visible { background: var(--paper-soft); outline: none; }
.more-panel hr { margin: 6px 4px; border: 0; border-top: 1px solid #e3e6f3; }
.more-icon { flex: none; width: 22px; text-align: center; }

.toolbar, #support, #feedback { scroll-margin-top: 80px; }
.logo img { display: block; width: 34px; height: auto; filter: drop-shadow(0 3px 0 rgba(22, 20, 58, 0.5)); }

/* Hero: one line on desktop, balanced wrapping on smaller screens. */
.hero { padding-top: 26px; padding-bottom: 34px; text-align: center; }
.hero h1 { margin: 0; font-size: clamp(30px, 4.1vw, 52px); line-height: 1.15; text-wrap: balance; }
@media (min-width: 960px) {
  .hero h1 { white-space: nowrap; }
}

/* Buttons */
.btn {
  --btn-bg: var(--yellow);
  --btn-shade: var(--yellow-deep);
  --btn-color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--btn-bg);
  color: var(--btn-color);
  box-shadow: inset 0 -5px 0 var(--btn-shade), 0 4px 0 1px var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 -3px 0 var(--btn-shade), 0 1px 0 1px var(--ink); }
.btn:focus-visible, .tab:focus-visible, .claimed-toggle:focus-within { outline: 3px solid #fff; outline-offset: 2px; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn-blue, .btn-purple, .btn-green, .btn-red { --btn-color: #fff; text-shadow: 0 2px 0 rgba(22, 20, 58, 0.7); }
.btn-blue { --btn-bg: var(--blue); --btn-shade: var(--blue-deep); }
.btn-purple { --btn-bg: var(--purple); --btn-shade: var(--purple-deep); }
.btn-green { --btn-bg: var(--green); --btn-shade: var(--green-deep); }
.btn-red { --btn-bg: #ff4d5e; --btn-shade: #c81f35; }
.btn-white { --btn-bg: #fff; --btn-shade: #cfd6f3; }
.btn-small { font-size: 15px; padding: 5px 12px 8px; border-radius: 11px; box-shadow: inset 0 -4px 0 var(--btn-shade), 0 3px 0 1px var(--ink); }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 4px;
  padding: 5px;
  background: rgba(10, 14, 60, 0.6);
  border: 3px solid var(--ink);
  border-radius: 16px;
}

.tab {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #cdd6ff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { background: var(--yellow); color: var(--ink); box-shadow: inset 0 -4px 0 var(--yellow-deep); }
.tab .label-short { display: none; }

.count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}
.tab[aria-selected="true"] .count { background: var(--ink); color: var(--yellow); }
.count:empty { display: none; }

.toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }

.search {
  min-width: 230px;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  box-shadow: 0 4px 0 1px var(--ink);
}
.search:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }

.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--text-on-bg); cursor: pointer; user-select: none; }
.toggle input { width: 18px; height: 18px; accent-color: var(--yellow); margin: 0; }

/* Category bar: sticks under the header (--sticky-top is set by app.js) and jumps to a group. */
.cat-nav {
  position: sticky;
  top: var(--sticky-top, 0px);
  z-index: 30;
  margin: -12px 0 14px;
  padding: 8px 0;
  transition: top 0.28s ease;
}
.cat-chips {
  position: relative;
  display: flex;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  padding: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: rgba(14, 22, 84, 0.94);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none;
  padding: 5px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #cdd6ff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  cursor: pointer;
}
.cat-chip:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.08); }
.cat-chip:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.cat-chip[aria-current="true"] { background: var(--sky); color: var(--ink); box-shadow: inset 0 -3px 0 #25a3d4; }
.cat-chip:disabled { opacity: 0.38; cursor: default; }
/* Swipe indicator, only shown when the chips overflow (app.js sets .is-scrollable and the thumb). */
.cat-scroll {
  display: none;
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.cat-nav.is-scrollable .cat-scroll { display: block; }
.cat-scroll span { display: block; height: 100%; border-radius: 3px; background: var(--sky); }

/* Board: featured cards, then (on Home) status sections, each split into category groups. */
.board > * + * { margin-top: 40px; }
.board > .board-section + .board-section { margin-top: 64px; }
.board .featured-list { margin-bottom: 0; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; font-size: clamp(28px, 3vw, 36px); line-height: 1.1; }
.section-icon { font-size: 0.8em; text-shadow: none; }
.cat-group + .cat-group { margin-top: 34px; }
.cat-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  line-height: 1.2;
  color: var(--text-on-bg);
}
.cat-title::after { content: ""; flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }

/* Cards */
.grid { display: grid; gap: 26px 22px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  /* Each card is a size container, so its timer text scales with the card's own width (cqi units). */
  container: card / inline-size;
  color-scheme: light;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 7px 0 1px var(--ink);
  overflow: hidden;
  scroll-margin-top: 90px;
  transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-3px); }

.card-art {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  border-bottom: 4px solid var(--ink);
  background:
    repeating-conic-gradient(from 0deg at 50% 62%, rgba(255, 255, 255, 0.13) 0deg 9deg, transparent 9deg 18deg),
    radial-gradient(circle at 50% 62%, #c08bff 0%, var(--purple) 42%, var(--purple-deep) 100%);
}
.card-img { width: 44%; max-height: 76%; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(22, 20, 58, 0.45)); }

/* NEW tag: top-right for the first 48 hours after going live (card.js / app.js). */
/* Built as one ink shape (border + 3D base) with the gold face drawn on top, so there is no
   border/shadow seam at all. The face sits behind the text (z-index -1 inside the tag's own
   stacking context). */
.new-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 5px 13px 7px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0.08em;
}
.new-tag::before {
  content: "";
  position: absolute;
  inset: 3px 3px 6px;
  z-index: -1;
  border-radius: 9px;
  background:
    linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.8) 50%, transparent 70%) no-repeat -150% 0 / 60% 100%,
    linear-gradient(180deg, #fff48a 0%, var(--yellow) 48%, #ffae1a 100%);
  box-shadow: inset 0 -3px 0 rgba(214, 120, 0, 0.45);
  animation: tag-shine 3.2s ease-in-out infinite;
}

/* Image ↔ QR toggle (top-left). The mini picture shows what a click switches to. */
.art-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: clamp(38px, 13cqi, 48px);
  aspect-ratio: 1;
  display: grid;
  padding: 3px;
  border: 3px solid var(--ink);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 3px 0 1px var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.art-toggle:hover { transform: translateY(-1px) scale(1.06); }
.art-toggle:active { transform: translateY(2px); box-shadow: 0 1px 0 1px var(--ink); }
.art-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.art-toggle img { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.art-toggle .mini-img { padding: 2px; background: radial-gradient(circle, #c08bff, var(--purple-deep)); }
.card:not(.show-qr) .art-toggle .mini-img,
.card.show-qr .art-toggle .mini-qr { display: none; }

/* The QR replaces the reward image in the main area. Sized from the card width (cqi) so it always
   stays clear of the toggle and the NEW tag. */
.card-qr {
  display: none;
  width: 50cqi;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 0 1px rgba(22, 20, 58, 0.45);
}
.card.show-qr .card-qr { display: block; }
.card.show-qr .card-img { display: none; }
/* The CLAIMED stamp would cover the code. */
.card.is-claimed.show-qr .card-art::after { display: none; }

.amount { position: absolute; right: 12px; bottom: 6px; font-size: 30px; color: #fff; }

.card-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.card-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.12; overflow-wrap: anywhere; }
/* Source tag: one line, shortened with an ellipsis if a long name doesn't fit. */
.card-source {
  align-self: flex-start;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 0;
  padding: 2px 10px 2px 7px;
  border: 2px solid #cfd3f0;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}
.card-source svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.card-source-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-source.is-empty { visibility: hidden; }

/* Timer text never wraps: sizes follow the card width, and in the rare case it's still too tight
   the label (not the countdown) is shortened with an ellipsis. */
.timer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--paper-soft);
  white-space: nowrap;
}
.timer-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(10px, 4.2cqi, 12px);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5b5890;
}
.timer-value {
  flex: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(15px, 7.2cqi, 20px);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.card-actions .btn, .claimed-toggle { white-space: nowrap; }
.timer[data-level="soon"] { background: #fff1bd; }
.timer[data-level="urgent"] { background: #ffd9dd; }
.timer[data-level="urgent"] .timer-value { color: var(--red); animation: pulse 1s ease-in-out infinite; }
.timer[data-level="expired"], .timer[data-level="none"] { background: #ececf3; }
/* Same font-size as the other levels: keeps every card's height identical across tabs. */
.timer[data-level="expired"] .timer-value, .timer[data-level="none"] .timer-value { color: var(--ink-soft); }

.card-actions { display: flex; align-items: stretch; gap: 10px; }
.card-actions .claim { flex: 1; }

.claimed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 0 1px var(--ink);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.claimed-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--green-deep); }

.card.is-claimed .card-img { opacity: 0.45; }
.card.is-claimed .claimed-toggle { background: #d6f8e4; }
.card.is-claimed .card-art::after {
  content: attr(data-stamp);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-10deg);
  padding: 2px 14px 4px;
  border: 4px solid var(--ink);
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  text-shadow: 0 2px 0 var(--ink);
}

.card.is-expired .card-art { filter: grayscale(0.85) brightness(0.9); }
.card.is-expired:hover { transform: none; }

.card.highlight { animation: highlight 1.2s ease 3; }

/* Featured freebie: full grid width, above the normal cards. Container queries (not media
   queries) so it also stacks correctly inside the narrow admin preview. */
.featured-list { container: featured / inline-size; display: grid; gap: 26px; margin-bottom: 26px; }
.featured-list:empty { display: none; }

.card.card-featured {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  /* The 1px ink ring closes the seam between the border and the yellow ring (4px spread → 3px visible). */
  box-shadow: 0 0 0 1px var(--ink), 0 7px 0 1px var(--ink), 0 0 0 4px var(--yellow);
}
.card-featured:hover { transform: translateY(-2px); }
.card-featured .card-art {
  aspect-ratio: auto;
  min-height: 260px;
  border-bottom: 0;
  border-right: 4px solid var(--ink);
  overflow: hidden;
  background:
    repeating-conic-gradient(from 0deg at 50% 55%, rgba(255, 255, 255, 0.18) 0deg 9deg, transparent 9deg 18deg),
    radial-gradient(circle at 50% 55%, #ffe98f 0%, #ffb21f 45%, #e2641b 100%);
}
.card-featured .card-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: shine 4.5s ease-in-out infinite;
}
.card-featured .card-img { width: 40%; max-height: 70%; }
.card-featured .amount { right: 16px; bottom: 8px; font-size: 42px; }
.card-featured .new-tag { top: 14px; right: 14px; font-size: 18px; }
.card-featured .art-toggle { top: 14px; left: 14px; width: 54px; }
.card-featured .card-qr { width: min(22cqi, 250px); }
.card-featured .card-body { justify-content: center; gap: 14px; padding: 26px 30px; }
.card-featured .card-title { font-size: clamp(26px, 3vw, 36px); }
.card-featured .card-source { font-size: 14px; }
.card-featured .timer { margin-top: 4px; }
.card-featured .timer, .card-featured .card-actions { width: 100%; max-width: 440px; }

@container featured (max-width: 640px) {
  .card.card-featured { grid-template-columns: 1fr; }
  .card-featured .card-art { min-height: 0; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 4px solid var(--ink); }
  .card-featured .card-body { padding: 16px 18px 18px; gap: 10px; }
  .card-featured .card-title { font-size: 26px; }
  .card-featured .amount { font-size: 34px; }
  .card-featured .card-qr { width: 46cqi; }
  .card-featured .art-toggle { width: 46px; }
  .card-featured .timer, .card-featured .card-actions { max-width: none; }
}

.status { margin: 36px 0; text-align: center; font-size: 17px; color: var(--text-on-bg); }

.empty {
  grid-column: 1 / -1;
  padding: 44px 20px;
  border: 4px dashed rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-on-bg);
}
.empty h2 { margin: 0 0 8px; font-size: 28px; color: #fff; }
.empty p { margin: 0; }

/* Support banner */
.support-banner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
  align-items: center;
  gap: 28px;
  padding: 28px 30px;
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 7px 0 1px var(--ink);
  overflow: hidden;
  background:
    repeating-conic-gradient(from 0deg at 12% 50%, rgba(255, 255, 255, 0.07) 0deg 8deg, transparent 8deg 16deg),
    linear-gradient(120deg, var(--purple-deep) 0%, var(--purple) 45%, var(--blue) 100%);
}
.eyebrow { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: 0.02em; color: var(--yellow); }
/* The brand is always written "RareFreebies", never in capitals, even inside uppercase labels. */
.brand-name { text-transform: none; }
.support-intro h2 { margin: 4px 0 8px; font-size: clamp(30px, 3.4vw, 40px); line-height: 1.15; }
.support-intro p:last-child { margin: 0; color: var(--text-on-bg); }
/* Sits on the same baseline as "Use code" (inline-block aligns to its text baseline). */
.code-chip {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 0 12px;
  line-height: 1.2;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 4px 0 1px var(--ink);
  text-shadow: none;
}

.support-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.support-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: rgba(10, 14, 60, 0.5);
}
.support-option h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.support-option p { margin: 0 0 6px; color: var(--text-on-bg); font-size: 14px; line-height: 1.45; }
.support-option .btn { margin-top: auto; width: 100%; padding-inline: 12px; }
/* Desktop: keep both buttons on one line so the two boxes match in height.
   Narrower screens may wrap to two lines. */
@media (min-width: 900px) {
  .support-option .btn { white-space: nowrap; font-size: clamp(15px, 1.45vw, 18px); }
}

/* Feedback */
.feedback-panel {
  color-scheme: light;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 28px;
  padding: 28px 30px;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 7px 0 1px var(--ink);
}
.feedback-intro h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 3vw, 36px); line-height: 1.15; }
.feedback-intro p { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.feedback-intro .contact-line { margin-top: 18px; font-size: 15px; }
.contact-line a { color: var(--blue-deep); font-weight: 800; overflow-wrap: anywhere; }

/* The form is a size container so the email box can size its text to its own width (cqi). */
#feedback-form { container-type: inline-size; display: flex; flex-direction: column; gap: 12px; }
.feedback-type { display: flex; flex-wrap: wrap; gap: 18px; font-weight: 800; }
.feedback-type label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.feedback-type input { width: 17px; height: 17px; margin: 0; accent-color: var(--purple); }

#feedback-form textarea,
#feedback-form input[type="email"] {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 600 15px var(--font-body);
}
#feedback-form textarea { resize: vertical; min-height: 110px; }
/* The full placeholder ("Your email (optional, if you'd like a reply)") must fit on narrow phones:
   the text is about 18.6× its font size wide, and the box loses 26px to borders and padding. */
#feedback-form input[type="email"] { padding-inline: 10px; font-size: min(15px, calc((100cqi - 26px) / 19)); }
#feedback-form textarea:focus, #feedback-form input:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }

/* Bottom margin leaves room for the button's 4px drop shadow. */
.feedback-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 4px 0 4px; }
.feedback-actions .btn { min-width: 120px; }
.feedback-status { font-weight: 800; color: var(--green-deep); opacity: 0; transition: opacity 0.6s ease; }
.feedback-status.is-visible { opacity: 1; }
.feedback-status.is-error { color: #c81f35; }

/* Honeypot: visually hidden but still in the form (not display:none) so spam bots fill it in.
   No off-screen offset: a negative left would add sideways scrolling in right-to-left languages. */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}

/* "Spotted a freebie we missed?" call to action (Home and Active tabs) */
.submit-cta {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 16px, transparent 16px 32px),
    linear-gradient(120deg, #1d2f9c 0%, var(--blue) 100%);
  box-shadow: 0 7px 0 1px var(--ink);
}
.submit-cta-icon { flex: none; font-size: 40px; line-height: 1; filter: drop-shadow(0 3px 0 rgba(22, 20, 58, 0.5)); }
.submit-cta-text { flex: 1; min-width: 0; }
.submit-cta h2 { margin: 0 0 4px; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.15; }
.submit-cta p { margin: 0; color: var(--text-on-bg); }
.submit-cta .btn { flex: none; white-space: nowrap; }

/* Submit page (/submit) */
.submit-page .site-header { position: static; }
.submit-main { max-width: 780px; }
.submit-hero { padding: 16px 0 26px; text-align: center; }
.submit-hero h1 { margin: 0 0 10px; font-size: clamp(34px, 5vw, 50px); line-height: 1.1; }
.submit-hero p { max-width: 54ch; margin: 0 auto; color: var(--text-on-bg); line-height: 1.5; }
.submit-panel {
  color-scheme: light;
  padding: 26px 28px;
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 7px 0 1px var(--ink);
}
#submit-form { display: flex; flex-direction: column; gap: 18px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-block > label, .field-label { font-weight: 800; font-size: 15px; }
.field-block .req { color: var(--red); }
.field-block .opt { font-weight: 700; font-size: 13px; color: var(--ink-soft); }
/* 16px text: iPhones don't zoom the page when a field is tapped. */
#submit-form input:not([type="file"]),
#submit-form select,
#submit-form textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 600 16px var(--font-body);
}
#submit-form textarea { resize: vertical; min-height: 80px; }
#submit-form input:focus, #submit-form select:focus, #submit-form textarea:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
.field-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-soft); }
.word-count.is-over { color: #c81f35; font-weight: 800; }

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 3px dashed #b9bde0;
  border-radius: 14px;
  background: var(--paper-soft);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--blue); background: #e3ecff; }
.dropzone:focus-within { outline: 3px solid var(--yellow); outline-offset: 1px; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-icon { font-size: 30px; line-height: 1; }
.dropzone strong, .shot-preview strong { display: block; }
.dropzone small, .shot-preview small { color: var(--ink-soft); font-size: 13px; }
.shot-preview { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 14px; }
.shot-preview img { flex: none; width: 72px; height: 72px; object-fit: cover; border: 2px solid var(--ink); border-radius: 8px; }
.shot-preview > div { flex: 1; min-width: 0; }
.shot-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.submit-error {
  margin: 0;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #ffd9dd;
  color: #9c0f22;
  font-weight: 800;
  font-size: 14px;
}
.submit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 4px; }
.submit-actions .btn { min-width: 170px; }
.submit-note { font-size: 14px; color: var(--ink-soft); }
.submit-done { padding: 10px 0 4px; text-align: center; }
.submit-done-icon { font-size: 54px; line-height: 1; }
.submit-done h2 { margin: 10px 0 8px; font-size: 34px; color: #fff; }
.submit-done p { max-width: 46ch; margin: 0 auto 20px; color: var(--ink-soft); line-height: 1.5; }
.submit-done .submit-actions { justify-content: center; }

@media (max-width: 640px) {
  .submit-cta { flex-wrap: wrap; gap: 14px; padding: 18px; }
  .submit-cta-icon { font-size: 32px; }
  .submit-cta .btn { width: 100%; }
  .submit-panel { padding: 20px 18px; }
  .field-row { grid-template-columns: 1fr; }
  .submit-actions .btn { width: 100%; }
}

/* Notification dialog */
.modal {
  color-scheme: light;
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 0 1px var(--ink);
}
.modal::backdrop { background: rgba(8, 10, 40, 0.65); }
.modal-body { padding: 22px 24px 20px; }
.modal h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.15; }
.modal p, .modal li { color: var(--ink-soft); line-height: 1.5; }
.modal p { margin: 0; }
.modal li b { color: var(--ink); }
.modal ol { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 4px; }
.modal-alt { margin-top: 14px !important; font-size: 13px; }
.modal-alt a { color: var(--purple-deep); font-weight: 800; }

/* Footer & toast */
.site-footer {
  margin-top: 56px;
  padding: 24px 0 40px;
  border-top: 3px solid rgba(0, 0, 0, 0.25);
  font-size: 13px;
  color: #a9b5ee;
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-legal p { margin: 4px 0; }
.footer-legal a { color: #cdd6ff; font-weight: 800; }
.footer-legal a:hover { color: #fff; }

.social-row { display: flex; flex-wrap: wrap; gap: 20px; }
.social-row a { color: #cdd6ff; font-weight: 800; font-size: 14px; text-decoration: none; }
.social-row a:hover { color: #fff; text-decoration: underline; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 0 1px var(--ink);
  font-weight: 800;
  text-align: center;
}

@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes highlight { 50% { box-shadow: 0 7px 0 1px var(--ink), 0 0 0 7px var(--yellow); } }
@keyframes tag-shine { 0%, 55% { background-position: -150% 0, 0 0; } 100% { background-position: 250% 0, 0 0; } }
@keyframes shine { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

@media (max-width: 900px) {
  .support-banner, .feedback-panel { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 640px) {
  .wrap, .header-inner { padding-left: 16px; padding-right: 16px; }
  .logo { font-size: 24px; }
  .logo img { width: 28px; }
  .hero { padding-top: 18px; padding-bottom: 24px; }
  .hero h1 { font-size: clamp(28px, 8.2vw, 38px); }

  .toolbar { flex-direction: column; align-items: stretch; }
  /* min-width: 0 lets the tabs and the search row shrink to the page width instead of their content width. */
  .toolbar > * { min-width: 0; }
  /* Search and "Hide claimed" share one row: the search box takes whatever the toggle leaves. */
  .toolbar-right { flex-wrap: nowrap; gap: 12px; }
  .toggle { flex: none; white-space: nowrap; }
  /* All four tabs share one row; Home and Expired (no count) take less room. No horizontal scrolling. */
  .tabs { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.25fr) auto; gap: 3px; padding: 4px; }
  .tab { gap: 5px; padding: 8px 7px; font-size: 15px; }
  .count { min-width: 20px; padding: 0 5px; font-size: 12px; }
  .search { flex: 1 1 0; min-width: 0; width: 0; }
  /* Chips spread over the full width when they fit; otherwise the row swipes (see .cat-scroll). */
  .cat-chips { width: 100%; }
  .cat-chip { flex: 1 0 auto; padding: 5px clamp(4px, 1.6vw, 8px); font-size: clamp(13px, 4vw, 15px); }
  .section-title { font-size: 28px; }
  .cat-title { font-size: 19px; }

  .page-section { margin-top: 36px; }
  .support-banner, .feedback-panel { padding: 20px 18px; }
  .support-options { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .logo { font-size: 21px; gap: 8px; }
  .logo img { width: 24px; }
  .header-actions { gap: 8px; }
  .more-btn { width: 36px; height: 36px; }
  .tab { padding: 8px 5px; font-size: 14px; }
  .tab .label-long { display: none; }
  .tab .label-short { display: inline; }
}

/* "RareFreebies" is longer than the old wordmark: tighten the header so the longest
   alerts label ("🔕 Alerts blocked") still shows in full next to it. */
@media (max-width: 640px) {
  .header-inner { gap: 8px; }
  .header-actions { gap: 8px; }
  .header-actions #push-btn { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 420px) {
  .logo { font-size: 19px; gap: 6px; }
  .logo img { width: 22px; }
  .header-actions #push-btn { font-size: 14px; }
}
@media (max-width: 380px) {
  .logo { font-size: 18px; gap: 5px; }
  .logo img { width: 20px; }
  .more-btn { width: 34px; height: 34px; }
}
@media (max-width: 340px) {
  .logo { font-size: 16px; }
  .logo img { width: 18px; }
  .header-actions { gap: 6px; }
  .more-btn { width: 32px; height: 32px; }
  .header-inner { gap: 6px; }
  .header-actions #push-btn { font-size: 13px; padding-left: 6px; padding-right: 6px; }
}

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