/* Layout: a pinned, scroll-driven 3D curtain reveal over last year's Annakoot photo, then a dish grid
   with a sticky "thali" (basket + form) beside it; stacks to one column on phones.
   Single deliberate look: peacock night, brass and marigold. */
:root {
  --night: #061a1e;        /* page ground: deep peacock night */
  --night-2: #0b2a30;      /* raised surfaces */
  --night-3: #174249;      /* borders, inputs */
  --ivory: #fbeedd;        /* text */
  --ivory-dim: #b9cdc9;    /* secondary text */
  --saffron: #ff9a1f;      /* primary accent */
  --marigold: #ffc533;     /* highlight */
  --brass: #c9a14a;        /* plates, rules */
  --kumkum: #e2485a;       /* errors */
  --taken: #5f7774;        /* greyed-out */
  --shade-rgb: 3, 18, 21;  /* scrims and shadows */
  --raised-rgb: 11, 42, 48;
  --tint-rgb: 64, 200, 210;
  --card-deep: #0f3d44;

  --f-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --f-body: "Mukta", "Segoe UI", system-ui, sans-serif;

  --r: 14px;
  color-scheme: dark;
}

/* Site colour themes. The default is set with data-palette on <canvas id="hero-3d">;
   test mode (?test) lets you try them. All are dark so the text over the photo stays readable. */
:root[data-palette="maroon"] {
  --night: #1c0a0c; --night-2: #2c1215; --night-3: #4a2327; --ivory-dim: #d8c2b9; --taken: #7a6461;
  --shade-rgb: 20, 6, 8; --raised-rgb: 44, 18, 21; --tint-rgb: 230, 120, 90; --card-deep: #3e171b;
}
:root[data-palette="indigo"] {
  --night: #0c0e22; --night-2: #161a37; --night-3: #2a2f57; --ivory-dim: #c2c5de; --taken: #6b6f8c;
  --shade-rgb: 7, 8, 22; --raised-rgb: 22, 26, 55; --tint-rgb: 140, 150, 255; --card-deep: #232858;
}
:root[data-palette="tulsi"] {
  --night: #09190f; --night-2: #11281b; --night-3: #22432f; --ivory-dim: #c0d4c5; --taken: #62786a;
  --shade-rgb: 4, 15, 9; --raised-rgb: 17, 40, 27; --tint-rgb: 120, 210, 150; --card-deep: #1a3d29;
}
:root[data-palette="charcoal"] {
  --night: #141210; --night-2: #201d19; --night-3: #3a342c; --ivory-dim: #d0c7b9; --taken: #716b62;
  --shade-rgb: 11, 9, 7; --raised-rgb: 32, 29, 25; --tint-rgb: 255, 190, 120; --card-deep: #2e2a23;
}
:root[data-palette="plum"] {
  --night: #170b1c; --night-2: #24122b; --night-3: #422548; --ivory-dim: #d6c3d8; --taken: #75647a;
  --shade-rgb: 14, 6, 17; --raised-rgb: 36, 18, 43; --tint-rgb: 230, 140, 220; --card-deep: #3a1a42;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ivory);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.1; text-wrap: balance; margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.draft-banner {
  background: var(--marigold);
  color: var(--night);
  font-size: 0.9rem;
  padding-block: 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  text-align: center;
}
.link-btn { background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0 4px; color: inherit; font-weight: 700; }

/* ---------- Scroll story (pinned 3D stage) ---------- */
.story { position: relative; height: 520vh; background: var(--night); }
.stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(55% 50% at 50% 55%, rgba(255, 154, 31, 0.16), transparent 70%),
    radial-gradient(40% 40% at 10% 0%, rgba(var(--tint-rgb), 0.08), transparent 70%),
    var(--night);
}
#hero-3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, transparent 50%, rgba(var(--shade-rgb), 0.88) 92%),
    radial-gradient(130% 100% at 50% 40%, transparent 60%, rgba(var(--shade-rgb), 0.6));
}
.stage.no-3d { background-size: cover; background-position: center; }
.beat {
  position: absolute;
  display: grid; gap: 14px;
  max-width: 30rem;
  will-change: opacity, transform;
}
.pos-center {
  left: 50%; top: 46%; translate: -50% -50%;
  text-align: center; justify-items: center; width: min(52rem, calc(100% - 32px)); max-width: none;
}
.pos-bottom {
  left: 50%; bottom: max(36px, 6vh); translate: -50% 0;
  text-align: center; justify-items: center; width: min(36rem, calc(100% - 32px)); max-width: none;
}
.pos-center .facts { justify-content: center; }
/* A soft dark pool behind the opening text keeps it readable on any curtain colour */
.pos-center::before {
  content: ""; position: absolute; inset: -14% -10%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--shade-rgb), 0.82), rgba(var(--shade-rgb), 0.58) 55%, transparent);
  border-radius: 50%;
}
.theme {
  margin: 0; display: grid; justify-items: center; gap: 2px;
  padding-block: 8px; padding-inline: 18px;
  border-top: 1px solid rgba(230, 187, 82, 0.6); border-bottom: 1px solid rgba(230, 187, 82, 0.6);
}
.theme span { font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--brass); }
.theme em {
  font-family: var(--f-display); font-style: italic; font-weight: 600;
  font-size: clamp(1.3rem, 3.2vw, 1.75rem); color: var(--marigold);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}
.presence { margin: 0; text-wrap: balance; font-style: italic; color: var(--ivory-dim); font-size: 1rem; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.presence strong { display: block; text-wrap: balance; font-style: normal; font-weight: 500; color: var(--ivory); font-size: 1.1rem; }
.facts .addr { color: var(--ivory-dim); font-weight: 400; }
.pos-center .skip-link { justify-self: center; }
.pos-center h1 { text-shadow: 0 2px 0 rgb(var(--shade-rgb)), 0 6px 30px rgba(0, 0, 0, 0.6); }
.pos-center .facts dd { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.beat:not(.beat-1) { visibility: hidden; opacity: 0; }
.eyebrow {
  margin: 0;
  color: var(--marigold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
}
.story h1 {
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.95;
  text-shadow: 0 2px 30px rgba(255, 154, 31, 0.35);
}
.beat-h {
  font-size: clamp(2.4rem, 5.6vw, 4.6rem);
  line-height: 0.98;
  text-shadow: 0 2px 30px rgba(var(--shade-rgb), 0.9);
}
.beat-h em, .story h1 em { font-style: italic; font-weight: 500; color: var(--marigold); }
.beat-p { margin: 0; color: var(--ivory-dim); font-size: 1.08rem; max-width: 26rem; text-shadow: 0 1px 12px rgba(var(--shade-rgb), 0.9); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 4px 0 0; }
.facts dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--brass); }
.facts dd { margin: 0; font-weight: 500; }
.skip-link { color: var(--ivory-dim); font-size: 0.9rem; text-underline-offset: 3px; justify-self: start; }
.tally { display: grid; gap: 8px; width: 100%; max-width: 22rem; }
.tally-num { font-family: var(--f-display); font-size: 2.4rem; font-weight: 600; color: var(--marigold); font-variant-numeric: tabular-nums; line-height: 1; }
.tally-num small { font-family: var(--f-body); font-size: 1rem; color: var(--ivory-dim); }
.progress { height: 6px; border-radius: 99px; background: var(--night-3); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--saffron), var(--marigold)); transition: width 0.6s ease; }
.btn-cta { justify-self: center; text-decoration: none; display: inline-block; padding: 14px 28px; font-size: 1.05rem; }
.scroll-cue {
  position: absolute; left: 50%; bottom: 28px; translate: -50% 0;
  display: grid; justify-items: center; gap: 10px;
  color: var(--ivory-dim); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  pointer-events: none;
}
.scroll-cue span {
  width: 22px; height: 36px; border: 1.5px solid var(--ivory-dim); border-radius: 12px; position: relative;
}
.scroll-cue span::after {
  content: ""; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px;
  border-radius: 2px; background: var(--marigold); animation: cue 1.6s ease-in-out infinite;
}
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* Reduced motion: no pinned scroll; show the finished scene with title and call to action */
.reduce-motion .story { height: auto; }
.reduce-motion .stage { position: relative; }
.reduce-motion .beat { opacity: 1 !important; visibility: visible !important; transform: none !important; }
.reduce-motion .beat:not(.beat-1):not(.beat-5), .reduce-motion .scroll-cue { display: none; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding-block: 40px 96px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
  align-items: start;
}
.menu { min-width: 0; display: grid; gap: 20px; }
.menu-head h2 { font-size: 2rem; }
.hint { margin: 4px 0 0; color: var(--ivory-dim); }

.filters { display: grid; gap: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  border: 1px solid var(--night-3);
  background: var(--night-2);
  border-radius: 99px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.92rem;
}
.tab:hover { border-color: var(--brass); }
/* Phones: one row of categories that scrolls sideways, instead of five rows of buttons */
@media (max-width: 640px) {
  .tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-inline: -16px; padding: 2px 16px 6px; scroll-padding-inline: 16px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 28px), transparent);
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; white-space: nowrap; }
}
.tab[aria-pressed="true"] { background: var(--saffron); border-color: var(--saffron); color: var(--night); font-weight: 700; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.search { flex: 1 1 220px; }
.search input, .field input {
  width: 100%;
  background: var(--night-2);
  border: 1px solid var(--night-3);
  border-radius: 10px;
  padding: 10px 12px;
}
.search input::placeholder, .field input::placeholder { color: var(--taken); }
.toggle { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; color: var(--ivory-dim); }
.toggle input { accent-color: var(--saffron); width: 18px; height: 18px; }
.load-note, .no-results { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--night-2); color: var(--ivory-dim); }

/* ---------- Dish cards ---------- */
.dish-grid { display: grid; gap: 28px; }
.cat-block { display: grid; gap: 12px; }
.cat-title { font-size: 1.35rem; color: var(--marigold); display: flex; align-items: center; gap: 12px; }
.cat-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--brass), transparent); opacity: 0.5; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 12px;
  perspective: 900px;
}


.dish {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 0%;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  text-align: left;
  padding: 0;
  overflow: hidden;
  border-radius: var(--r);
  border: 1px solid var(--night-3);
  background:
    radial-gradient(120% 90% at var(--gx) var(--gy), rgba(255, 197, 51, 0.10), transparent 60%),
    var(--night-2);
  cursor: pointer;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.18s ease, border-color 0.2s, box-shadow 0.2s, filter 0.3s, opacity 0.3s;
  box-shadow: 0 6px 0 -2px rgba(0, 0, 0, 0.35);
}
.dish:hover:not(:disabled) { border-color: var(--brass); box-shadow: 0 14px 24px -10px rgba(255, 154, 31, 0.35); }

/* Photo: every dish uses the same 4:3 frame */
.dish-photo {
  display: block;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  overflow: hidden;
  background: var(--night-3);
  position: relative;
}
.dish-photo::after { /* soft shade so the photo sits into the dark card */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(var(--shade-rgb), 0.55));
}
.dish-photo img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.dish:hover:not(:disabled) .dish-photo img { transform: scale(1.06); }
.dish-photo.is-empty {
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 55%, rgba(201, 161, 74, 0.28) 0 28%, transparent 29%),
    repeating-conic-gradient(from 0deg at 50% 55%, rgba(201, 161, 74, 0.10) 0 10deg, transparent 10deg 20deg),
    linear-gradient(160deg, var(--card-deep), var(--night-2));
}
.dish-mono {
  font-family: var(--f-display); font-weight: 600; font-size: 2.6rem; line-height: 1;
  color: var(--marigold); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  position: relative; z-index: 1;
}
.dish-body { display: grid; gap: 2px; padding: 10px 12px 12px; align-content: start; transform: translateZ(14px); }
.dish-name { font-weight: 700; font-size: 1.02rem; line-height: 1.25; }
.dish-status { font-size: 0.85rem; color: var(--ivory-dim); }
.dish-check {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid rgba(251, 238, 221, 0.85);
  background: rgba(var(--shade-rgb), 0.45);
  transform: translateZ(20px);
}

.dish.is-selected {
  border-color: var(--saffron);
  box-shadow: 0 0 0 1px var(--saffron), 0 16px 30px -12px rgba(255, 154, 31, 0.6);
}
.dish.is-selected .dish-status { color: var(--marigold); font-weight: 500; }
.dish.is-selected .dish-check { background: var(--saffron); border-color: var(--saffron); }
.dish.is-selected .dish-check::after {
  content: ""; position: absolute; left: 7.5px; top: 3.5px; width: 5px; height: 10px;
  border: solid var(--night); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.dish.is-taken {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.5;
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, 0.03) 10px 20px),
    var(--night-2);
  box-shadow: none;
  transform: none;
}
.dish.is-taken .dish-name { text-decoration: line-through; text-decoration-color: var(--taken); }
.dish.is-taken .dish-check { display: none; }
.dish.is-mine { filter: none; opacity: 0.9; border-color: var(--brass); }
.dish.is-mine .dish-name { text-decoration: none; }
.dish.is-mine .dish-status { color: var(--marigold); }
.dish:disabled:not(.is-taken) { cursor: progress; }

/* ---------- Basket ---------- */
.basket { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); }
.basket { min-width: 0; }
.basket-card {
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  padding: 22px;
  border-radius: 20px;
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(255, 154, 31, 0.14), transparent 70%),
    var(--night-2);
  border: 1px solid var(--night-3);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.6);
}
.basket-card h2 { font-size: 1.7rem; }
.picked-empty { margin: 0; color: var(--ivory-dim); font-size: 0.95rem; }
.picked-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.picked-list li {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--night-3); border: 1px solid var(--brass);
  border-radius: 99px; padding: 4px 4px 4px 12px; font-size: 0.92rem;
}
.chip-x { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--ivory-dim); }
.chip-x:hover { background: var(--night-2); color: var(--ivory); }
.custom-dish {
  grid-template-columns: minmax(0, 1fr);
  display: grid; gap: 4px;
  padding: 12px; border-radius: 12px;
  border: 1px dashed rgba(201, 161, 74, 0.55);
  background: rgba(201, 161, 74, 0.06);
}
.custom-dish label { font-weight: 500; font-size: 0.92rem; }
.custom-row { display: flex; gap: 8px; }
.custom-row input {
  flex: 1; min-width: 0;
  background: var(--night-2); border: 1px solid var(--night-3); border-radius: 10px; padding: 9px 12px;
}
.custom-row input::placeholder { color: var(--taken); }
.custom-row input[aria-invalid="true"] { border-color: var(--kumkum); }
.custom-note { font-size: 0.85rem; color: var(--marigold); }
.custom-note:empty { display: none; }
.btn-ghost {
  border: 1px solid var(--brass); background: transparent; color: var(--marigold);
  border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer;
}
.btn-ghost:hover { background: rgba(201, 161, 74, 0.14); }
.no-results { display: grid; gap: 10px; justify-items: start; }
.no-results p { margin: 0; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 500; font-size: 0.92rem; }
.field input[aria-invalid="true"] { border-color: var(--kumkum); }
.err { color: var(--kumkum); font-size: 0.85rem; min-height: 0; }
.err:empty { display: none; }
.field-note { color: var(--ivory-dim); font-size: 0.8rem; }

.btn-primary {
  border: 0; cursor: pointer;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  color: var(--night);
  background: linear-gradient(180deg, var(--marigold), var(--saffron));
  box-shadow: 0 4px 0 #b4620c, 0 10px 20px -8px rgba(255, 154, 31, 0.6);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
}
.btn-primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #b4620c; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-small { padding: 9px 14px; }
.dropoff { margin: 0; font-size: 0.85rem; color: var(--ivory-dim); }
.mine { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(201, 161, 74, 0.14); font-size: 0.92rem; }

/* ---------- Mobile bar ---------- */
.mobile-bar { display: none; }

/* ---------- Result dialog ---------- */
.result {
  border: 1px solid var(--brass);
  border-radius: 20px;
  background: var(--night-2);
  color: var(--ivory);
  max-width: min(440px, calc(100vw - 32px));
  padding: 26px;
}
.result::backdrop { background: rgba(var(--shade-rgb), 0.7); backdrop-filter: blur(3px); }
.result h2 { font-size: 1.6rem; color: var(--marigold); margin-bottom: 8px; }
.result p { margin: 0 0 12px; }
.result .btn-primary { margin-top: 6px; width: 100%; }

.burst { position: fixed; left: 50%; top: 60%; pointer-events: none; z-index: 1000; }
.petal {
  position: absolute; width: 14px; height: 8px; border-radius: 50%;
  background: var(--marigold);
  animation: fly 1.5s cubic-bezier(.2, .7, .3, 1) forwards;
}
.petal:nth-child(3n) { background: var(--saffron); }
.petal:nth-child(4n) { background: var(--kumkum); }
@keyframes fly {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

.credits { margin-top: 10px; font-size: 0.8rem; }
.credits summary { cursor: pointer; color: var(--ivory-dim); }
.credits p { margin: 8px 0; }
.credits ul { list-style: none; padding: 0; margin: 0 auto; max-width: 52rem; columns: 2 18rem; column-gap: 24px; text-align: left; }
.credits li { break-inside: avoid; padding: 2px 0; overflow-wrap: anywhere; }
.credits a { color: var(--marigold); }
.foot p { margin: 0; }
.foot {
  text-align: center; color: var(--ivory-dim); font-size: 0.85rem;
  padding-block: 24px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--night-3);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .basket { position: static; }
  .beat-p { font-size: 1rem; }
  .beat-h { font-size: clamp(2.1rem, 9vw, 3rem); }
  .mobile-bar:not([hidden]) {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding-top: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    background: rgba(var(--raised-rgb), 0.94);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--brass);
  }
}
@media (max-width: 420px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Test mode panel (only with ?test) ---------- */
.testmode {
  position: fixed; z-index: 200;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  display: grid; justify-items: end; gap: 8px;
  font-size: 0.9rem;
}
.tm-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: rgba(var(--raised-rgb), 0.92); color: var(--ivory);
  border: 1px solid var(--brass); font-weight: 700;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px);
}
.tm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--marigold); box-shadow: 0 0 8px var(--marigold); }
.tm-panel {
  width: min(330px, calc(100vw - 24px)); max-height: calc(100svh - 80px); overflow: auto;
  padding: 14px; border-radius: var(--r);
  background: rgba(var(--raised-rgb), 0.97); border: 1px solid var(--night-3);
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.7);
}
.tm-title { margin: 0 0 10px; font-weight: 700; }
.tm-title span { display: block; font-weight: 400; color: var(--ivory-dim); font-size: 0.82rem; }
.tm-panel fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.tm-panel legend { padding: 0; margin-bottom: 6px; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brass); }
.tm-swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tm-swatch {
  display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left;
  padding: 6px 8px; border-radius: 10px; cursor: pointer; font-size: 0.85rem; line-height: 1.2;
  background: var(--night); border: 1px solid var(--night-3); color: var(--ivory);
}
.tm-swatch[aria-pressed="true"] { border-color: var(--marigold); box-shadow: inset 0 0 0 1px var(--marigold); }
.tm-chip { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.25); }
.tm-btn {
  width: 100%; padding: 9px; border-radius: 10px; cursor: pointer; font-weight: 700;
  background: var(--saffron); color: #1a0d02; border: 0;
}
.tm-code { margin: 12px 0 8px; font-size: 0.8rem; color: var(--ivory-dim); }
.tm-code code { color: var(--marigold); word-break: break-word; }
.tm-row { display: flex; justify-content: space-between; gap: 8px; }
.tm-link { background: none; border: 0; padding: 4px 0; color: var(--ivory-dim); text-decoration: underline; cursor: pointer; font-size: 0.82rem; }
