:root {
  color-scheme: light;
  --cream: #f7f4e9;
  --cream-deep: #eee9d8;
  --paper: #fffdf6;
  --forest: #173d2c;
  --forest-soft: #28583d;
  --leaf: #73a64b;
  --leaf-light: #a8c968;
  --gold: #c89b42;
  --ink: #23362a;
  --muted: #68766a;
  --line: #dcdcc9;
  --error: #9b4038;
  --shadow: 0 18px 55px rgb(38 57 37 / 8%);
  font-family: ui-rounded, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 17px;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--cream); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--cream); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }

.page-form { background: radial-gradient(ellipse at 50% 0%, #fffdf7 0, var(--cream) 58rem); }
.form-layout, .admin-layout { width: min(100% - 32px, 680px); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); }
.brand-header, .tree-header, .admin-title-row, .admin-section-heading, .label-row, .page-footer, .tree-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--forest); font-size: .94rem; font-weight: 750; text-decoration: none; letter-spacing: .01em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--forest); color: #e8d492; font-size: 1.2rem; }
.event-date, .admin-label { color: var(--muted); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
.intro { padding: 42px 0 22px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: #67824a; font-size: .72rem; font-weight: 800; letter-spacing: .14em; line-height: 1.4; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.intro h1, .tree-heading h1, .admin-login h1, .admin-title-row h1 { margin-bottom: 12px; color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.1rem, 7vw, 3.35rem); font-weight: 500; letter-spacing: -.045em; line-height: 1.08; }
.intro h1 span { color: #789b4a; white-space: nowrap; }
.intro-copy { max-width: 520px; margin: 0 auto; color: var(--muted); font-size: .95rem; line-height: 1.6; }

.preview-card { position: relative; margin: 0 0 16px; overflow: hidden; border: 1px solid #e2e3d1; border-radius: 22px; background: linear-gradient(108deg, #f1f2e2, #fbf8eb 70%); box-shadow: 0 10px 30px rgb(38 57 37 / 6%); }
.preview-tree { width: 100%; }
.preview-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px 14px; }
.preview-count { display: flex; align-items: baseline; gap: 7px; padding-top: 8px; color: var(--forest); }
.preview-count strong { font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.count-label { color: var(--muted); font-size: .82rem; }
.text-link { display: inline-flex; align-items: center; gap: 7px; width: fit-content; color: var(--forest-soft); font-size: .84rem; font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.preview-card .text-link { flex: 0 0 auto; }
.form-card, .success-card { padding: clamp(20px, 5vw, 32px); border: 1px solid #ebe7d8; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.field-group { margin-bottom: 18px; }
.field-group label, .admin-login label, .settings-form label { display: block; margin-bottom: 8px; color: var(--forest); font-size: .9rem; font-weight: 750; }
.field-group input, .field-group textarea, .admin-login input, .settings-form input { display: block; width: 100%; min-height: 52px; padding: 13px 15px; border: 1px solid #d7dccd; border-radius: 12px; background: #fffefa; color: var(--ink); font-size: 1rem; }
.field-group textarea { min-height: 126px; resize: vertical; line-height: 1.5; }
.field-group input::placeholder, .field-group textarea::placeholder { color: #a2a99b; }
.field-note { margin: 7px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.field-error { min-height: 0; margin: 0; color: var(--error); font-size: .78rem; line-height: 1.4; }
.field-error:not(:empty) { margin-top: 6px; }
.label-row { align-items: baseline; margin-bottom: 8px; }
.label-row label { margin: 0; }
.character-count { color: #7d8878; font-size: .75rem; font-variant-numeric: tabular-nums; }
.form-message { min-height: 0; margin: 0; color: var(--forest-soft); font-size: .88rem; line-height: 1.5; }
.form-message:not(:empty) { margin: 0 0 12px; }
.form-message[data-state="waiting"] { padding: 12px 14px; border-radius: 12px; background: #f1f2e5; }
.form-message[data-state="error"] { color: var(--error); }
.button { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; gap: 12px; padding: 12px 18px; border: 1px solid transparent; border-radius: 999px; font-size: .9rem; font-weight: 750; text-align: center; text-decoration: none; cursor: pointer; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--forest); color: #fffdf5; box-shadow: 0 7px 16px rgb(23 61 44 / 14%); }
.button-primary:hover { background: #23543a; }
.button-secondary { border-color: #d8ddce; background: transparent; color: var(--forest); }
.submit-button { width: 100%; justify-content: space-between; padding: 14px 20px; font-size: 1rem; }
.submit-button:disabled { cursor: wait; opacity: .88; }
.privacy-note { display: flex; gap: 9px; margin: 18px 0 0; color: var(--muted); font-size: .77rem; line-height: 1.5; }
.privacy-note span { color: var(--gold); }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile-slot { min-height: 0; margin-bottom: 8px; }
.turnstile-slot:not(:empty) { min-height: 68px; }
.page-footer { margin-top: 23px; color: #798174; font-size: .72rem; }
.page-footer a { color: inherit; text-decoration: none; }

.success-card { padding-top: 32px; text-align: center; animation: rise-in .65s ease both; }
.success-apple { display: grid; width: 74px; height: 74px; place-items: center; margin: 0 auto 16px; border: 1px solid #e1e5cb; border-radius: 50%; background: #f1f3e4; font-size: 2.2rem; animation: apple-pop .8s cubic-bezier(.18,.8,.25,1.3) both; }
.success-card h2 { margin: 0 auto 12px; color: var(--forest); font-family: Georgia, serif; font-size: clamp(1.65rem, 6vw, 2.35rem); font-weight: 500; line-height: 1.2; }
.success-card blockquote { margin: 18px 0 22px; padding: 16px 18px; border-left: 2px solid var(--gold); background: #f7f5eb; color: var(--forest-soft); font-family: Georgia, serif; font-size: 1.05rem; font-style: italic; line-height: 1.55; text-align: left; }
.duplicate-note { margin: 0; color: #78883e; font-size: .9rem; }
.success-actions { display: flex; flex-direction: column; gap: 10px; }

.tree-page { min-height: 100svh; overflow-x: hidden; background: radial-gradient(ellipse at 50% 48%, #fffef8, var(--cream) 70%); }
.tree-page-layout { position: relative; display: flex; width: min(100% - 34px, 1100px); min-height: 100svh; flex-direction: column; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 0 max(12px, env(safe-area-inset-bottom)); }
.tree-heading { z-index: 1; padding: 25px 0 0; text-align: center; }
.tree-heading h1 { margin-bottom: 5px; font-size: clamp(2.2rem, 8vw, 3.8rem); }
.tree-heading > p:not(.eyebrow) { margin-bottom: 9px; color: var(--muted); font-size: .88rem; }
.tree-total { color: var(--forest); font-size: .92rem; }
.tree-total span { color: #6c943f; font-family: Georgia, serif; font-size: 1.5rem; }
.full-tree-wrap { display: grid; min-height: 0; flex: 1; place-items: center; margin: 4px 0 0; }
.full-tree { width: 100%; max-width: 1100px; }
.tree-footer { padding-top: 4px; color: var(--muted); font-size: .74rem; }
.apple-card { position: fixed; z-index: 5; right: max(16px, env(safe-area-inset-right)); bottom: max(54px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); max-width: 490px; margin: 0 auto; padding: 19px 21px 20px; border: 1px solid #e7dfc8; border-radius: 18px; background: #fffdf6; box-shadow: 0 16px 50px rgb(23 61 44 / 16%); animation: rise-in .22s ease both; }
.apple-card h2 { margin: 0 25px 7px 0; color: var(--forest); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.apple-card > p:last-child { margin: 0; color: var(--ink); line-height: 1.55; }
.apple-card-close { position: absolute; top: 9px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.6rem; cursor: pointer; }
.apple-group { cursor: pointer; transform-box: fill-box; transform-origin: center; }
.apple-group:hover { filter: drop-shadow(0 2px 4px rgb(23 61 44 / 30%)); }
.apple-highlight { fill: none; stroke: #d1a84f; stroke-width: 2.8; opacity: .98; }
.apple-pop { animation: apple-pop .55s cubic-bezier(.18,.8,.25,1.2) both; transform-box: fill-box; transform-origin: center; }
.tree-artwork { position: relative; width: 100%; aspect-ratio: 11906 / 6803; overflow: hidden; isolation: isolate; background: #d9f5f4; }
.tree-artwork > img, .tree-artwork > .tree-overlay { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.tree-artwork > img { object-fit: fill; }
.tree-overlay { overflow: visible; }
.apple-graphic { pointer-events: none; }

.page-screen { width: 100vw; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; background: #e9f7f5; color: var(--forest); }
.screen-layout { position: relative; display: grid; width: 100vw; height: 100vh; height: 100dvh; min-height: 0; grid-template: 7% 75% 13% 5% / 1fr; overflow: hidden; padding: 0 3.2vw; background: radial-gradient(ellipse at 37% 43%, #f8f6e9, #e3f5f3 72%); }
.screen-topline { display: flex; align-items: center; justify-content: space-between; color: #496c50; font-size: clamp(10px, 1vw, 17px); font-weight: 700; letter-spacing: .15em; }
.screen-tree { position: absolute; top: 8%; bottom: 17%; left: 0; display: flex; width: 72%; align-items: center; }
.screen-tree-art { width: 100%; max-height: 100%; }
.screen-stats { position: absolute; top: 13%; right: 4%; display: flex; width: 24%; height: 70%; flex-direction: column; align-items: flex-start; }
.screen-eyebrow { margin: 0 0 8px; color: #6c874c; font-size: clamp(10px, 1vw, 16px); font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.screen-stats h1 { margin: 0; color: var(--forest); font-family: Georgia, serif; font-size: clamp(38px, 4vw, 74px); font-weight: 400; letter-spacing: -.03em; }
.screen-total { display: flex; align-items: baseline; gap: .12em; margin: 0 0 12px; color: #67844d; font-family: Georgia, serif; font-size: clamp(18px, 1.65vw, 30px); }
.screen-total strong { color: var(--forest); font-size: clamp(54px, 6.6vw, 124px); font-weight: 500; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.screen-split { display: flex; flex-wrap: wrap; gap: 8px 20px; color: #627568; font-size: clamp(12px, 1.1vw, 20px); }
.screen-split b { margin-left: 5px; color: var(--forest); }
.screen-progress { width: 100%; height: 7px; margin: 18px 0 18px; overflow: hidden; border-radius: 99px; background: #ceded2; }
.screen-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: #c49a44; transition: width .8s ease; }
.screen-qr-block { display: flex; align-items: center; gap: 15px; margin-top: auto; }
.screen-qr-block img { display: block; width: clamp(90px, 8vw, 150px); height: clamp(90px, 8vw, 150px); border: 7px solid #fffdf4; border-radius: 8px; background: #fffdf4; box-shadow: 0 4px 18px rgb(39 74 49 / 10%); }
.screen-qr-block p { margin: 0; color: #506c57; font-size: clamp(12px, 1.1vw, 20px); line-height: 1.45; }
.screen-ticker { position: absolute; right: 3.2vw; bottom: 5.5%; left: 3.2vw; display: flex; height: 11%; align-items: center; gap: 20px; overflow: hidden; border-top: 1px solid rgb(82 117 80 / 35%); border-bottom: 1px solid rgb(82 117 80 / 20%); }
.ticker-label { flex: 0 0 auto; color: #71884a; font-size: clamp(10px, .85vw, 15px); font-weight: 800; letter-spacing: .14em; }
.ticker-track { display: block; min-width: 0; flex: 1; overflow: hidden; color: #315642; font-family: Georgia, serif; font-size: clamp(14px, 1.25vw, 22px); white-space: nowrap; }
.ticker-marquee { display: flex; width: max-content; align-items: center; gap: 42px; animation: ticker-scroll 75s linear infinite; }
.ticker-item { animation: ticker-in .45s ease both; }
.ticker-item b { color: #6e8946; font-family: ui-rounded, "Avenir Next", "Segoe UI", sans-serif; font-size: .75em; font-weight: 700; }
.screen-footer { position: absolute; right: 3.2vw; bottom: 1.2%; left: 3.2vw; display: flex; justify-content: space-between; color: #718276; font-size: clamp(9px, .75vw, 13px); letter-spacing: .06em; }

.admin-layout { width: min(100% - 36px, 1040px); }
.admin-login { max-width: 560px; margin: 70px auto 100px; padding: 32px; border: 1px solid #ebe7d8; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.admin-login h1, .admin-title-row h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
.login-row { display: flex; gap: 10px; }
.login-row input { flex: 1; min-width: 0; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; }
.admin-panel { padding-top: 36px; }
.admin-title-row { margin-bottom: 20px; }
.admin-title-row h1 { margin-bottom: 0; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-card { padding: 18px; border: 1px solid #e5e2d2; border-radius: 16px; background: var(--paper); }
.stat-card span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .76rem; }
.stat-card strong { color: var(--forest); font-family: Georgia, serif; font-size: 1.85rem; font-weight: 500; }
.admin-section { margin: 15px 0; padding: 22px; border: 1px solid #e5e2d2; border-radius: 18px; background: var(--paper); }
.admin-section h2 { margin: 0; color: var(--forest); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.admin-section-heading { margin-bottom: 15px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 12px; border-bottom: 1px solid #ecebdd; font-size: .87rem; }
th { color: var(--muted); font-size: .75rem; font-weight: 700; }
.settings-card { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; align-items: start; }
.settings-form { display: grid; grid-template-columns: 100px minmax(70px, 1fr) 90px minmax(70px, 1fr) auto; gap: 9px; align-items: center; }
.settings-form label { margin: 0; font-size: .78rem; }
.settings-form input { min-height: 42px; padding: 8px 10px; }
.settings-form .button { min-height: 42px; padding: 8px 13px; white-space: nowrap; }
.settings-form .form-message { grid-column: 1 / -1; }
.list-heading { align-items: end; }
.filter-tabs { display: flex; gap: 7px; margin-bottom: 13px; }
.filter-tabs button { min-height: 42px; padding: 8px 14px; border: 1px solid transparent; border-radius: 999px; background: #f1f1e6; color: var(--forest-soft); font-size: .81rem; font-weight: 700; cursor: pointer; }
.filter-tabs button[aria-pressed="true"] { border-color: #c8d4b7; background: #e7eddb; }
.admin-list { display: grid; gap: 10px; }
.admin-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 15px; border: 1px solid #ecebdd; border-radius: 13px; }
.admin-row h3 { margin: 0 0 4px; color: var(--forest); font-size: .95rem; }
.admin-row p { margin: 0 0 5px; color: var(--ink); font-size: .83rem; line-height: 1.45; overflow-wrap: anywhere; }
.admin-row .row-meta { color: var(--muted); font-size: .72rem; }
.row-actions { display: flex; flex-wrap: wrap; align-content: center; justify-content: end; gap: 6px; }
.row-actions button { min-height: 38px; padding: 7px 11px; border: 1px solid #d8ddce; border-radius: 999px; background: transparent; color: var(--forest); font-size: .73rem; font-weight: 700; cursor: pointer; }
.row-actions button:disabled { opacity: .45; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 17px; }
.pagination .button { min-height: 42px; padding: 8px 14px; }
#page-label { color: var(--muted); font-size: .82rem; }

@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes apple-pop { 0% { opacity: 0; transform: translateY(-22px) scale(.45); } 70% { opacity: 1; transform: translateY(2px) scale(1.08); } 100% { transform: translateY(0) scale(1); } }
@keyframes ticker-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (min-width: 900px) {
  .form-layout { padding-top: 24px; }
  .intro { padding-top: 48px; }
  .tree-page-layout { width: min(100% - 56px, 1200px); }
  .tree-heading { padding-top: 24px; }
  .apple-card { right: 34px; bottom: 30px; left: auto; width: 420px; }
}

@media (max-width: 700px) {
  .screen-layout { padding: 0 3vw; }
  .screen-topline { letter-spacing: .08em; }
  .screen-tree { top: 13%; bottom: 23%; left: -8%; width: 74%; }
  .screen-stats { top: 16%; right: 3%; width: 28%; height: 68%; }
  .screen-total strong { font-size: clamp(40px, 7vw, 64px); }
  .screen-split { gap: 5px 10px; }
  .screen-progress { margin: 10px 0; }
  .screen-qr-block { gap: 8px; }
  .screen-qr-block img { width: 70px; height: 70px; border-width: 4px; }
  .screen-ticker { right: 3vw; left: 3vw; gap: 10px; }
  .ticker-label { max-width: 70px; font-size: 8px; }
  .ticker-track { gap: 20px; }
  .ticker-marquee { gap: 24px; }
  .screen-footer { font-size: 8px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .settings-card { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 82px 1fr 82px 1fr; }
  .settings-form .button { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  .form-layout { width: min(100% - 26px, 680px); }
  .event-date { font-size: .6rem; }
  .intro { padding-top: 34px; }
  .preview-bottom { flex-wrap: wrap; }
  .preview-count { flex-wrap: wrap; gap: 3px 6px; }
  .preview-count strong { font-size: 1.8rem; }
  .count-label { font-size: .74rem; }
  .form-card { padding: 20px 17px; }
  .page-footer { align-items: flex-start; font-size: .67rem; }
  .tree-page-layout { width: min(100% - 24px, 1100px); }
  .tree-heading { padding-top: 29px; }
  .tree-heading > p:not(.eyebrow) { max-width: 310px; margin-right: auto; margin-left: auto; font-size: .8rem; }
  .full-tree { width: 100%; height: auto; margin-left: 0; }
  .tree-footer { font-size: .66rem; }
  .admin-layout { width: min(100% - 24px, 1040px); }
  .admin-login { margin: 44px auto 70px; padding: 22px; }
  .login-row { flex-direction: column; }
  .login-row .button { width: 100%; }
  .admin-title-row { align-items: flex-start; }
  .admin-title-row .button { min-height: 42px; padding: 9px 13px; font-size: .78rem; }
  .admin-section { padding: 17px 14px; }
  .admin-row { grid-template-columns: 1fr; }
  .row-actions { justify-content: start; }
  .row-actions button { min-height: 42px; }
  .settings-form { grid-template-columns: 74px 1fr; }
  .settings-form label:nth-of-type(2) { grid-column: 1; }
  .settings-form #target-count { grid-column: 2; grid-row: 2; }
}

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