:root {
  --paper: #fbfaf7;
  --surface: #ffffff;
  --ink: #182026;
  --muted: #65727a;
  --line: #ded8cd;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --rose: #bd3f58;
  --gold: #c58b2c;
  --blue: #2f5f98;
  --shadow: 0 18px 45px rgba(24, 32, 38, 0.11);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; color: var(--ink); background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 320px), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 4vw, 48px); border-bottom: 1px solid rgba(222, 216, 205, 0.88); background: rgba(251, 250, 247, 0.92); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--ink); font-weight: 800; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: white; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(24, 32, 38, 0.08); flex: 0 0 auto; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; object-position: center; transform: scale(1.22); }
.market-menu-wrap { position: relative; flex: 0 0 auto; }
.market-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 58px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--ink); font-size: 13px; font-weight: 900; }
.market-button:focus-visible { outline: 2px solid rgba(15, 118, 110, 0.32); outline-offset: 2px; }
.market-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--teal-dark); font-size: 17px; line-height: 1; }
.market-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; display: grid; min-width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.market-menu[hidden] { display: none; }
.market-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; font-weight: 800; }
.market-option span { color: var(--muted); font-size: 12px; font-weight: 700; }
.market-option:hover, .market-option.is-selected { background: #e5f3f1; color: var(--teal-dark); }
.nav-tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; overflow: visible; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab { min-height: 38px; padding: 8px 12px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; }
.nav-tab.is-active { background: var(--ink); color: white; }
.cart-tab span { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 4px; border-radius: 999px; background: var(--teal); color: white; font-size: 12px; }
main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 52px; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(310px, 0.9fr); gap: 18px; align-items: start; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr); gap: 18px; align-items: stretch; min-height: 470px; padding: clamp(18px, 4vw, 34px); border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, #ffffff, #f3eee4); box-shadow: var(--shadow); }
.hero-copy { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.eyebrow { margin: 0 0 10px; color: var(--teal-dark); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(36px, 7vw, 74px); line-height: 0.98; letter-spacing: 0; }
.lede { max-width: 64ch; margin: 18px 0 0; color: #43505a; font-size: clamp(17px, 2vw, 21px); line-height: 1.45; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: white; font-weight: 800; text-decoration: none; }
.button.secondary { background: white; color: var(--ink); }
.button.tonal { border-color: rgba(15, 118, 110, 0.24); background: #e5f3f1; color: var(--teal-dark); }
.hero-art { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: #f7f1e6; }
.hero-art img { width: 100%; height: 100%; min-height: 300px; object-fit: contain; background: white; padding: 10px; }
.hero-art figcaption { padding: 12px; font-size: 14px; color: var(--muted); background: white; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 0 14px; }
.section-head h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); }
.section-head p, .panel p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--ink); font-weight: 750; }
.chip.is-selected { border-color: var(--teal); background: #dff2ef; color: var(--teal-dark); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.book-card, .panel, .design-card, .cart-row, .favorite-row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 10px 24px rgba(24, 32, 38, 0.06); }
.book-card { display: flex; flex-direction: column; min-height: 250px; overflow: hidden; }
.book-card-top { position: relative; height: 132px; color: white; background: var(--blue); overflow: hidden; }
.book-design-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 1px; height: 100%; background: var(--line); }
.book-design-preview { min-width: 0; overflow: hidden; background: white; }
.book-card-top .design-art { height: 100%; aspect-ratio: auto; border: 0; background: white; }
.book-card-top .design-art img { padding: 6px; }
.book-card-top .generated-art { padding: 10px; }
.book-card-top .generated-art strong { font-size: 16px; }
.book-card-top .badge { position: absolute; left: 10px; top: 10px; background: rgba(24,32,38,0.72); backdrop-filter: blur(8px); }
.book-card[data-genre="Fantasy"] .book-card-top { background: var(--teal-dark); }
.book-card[data-genre="Romance"] .book-card-top { background: var(--rose); }
.book-card[data-genre="Thriller"] .book-card-top { background: #26313a; }
.book-card[data-genre="Kids"] .book-card-top { background: #39806e; }
.book-card[data-genre="Classics"] .book-card-top { background: var(--gold); }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,0.18); font-size: 12px; font-weight: 800; }
.book-card-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 14px; }
.book-card h3 { margin: 0; font-size: 20px; }
.book-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.book-card-actions { display: flex; gap: 8px; margin-top: auto; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); font-size: 20px; line-height: 1; }
.icon-button.is-active { color: white; border-color: var(--rose); background: var(--rose); }
.panel { padding: 16px; }
.panel h2, .panel h3 { margin: 0 0 10px; }
.search-box { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); }
.design-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.design-card { overflow: hidden; }
.design-art { display: grid; place-items: center; aspect-ratio: 1 / 0.75; background: #f5efe3; border-bottom: 1px solid var(--line); overflow: hidden; }
.design-art img { width: 100%; height: 100%; object-fit: contain; padding: 10px; background: white; }
.generated-art { width: 100%; height: 100%; display: grid; place-items: center; padding: 18px; text-align: center; color: white; background: linear-gradient(135deg, #0f766e, #2f5f98 58%, #bd3f58); }
.generated-art strong { font-size: clamp(18px, 3vw, 28px); line-height: 1.05; }
.design-body { padding: 12px; }
.design-body h3 { margin: 0 0 6px; font-size: 17px; }
.design-body p { margin: 0; color: var(--muted); line-height: 1.4; }
.product-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.product-chip { border: 1px solid var(--line); border-radius: 999px; background: white; padding: 8px 10px; font-weight: 750; }
.product-chip span { color: var(--muted); font-size: 12px; margin-left: 4px; }
.product-chip.is-selected { background: #102027; color: white; border-color: #102027; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 16px; }
.detail-title { margin: 0 0 6px; font-size: clamp(30px, 5vw, 52px); line-height: 1; }
.meta { color: var(--muted); font-weight: 700; }
.quote-list { display: grid; gap: 10px; }
.quote { margin: 0; padding-left: 14px; border-left: 3px solid var(--gold); color: #35414a; font-size: 18px; line-height: 1.42; }
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 32, 0.48); }
.modal-panel { position: relative; width: min(980px, 100%); max-height: min(88vh, 900px); overflow: auto; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.modal-close { position: sticky; top: 10px; float: right; margin: 10px; z-index: 2; }
#modalContent { padding: 20px; clear: both; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(24px); opacity: 0; pointer-events: none; padding: 10px 14px; border-radius: var(--radius); background: var(--ink); color: white; font-weight: 800; transition: 180ms ease; z-index: 80; }
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty-state { padding: 38px 18px; text-align: center; color: var(--muted); }
.stack { display: grid; gap: 12px; }
.price-summary { margin: 0 0 14px; }
.cart-row, .favorite-row { display: flex; justify-content: space-between; gap: 12px; padding: 13px; align-items: center; }
.cart-row strong, .favorite-row strong { display: block; }
.cart-row span, .favorite-row span { color: var(--muted); }
@media (max-width: 860px) { .topbar { align-items: flex-start; flex-direction: column; } .nav-tabs { width: 100%; } .hero, .page-grid, .detail-layout { grid-template-columns: 1fr; } .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { main { width: min(100% - 24px, 1180px); padding-top: 16px; } .brand span:last-child { font-size: 15px; } .nav-tab { padding-inline: 10px; } .hero { min-height: auto; padding: 16px; } .hero-art img { min-height: 230px; } .card-grid, .design-grid { grid-template-columns: 1fr; } .section-head { align-items: flex-start; flex-direction: column; } .cart-row, .favorite-row { align-items: flex-start; flex-direction: column; } }
