:root { color-scheme: dark; --ink: #fbf6ec; --dim: #e9e2d2; --bg: #14110f; }
* { box-sizing: border-box; }
/* Fonts (self-hosted, OFL): Inter for the interface, Cormorant Garamond for titles. */
@font-face { font-family: "Inter"; src: url(fonts/inter-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/cormorant-garamond-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
:root { --sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif; --serif: "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); overflow: hidden;
  font: 400 14px/1.45 var(--sans); letter-spacing: .005em; -webkit-font-smoothing: antialiased; }
h1, h2, .card-date { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; }
/* In the white room the interface text turns dark, since it sits straight on the scene with no shadow. */
body.studio { color-scheme: light; --ink: #221d18; --dim: #5a5249; }
body.studio .bar, body.studio .note { color: var(--ink); }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* soft lens vignette over the render */
body::after { content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(8,6,5,.38) 100%); }
.bar { position: fixed; z-index: 2; top: 0; left: 0; right: 0; display: flex; align-items: baseline; gap: 1.25rem;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem 0; }
.bar h1 { margin: 0; font-size: 1.25rem; font-weight: 500; letter-spacing: .01em; }
.back { color: var(--dim); text-decoration: none; font-size: .85rem; }
.back:hover, .back:focus-visible { color: var(--ink); }
.note { position: fixed; z-index: 2; left: 1.25rem; bottom: max(1rem, env(safe-area-inset-bottom)); margin: 0;
  color: var(--dim); font-size: .85rem; }
/* Settings button and panel. The panel sits at the side so the table stays in view while you choose. */
.open-settings { margin-left: auto; align-self: center; display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .8rem; border: 0; border-radius: 999px; font: inherit; font-size: .85rem; color: var(--ink); cursor: pointer;
  background: rgba(20,17,15,.38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.open-settings:hover { background: rgba(20,17,15,.55); }
.open-settings:focus-visible, .settings :focus-visible { outline: 2px solid #d9b56a; outline-offset: 2px; }

.settings { position: fixed; inset: 0 0 0 auto; width: min(340px, 100vw); max-width: none; height: 100%; max-height: none; margin: 0;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem 1.5rem; border: 0; border-left: 1px solid rgba(255,255,255,.08);
  background: rgba(24,20,17,.82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  color: var(--ink); overflow-y: auto; }
.settings::backdrop { background: rgba(8,6,5,.12); }
.settings[open] { animation: slide-in .22s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 1.25rem; }
.settings h2 { margin: 0; font-size: 1.05rem; font-weight: 500; }
.close { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--dim); cursor: pointer; }
.close:hover { background: rgba(255,255,255,.08); color: var(--ink); }
.setting { margin: 0 0 1.6rem; padding: 0; border: 0; }
.setting-label, .setting legend { display: flex; justify-content: space-between; width: 100%; padding: 0;
  margin-bottom: .6rem; font-size: .9rem; color: var(--ink); }
.setting output { color: var(--dim); }
.setting input[type=range] { width: 100%; margin: 0; accent-color: #d9b56a; }
.ends { display: flex; justify-content: space-between; margin-top: .3rem; font-size: .75rem; color: var(--dim); opacity: .75; }
.swatches { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.swatch { position: relative; display: block; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch img, .swatch .generated { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px;
  border: 2px solid transparent; box-sizing: border-box; }
.swatch .generated { background:
  repeating-linear-gradient(176deg, rgba(0,0,0,.0) 0 5px, rgba(0,0,0,.28) 6px 7px, rgba(0,0,0,0) 8px 12px),
  linear-gradient(90deg, #4a2a18, #3a2012 60%, #4d2c19); }
.swatch span { display: block; margin-top: .3rem; font-size: .8rem; color: var(--dim); }
.swatch input:checked + img, .swatch input:checked + .generated { border-color: #d9b56a; }
.swatch input:checked ~ span { color: var(--ink); }
.swatch input:focus-visible + img, .swatch input:focus-visible + .generated { outline: 2px solid #d9b56a; outline-offset: 2px; }
.swatch[aria-busy=true] span::after { content: " · loading"; }
.swatch-error span::after { content: " · couldn’t load"; color: #e8a08a; }

@media (max-width: 560px) {
  .open-settings span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .open-settings { padding: .5rem; }
  /* A sheet from the bottom on phones, so the pot stays visible above it. */
  .settings { inset: auto 0 0 0; width: 100%; height: auto; max-height: 52vh; border-left: 0;
    border-top: 1px solid rgba(255,255,255,.08); border-radius: 16px 16px 0 0; padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
  .settings[open] { animation-name: rise; }
  @keyframes rise { from { transform: translateY(30px); opacity: 0; } }
  .swatches { grid-template-columns: repeat(4, 1fr); gap: .5rem; }
  .swatch img, .swatch .generated { aspect-ratio: 1; }
  .swatch span { font-size: .72rem; }
  .setting { margin-bottom: 1.1rem; }
  .settings-head { margin-bottom: .75rem; }
}
@media (prefers-reduced-motion: reduce) { .settings[open] { animation: none; } }

/* The interface stays hidden through the opening and fades in once the pieces have settled. */
.gui { opacity: 0; pointer-events: none; transition: opacity .8s ease; }
body.playing .gui { opacity: 1; pointer-events: auto; }
.bar .timer { margin: 0 auto; font-variant-numeric: tabular-nums; font-size: .95rem; letter-spacing: .04em; }
.bar .timer + .hint, .bar .hint + .open-settings { margin-left: 0; }
.bar .hint { font: inherit; font-size: .9rem; background: none; border: 1px solid currentColor; border-radius: 999px; padding: .2rem .8rem; color: inherit; cursor: pointer; opacity: .85; }
.bar .hint:hover { opacity: 1; }

.card { position: fixed; z-index: 3; inset: 0; display: grid; place-content: center; justify-items: center; gap: .3rem;
  text-align: center; padding: 2rem; background: rgba(250,248,244,.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  --ink: #221d18; --dim: #6b6156; color: var(--ink); color-scheme: light;
  transition: opacity .6s ease, visibility .6s; }
.card.gone { opacity: 0; visibility: hidden; }
.card h2 { margin: 0; font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 400; letter-spacing: .01em; }
.card-date, .card-pot { margin: 0; color: var(--dim); }
.card-pot { margin-bottom: 1.4rem; }
.begin { min-width: 9rem; padding: .7rem 1.6rem; border: 1px solid rgba(217,181,106,.7); border-radius: 999px; font: inherit; font-size: 1rem;
  color: var(--ink); background: rgba(217,181,106,.16); cursor: pointer; transition: background .2s; }
.begin:hover:not(:disabled) { background: rgba(217,181,106,.3); }
.begin:disabled { opacity: .6; cursor: progress; border-color: rgba(34,29,24,.25); background: transparent; }
.card .begin { border-color: #b08436; background: rgba(176,132,54,.12); }
.card .begin:hover:not(:disabled) { background: rgba(176,132,54,.24); }
.card .back { color: var(--dim); }
.begin:focus-visible, .skip:focus-visible, .replay:focus-visible, .toggle input:focus-visible { outline: 2px solid #d9b56a; outline-offset: 3px; }
.card .back { margin-top: 1.2rem; }

.skip { position: fixed; z-index: 2; right: 1.25rem; bottom: max(1rem, env(safe-area-inset-bottom)); padding: .4rem .9rem; border: 0; border-radius: 999px;
  font: inherit; font-size: .85rem; color: var(--ink); background: rgba(20,17,15,.38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer; }

.toggle { display: flex; align-items: center; justify-content: space-between; font-size: .9rem; cursor: pointer; }
.toggle input { appearance: none; -webkit-appearance: none; width: 2.4rem; height: 1.35rem; margin: 0; border-radius: 999px; position: relative;
  background: rgba(255,255,255,.18); cursor: pointer; transition: background .2s; }
.toggle input::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.toggle input:checked { background: #b8954f; }
.toggle input:checked::after { transform: translateX(1.05rem); }
.replay { width: 100%; margin-top: .4rem; padding: .6rem; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; font: inherit; font-size: .88rem;
  color: var(--ink); background: transparent; cursor: pointer; }
.replay:hover { background: rgba(255,255,255,.06); }
@media (prefers-reduced-motion: reduce) { .gui, .card { transition: none; } }

.setting-help { margin: .35rem 0 0; font-size: .8rem; opacity: .7; }

/* Shelf calendar: floating planks of the chosen table wood on a warm, sunlit wall, one plank per week. */
.shelf { --wood: url(textures/wood066/color.jpg); width: min(58rem, 96vw); position: fixed; max-height: 92vh; padding: 1.2rem 1.4rem 1.6rem; border: 0; border-radius: 14px;
  color: #2a241e; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  background: radial-gradient(120% 80% at 12% 0%, #fffaf2 0%, rgba(255, 250, 242, 0) 60%), linear-gradient(#efe6da, #e6dccf); }
.shelf::backdrop { background: rgba(20, 16, 12, .45); backdrop-filter: blur(3px); }
.shelf-head { display: flex; align-items: center; gap: 1rem; }
.shelf-head h2 { margin: 0; font-size: 1.4rem; }
.shelf-nav { display: flex; align-items: center; gap: .5rem; margin-left: auto; font-size: .9rem; }
.shelf-nav button, .shelf .close { font: inherit; font-size: 1.1rem; background: none; border: 0; color: inherit; cursor: pointer; padding: .1rem .5rem; }
.shelf-nav button:disabled { opacity: .25; cursor: default; }
.shelf-month { min-width: 8.5rem; text-align: center; }
/* Stats set like a poster: one big number, then a quiet row of three. */
.shelf-stats { display: flex; align-items: flex-end; gap: 2.4rem; margin: 1rem 0 1.6rem; padding-bottom: 1.2rem; border-bottom: 1px solid rgba(42, 36, 30, .15); }
.stat-hero { display: flex; align-items: baseline; gap: .7rem; }
.stat-hero b { font-family: var(--serif); font-weight: 500; font-size: clamp(4rem, 11vw, 6.5rem); line-height: .8; letter-spacing: -.02em; }
.stat-hero span { font-family: var(--serif); font-size: 1.35rem; font-style: italic; color: #5a5047; }
.stat-list { display: flex; gap: 2rem; margin: 0 0 .3rem auto; }
.stat-list div { border-left: 1px solid rgba(42, 36, 30, .18); padding-left: .9rem; }
.stat-list dt { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: #8a7f72; }
.stat-list dd { margin: .2rem 0 0; font-family: var(--serif); font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.shelf-days, .shelf-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.shelf-days { font-size: .7rem; color: #8a7f72; text-align: center; margin-bottom: .2rem; }
.shelf-body { padding: 0 1.4rem; }
.shelf-row { position: relative; padding-top: .3rem; margin-bottom: 1.7rem; --l: -1.3rem; --r: -1.3rem; }
/* Each plank a little different in length and offset, like hand-hung shelves. */
.shelf-row:nth-child(2) { --l: -.9rem; --r: -1.4rem; }
.shelf-row:nth-child(3) { --l: -1.4rem; --r: -1rem; }
.shelf-row:nth-child(4) { --l: -1rem; --r: -1.35rem; }
.shelf-row:nth-child(5) { --l: -1.35rem; --r: -.85rem; }
/* The plank: a thin lit top surface (::before) and a thick front edge (::after), both cut from the wood scan. */
.shelf-row::before, .shelf-row::after { content: ''; position: absolute; left: var(--l); right: var(--r); background-image: var(--wood); background-size: 26rem auto; }
.shelf-row::before { bottom: 15px; height: 22px; background-position: 30% 40%; filter: brightness(1.18) saturate(.95);
  clip-path: polygon(2.5% 0, 97.5% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 6px 8px -4px rgba(40, 22, 10, .45); }
.shelf-row::after { bottom: 0; height: 15px; background-position: 60% 70%; border-radius: 1px 1px 3px 3px;
  box-shadow: inset 0 1px 0 rgba(255, 240, 215, .35), inset 0 -3px 4px rgba(40, 22, 10, .35),
    0 12px 14px -6px rgba(70, 45, 25, .45), 6px 22px 22px -10px rgba(70, 45, 25, .22); }
.shelf-spot { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: center; aspect-ratio: 1 / 1.05;
  padding-bottom: 24px; color: inherit; text-decoration: none; border-radius: 6px 6px 0 0; }
.shelf-spot img { width: 100%; max-width: 104px; height: auto; position: relative; z-index: 1; margin-bottom: -4px;
  filter: drop-shadow(5px 3px 4px rgba(70, 45, 25, .28)); }
.shelf-date { position: absolute; top: .15rem; left: .3rem; font-size: .62rem; color: #9a8e80; }
.shelf-spot.missed img { opacity: .3; filter: grayscale(.8) brightness(1.2); }
.shelf-spot.today { background: radial-gradient(ellipse at 50% 88%, rgba(255, 205, 120, .45), transparent 70%); }
.shelf-spot.today img { opacity: .55; }
.shelf-spot.current .shelf-date { color: #2a241e; font-weight: 600; }
.shelf-spot.out, .shelf-spot.future { pointer-events: none; }
.shelf-spot.out .shelf-date { display: none; }
a.shelf-spot:hover { background: rgba(255, 255, 255, .35); }
a.shelf-spot:focus-visible { outline: 2px solid #c4974a; }

/* Background choice: two pill buttons. */
.backdrops { display: flex; flex-wrap: wrap; gap: .5rem; }
.backdrops legend { width: 100%; margin-bottom: .5rem; font-size: .9rem; }
.backdrops label { cursor: pointer; }
.backdrops input { position: absolute; opacity: 0; pointer-events: none; }
.backdrops span { display: inline-block; padding: .3rem .9rem; border: 1px solid currentColor; border-radius: 999px; font-size: .85rem; opacity: .7; }
.backdrops input:checked + span { opacity: 1; background: currentColor; }
.backdrops input:checked + span { color: inherit; box-shadow: inset 0 0 0 20px rgba(255, 255, 255, .85); color: #1d1a17; }
.backdrops input:focus-visible + span { outline: 2px solid #d9b56a; outline-offset: 2px; }
#time-setting.off { opacity: .4; pointer-events: none; }

/* "Your shelf" on the title card: a quiet text button under Begin. */
.card-shelf { display: block; margin: .9rem auto 0; padding: .2rem .4rem; border: 0; background: none; font: inherit; font-size: .85rem;
  color: inherit; opacity: .75; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.card-shelf:hover { opacity: 1; }
.card-shelf:focus-visible { outline: 2px solid #d9b56a; outline-offset: 3px; }

/* Close-up of one pot: zooms forward from its spot on the shelf. */
.shelf-detail { position: absolute; inset: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 1rem;
  padding: 3.2rem 2.6rem 2.6rem; border-radius: inherit;
  background: radial-gradient(120% 80% at 12% 0%, #fffaf2 0%, rgba(255, 250, 242, 0) 60%), linear-gradient(#efe6da, #e6dccf);
  opacity: 0; transform: scale(.25); transition: opacity .25s ease, transform .35s cubic-bezier(.2, .8, .2, 1); }
.shelf-detail[hidden] { display: none; }
.shelf-detail.in { opacity: 1; transform: none; }
.detail-view { width: 100%; max-width: 30rem; height: auto; aspect-ratio: 1; justify-self: center; }
.detail-back { position: absolute; top: 1.1rem; left: 1.3rem; font: inherit; font-size: .85rem; background: none; border: 0; color: #6b6156; cursor: pointer; padding: .2rem .3rem; }
.detail-back:hover { color: #2a241e; }
.detail-date { margin: 0; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #8a7f72; }
.detail-name { margin: .3rem 0 .6rem; font-family: var(--serif); font-weight: 500; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; }
.detail-facts { margin: 0 0 1.6rem; color: #5a5047; font-size: .9rem; }
.detail-remake { display: inline-block; padding: .65rem 1.5rem; border: 1px solid #b08436; border-radius: 999px; color: #2a241e; text-decoration: none;
  background: rgba(176, 132, 54, .12); transition: background .2s; }
.detail-remake:hover { background: rgba(176, 132, 54, .24); }
.detail-remake:focus-visible, .detail-back:focus-visible { outline: 2px solid #c4974a; outline-offset: 3px; }
@media (max-width: 640px) { .shelf-detail { grid-template-columns: 1fr; text-align: center; padding-top: 3rem; } .stat-list { gap: 1rem; } .shelf-stats { flex-wrap: wrap; } }

/* Collection fits on one screen: spot height comes from the window height, columns never grow past 1/7. */
.shelf { --spot: clamp(3rem, calc((92vh - 16rem) / 6 - .9rem), 6rem); max-height: 96vh; overflow: hidden auto; padding: 1rem 1.6rem 1.2rem; }
.shelf-days, .shelf-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.shelf-stats { margin: .5rem 0 .8rem; padding-bottom: .7rem; gap: 2rem; }
.stat-hero b { font-size: clamp(2.8rem, 8vh, 4.6rem); }
.stat-hero span { font-size: 1.15rem; }
.stat-list dd { font-size: 1.35rem; }
.shelf-days { margin-bottom: 0; }
.shelf-row { margin-bottom: .9rem; padding-top: 0; }
.shelf-row::before { height: 12px; bottom: 14px; }
.shelf-row::after { height: 14px; }
.shelf-spot { aspect-ratio: auto; height: var(--spot); padding-bottom: 20px; }
.shelf-spot img { width: auto; height: auto; max-width: 94%; max-height: calc(var(--spot) - 20px); margin-bottom: 0; }
.shelf-date { top: 0; }
/* Thumbnails are cropped to the pot and share one scale; --h is the pot's height as a share of the field. */
.shelf-spot img { height: calc((var(--spot) - 20px) * 1.3 * var(--h, .5)); width: auto; max-width: 100%; max-height: none; object-fit: contain; object-position: bottom; }
/* Unmended pots: a dark, see-through silhouette rather than a washed-out ghost. */
.shelf-spot.missed img, .shelf-spot.today img { opacity: .45; filter: brightness(0) saturate(0); }
.shelf-spot.today img { opacity: .55; }
/* The close-up's 3D view is a big layer behind the text, so a pot (or a mug's handle) can run past its box. */
.shelf-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: visible; }
.detail-view { position: absolute; left: -4%; top: 50%; width: 72%; height: auto; max-width: none; aspect-ratio: 1; transform: translateY(-50%); z-index: 0; pointer-events: none; }
.detail-text { grid-column: 2; position: relative; z-index: 1; }
.detail-back { z-index: 2; }
@media (max-width: 640px) { .detail-view { left: 0; width: 100%; top: 38%; } .detail-text { grid-column: 1; margin-top: 55vw; } }

/* Short notes: kintsugi on the title card, glaze and shape in the close-up. */
.card-about { max-width: 30rem; margin: -.4rem auto 1.6rem; font-size: .9rem; line-height: 1.55; color: var(--dim); text-wrap: pretty; }
.detail-about { max-width: 24rem; margin: -.6rem 0 1.6rem; font-size: .88rem; line-height: 1.55; color: #5a5047; text-wrap: pretty; }
@media (max-width: 640px) { .detail-about { margin-inline: auto; } }
/* Close-up layout: the pot large across the upper left, the notes low on the right. */
.shelf-detail { align-items: end; }
.detail-view { left: 1%; top: 4%; width: 66%; height: 82%; aspect-ratio: auto; transform: none; }
.detail-text { align-self: end; padding-bottom: 1.5rem; }
@media (max-width: 640px) { .detail-view { left: 0; top: 6%; width: 100%; height: 52%; } .detail-text { margin-top: 0; } }
/* The close-up is the back of the card: the whole card flips (shelf.js flip()), so the panel itself doesn't zoom. */
.shelf-detail { opacity: 1; transform: none; transition: none; }

/* How to play: a light card like the collection. */
.help { width: min(40rem, 94vw); max-height: 90vh; overflow: auto; padding: 1.4rem 1.8rem 1.8rem; border: 0; border-radius: 14px; color: #2a241e;
  background: radial-gradient(120% 80% at 12% 0%, #fffaf2 0%, rgba(255, 250, 242, 0) 60%), linear-gradient(#f2ebe1, #e9e0d4); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.help::backdrop { background: rgba(20, 16, 12, .45); backdrop-filter: blur(3px); }
.help-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.help-head h2 { margin: 0; font-size: 1.8rem; font-weight: 500; }
.help .close { font: inherit; font-size: 1.2rem; background: none; border: 0; color: inherit; cursor: pointer; padding: .1rem .5rem; }
.help section { padding: 1rem 0; border-top: 1px solid rgba(42, 36, 30, .12); }
.help h3 { margin: 0 0 .5rem; font-size: .68rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #8a7f72; }
.help h4 { margin: .8rem 0 .4rem; font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.help p, .help li { margin: 0; font-size: .9rem; line-height: 1.55; color: #3d352d; }
.help ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0; font-size: .86rem; }
.help dt { color: #2a241e; font-weight: 500; }
.help dd { margin: 0; color: #5a5047; }
.help kbd { display: inline-block; min-width: 1.5em; padding: .05rem .35rem; border: 1px solid rgba(42, 36, 30, .25); border-bottom-width: 2px; border-radius: 5px;
  font: inherit; font-size: .78rem; text-align: center; background: rgba(255, 255, 255, .5); }
@media (max-width: 560px) { .help-cols { grid-template-columns: 1fr; } }
.bar a, .bar h1, .bar button { white-space: nowrap; }
@media (max-width: 720px) { .bar { gap: .55rem; } .bar .back { display: none; } .bar .hint { padding: .2rem .6rem; font-size: .8rem; } .open-settings span { display: none; } }

/* Sync across devices (Settings). */
.sync-setting { margin-top: 1.6rem; }
.sync-title { margin: 0 0 .3rem; font-size: .9rem; font-weight: 500; }
.sync-link { display: flex; gap: .4rem; margin-top: .5rem; }
.sync-link input { flex: 1; min-width: 0; padding: .55rem .7rem; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.06);
  color: inherit; font: inherit; font-size: .88rem; letter-spacing: .08em; text-transform: uppercase; }
.sync-link input::placeholder { letter-spacing: 0; text-transform: none; opacity: .6; }
.sync-link .replay { width: auto; margin-top: 0; padding-inline: .9rem; }
.sync-code { margin: .4rem 0 .2rem; font-family: var(--serif); font-size: 2rem; letter-spacing: .12em; user-select: all; }
.sync-quiet { border-color: transparent; opacity: .7; }
/* Touch screens: every button at least 44 px, the size of a fingertip. */
@media (pointer: coarse) {
  .bar .hint, .open-settings, .skip, .card-shelf, .begin, .replay, .detail-back, .detail-remake,
  .shelf-nav button, .shelf .close, .help .close, .settings .close { min-height: 44px; min-width: 44px; }
  .bar .hint { padding: .45rem .85rem; }
  .card-shelf, .detail-back { padding: .6rem .8rem; }
  .shelf-nav button, .shelf .close, .help .close { padding: .5rem .8rem; }
  .backdrops span { padding: .6rem 1rem; }
  .sync-link input { min-height: 44px; }
  a.shelf-spot { min-height: 52px; }
}
/* Phones: the header wraps to two rows rather than squeezing its buttons. */
@media (max-width: 520px) {
  .bar { flex-wrap: wrap; row-gap: .45rem; align-items: center; }
  .bar button { flex-shrink: 0; }
  .bar h1 { flex: 1 1 auto; }
  .bar .timer { margin: 0; }
  .bar .open-settings { margin-left: 0; }
}

/* Title card: collection and settings side by side; the studio credit at the foot of the screen. */
.card-links { display: flex; justify-content: center; gap: 1.2rem; margin-top: .9rem; }
.card-links .card-shelf { margin: 0; }
.card-credit { position: absolute; left: 0; right: 0; bottom: max(1.4rem, env(safe-area-inset-bottom)); text-align: center;
  font-size: .78rem; letter-spacing: .04em; color: var(--dim); text-decoration: none; }
.card-credit:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* Header menu: on desktop the buttons sit in the bar as before; on phones they fold into a menu. */
.bar-menu { display: contents; }
.menu-toggle, .menu-only { display: none; }
@media (max-width: 520px) {
  .bar { flex-wrap: nowrap; align-items: center; }
  .bar h1 { flex: 1 1 auto; }
  .bar .timer { margin: 0 .2rem 0 0; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-right: -.6rem;
    background: none; border: 0; color: inherit; cursor: pointer; }
  .bar-menu { display: none; position: absolute; top: calc(100% - .2rem); right: .8rem; flex-direction: column; align-items: stretch; gap: .2rem;
    min-width: 12rem; padding: .5rem; border-radius: 14px; background: rgba(20, 17, 15, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
  body.studio .bar-menu { background: rgba(250, 248, 244, .92); }
  .bar.menu-open .bar-menu { display: flex; }
  .bar-menu .hint, .bar-menu .open-settings, .bar-menu .menu-only { display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 44px; margin: 0;
    padding: .55rem .8rem; border: 0; border-radius: 9px; background: none; color: inherit; font: inherit; font-size: .95rem; text-align: left; text-decoration: none; opacity: 1; }
  .bar-menu .open-settings span { display: inline; position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .bar-menu .hint:hover, .bar-menu .open-settings:hover, .bar-menu .menu-only:hover { background: rgba(255, 255, 255, .1); }
  .bar-menu .menu-only { border-top: 1px solid rgba(255, 255, 255, .12); border-radius: 0 0 9px 9px; margin-top: .2rem; opacity: .8; }
}

/* The seal on the title card, and this pot's result if it's already mended. */
.card-stamp { width: 84px; height: 84px; margin: 0 auto .4rem; transform: rotate(-4deg); opacity: .92; }
.card-done { margin: -.2rem 0 1rem; font-size: .9rem; color: #8a2a1e; letter-spacing: .01em; }
/* The close-up pot can be turned by hand. */
.detail-view { pointer-events: auto; cursor: grab; touch-action: none; }
.detail-view:active { cursor: grabbing; }
