/* Surprise First Ward · Get LIT */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-style: normal; font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 400; font-style: italic; font-display: swap;
  src: url("/assets/fonts/fraunces-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 600; font-style: italic; font-display: swap;
  src: url("/assets/fonts/fraunces-latin-600-italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/assets/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("/assets/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("/assets/fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --evergreen: #1F4D3A;
  --evergreen-deep: #12332630;
  --night: #0F2A20;
  --gold: #E2B04A;
  --gold-text: #6B5A2E;
  --ivory: #FBF8F1;
  --ink: #1A1A1A;
  --line: #E6DCC3;
  --head: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-size: 18px; line-height: 1.5; color: var(--ink); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 56px; padding: 14px 24px;
  border-radius: 14px; border: 0; font-family: var(--body); font-weight: 700; font-size: 19px; text-decoration: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .08s ease, filter .15s ease; }
.btn:active { transform: scale(.98); }
.btn:focus-visible, input:focus-visible, label.chip:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn-gold { background: var(--gold); color: var(--night); }
.btn-green { background: var(--evergreen); color: var(--ivory); }
.btn-ghost { background: transparent; color: var(--evergreen); border: 2px solid var(--evergreen); }
.btn-ghost-light { background: transparent; color: var(--ivory); border: 2px solid rgba(251,248,241,.55); }
.btn-block { width: 100%; }
.btn[disabled] { filter: grayscale(.4) opacity(.7); cursor: progress; }

/* ---------- Card page ---------- */
.page-card { background: var(--night) radial-gradient(120% 900px at 50% 0%, #2a5f49 0%, var(--evergreen) 45%, var(--night) 100%) no-repeat; min-height: 100vh; padding: 14px 12px 40px; }
.card { max-width: 560px; margin: 0 auto; background: var(--ivory); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(226,176,74,.35); }
.card-head { position: relative; background: var(--evergreen); color: var(--ivory); text-align: center; padding: 150px 20px 22px; overflow: hidden; }
.card-head .star { width: 92px; height: 92px; margin: 0 auto 6px; position: relative; z-index: 1; }
.card-head .rays { position: absolute; left: 50%; top: 0; width: 150px; height: 150px; transform: translateX(-50%); pointer-events: none; }
.card-head .rays svg { width: 100%; height: 100%; }
.previews figure { margin: 0; }
.email-wrap { margin-top: 10px; }
.hint-gap { margin-top: 14px; }
.eyebrow { font-family: var(--body); font-weight: 700; letter-spacing: .28em; font-size: 13px; color: var(--gold); text-transform: uppercase; position: relative; }
.card-head h1 { font-family: var(--head); font-weight: 800; font-size: 64px; line-height: .95; margin: 6px 0 8px; letter-spacing: -.02em; position: relative; }
.card-head h1 span { color: var(--gold); }
.subline { font-family: var(--serif); font-style: italic; font-size: 18px; margin: 0; opacity: .95; position: relative; }
.gold-rule { height: 7px; background: linear-gradient(90deg, #c9973a, var(--gold) 30%, #f0c96e 50%, var(--gold) 70%, #c9973a); }

.lit-row { display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 20px 18px 18px 14px; border-bottom: 1px solid var(--line); }
.lit-letter { font-family: var(--head); font-weight: 800; font-size: 72px; line-height: .85; color: var(--evergreen); text-align: center; padding-top: 2px; }
.lit-label { font-weight: 700; font-size: 14px; letter-spacing: .22em; color: var(--gold-text); text-transform: uppercase; }
.lit-prompt { display: block; font-weight: 600; font-size: 19px; line-height: 1.3; margin: 2px 0 10px; color: var(--ink); }
.lit-input { width: 100%; min-height: 56px; font: 600 19px/1.3 var(--body); color: var(--evergreen); background: #fff;
  border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; -webkit-appearance: none; appearance: none; }
.lit-input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 4px rgba(226,176,74,.25); }
.lit-input::placeholder { color: #9a9483; font-weight: 400; }
.ref { display: block; text-align: right; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--gold-text); margin-top: 8px; }

.chips { display: grid; gap: 10px; }
label.chip { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 16px; border: 2px solid var(--line);
  border-radius: 12px; background: #fff; font-weight: 600; font-size: 19px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
label.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.box { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 8px; border: 2.5px solid var(--evergreen); display: grid; place-items: center; background: #fff; }
.box svg { width: 20px; height: 20px; opacity: 0; transform: scale(.6); transition: .12s ease; }
label.chip:has(input:checked) { border-color: var(--evergreen); background: #eef4f0; }
label.chip input:checked + .box { background: var(--evergreen); }
label.chip input:checked + .box svg { opacity: 1; transform: scale(1); }

.tree-name { padding: 20px 18px 6px; }
.tree-name .lit-prompt { margin-bottom: 4px; }
.hint { font-size: 15px; color: #5d5a50; margin: 0 0 10px; }
.optin { padding: 6px 18px 4px; }
.optin label.chip { font-size: 17px; font-weight: 600; align-items: flex-start; }
.optin .box { margin-top: 2px; }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.submit-wrap { padding: 16px 18px 22px; }
.form-error { color: #9b2c1f; font-weight: 600; font-size: 16px; margin: 0 0 12px; }
.privacy-note { font-size: 15px; color: #4d4a42; display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; }
.privacy-note svg { flex: 0 0 20px; width: 20px; margin-top: 2px; }

.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px 16px; border-top: 3px solid var(--gold); background: var(--ivory); }
.card-foot .ward { font-family: var(--head); font-weight: 800; color: var(--evergreen); font-size: 18px; }
.card-foot .share { font-family: var(--serif); font-style: italic; color: var(--gold-text); font-size: 16px; }

/* Result view */
.result { padding: 22px 18px 24px; }
.result h2 { font-family: var(--head); font-weight: 800; font-size: 36px; line-height: 1; color: var(--evergreen); margin: 0 0 6px; }
.result .lead { margin: 0 0 18px; font-size: 18px; }
.previews { display: grid; grid-template-columns: 1fr .62fr; gap: 12px; align-items: start; margin-bottom: 18px; }
.previews button { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.previews img { width: 100%; height: auto; }
.previews figcaption { font-size: 14px; color: var(--gold-text); text-align: center; margin-top: 6px; font-weight: 600; }
.stack { display: grid; gap: 10px; }
.howto { background: #f3eedf; border-radius: 14px; padding: 14px 16px; margin: 18px 0; font-size: 16px; }
.howto strong { color: var(--evergreen); }
.howto ol { margin: 8px 0 0; padding-left: 22px; }
.status { font-size: 16px; color: var(--evergreen); font-weight: 600; min-height: 1.5em; margin: 8px 0 0; }
.saved-banner { background: #eef4f0; border: 2px solid var(--evergreen); border-radius: 14px; padding: 14px 16px; margin: 0 0 16px; font-size: 16px; }

/* Fullscreen fallback viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(8,22,16,.96); display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 16px; gap: 14px; }
.viewer img { max-height: calc(100vh - 150px); width: auto; max-width: 100%; border-radius: 10px; -webkit-touch-callout: default; user-select: auto; }
.viewer p { color: var(--ivory); font-weight: 700; font-size: 20px; margin: 0; text-align: center; }

/* ---------- Tree pages (home + tv) ---------- */
.page-tree { background: #0b2118 radial-gradient(130% 1100px at 50% 10%, #23573f 0%, #163d2d 50%, #0b2118 100%) no-repeat; color: var(--ivory); min-height: 100vh; }
.home { max-width: 980px; margin: 0 auto; padding: 18px 14px 40px; text-align: center; }
.brand { font-weight: 700; letter-spacing: .24em; font-size: 13px; color: var(--gold); text-transform: uppercase; }
.home h1 { font-family: var(--head); font-weight: 800; font-size: clamp(44px, 12vw, 88px); line-height: .95; margin: 8px 0 6px; letter-spacing: -.02em; }
.home h1 span, .tv h1 span { color: var(--gold); }
.home .subline { font-size: clamp(18px, 4.6vw, 24px); }
.tree-wrap { position: relative; max-width: 720px; margin: 8px auto 0; }
.tree-svg { width: 100%; height: auto; overflow: visible; }
.counters { display: flex; justify-content: center; gap: 12px; margin: 6px auto 18px; max-width: 520px; }
.counter { flex: 1; background: rgba(251,248,241,.07); border: 1px solid rgba(226,176,74,.35); border-radius: 16px; padding: 12px 10px; }
.counter b { display: block; font-family: var(--head); font-weight: 800; font-size: clamp(34px, 9vw, 54px); line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.counter span { font-size: 15px; opacity: .9; }
.cta { max-width: 420px; margin: 0 auto; display: grid; gap: 10px; }
.newest { min-height: 1.6em; font-family: var(--serif); font-style: italic; font-size: 18px; opacity: .9; margin: 14px auto 0; max-width: 640px; }
.band { margin: 28px auto 0; max-width: 560px; border-top: 1px solid rgba(226,176,74,.35); padding-top: 16px; font-size: 16px; opacity: .92; }
.band p { margin: 4px 0; }
.band .plan { font-family: var(--head); font-weight: 800; color: var(--gold); font-size: 20px; margin-top: 8px; }
.site-foot { margin-top: 26px; font-size: 13px; opacity: .6; }
.legend { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 14px; opacity: .85; margin-bottom: 14px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 6px; }
.legend .l0 { background: #6f8a7b; opacity: .7; }
.legend .l1 { background: #d9a948; }
.legend .l3 { background: #ffd877; box-shadow: 0 0 10px #ffd877; }

/* Ornament effects */
.orn { transition: opacity .6s ease; }
.orn-glow { animation: glow 2.6s ease-in-out infinite; }
.sparkle { animation: twinkle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.mine-ring { animation: pulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.orn-new { animation: drop .9s cubic-bezier(.2,1.4,.4,1) both; }
.twinkle-light { animation: twinkle 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes glow { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes twinkle { 0%,100% { opacity: .35; transform: scale(.75); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes pulse { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
@keyframes drop { 0% { opacity: 0; transform: translateY(-40px); } 100% { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .orn-glow, .sparkle, .mine-ring, .orn-new, .twinkle-light { animation: none; } }

/* TV */
.page-tv { overflow: hidden; cursor: none; }
.tv { height: 100vh; display: grid; grid-template-columns: 1fr minmax(260px, 30vw); align-items: center; gap: 2vw; padding: 2vh 3vw; }
.tv .tree-svg { height: 94vh; width: auto; margin: 0 auto; }
.tv-side { text-align: center; }
.tv h1 { font-family: var(--head); font-weight: 800; font-size: 7vw; line-height: .9; margin: 1vh 0; }
.tv .subline { font-size: 1.8vw; }
.tv .counter b { font-size: 5vw; }
.tv .counter span { font-size: 1.3vw; }
.tv .counters { flex-direction: column; margin: 3vh 0; }
.tv-qr { background: var(--ivory); border-radius: 14px; padding: 12px; width: 11vw; margin: 0 auto; }
.tv-qr canvas, .tv-qr img { width: 100% !important; height: auto !important; }
.tv-scan { font-size: 1.3vw; margin-top: 1vh; color: var(--gold); font-weight: 700; }
.tv .newest { font-size: 1.4vw; }
@media (max-aspect-ratio: 1/1) { .tv { grid-template-columns: 1fr; } .tv .tree-svg { height: 60vh; } }

/* ---------- Done page ---------- */
.done-list { display: grid; gap: 12px; margin: 10px 0 18px; }
.done-btn { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 76px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.done-btn .lit-letter { font-size: 52px; }
.done-btn .t { font-weight: 700; font-size: 19px; color: var(--ink); }
.done-btn .s { font-size: 15px; color: var(--gold-text); }
.done-btn .mark { font-weight: 700; font-size: 15px; color: var(--evergreen); background: #eef4f0; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.done-btn.is-done { border-color: var(--gold); background: #fff8e6; }
.done-btn.is-done .mark { background: var(--gold); color: var(--night); }
.done-btn[disabled] { opacity: .45; cursor: not-allowed; }
.done-orn { width: 120px; margin: 0 auto 8px; }

/* ---------- Admin + simple pages ---------- */
.page-simple { background: var(--ivory); min-height: 100vh; }
.simple { max-width: 880px; margin: 0 auto; padding: 24px 16px 60px; }
.simple h1 { font-family: var(--head); font-weight: 800; color: var(--evergreen); font-size: 40px; margin: 0 0 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat b { display: block; font-family: var(--head); font-weight: 800; font-size: 34px; color: var(--evergreen); line-height: 1.05; }
.stat span { font-size: 14px; color: var(--gold-text); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 26px; }
table.names { width: 100%; border-collapse: collapse; font-size: 16px; background: #fff; border-radius: 12px; overflow: hidden; }
table.names th, table.names td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.names th { background: var(--evergreen); color: var(--ivory); font-weight: 600; }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: 15px; border-radius: 10px; }
.qr-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 22px; }
.qr-box canvas { width: 180px; height: 180px; }

@media (min-width: 600px) {
  .card-head h1 { font-size: 76px; }
  .lit-row { grid-template-columns: 78px 1fr; padding: 22px 24px 20px 18px; }
  .lit-letter { font-size: 86px; }
}
