:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #171717;
  background: #f9f9f9;
  --accent-color: #dcd9d4;
  --card-border: var(--accent-color);
  --gallery-columns: 11;
  --header-height: 36px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { overflow-x: clip; }
html { scroll-padding-top: calc(var(--header-height) + 5px); }
button { color: inherit; font: inherit; }
button, h1, h2, p { margin: 0; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#board-visibility { font: inherit; width: 100%; padding: 8px; margin: 8px 0; }
#board-content-confirmed { width: auto; }
.gallery {
  display: grid;
  grid-template-columns: repeat(var(--gallery-columns), minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  min-height: calc(100svh - var(--header-height));
  padding: 0;
  margin: 0;
  align-content: start;
}
.tile {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #f9f9f9;
  cursor: pointer;
  position: relative;
  touch-action: manipulation;
}
.tile img, .card-image, .dialog-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center;
}
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 5px solid var(--card-border);
  opacity: 0;
  pointer-events: none;
}
.tile-plus {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: min(36px, 70%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fffffff0;
  color: #292723;
  opacity: 0;
  pointer-events: none;
}
.tile-plus svg { width: 55%; height: 55%; fill: none; stroke: currentColor; stroke-width: 1.5; }
@media (hover: hover) {
  .tile:hover::after, .tile:hover .tile-plus { opacity: 1; }
}
.tile:focus-visible::after, .tile:focus-visible .tile-plus { opacity: 1; }
.tile:focus-visible { outline: none; z-index: 1; }
.expanded-card {
  --card-scale: 1;
  position: fixed;
  z-index: 10;
  border: 5px solid var(--card-border);
  background: #f9f9f9;
  color: inherit;
  box-shadow: 0 12px 32px #00000040, 0 3px 9px #00000024;
  will-change: transform, opacity;
}
.card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(13px * var(--card-scale)) calc(23px * var(--card-scale)) calc(19px * var(--card-scale));
}
.card-content h1 { font-size: calc(25px * var(--card-scale)); font-weight: 700; line-height: 1.18; }
.card-content p { max-width: calc(190px * var(--card-scale)); font-size: calc(16px * var(--card-scale)); line-height: 1.38; margin: calc(12px * var(--card-scale)) 0 calc(21px * var(--card-scale)); }
.brand-button {
  min-height: calc(34px * var(--card-scale));
  width: 100%;
  max-width: calc(210px * var(--card-scale));
  padding: calc(7px * var(--card-scale)) calc(16px * var(--card-scale));
  border: 0;
  border-radius: calc(7px * var(--card-scale));
  background: var(--card-border);
  font-size: calc(13px * var(--card-scale));
  line-height: 1.3;
  cursor: pointer;
  transition: background 150ms ease;
}
.brand-button:hover { background: #cbc7c0; }
.brand-button:focus-visible, .close-dialog:focus-visible, .close-card:focus-visible { outline: 2px solid #37342e; outline-offset: 3px; }
dialog {
  width: min(370px, calc(100vw - 30px));
  max-height: calc(100svh - 30px);
  padding: 0;
  border: 5px solid var(--card-border);
  border-radius: 0;
  background: #f9f9f9;
  box-shadow: 0 20px 80px #0005;
  overscroll-behavior: contain;
}
dialog::backdrop { background: #27252280; backdrop-filter: blur(3px); }
.dialog-image { max-height: 60svh; object-fit: contain; }
.dialog-content { padding: 22px 26px 28px; text-align: center; }
.dialog-content h2 { font-size: 27px; line-height: 1.2; margin-bottom: 12px; }
.dialog-content p { font-size: 16px; line-height: 1.5; }
.close-dialog, .close-card {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dcd9d4;
  border-radius: 50%;
  background: #fffffff0;
  cursor: pointer;
}
.close-dialog svg, .close-card svg { fill: none; stroke: currentColor; stroke-width: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-color);
  color: var(--header-ink, #000);
  border-bottom: 1px solid #00000012;
}
.site-name { font-size: 13px; letter-spacing: .08em; }
.header-actions { display: flex; align-items: center; gap: 8px; height: 100%; }
.icon-button, .text-button { display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 32px; height: 36px; }
.text-button { min-height: 36px; font-size: 12px; }
.icon-button svg, .favorite-button svg { fill: none; stroke: #000; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-button[aria-pressed="true"] svg { fill: var(--accent-color); }
.favorite-button[aria-pressed="true"] svg, .saved-board-row .saved-board-remove svg { fill: currentColor; }
.header-actions button:focus-visible, .settings-panel input:focus-visible, .settings-panel select:focus-visible, .favorite-button:focus-visible, .submission-dialog button:focus-visible { outline: 0px solid #37342e; outline-offset: 0px; }
.settings-anchor { position: relative; }
.settings-panel { position: absolute; right: 0; top: calc(100% + 5px); width: 280px; max-width: calc(100vw - 24px); max-height: calc(100dvh - var(--header-height) - 12px); overflow-y: auto; padding: 18px; border: 1px solid #dedede; background: #fff; color: #171717; font-size: 12px; }
.header-actions > button:focus-visible, .settings-anchor > button:focus-visible, .account-link:focus-visible { outline-color: currentColor; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#accent-picker { width: 32px; height: 26px; border: 1px solid #ddd; padding: 2px; background: #fff; cursor: pointer; }
.accent-swatches { display: flex; gap: 10px; margin: 8px 0 36px; }
.accent-swatches button { width: 22px; height: 22px; padding: 0; background: var(--swatch); border: 1px solid #0002; cursor: pointer; }
.accent-swatches button[aria-pressed="true"] { outline: 1px solid #555; outline-offset: 2px; }
.column-stepper { display: flex; align-items: center; border: 0px solid #ddd; }
.column-stepper button { width: 28px; height: 28px; border: 0; background: #fff; cursor: pointer; }
.column-stepper button:disabled { opacity: .35; cursor: default; }
.column-stepper input { appearance: textfield; width: 30px; padding: 0; border: 0; text-align: center; font: inherit; }
.column-stepper input::-webkit-inner-spin-button, .column-stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.setting-hint { display: none; color: #666; font-size: 10px; margin: 6px 0 16px; }
.select-setting { display: grid; gap: 6px; margin-top: 12px; }
.category-setting { margin: 0 0 36px; }
.select-setting select { width: 100%; min-height: 30px; padding: 4px 6px; border: 1px solid #ddd; border-radius: 0; background: #fff; color: inherit; font: inherit; }
.reset-settings { margin-top: 30px; color: #555; min-height: 28px; text-decoration: underline; text-underline-offset: 3px; }
.gallery-item { position: relative; min-width: 0; }
.favorite-button { position: absolute; top: 7px; right: 7px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 0; background: #fffffff0; color: #292723; cursor: pointer; touch-action: manipulation; }
.tile-favorite { opacity: 0; pointer-events: none; }
@media (hover: hover) {
  .gallery-item:hover .tile-favorite { opacity: 1; pointer-events: auto; }
}
.tile:focus-visible + .tile-favorite, .tile-favorite:focus-visible { opacity: 1; pointer-events: auto; }
.expanded-favorite { top: 12px; left: 12px; right: auto; }
.gallery-empty { padding: 40px 16px; text-align: center; color: #666; font-size: 13px; }
.gallery-empty:not([hidden]) + .gallery { min-height: 0; }
.gallery-category-divider { grid-column: 1 / -1; margin: 16px 16px 4px; }
.gallery-category-divider hr { border: 0; border-top: 1px solid #e2dfda; margin: 0 0 12px; }
.gallery-category-divider h2 { font-size: 16px; font-weight: 500; }
.gallery-load-more { display: flex; margin: 12px auto; padding: 0 16px; }
.submission-dialog { width: min(340px, calc(100vw - 30px)); padding: 48px 24px 32px; border: 1px solid #ddd; background: #fff; box-shadow: none; }
.submission-dialog h2 { font-size: 14px; font-weight: 400; text-align: center; line-height: 1.5; }
#close-submission { position: absolute; right: 8px; top: 5px; font-size: 23px; }
.submission-dialog::backdrop { background: #0003; backdrop-filter: none; }
@media (max-width: 900px) { .gallery { grid-template-columns: repeat(min(var(--gallery-columns), 6), minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-header { padding: 0 12px; }
  .header-actions { gap: 8px; }
}
@media (max-width: 380px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0s !important; transition: none !important; } }

/* Phase 1 foundation: keep original zero-gap 11-column collage and tiny header. */
.site-name { color: inherit; text-decoration: none; }
.header-category { max-width: 150px; min-width: 90px; height: 29px; padding: 0 3px; background: transparent; border: 0; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.header-category:focus-visible, .account-link:focus-visible { outline: 0px solid #37342e; outline-offset: 0px; }
.account-link svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.expanded-media { position: relative; width: 100%; aspect-ratio: 4 / 5; }
.expanded-media .card-image { width: 100%; height: 100%; object-fit: contain; }
.media-nav { position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: #ffffffdf; cursor: pointer; font-size: 29px; line-height: 1; z-index: 2; }
.media-prev { left: 7px; }
.media-next { right: 7px; }
.media-counter { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 5px 9px; background: #ffffffeb; color: #171717; font-size: 11px; white-space: nowrap; }
.expanded-card .media-nav:focus-visible, .expanded-card .brand-button:focus-visible { outline: 2px solid #37342e; outline-offset: 2px; }
.card-content .card-discount { margin-top: 0; margin-bottom: 12px; font-size: 13px; font-weight: 700; }
a.brand-button { display: grid; place-items: center; color: inherit; text-decoration: none; }
@media (max-width: 600px) {
  .header-actions { gap: 5px; }
  .site-header { padding: 0 8px; }
  .site-name { font-size: 12px; }
  .header-category { min-width: 76px; max-width: 98px; font-size: 11px; }
  .text-button { font-size: 11px; }
  .icon-button { width: 27px; }
}
@media (max-width: 380px) {
  .header-category { min-width: 70px; max-width: 78px; }
  .header-actions { gap: 3px; }
}
/* Keep controls above expanded media (the image cannot cover close/favorite). */
.expanded-favorite, .expanded-card > .close-card { z-index: 4; }
.account-link { color: inherit; text-decoration: none; }

/* SEO routes: only visible change is a compact page label on category URLs. */
.category-banner {
  display: flex; align-items: center; gap: 8px;
  min-height: 30px; padding: 5px 16px;
  border-bottom: 1px solid #eee; background: #fff;
  font-size: 12px; line-height: 1.3;
}
.category-banner a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.category-banner h1 { font: inherit; font-weight: 600; }
.tile { color: inherit; text-decoration: none; }
/* Fallback content is visible if JavaScript is off or fails, but never overlays the gallery. */
.seo-fallback { padding: 22px 18px 35px; max-width: 760px; margin-inline: auto; }
.seo-fallback h1 { font-size: 24px; margin: 16px 0; }
.seo-fallback p { line-height: 1.5; margin: 12px 0; }
.seo-fallback img { display: block; width: min(360px, 100%); height: auto; }
.seo-fallback nav { font-size: 12px; margin-bottom: 20px; }
.seo-fallback a { color: inherit; }
.seo-fallback ul { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 14px; }
.seo-fallback li a { display: flex; align-items: center; gap: 12px; }
.seo-fallback li img { width: 60px; aspect-ratio: 4 / 5; object-fit: cover; }
.js-enabled .seo-fallback { display: none; }
@media (max-width: 600px) { .category-banner { padding-inline: 8px; } }

.favorites-page .gallery { min-height: 0; }
.favorites-back { margin: 16px; color: inherit; text-underline-offset: 3px; }
#favorites-toggle[aria-current="page"] svg { fill: currentColor; }
#favorites-toggle:focus-visible, .favorites-back:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
/* Boards reuse the gallery's compact controls and neutral panels. */
.boards-anchor { position: relative; height: 100%; }
.boards-panel { width: 280px; overflow: visible;
  max-height: none;}
.boards-panel h2, .board-dialog h2 { font-size: 15px; margin: 0 0 12px; }
.boards-panel-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}
.boards-panel-heading h2{margin:0;white-space:nowrap}
.boards-panel-heading a{display:inline-flex;gap:5px;flex-shrink:0;color:inherit;text-decoration:none;font-size:11px}
.boards-panel-heading svg{fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.boards-divider{border:0;border-top:1px solid #eee;margin:14px 0}
.boards-empty{font-size:12px;line-height:1.5;color:#666;margin:8px 0}
.saved-board-row{display:grid;grid-template-columns:minmax(0,1fr) 32px 32px;align-items:center;gap:4px;min-height:40px}
.saved-board-name{min-width:0;overflow-wrap:anywhere}
#popup-saved-status{font-size:12px;line-height:1.5}
#popup-saved-status:empty,#boards-storage-status:empty{display:none}
.discovery-nav-link svg{stroke:currentColor}
.discovery-nav-link[aria-current=page]{font-weight:600;text-decoration:underline;text-underline-offset:5px}
.discovery-switcher{position:absolute;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:5px;height:36px;font-size:12px}
.discovery-switcher .discovery-nav-link{display:inline-flex;align-items:center;height:100%;padding:0 7px}
.discovery-switcher>span{opacity:.5}
@media(max-width:700px){
  :root:has(.discovery-switcher){--header-height:68px}
  .site-header:has(.discovery-switcher){display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:36px 32px;align-items:center}
  .site-header>.site-name{grid-column:1;grid-row:1}
  .site-header>.header-actions{grid-column:2;grid-row:1}
  .discovery-switcher{position:static;transform:none;grid-column:1/-1;grid-row:2;justify-self:center;height:32px}
}
.discovery-nav-link:hover,.boards-panel-heading a:hover,.saved-board-row .icon-button:hover{background:#00000008}
.discovery-nav-link:focus-visible,.boards-panel a:focus-visible,.boards-panel button:focus-visible{outline:2px solid currentColor;outline-offset:-2px}
.boards-panel{max-height:calc(100dvh - var(--header-height) - 12px);overflow-y:auto;overscroll-behavior:contain}
@media(max-width:380px){.header-actions{gap:2px}.header-actions>.icon-button,.header-actions .boards-anchor>.icon-button,.header-actions .settings-anchor>.icon-button{width:25px}.header-actions #list-store{font-size:10px}}
.board-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 32px;  }
.board-link { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 40px; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.board-count { color: #666; flex-shrink: 0; }
.board-menu { position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;

  display: flex;
  flex-direction: column;
  min-width: 140px;
  padding: 5px;

  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.board-menu[hidden] {
  display: none;
}
.board-heading { padding: 12px 16px; border-bottom: 1px solid #eee; background: #fff; overflow-wrap: anywhere; }
.board-heading h1 { font-size: 16px; }
.board-heading p, .board-dialog p { font-size: 12px; line-height: 1.5; margin: 8px 0; color: #555; }
.board-heading p:empty { display: none; }
.board-dialog { width: 300px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 16px; border: 1px solid #dedede; background: #fff; color: #171717; font-size: 13px; overflow-y: auto; }
#board-selector { position: fixed; margin: 0; }
#board-selector::backdrop { background: transparent; backdrop-filter: none; }
.board-option { display: flex; align-items: center; gap: 10px; min-height: 40px; overflow-wrap: anywhere; }
.board-option input { flex-shrink: 0; accent-color: #37342e; width: 17px; height: 17px; }
.board-dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 12px; }
.board-dialog-actions .brand-button { width: auto; font-size: 13px; padding: 8px 18px; min-height: 36px; border-radius: 7px; }
#board-name, #board-share-url { width: 100%; margin: 8px 0; padding: 8px; border: 1px solid #aaa; font: inherit; }
#board-visibility{width:100%;min-height:44px;margin:8px 0;padding:8px;border:1px solid #aaa;background:#fff;font:inherit}
#board-content-label{display:flex;align-items:flex-start;gap:8px;margin:12px 0}
#board-content-label[hidden]{display:none}
#board-content-confirmed{flex-shrink:0;margin-top:2px}
#board-editor .board-dialog-actions button,#board-editor #board-unshare{min-height:44px}
#board-editor .board-dialog-actions{flex-wrap:wrap}
@media(max-width:600px){#board-name,#board-share-url,#board-visibility{font-size:16px;min-height:44px}}
.boards-panel :focus-visible, .board-dialog :focus-visible { outline: 0px solid #37342e;}
#boards-storage-status { font-size: 12px; line-height: 1.5; }
@media (max-width: 600px) { .boards-panel { position: fixed; top: calc(var(--header-height) + 5px); right: 8px; } }
.board-menu-button {
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.board-menu-button:hover {
  background: #f5f5f5;
}/* Account entry points retain the existing neutral panel and button styling. */
.account-main { min-height: calc(100svh - var(--header-height)); display: grid; place-items: center; padding: 24px; }
.account-panel { width: 100%; max-width: 400px; text-align: center; }
.account-panel h1 { font-size: 25px; margin: 0 0 14px; }
.account-panel p { font-size: 14px; line-height: 1.5; margin: 12px 0; color: #555; }
.account-panel a, .account-panel button { margin: 12px auto; }
.account-panel > a, .account-panel [data-signed-in] > a { display: block; color: inherit; font-size: 13px; }
#auth-email { width: 100%; margin-top: 8px; border: 1px solid #aaa; padding: 8px; font: inherit; }
#auth-status:empty { display: none; }
button:disabled { cursor: default; opacity: .6; }
#merchant-form { text-align: left; }
#merchant-form label { display: block; margin-top: 12px; font-size: 13px; }
#merchant-form input { width: 100%; margin-top: 6px; padding: 8px; font: inherit; border: 1px solid #aaa; }
/* Merchant/admin workspace: reuse the existing neutral panels and compact controls. */
.merchant-main { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.merchant-main .account-panel { margin: 0 auto 28px; }
.workflow { font-size: 13px; line-height: 1.5; }
.workflow h2 { font-size: 18px; margin: 20px 0 12px; }
.workflow h3 { font-size: 16px; margin: 0 0 8px; }
.workflow-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.workflow a { color: inherit; }
.workflow-editor { max-width: 520px; margin: 24px auto; }
.workflow label { display: block; margin: 10px 0; }
.workflow input:not([type=file]), .workflow textarea, .workflow select { width: 100%; display: block; margin-top: 5px; padding: 8px; border: 1px solid #aaa; background: #fff; color: inherit; font: inherit; }
.workflow fieldset { border: 1px solid #dedede; padding: 12px; margin-top: 16px; }
.workflow fieldset p { margin: 0 0 12px; }
.workflow-listing { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 8px 0; border-bottom: 1px solid #eee; }
.workflow-listing span { flex: 1; min-width: 160px; }
.workflow-preview { display: grid; grid-template-columns: 160px minmax(0,1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid #ddd; }
.workflow-preview > img { width: 160px; height: 200px; object-fit: cover; }
.workflow-preview .text-button { margin-right: 18px; }
.workflow-images { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.workflow-images > div { width: 130px; }
.workflow-images img { width: 80px; height: 100px; object-fit: cover; }
.workflow :focus-visible { outline: 2px solid #37342e; outline-offset: 2px; }
@media(max-width:600px) { .workflow-preview { grid-template-columns: 100px minmax(0,1fr); gap: 12px; } .workflow-preview > img { width:100px; height:125px; } }
/* Contextual sign-in keeps the existing compact gallery dialog. */
#auth-dialog h1 { font-size: 18px; font-weight: 500; }
#auth-dialog .auth-benefits { list-style: none; padding: 0; margin: 16px 0; font-size: 12px; line-height: 1.8; }
#auth-dialog .auth-benefits li::before { content: '✓'; color: #348055; margin-right: 8px; }
#auth-dialog .brand-button { width: 100%; min-height: 40px; margin: 8px 0; border-radius: 0; font-size: 13px; }
#auth-dialog #auth-google { background: #292723; color: #fff; }
#auth-dialog .auth-divider { text-align: center; color: #666; margin: 8px 0; }
#auth-dialog :focus-visible, #board-editor :focus-visible { outline: 2px solid #37342e; outline-offset: 2px; }
.offer-badge{position:absolute;left:6px;bottom:6px;padding:3px 5px;background:rgba(255,255,255,.9);color:#171717;font-size:9px;font-weight:500;line-height:1.2;pointer-events:none}
.card-listing-details p{overflow-wrap:anywhere}
