/* Material 3 Expressive, hand-rolled. Tonal palette from a green seed. */
:root {
  color-scheme: light;
  --primary: #4c662b; --on-primary: #fff;
  --primary-container: #cdeda3; --on-primary-container: #354e16;
  --secondary: #586249; --on-secondary: #fff;
  --secondary-container: #dce7c8; --on-secondary-container: #404a33;
  --tertiary: #386663; --on-tertiary: #fff;
  --tertiary-container: #bcece7; --on-tertiary-container: #1f4e4b;
  --error: #ba1a1a; --on-error: #fff;
  --error-container: #ffdad6; --on-error-container: #93000a;
  --amber-container: #ffddb8; --on-amber-container: #653e00; --amber: #855318;
  --surface: #f9faef; --on-surface: #1a1c16; --on-surface-variant: #44483d;
  --surface-lowest: #fff; --surface-low: #f3f4e9; --surface-container: #eeefe3;
  --surface-high: #e8e9de; --surface-highest: #e2e3d8;
  --outline: #75796c; --outline-variant: #c5c8ba;
  --inverse-surface: #2f312a; --inverse-on-surface: #f1f2e6; --inverse-primary: #b1d18a;
  --scrim: rgb(0 0 0 / .32);
  --shadow: 0 1px 2px rgb(0 0 0 / .18), 0 2px 6px 2px rgb(0 0 0 / .08);
  --shadow-3: 0 4px 8px 3px rgb(0 0 0 / .1), 0 1px 3px rgb(0 0 0 / .2);

  /* M3 Expressive motion tokens (cubic approximations of the spring specs) */
  --spring-fast: cubic-bezier(.42, 1.67, .21, .9);
  --spring: cubic-bezier(.38, 1.21, .22, 1);
  --spring-slow: cubic-bezier(.39, 1.29, .35, .98);
  --effects-fast: cubic-bezier(.31, .94, .34, 1);
  --effects: cubic-bezier(.34, .8, .34, 1);
  --emphasized-decel: cubic-bezier(.05, .7, .1, 1);
  --emphasized-accel: cubic-bezier(.3, 0, .8, .15);

  --r-xs: 4px; --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-li: 20px;
  --r-xl: 28px; --r-xli: 32px; --r-xxl: 48px;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Roboto Flex", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --primary: #b1d18a; --on-primary: #1f3701;
    --primary-container: #354e16; --on-primary-container: #cdeda3;
    --secondary: #bfcbad; --on-secondary: #2a331e;
    --secondary-container: #404a33; --on-secondary-container: #dce7c8;
    --tertiary: #a0d0cb; --on-tertiary: #003735;
    --tertiary-container: #1f4e4b; --on-tertiary-container: #bcece7;
    --error: #ffb4ab; --on-error: #690005;
    --error-container: #93000a; --on-error-container: #ffdad6;
    --amber-container: #613b00; --on-amber-container: #ffddb8; --amber: #fbb96d;
    --surface: #12140e; --on-surface: #e2e3d8; --on-surface-variant: #c5c8ba;
    --surface-lowest: #0c0f09; --surface-low: #1a1c16; --surface-container: #1e201a;
    --surface-high: #282b24; --surface-highest: #33362e;
    --outline: #8f9285; --outline-variant: #44483d;
    --inverse-surface: #e2e3d8; --inverse-on-surface: #2f312a; --inverse-primary: #4c662b;
    --scrim: rgb(0 0 0 / .5);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 2px 6px 2px rgb(0 0 0 / .2);
    --shadow-3: 0 4px 8px 3px rgb(0 0 0 / .25), 0 1px 3px rgb(0 0 0 / .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh; background: var(--surface); color: var(--on-surface);
  font: 400 16px/24px var(--font); letter-spacing: .01em;
  font-optical-sizing: auto;
}
body.locked { overflow: hidden; }
#app { overflow-x: clip; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }

.icon {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal;
  font-size: 24px; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr; user-select: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  width: 1em; height: 1em; overflow: hidden; flex: none;
}
.icon.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ------------------------------------------------------------ type scale */
.display-s { font-size: 36px; line-height: 44px; font-weight: 500; letter-spacing: -.01em; font-variation-settings: "wdth" 108; }
.headline-l { font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -.01em; font-variation-settings: "wdth" 106; }
.headline-m { font-size: 28px; line-height: 36px; font-weight: 600; font-variation-settings: "wdth" 104; }
.headline-s { font-size: 24px; line-height: 32px; font-weight: 600; }
.title-l { font-size: 22px; line-height: 28px; font-weight: 600; }
.title-m { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: .01em; }
.title-s { font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: .01em; }
.body-l { font-size: 16px; line-height: 24px; }
.body-m { font-size: 14px; line-height: 20px; letter-spacing: .015em; }
.body-s { font-size: 12px; line-height: 16px; letter-spacing: .03em; }
.label-l { font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: .01em; }
.label-m { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; }
.muted { color: var(--on-surface-variant); }

/* ------------------------------------------------------------ layout */
#views { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.view { max-width: 920px; margin: 0 auto; padding: 0 16px; animation: view-in .45s var(--emphasized-decel); }
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 28px 4px 12px; }
.section-title h2 { margin: 0; }

/* ------------------------------------------------------------ navigation bar */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.service-notice {
  max-width: 888px; margin: 24px auto 16px; padding: 24px;
  background: var(--surface-container); border: 1px solid var(--outline-variant);
  border-radius: var(--r-xl); overflow-wrap: anywhere;
}
.service-heading { display: flex; align-items: flex-start; gap: 16px; }
.service-heading > div { min-width: 0; }
.service-heading h2 { margin: 0; max-width: 32ch; }
.service-symbol { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 16px; background: var(--amber-container); color: var(--on-amber-container); }
.service-eyebrow { color: var(--on-surface-variant); margin: 0 0 4px; }
.service-notice > p { max-width: 65ch; }
.service-duration { font-weight: 600; }
.service-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.service-actions .btn { min-height: 44px; height: auto; padding-block: 10px; }
.service-footnote { margin-bottom: 0; }
@media (max-width: 839px) { .service-notice { margin: 16px; padding: 20px; } }

.navbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: var(--surface-container);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--on-surface-variant); position: relative; min-width: 0;
}
.nav-ind {
  position: relative; width: 56px; height: 32px; border-radius: 16px;
  display: grid; place-items: center;
  transition: background-color .2s var(--effects), width .35s var(--spring-fast);
}
.nav-item:hover .nav-ind { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.nav-item.active { color: var(--on-surface); }
.nav-item.active .nav-ind { background: var(--secondary-container); color: var(--on-secondary-container); }
.nav-item.active .icon { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }
.nav-item.active .nav-label { font-weight: 700; }
.nav-item:active .nav-ind { width: 48px; }
.nav-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.badge {
  position: absolute; top: 0; left: 32px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--error); color: var(--on-error);
  font-size: 11px; line-height: 16px; font-weight: 600; text-align: center;
}

@media (min-width: 840px) {
  :root { --nav-h: 0px; }
  .navbar {
    top: 0; right: auto; width: 96px; height: 100dvh; flex-direction: column;
    justify-content: flex-start; padding: 88px 0 0; gap: 12px; background: var(--surface);
  }
  .nav-item { flex: none; height: 64px; }
  #views, .detail { padding-left: 96px; }
  #views { padding-bottom: 48px; }
}

/* ------------------------------------------------------------ search hero + bar */
.hero, .info-hero { position: relative; padding: 28px 4px 8px; isolation: isolate; }
.hero-eyebrow { color: var(--primary); margin: 0 0 6px; }
.hero h1 { margin: 0 0 20px; max-width: 13ch; }
@keyframes spin { to { transform: rotate(360deg); } }

.searchbar {
  display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 4px 0 16px;
  border-radius: 28px; background: var(--surface-high); color: var(--on-surface);
  transition: border-radius .35s var(--spring-fast), background-color .2s var(--effects), box-shadow .2s;
}
.searchbar:focus-within { background: var(--surface-highest); border-radius: var(--r-l); box-shadow: var(--shadow); }
.searchbar > .icon { color: var(--on-surface-variant); }
.searchbar input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
  font-size: 16px; padding: 0 8px;
}
.searchbar input::placeholder { color: var(--on-surface-variant); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.sticky-search {
  position: sticky; top: 0; z-index: 20; margin: 0 -16px; padding: 8px 16px 8px;
  background: var(--surface);
  transition: box-shadow .2s var(--effects);
}
.sticky-search.scrolled { box-shadow: 0 6px 12px -10px rgb(0 0 0 / .35); }

/* ------------------------------------------------------------ chips */
.chip-row {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 16px 4px;
  margin: 0 -16px; scroll-padding: 16px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: var(--r-s); border: 1px solid var(--outline-variant); color: var(--on-surface-variant);
  font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  transition: background-color .2s var(--effects), border-radius .3s var(--spring-fast), color .2s, padding .3s var(--spring-fast);
  position: relative; overflow: hidden;
}
.chip .icon { font-size: 18px; }
.chip:hover { background: color-mix(in srgb, var(--on-surface-variant) 8%, transparent); }
.chip:active { border-radius: var(--r-m); }
.chip[aria-pressed="true"], .chip.selected {
  background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent;
  padding-left: 8px; border-radius: var(--r-m);
}
.chip.assist { color: var(--on-surface); }
.chip.assist .icon { color: var(--primary); }
.chip.input { padding-right: 6px; background: var(--secondary-container); border-color: transparent; color: var(--on-secondary-container); }
.chip.input .icon:last-child { font-size: 18px; opacity: .8; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px; border-radius: 20px; font-size: 14px; line-height: 20px;
  font-weight: 600; letter-spacing: .01em; white-space: nowrap; position: relative; overflow: hidden;
  transition: border-radius .35s var(--spring-fast), background-color .2s var(--effects), box-shadow .2s, transform .35s var(--spring-fast);
}
.btn .icon { font-size: 20px; margin-left: -6px; }
.btn:active { border-radius: var(--r-m); }
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.filled:hover { box-shadow: var(--shadow); }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.outlined { border: 1px solid var(--outline-variant); color: var(--on-surface-variant); }
.btn.text { padding: 0 12px; color: var(--primary); }
.btn.lg { height: 56px; padding: 0 28px; border-radius: 28px; font-size: 16px; }
.btn.lg:active { border-radius: var(--r-l); }
.btn::after, .icon-btn::after, .chip::after, .card-tap::after, .nav-ind::after {
  content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0;
  transition: opacity .15s var(--effects-fast); pointer-events: none; border-radius: inherit;
}
.btn:hover::after, .icon-btn:hover::after, .card-tap:hover::after { opacity: .08; }
.btn:active::after, .icon-btn:active::after, .chip:active::after, .card-tap:active::after { opacity: .12; }
.btn[disabled] { opacity: .38; pointer-events: none; }

.icon-btn {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 24px; flex: none;
  color: var(--on-surface-variant); position: relative;
  transition: border-radius .35s var(--spring-fast), background-color .2s;
}
.icon-btn:active { border-radius: var(--r-m); }
.icon-btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); width: 40px; height: 40px; }
.icon-btn.toggled { background: var(--primary); color: var(--on-primary); border-radius: var(--r-l); }
.icon-btn.toggled .icon { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }
.icon-btn .dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 4px; background: var(--error); }

/* connected button group (segmented) */
.btn-group { display: flex; gap: 2px; }
.btn-group button {
  flex: 1; height: 44px; padding: 0 12px; background: var(--surface-high); color: var(--on-surface-variant);
  font-size: 14px; font-weight: 600; border-radius: var(--r-s);
  transition: border-radius .35s var(--spring-fast), background-color .2s var(--effects), flex-grow .35s var(--spring-fast);
}
.btn-group button:first-child { border-radius: 22px var(--r-s) var(--r-s) 22px; }
.btn-group button:last-child { border-radius: var(--r-s) 22px 22px var(--r-s); }
.btn-group button[aria-pressed="true"] {
  background: var(--secondary); color: var(--on-secondary); border-radius: 22px; flex-grow: 1.25;
}
.btn-group button:active { border-radius: var(--r-m); }

/* ------------------------------------------------------------ cards: result list */
.results-head { display: flex; align-items: center; gap: 4px; margin: 14px 4px 6px; min-height: 48px; }
.results-head .count { flex: 1; }
.results-head .count strong { font-weight: 700; color: var(--on-surface); }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 8px 0;
  border-radius: var(--r-l); background: var(--tertiary-container); color: var(--on-tertiary-container);
}
.notice .icon { margin-top: 2px; }
.notice p { margin: 0; }

.list { display: grid; gap: 4px; }
@media (min-width: 720px) { .list { grid-template-columns: 1fr 1fr; gap: 12px; } }
.book {
  display: flex; gap: 16px; padding: 12px; border-radius: var(--r-xs); background: var(--surface-low);
  position: relative; text-align: left; width: 100%;
  transition: border-radius .35s var(--spring-fast), transform .35s var(--spring-fast);
  animation: card-in .5s var(--spring) both;
}
.list > .book:first-child { border-radius: var(--r-xl) var(--r-xl) var(--r-xs) var(--r-xs); }
.list > .book:last-child { border-radius: var(--r-xs) var(--r-xs) var(--r-xl) var(--r-xl); }
.list > .book:only-child { border-radius: var(--r-xl); }
@media (min-width: 720px) { .list > .book, .list > .book:first-child, .list > .book:last-child { border-radius: var(--r-xl); } }
.book:active { border-radius: var(--r-xl); transform: scale(.985); }
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.book .cover { width: 72px; height: 104px; }
.book-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.book-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-sub { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.book-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; align-items: center; }
mark { background: none; color: var(--primary); }

.cover {
  flex: none; border-radius: var(--r-m); overflow: hidden; background: var(--surface-highest);
  position: relative; box-shadow: var(--shadow);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.ph { display: grid; place-items: center; box-shadow: none; }
.cover.ph svg { position: absolute; inset: 12% 8%; width: 84%; height: 76%; opacity: .9; }
.cover.ph span {
  position: relative; font-weight: 800; font-size: 22px; letter-spacing: -.02em;
  font-variation-settings: "wdth" 120;
}
.c0 { background: var(--primary-container); color: var(--on-primary-container); }
.c0 svg { color: color-mix(in srgb, var(--primary) 30%, var(--primary-container)); }
.c1 { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.c1 svg { color: color-mix(in srgb, var(--tertiary) 30%, var(--tertiary-container)); }
.c2 { background: var(--secondary-container); color: var(--on-secondary-container); }
.c2 svg { color: color-mix(in srgb, var(--secondary) 30%, var(--secondary-container)); }
.c3 { background: var(--amber-container); color: var(--on-amber-container); }
.c3 svg { color: color-mix(in srgb, var(--amber) 30%, var(--amber-container)); }

/* availability pill */
.avail {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px 0 6px;
  border-radius: 12px; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .03em;
  background: var(--surface-highest); color: var(--on-surface-variant); white-space: nowrap;
  transition: background-color .3s var(--effects), color .3s;
}
.avail .icon { font-size: 16px; font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20; }
.avail.yes { background: var(--primary-container); color: var(--on-primary-container); }
.avail.no { background: var(--amber-container); color: var(--on-amber-container); }
.avail.none { background: var(--surface-highest); }
.avail.wait { padding-left: 8px; }
.avail.pop { animation: pop .45s var(--spring-fast); }
@keyframes pop { 40% { transform: scale(1.12); } }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
}
.tag .icon { font-size: 15px; }

/* ------------------------------------------------------------ loading indicator (shape morph) */
.loader { display: grid; place-items: center; padding: 28px 0; }
.loader svg { width: 48px; height: 48px; color: var(--primary); animation: spin 1.6s linear infinite; }
.loader path { animation: morph 2.8s var(--spring) infinite; }
.loader.contained svg { background: var(--primary-container); border-radius: 24px; padding: 6px; }
.loader.sm svg { width: 18px; height: 18px; }
.loader.sm { padding: 0; display: inline-grid; }
.avail .loader.sm svg { color: currentColor; width: 14px; height: 14px; }

.wavy { height: 10px; color: var(--primary); overflow: hidden; border-radius: 5px; }
.wavy svg { width: 200%; height: 10px; animation: wave 1.2s linear infinite; }
@keyframes wave { to { transform: translateX(-50%); } }

/* ------------------------------------------------------------ empty / error state */
.empty { text-align: center; padding: 40px 16px; display: grid; justify-items: center; gap: 8px; }
.empty .blob { width: 112px; height: 112px; position: relative; display: grid; place-items: center; margin-bottom: 8px; }
.empty .blob svg { position: absolute; inset: 0; color: var(--tertiary-container); animation: spin 30s linear infinite; }
.empty .blob .icon { position: relative; font-size: 44px; color: var(--on-tertiary-container); }
.empty h3 { margin: 0; }
.empty p { margin: 0; max-width: 36ch; }
.empty .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }

/* ------------------------------------------------------------ home cards */
.status-card {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-top: 20px;
  border-radius: var(--r-xl); background: var(--surface-container); position: relative; overflow: hidden;
}
.status-card .shape { width: 52px; height: 52px; flex: none; display: grid; place-items: center; position: relative; }
.status-card .shape svg { position: absolute; inset: 0; }
.status-card .shape .icon { position: relative; }
.status-card.open .shape svg { color: var(--primary-container); }
.status-card.open .shape .icon { color: var(--on-primary-container); }
.status-card.closed .shape svg { color: var(--amber-container); }
.status-card.closed .shape .icon { color: var(--on-amber-container); }
.status-card .grow { flex: 1; min-width: 0; }
.status-card p { margin: 0; }

.carousel {
  display: flex; gap: 8px; overflow: auto hidden; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 16px;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel .item {
  flex: none; width: 128px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px;
  animation: card-in .5s var(--spring) both;
}
.carousel .item:first-child { width: 168px; }
.carousel .cover { width: 100%; aspect-ratio: 2 / 3; border-radius: var(--r-xl); transition: border-radius .35s var(--spring-fast); }
.carousel .item:active .cover { border-radius: var(--r-l); }
.carousel .item .cap { padding: 0 4px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* grid of covers (new arrivals, saved) */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 10px; }
@media (max-width: 359px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 14px; } }
.grid .avail { padding: 0 8px 0 5px; font-size: 11px; }
.tile { display: flex; flex-direction: column; gap: 8px; text-align: left; animation: card-in .5s var(--spring) both; }
.tile .cover { width: 100%; aspect-ratio: 2 / 3; border-radius: var(--r-li); transition: border-radius .35s var(--spring-fast), transform .35s var(--spring-fast); }
.tile:active .cover { border-radius: var(--r-xl); transform: scale(.97); }
.tile .cap { padding: 0 2px; display: grid; gap: 2px; }
.tile .avail { justify-self: start; margin-top: 4px; }

/* ------------------------------------------------------------ detail (full-screen dialog) */
.detail {
  position: fixed; inset: 0; z-index: 40; background: var(--surface); overflow-y: auto;
  overscroll-behavior: contain; animation: detail-in .5s var(--spring);
}
.detail.out { animation: detail-out .25s var(--emphasized-accel) forwards; }
@keyframes detail-in { from { opacity: 0; transform: translateY(48px) scale(.98); border-radius: 28px; } }
@keyframes detail-out { to { opacity: 0; transform: translateY(32px); } }
.detail-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; height: 64px; padding: 0 4px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(16px);
}
.detail-bar .grow { flex: 1; min-width: 0; opacity: 0; transition: opacity .2s; }
.detail.scrolled .detail-bar .grow { opacity: 1; }
.detail-inner { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.detail-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 8px 0 20px; position: relative; }
.detail-hero .backdrop {
  position: absolute; left: 50%; top: -40px; width: 320px; height: 320px; translate: -50% 0; z-index: -1;
  color: var(--surface-container); animation: spin 60s linear infinite;
}
.detail-hero .cover { width: 152px; height: 224px; border-radius: var(--r-li); margin-bottom: 16px; box-shadow: var(--shadow-3); }
.detail-hero .cover.ph span { font-size: 40px; }
.detail-hero h1 { margin: 0; }
.detail-hero .sub { margin: 4px 0 0; }
.detail-hero .chip-row { justify-content: center; flex-wrap: wrap; padding: 14px 0 0; margin: 0; overflow: visible; }
@media (min-width: 720px) {
  .detail-hero { flex-direction: row; text-align: left; align-items: flex-end; gap: 28px; padding-top: 24px; }
  .detail-hero .cover { margin: 0; width: 184px; height: 272px; }
  .detail-hero .chip-row { justify-content: flex-start; }
  .detail-hero .backdrop { left: 90px; }
}

.where {
  border-radius: var(--r-xl); padding: 20px; margin: 4px 0 12px;
  background: var(--surface-container); transition: background-color .4s var(--effects);
}
.where.yes { background: var(--primary-container); color: var(--on-primary-container); }
.where.no { background: var(--amber-container); color: var(--on-amber-container); }
.where-head { display: flex; align-items: center; gap: 14px; }
.where-head .grow { flex: 1; min-width: 0; }
.where-head p { margin: 0; }
.where-head .shape { width: 48px; height: 48px; position: relative; display: grid; place-items: center; flex: none; }
.where-head .shape svg { position: absolute; inset: 0; color: color-mix(in srgb, currentColor 14%, transparent); }
.where-head .shape .icon { position: relative; font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }
.copies { display: grid; gap: 2px; margin-top: 16px; }
.copy {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px;
  background: color-mix(in srgb, var(--surface-lowest) 55%, transparent); border-radius: var(--r-xs);
}
.copies .copy:first-child { border-radius: var(--r-l) var(--r-l) var(--r-xs) var(--r-xs); }
.copies .copy:last-child { border-radius: var(--r-xs) var(--r-xs) var(--r-l) var(--r-l); }
.copies .copy:only-child { border-radius: var(--r-l); }
.copy .shelf { font-size: 22px; line-height: 28px; font-weight: 800; font-variation-settings: "wdth" 115; letter-spacing: -.01em; }
.copy .right { grid-row: span 2; align-self: center; }
.where-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.where .wavy { margin-top: 16px; color: currentColor; }

.actions-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 4px 16px 8px; }
.actions-row::-webkit-scrollbar { display: none; }
.actions-row .btn { flex: none; }

.facts { margin: 8px 0 0; border-radius: var(--r-xl); background: var(--surface-low); overflow: hidden; }
.fact { display: grid; grid-template-columns: 40px 1fr; gap: 0 12px; padding: 14px 16px; align-items: start; }
.fact + .fact { border-top: 1px solid var(--outline-variant); }
.fact .icon { color: var(--on-surface-variant); margin-top: 8px; }
.fact dt { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; color: var(--on-surface-variant); }
.fact dd { margin: 2px 0 0; font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }
.fact dd a { color: var(--primary); font-weight: 600; }
.fact .chip-row { padding: 6px 0 0; }

/* ------------------------------------------------------------ bottom sheet */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); animation: fade .25s var(--effects); }
.scrim.out { animation: fade .2s var(--effects) reverse forwards; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto;
  background: var(--surface-low); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 0 20px calc(20px + var(--safe-b)); animation: sheet-in .5s var(--spring);
  overscroll-behavior: contain;
}
.sheet.out { animation: sheet-out .22s var(--emphasized-accel) forwards; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: 50%; width: 560px; translate: -50% 50%; border-radius: var(--r-xl); max-height: 86dvh; }
  @keyframes sheet-in { from { opacity: 0; transform: scale(.92); } }
  @keyframes sheet-out { to { opacity: 0; transform: scale(.95); } }
}
.handle { width: 32px; height: 4px; border-radius: 2px; background: var(--on-surface-variant); opacity: .4; margin: 16px auto 8px; }
.sheet h2 { margin: 8px 0 4px; }
.sheet h3 { margin: 24px 0 10px; }
.sheet .foot {
  position: sticky; bottom: calc(-20px - var(--safe-b)); display: flex; gap: 8px; justify-content: flex-end;
  margin: 24px -20px calc(-20px - var(--safe-b)); padding: 12px 20px calc(16px + var(--safe-b)); background: var(--surface-low);
}
.field { display: grid; gap: 4px; margin-top: 12px; }
.field label { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--on-surface-variant); padding-left: 16px; }
.field input {
  height: 56px; border: 1px solid var(--outline); border-radius: var(--r-xs); background: none;
  padding: 0 16px; font-size: 16px; outline: 0;
}
.field input:focus { border: 2px solid var(--primary); padding: 0 15px; }
.radio-list { display: grid; }
.radio {
  display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 0 8px; border-radius: var(--r-m);
  cursor: pointer; position: relative;
}
.radio:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.radio input { appearance: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--on-surface-variant); margin: 0; display: grid; place-items: center; transition: border-color .2s; }
.radio input::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); transform: scale(0); transition: transform .35s var(--spring-fast); }
.radio input:checked { border-color: var(--primary); }
.radio input:checked::after { transform: scale(1); }
.switch-row { display: flex; align-items: center; gap: 16px; min-height: 56px; cursor: pointer; }
.switch-row .grow { flex: 1; }
.switch {
  appearance: none; width: 52px; height: 32px; border-radius: 16px; border: 2px solid var(--outline);
  background: var(--surface-highest); position: relative; margin: 0; flex: none; cursor: pointer;
  transition: background-color .2s var(--effects), border-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 50%; left: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--outline); translate: 0 -50%;
  transition: left .35s var(--spring-fast), width .35s var(--spring-fast), height .35s var(--spring-fast), background-color .2s;
}
.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::after { left: 22px; width: 24px; height: 24px; background: var(--on-primary); }
.switch:active::after { width: 28px; height: 28px; }

/* ------------------------------------------------------------ info */
.info-hero { padding: 28px 4px 4px; }
.info-hero h1 { margin: 6px 0 0; }
.week { display: grid; gap: 2px; margin-top: 12px; }
.day {
  display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 0 20px;
  background: var(--surface-low); border-radius: var(--r-xs);
}
.week .day:first-child { border-radius: var(--r-xl) var(--r-xl) var(--r-xs) var(--r-xs); }
.week .day:last-child { border-radius: var(--r-xs) var(--r-xs) var(--r-xl) var(--r-xl); }
.day.today { background: var(--primary-container); color: var(--on-primary-container); border-radius: var(--r-l) !important; margin: 4px 0; min-height: 60px; font-weight: 700; }
.day.closed .h { color: var(--on-surface-variant); }
.day.today.closed { background: var(--amber-container); color: var(--on-amber-container); }
.day.today.closed .h { color: inherit; }
.contact { display: grid; gap: 8px; margin-top: 8px; }
.contact a, .contact div {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: var(--r-l);
  background: var(--surface-low); position: relative; overflow: hidden;
}
.contact .icon { color: var(--primary); }
.fineprint { margin: 28px 4px 0; }
.fineprint a { color: var(--primary); font-weight: 600; }

/* ------------------------------------------------------------ snackbar */
.snackbar {
  position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  max-width: 560px; margin: 0 auto; padding: 14px 16px; border-radius: var(--r-s);
  background: var(--inverse-surface); color: var(--inverse-on-surface); font-size: 14px; line-height: 20px;
  box-shadow: var(--shadow-3); transform: translateY(24px); opacity: 0; pointer-events: none;
  transition: transform .4s var(--spring-fast), opacity .2s var(--effects);
}
.snackbar.show { transform: none; opacity: 1; }

.fab {
  position: fixed; z-index: 25; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  width: 56px; height: 56px; border-radius: var(--r-l); display: grid; place-items: center;
  background: var(--primary-container); color: var(--on-primary-container); box-shadow: var(--shadow-3);
  transition: transform .4s var(--spring-fast), border-radius .35s var(--spring-fast), opacity .2s;
}
.fab:active { border-radius: 28px; }
.fab.hide { transform: translateY(24px) scale(.6); opacity: 0; pointer-events: none; }

.sentinel { height: 1px; }
.more-wrap { display: grid; place-items: center; padding: 20px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
