/* Secret Santa: draw names, send each person a private link that unwraps.
 * One Page Toys tool family, self-contained, theme-aware (light/dark).
 * The garland board and the gift are physical things (pine board, red paper,
 * ivory ribbon), so they keep their colors in both themes; the page around
 * them and the winter sky behind the gift follow the theme. */

@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap");

:root{
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --ink: #1b2420;
  --bg: #f5efe4;
  --surface: #fffcf6;
  --surface-2: #f3ecdf;
  --muted: #66675e;
  --line: #e7ddcc;
  --line-strong: #d2c5ad;
  --accent: #b0172e;
  --accent-hover: #93101f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(176, 23, 46, 0.1);
  --pine: #1f5a44;
  --pine-soft: rgba(31, 90, 68, 0.1);
  --gold: #a98326;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(44, 26, 14, 0.07);
  --shadow-md: 0 10px 26px rgba(44, 26, 14, 0.11);
  --shadow-lg: 0 22px 50px rgba(44, 26, 14, 0.18);
  /* physical things: close to identical in both themes */
  --board-1: #1d4a3a;
  --board-2: #12342a;
  --tag: #fbf5e8;
  --tag-ink: #1c2621;
  --tag-edge: rgba(150, 122, 64, 0.45);
  --berry: #a8152d;
  --twine-a: #c21f37;
  --twine-b: #f7f1e4;
  --foil: #d6b05a;
  /* the sky behind the gift */
  --sky-1: #b9cbd4;
  --sky-2: #dfe3df;
  --sky-3: #f2e8d8;
  --sky-glow: rgba(255, 198, 120, 0.55);
}
:root[data-theme="dark"]{
  --ink: #f1ebdf;
  --bg: #0c1512;
  --surface: #131e1a;
  --surface-2: #1a2722;
  --muted: #a1a79e;
  --line: #24322c;
  --line-strong: #36483f;
  --accent: #ff6f80;
  --accent-hover: #ff8e9b;
  --accent-ink: #1d0509;
  --accent-soft: rgba(255, 111, 128, 0.13);
  --pine: #5cbf94;
  --pine-soft: rgba(92, 191, 148, 0.13);
  --gold: #e2c070;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 54px -10px rgba(0, 0, 0, 0.7);
  --tag: #efe6d3;
  --sky-1: #08141c;
  --sky-2: #0e1e24;
  --sky-3: #172820;
  --sky-glow: rgba(255, 176, 92, 0.32);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ -webkit-tap-highlight-color: transparent; }
body{
  margin: 0; min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--ink);
  background:
    radial-gradient(70% 38% at 50% 0%, var(--accent-soft), transparent 72%),
    var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea{ font: inherit; color: inherit; }
.visually-hidden{ position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden]{ display: none !important; }

/* the gift view takes over before first paint when the URL is a gift link */
:root[data-view="gift"] #organizer{ display: none !important; }
:root[data-view="gift"] #giftView{ display: flex !important; }

/* ---------- Top bar (family chrome) ---------- */
.topbar{
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 30px);
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(clamp(16px, 4vw, 30px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 30px), env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand{ display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brand__mark{ width: 1.1em; height: 1.1em; border: 1.5px solid var(--ink); border-radius: 6px; background: linear-gradient(90deg, var(--ink) 0 50%, var(--surface) 50% 100%); }
.topbar__right{ display: inline-flex; align-items: center; gap: 10px; }
.topbar__tag{ font-family: var(--font-sans); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.iconbtn{ appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; font-size: 1rem; line-height: 1; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.iconbtn svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#soundBtn .snd-off{ display: none; }
#soundBtn[aria-pressed="false"] .snd-on{ display: none; }
#soundBtn[aria-pressed="false"] .snd-off{ display: inline; }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }
@media (max-width: 380px){ .topbar__tag{ display: none; } }

/* ---------- Stage ---------- */
.stage{
  position: relative; z-index: 2; flex: 1 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 24px;
  padding: clamp(22px, 4vw, 44px) 16px clamp(48px, 6vw, 72px);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(clamp(64px, 7vw, 88px), calc(env(safe-area-inset-bottom) + 48px));
}

/* ---------- Hero ---------- */
.hero{ width: 100%; max-width: 720px; text-align: center; }
.eyebrow{ margin: 0 0 10px; font-family: var(--font-sans); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.headline{ margin: 0 0 12px; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.95rem, 6.4vw, 3.2rem); line-height: 1.04; letter-spacing: -0.02em; font-variation-settings: "opsz" 120; text-wrap: balance; }
.lede{ margin: 0 auto; max-width: 590px; font-size: clamp(0.95rem, 2.6vw, 1.05rem); line-height: 1.55; color: var(--muted); text-wrap: pretty; }

/* ---------- Buttons ---------- */
.btn{
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 22px;
  font-family: var(--font-sans); font-size: 0.94rem; font-weight: 650; letter-spacing: -0.005em;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
  text-decoration: none; -webkit-user-select: none; user-select: none;
}
.btn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active{ transform: translateY(0) scale(0.98); }
.btn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.btn--primary{ background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover{ background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ink{ background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn--ghost{ background: transparent; box-shadow: none; }
.btn--sm{ min-height: 44px; padding: 9px 18px; font-size: 0.88rem; }
.btn--big{ min-height: 58px; padding: 14px 34px; font-size: 1.08rem; font-weight: 700; width: 100%; max-width: 420px; }
.btn:disabled{ opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.linkbtn{ appearance: none; border: 0; background: transparent; padding: 10px 6px; min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; font-size: 0.88rem; color: var(--accent); cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; border-radius: 8px; }
.linkbtn:hover{ color: var(--accent-hover); }
.linkbtn:focus-visible{ outline: 2px solid var(--accent); outline-offset: 1px; }
.linkbtn--danger{ color: var(--muted); }
.linkbtn--danger:hover{ color: var(--accent); }

/* ---------- Layout ---------- */
.layout{ width: 100%; max-width: 1120px; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px){
  .layout{
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px 30px; align-items: start;
    grid-template-areas: "people garland" "rules garland" "details garland" "draw garland" "send garland";
  }
  #peopleCard{ grid-area: people; } #rulesCard{ grid-area: rules; } #detailsCard{ grid-area: details; }
  #drawBar{ grid-area: draw; } #sendCard{ grid-area: send; }
  .garland{ grid-area: garland; position: sticky; top: 20px; }
  .layout.is-drawn{ grid-template-areas: "send garland"; }
}
/* after the draw, the send list comes first on a phone */
.layout.is-drawn #sendCard{ order: -1; }

/* ---------- Cards ---------- */
.card{
  position: relative;
  padding: clamp(16px, 3.6vw, 22px);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.card__head{ display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card__title{ margin: 0; display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.26rem; font-weight: 600; letter-spacing: -0.01em; font-variation-settings: "opsz" 48; }
.step{ display: inline-grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--font-sans); font-size: 0.78rem; font-weight: 800; }
.opt{ font-family: var(--font-sans); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.count{ font-size: 0.8rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.card__tip{ margin: 10px 0 0; font-size: 0.84rem; line-height: 1.5; color: var(--muted); }
.card__tip--top{ margin: -4px 0 14px; }
.msg{ margin: 10px 0 0; font-size: 0.86rem; line-height: 1.45; font-weight: 600; color: var(--accent); }
.msg--why{ max-width: 520px; margin: 14px auto 0; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); text-align: left; font-weight: 500; color: var(--ink); }
.msg--why b{ color: var(--accent); }

/* inputs */
input[type="text"], input[type="date"], select, textarea{
  width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font-size: 1rem;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
textarea{ resize: vertical; min-height: 64px; line-height: 1.45; }
input::placeholder, textarea::placeholder{ color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus-visible, select:focus-visible, textarea:focus-visible{ outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
select{ appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
:root[data-theme="dark"] input[type="date"]{ color-scheme: dark; }

.addrow{ display: flex; gap: 10px; }
.addrow input{ flex: 1; min-width: 0; }

.rulepick{ display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 10px; align-items: center; }
.rulepick__amp{ font-family: var(--font-display); font-size: 1.3rem; color: var(--muted); font-style: italic; }
.rulepick .btn{ grid-column: 1 / -1; justify-self: start; }
@media (min-width: 560px){
  .rulepick{ grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; }
  .rulepick .btn{ grid-column: auto; }
}
.rules{ list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rules:empty{ display: none; }
.rule{
  display: inline-flex; align-items: center; gap: 4px; padding: 0 2px 0 14px; min-height: 40px;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); background: var(--surface-2);
  font-size: 0.9rem; font-weight: 600;
}
.rule__amp{ color: var(--muted); font-family: var(--font-display); font-style: italic; font-weight: 500; padding: 0 2px; }
.rule__x{ appearance: none; border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.rule__x:hover{ color: var(--accent); background: var(--accent-soft); }
.rule__x:focus-visible{ outline: 2px solid var(--accent); }
.rule--hot{ border-color: var(--accent); background: var(--accent-soft); animation: nudge 520ms ease 2; }
@keyframes nudge{ 0%, 100%{ transform: translateX(0); } 25%{ transform: translateX(-3px); } 75%{ transform: translateX(3px); } }

.fields{ display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.field{ display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }
.field--wide{ grid-column: 1 / -1; }
.field__k{ font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.field__count{ position: absolute; right: 10px; bottom: 8px; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }

.drawbar{ text-align: center; padding: 4px 0 2px; }

/* ---------- The garland: a pine board with tags on baker's twine ---------- */
.garland{
  position: relative; overflow: hidden; min-height: 220px;
  padding: 18px 12px 26px;
  border-radius: var(--radius);
  background:
    radial-gradient(5px 5px at 12% 8%, rgba(255, 214, 150, 0.9), transparent 70%),
    radial-gradient(4px 4px at 31% 4%, rgba(255, 214, 150, 0.7), transparent 70%),
    radial-gradient(5px 5px at 58% 7%, rgba(255, 214, 150, 0.85), transparent 70%),
    radial-gradient(4px 4px at 81% 3%, rgba(255, 214, 150, 0.7), transparent 70%),
    radial-gradient(5px 5px at 94% 9%, rgba(255, 214, 150, 0.85), transparent 70%),
    radial-gradient(120% 70% at 50% 0%, rgba(255, 196, 120, 0.16), transparent 60%),
    linear-gradient(180deg, var(--board-1), var(--board-2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), var(--shadow-md);
}
.garland::before{
  /* fine felt grain, so the board isn't a flat fill */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,0.025) 0 2px, transparent 2px 5px);
}
.garland__tags{
  position: relative;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  grid-auto-rows: 118px;
}
.garland__empty{ position: relative; margin: 70px auto 0; max-width: 220px; text-align: center; font-family: var(--font-hand); font-size: 1.5rem; line-height: 1.15; color: rgba(247, 241, 228, 0.7); }
.gtag{
  position: relative; display: flex; justify-content: center;
  /* each cell carries its own scallop of twine; together they read as one garland */
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path d='M0 8 Q50 30 100 8' fill='none' stroke='%23f7f1e4' stroke-width='2.4' vector-effect='non-scaling-stroke'/><path d='M0 8 Q50 30 100 8' fill='none' stroke='%23c21f37' stroke-width='2.4' stroke-dasharray='3 3' vector-effect='non-scaling-stroke'/></svg>") top center / 100% 30px no-repeat;
}
.gtag::before{
  /* a gold pin where two scallops meet */
  content: ""; position: absolute; left: -4px; top: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c8, var(--foil) 55%, #8a6a22);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); z-index: 1;
}
.gtag:first-child::before{ left: 0; }
.gtag__swing{
  position: absolute; top: 18px; transform-origin: 50% 0;
  transform: rotate(var(--tilt, 0deg));
  animation: swing 3.4s ease-in-out var(--delay, 0s) infinite alternate;
}
.gtag__swing::before{
  /* the short loop of string down to the tag */
  content: ""; position: absolute; left: 50%; top: 0; width: 1.5px; height: 14px; margin-left: -0.75px;
  background: repeating-linear-gradient(180deg, var(--twine-a) 0 3px, var(--twine-b) 3px 6px);
}
@keyframes swing{ from{ transform: rotate(calc(var(--tilt, 0deg) - 2.5deg)); } to{ transform: rotate(calc(var(--tilt, 0deg) + 2.5deg)); } }
.gtag__card{
  position: relative; margin-top: 12px; width: 96px; height: 70px; perspective: 600px;
}
.gtag__face, .gtag__back{
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; padding: 18px 8px 6px;
  clip-path: polygon(22% 0, 78% 0, 100% 20%, 100% 100%, 0 100%, 0 20%);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform 620ms cubic-bezier(0.3, 1.4, 0.5, 1);
}
.gtag__face{ background: linear-gradient(170deg, #fffaf0, var(--tag)); color: var(--tag-ink); }
.gtag__back{ background: linear-gradient(170deg, #b81c35, #8c0f22); color: #fbf1df; transform: rotateY(180deg); }
.gtag__face::before, .gtag__back::before{
  /* the reinforced hole */
  content: ""; position: absolute; top: 6px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%;
  background: var(--board-2); box-shadow: 0 0 0 2px var(--foil);
}
.gtag__name{ font-family: var(--font-hand); font-weight: 700; font-size: 1.42rem; line-height: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gtag__name--long{ font-size: 1.08rem; }
.gtag__seal{
  position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f6dc8f, var(--foil) 50%, #8a6a22);
  display: grid; place-items: center; color: #5a3f0c; font-size: 11px; font-weight: 800;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  opacity: 0; transform: scale(0.4); transition: opacity 240ms ease, transform 320ms cubic-bezier(0.3, 1.6, 0.5, 1);
}
.gtag.is-sent .gtag__seal{ opacity: 1; transform: scale(1); }
.gtag.is-sealed .gtag__face{ transform: rotateY(-180deg); }
.gtag.is-sealed .gtag__back{ transform: rotateY(0deg); }
.gtag__x{
  position: absolute; top: 14px; right: -12px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(12, 30, 24, 0.85); color: #f6eedd; font-size: 1rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center; opacity: 0.85;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.gtag__x::after{ content: ""; position: absolute; inset: -8px; }   /* a 46px touch target */
.gtag__x:hover{ background: var(--berry); opacity: 1; }
.gtag__x:focus-visible{ outline: 2px solid var(--foil); outline-offset: 2px; opacity: 1; }
.gtag.is-sealed .gtag__x{ display: none; }
.gtag.is-new .gtag__swing{ animation: drop 700ms cubic-bezier(0.3, 1.5, 0.5, 1) both, swing 3.4s ease-in-out 700ms infinite alternate; }
@keyframes drop{ from{ transform: translateY(-26px) rotate(-14deg); opacity: 0; } to{ transform: rotate(var(--tilt, 0deg)); opacity: 1; } }
.garland.is-drawn{ padding-bottom: 52px; }
.garland__stamp{
  position: absolute; right: 16px; bottom: 12px; margin: 0; z-index: 2;
  font-family: var(--font-hand); font-size: 1.35rem; color: rgba(247, 241, 228, 0.82); transform: rotate(-4deg);
}

/* ---------- Send list ---------- */
.sends{ list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.send{
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 8px 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
  transition: background 200ms ease, border-color 200ms ease;
}
.send.is-sent{ background: var(--pine-soft); border-color: color-mix(in srgb, var(--pine) 35%, transparent); }
.send__check{
  appearance: none; flex: 0 0 auto; width: 44px; height: 44px; margin: -4px 0; border-radius: 50%; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center;
}
.send__check span{
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; transition: background 160ms ease, border-color 160ms ease, transform 200ms cubic-bezier(0.3, 1.6, 0.5, 1);
}
.send__check svg{ width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.send__check[aria-pressed="true"] span{ background: var(--pine); border-color: var(--pine); transform: scale(1.06); }
:root[data-theme="dark"] .send__check svg{ stroke: #08130e; }
.send__check[aria-pressed="true"] svg{ opacity: 1; }
.send__check:focus-visible{ outline: 2px solid var(--accent); }
.send__who{ min-width: 0; }
.send__name{ display: block; font-weight: 650; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send__state{ display: block; font-size: 0.76rem; color: var(--muted); }
.send__acts{ display: inline-flex; align-items: center; gap: 4px; }
.send__open{ font-size: 0.8rem; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 10px 6px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 8px; }
.send__open:hover{ color: var(--accent); }
.send__open:focus-visible{ outline: 2px solid var(--accent); }
.send .btn{ min-height: 40px; padding: 7px 14px; font-size: 0.85rem; }
@media (max-width: 420px){
  .send__open{ display: none; }
}
.privacy{ margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.8rem; line-height: 1.5; color: var(--muted); }
.drawinfo{ margin-top: 12px; font-size: 0.8rem; color: var(--muted); }
.drawinfo b{ font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.12em; color: var(--ink); }
.drawinfo__k{ text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.7rem; font-weight: 700; }
.sendcard__actions{ margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }

.backlink{ margin-top: 8px; color: var(--muted); font-size: 0.86rem; text-decoration: none; padding: 10px; border-radius: 8px; }
.backlink:hover{ color: var(--ink); }
.backlink:focus-visible{ outline: 2px solid var(--accent); }

/* ---------- The gift view ---------- */
.giftview{ gap: 14px; }
.giftview__head{ width: 100%; max-width: 640px; text-align: center; }
.giftview__head .headline{ font-size: clamp(2.3rem, 9vw, 3.6rem); margin-bottom: 8px; }
.scene{
  position: relative; width: 100%; max-width: 560px;
  height: clamp(360px, 62vh, 560px);
  border-radius: 26px; overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 70%, var(--sky-glow), transparent 70%),
    linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), var(--shadow-lg);
}
.scene::after{
  /* a soft snowy floor the box stands on */
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -12%; height: 30%; pointer-events: none;
  background: radial-gradient(60% 60% at 50% 20%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
}
:root[data-theme="dark"] .scene::after{ background: radial-gradient(60% 60% at 50% 20%, rgba(220, 235, 240, 0.12), rgba(255, 255, 255, 0) 70%); }
#giftCanvas{
  position: relative; z-index: 1; display: block; width: 100%; height: 100%;
  touch-action: none; cursor: grab;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
#giftCanvas:active{ cursor: grabbing; }
#giftCanvas:focus-visible{ outline: 3px solid var(--accent); outline-offset: -6px; border-radius: 26px; }
.gesture{
  margin: 2px 0 0; display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-hand); font-size: 1.6rem; line-height: 1; color: var(--ink);
}
.gesture__dot{ width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent-soft); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse{ 0%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100%{ box-shadow: 0 0 0 12px transparent; } }
.giftbtns{ display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.ticket{
  position: relative; width: 100%; max-width: 440px; margin-top: 4px;
  padding: 18px 20px 16px;
  background: linear-gradient(170deg, #fffaf0, var(--tag)); color: var(--tag-ink);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, var(--shadow-md);
  animation: ticketIn 520ms cubic-bezier(0.3, 1.3, 0.5, 1) both;
}
.ticket::before{
  /* scalloped top edge, like a gift card's */
  content: ""; position: absolute; left: 10px; right: 10px; top: -6px; height: 12px;
  background: radial-gradient(circle at 6px 6px, var(--bg) 4.5px, transparent 5px) 0 0 / 12px 12px repeat-x;
}
@keyframes ticketIn{ from{ opacity: 0; transform: translateY(14px) rotate(-1deg); } to{ opacity: 1; transform: none; } }
.ticket__rows{ margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; align-items: baseline; }
.ticket__rows dt{ font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(28, 38, 33, 0.6); }
.ticket__rows dd{ margin: 0; font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; font-variation-settings: "opsz" 36; }
.ticket__rows dd small{ display: block; margin-top: 2px; font-family: var(--font-sans); font-size: 0.8rem; font-weight: 500; color: rgba(28, 38, 33, 0.62); }
.ticket__note{ margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed rgba(28, 38, 33, 0.22); font-family: var(--font-hand); font-size: 1.45rem; line-height: 1.15; color: #26302b; overflow-wrap: anywhere; }
.ticket__code{ margin: 12px 0 0; font-size: 0.72rem; color: rgba(28, 38, 33, 0.55); letter-spacing: 0.04em; }
.giftview__fine{ max-width: 460px; margin: 8px 0 0; text-align: center; font-size: 0.8rem; line-height: 1.5; color: var(--muted); }
.giftview__err{ max-width: 460px; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); text-align: center; line-height: 1.5; }
.giftview__more{ display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; }

/* ---------- Confirm dialog ---------- */
.confirm{
  width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.confirm::backdrop{ background: rgba(8, 14, 12, 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.confirm form{ margin: 0; }
.confirm__title{ margin: 0 0 8px; font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; }
.confirm__body{ margin: 0 0 18px; color: var(--muted); line-height: 1.5; font-size: 0.94rem; }
.confirm__actions{ display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast{
  position: fixed; left: 50%; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); z-index: 50;
  transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: var(--radius-pill);
  background: var(--ink); color: var(--bg); font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toastIn 240ms ease both;
}
@keyframes toastIn{ from{ opacity: 0; transform: translate(-50%, 10px); } to{ opacity: 1; transform: translate(-50%, 0); } }

/* a roomier evening on a big screen */
@media (min-width: 1000px) and (min-height: 860px){
  .scene{ max-width: 780px; height: min(600px, 64vh); }
}

/* ---------- Phone landscape: the gift fits the short screen ---------- */
@media (orientation: landscape) and (max-height: 500px){
  .giftview__head .headline{ font-size: 2rem; margin-bottom: 4px; }
  .giftview__head .lede{ font-size: 0.9rem; }
  .scene{ height: max(300px, calc(100vh - 40px)); max-width: 620px; }
}

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