:root {
  --background: #fff8ed;
  --surface: #fffefa;
  --ink: #30353a;
  --muted: #687078;
  --accent: #c44b42;
  --accent-dark: #a83d35;
  --accent-soft: #ffd9c9;
  --sunny: #f6c453;
  --sunny-soft: #fff1bd;
  --sky: #69afc4;
  --sky-soft: #d9eff3;
  --sage: #6f9277;
  --line: #dfd7ca;
  --error: #9b2f2f;
  --shadow: 0 18px 45px rgba(64, 78, 72, 0.11);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(246, 196, 83, 0.14) 0 90px, transparent 92px),
    radial-gradient(circle at 94% 34%, rgba(105, 175, 196, 0.11) 0 120px, transparent 122px),
    var(--background);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0 0 0.6em;
  font-family: ui-rounded, "Avenir Next Rounded", "Trebuchet MS", ui-sans-serif, sans-serif;
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: -0.035em;
}
h1 { font-size: clamp(2.55rem, 8vw, 4.8rem); }
h2 { font-size: clamp(2rem, 5vw, 3.25rem); }
h3 { font-size: 1.45rem; }
p { margin: 0 0 1rem; }
a { color: inherit; }
.wrap { width: min(1160px, calc(100% - 36px)); margin-inline: auto; }
.wrap-narrow { width: min(760px, calc(100% - 30px)); margin-inline: auto; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 1000; background: var(--ink); color: white; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { top: 12px; }

.site-header { border-bottom: 1px solid rgba(75, 86, 80, 0.1); background: rgba(255, 248, 237, 0.94); backdrop-filter: blur(10px); }
.header-inner { width: min(1160px, calc(100% - 36px)); min-height: 70px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wordmark { font-family: ui-rounded, "Avenir Next Rounded", "Trebuchet MS", sans-serif; font-size: 1.08rem; font-weight: 760; text-decoration: none; white-space: nowrap; }
.text-button { border: 0; padding: 10px 4px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--accent); }

.hero { padding-block: clamp(36px, 7vw, 86px); display: grid; gap: clamp(32px, 6vw, 80px); align-items: center; }
.photo-placeholder { position: relative; overflow: hidden; min-height: 280px; border: 8px solid var(--surface); border-radius: 30px; background: #e8ded0; box-shadow: 12px 12px 0 var(--accent-soft), var(--shadow); transform: rotate(1deg); }
.photo-placeholder img { width: 100%; height: 100%; min-height: 280px; display: block; object-fit: cover; }
.photo-placeholder span { position: absolute; inset: auto 20px 18px; padding: 9px 14px; border: 2px solid rgba(48,53,58,0.08); border-radius: 999px; background: rgba(255,254,250,0.94); color: var(--ink); font-size: 0.83rem; font-weight: 700; text-align: center; transform: rotate(-1deg); }
.hero-copy > p:not(.eyebrow) { color: var(--muted); font-size: clamp(1.05rem, 2.2vw, 1.24rem); margin-bottom: 1.7rem; }
.hero-copy h1 { text-decoration: underline; text-decoration-color: var(--sunny); text-decoration-thickness: 0.13em; text-underline-offset: 0.13em; text-decoration-skip-ink: none; }
.eyebrow { margin-bottom: 0.8rem; color: var(--accent-dark); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }

.button {
  display: inline-flex; min-height: 54px; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid transparent; border-radius: 16px; padding: 12px 24px;
  font: inherit; font-weight: 720; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.button:hover { transform: translateY(-2px) rotate(-0.3deg); }
.button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .text-button:focus-visible { outline: 3px solid #2d6fa3; outline-offset: 3px; }
.button.primary { background: var(--accent); color: white; box-shadow: 0 5px 0 var(--accent-dark); }
.button.primary:hover { background: #b74239; box-shadow: 0 6px 0 var(--accent-dark); }
.button.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-dark); }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button.secondary:hover { border-color: #b9a998; }
.button.full { width: 100%; }
.button.small { min-height: 42px; padding: 8px 16px; font-size: 0.9rem; }
.button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.story-section { padding: clamp(55px, 8vw, 100px) 0; background: linear-gradient(150deg, #e9f5f1 0%, #e2f0f3 100%); }
.form-card { border: 3px solid rgba(105,175,196,0.2); border-radius: 32px; padding: clamp(26px, 6vw, 64px); background: var(--surface); box-shadow: 10px 10px 0 rgba(105,175,196,0.2), var(--shadow); }
.section-intro > p:not(.eyebrow) { color: var(--muted); font-size: 1.08rem; }
.gentle-notes { margin: 24px 0 36px; border: 0; border-radius: 18px; padding: 17px 19px; background: var(--sunny-soft); color: #5e5540; transform: rotate(-0.35deg); }
.gentle-notes p { margin: 0 0 5px; }
.gentle-notes p:last-child { margin: 0; }
.field { margin: 0 0 25px; }
label, legend { display: block; margin-bottom: 8px; font-weight: 720; }
input[type="text"], input[type="password"], select {
  width: 100%; min-height: 54px; border: 1.5px solid #bdb2a5; border-radius: 12px;
  padding: 12px 14px; background: white; color: var(--ink); font: inherit;
}
input::placeholder { color: #91887d; }
.optional { color: var(--muted); font-size: 0.86rem; font-weight: 500; }
.field-help { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }
.video-fieldset { margin: 36px 0 24px; padding: 0; border: 0; }
.video-fieldset legend { font-family: ui-rounded, "Avenir Next Rounded", "Trebuchet MS", sans-serif; font-size: 1.5rem; font-weight: 760; }
.video-actions { display: grid; gap: 12px; margin-top: 18px; }
.recorder, .selected-video, .upload-panel { margin: 28px 0; border: 2px solid var(--sky-soft); border-radius: 20px; padding: 20px; background: #f8fcfb; }
.recorder video, .selected-video video { width: 100%; max-height: 480px; display: block; border-radius: 12px; background: #222; }
.recording-time { margin: 12px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.recording-time.active { color: var(--error); font-weight: 700; }
.video-details { margin: 12px 0; color: var(--muted); }
.form-error { margin: 18px 0; border-left: 4px solid var(--error); padding: 12px 14px; background: #fff2f1; color: #7f2525; border-radius: 6px; }
.notice { margin: 0 0 24px; border-left: 4px solid var(--sage); border-radius: 6px; padding: 12px 14px; background: #eef3eb; }
.notice.warning { border-left-color: #b97822; background: #fff4dc; }
.upload-panel h3 { margin-bottom: 12px; }
progress { width: 100%; height: 18px; accent-color: var(--accent); }
.submit-button { margin-top: 32px; min-height: 60px; font-size: 1.08rem; }
.site-footer { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 0.92rem; background: var(--sunny-soft); }

.gate-page { min-height: 100vh; background: radial-gradient(circle at 12% 18%, var(--sunny-soft) 0 130px, transparent 132px), radial-gradient(circle at 88% 80%, var(--sky-soft) 0 170px, transparent 172px), var(--background); }
.gate-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; }
.gate-card { width: min(500px, 100%); border: 3px solid rgba(233,101,87,0.16); border-radius: 32px; padding: clamp(28px, 8vw, 55px); background: rgba(255,254,250,0.97); box-shadow: 9px 9px 0 var(--accent-soft), var(--shadow); text-align: center; }
.gate-card h1 { font-size: clamp(2.4rem, 9vw, 3.8rem); }
.gate-mark { width: 124px; height: 94px; border: 4px solid white; border-radius: 16px; object-fit: cover; margin-bottom: 22px; box-shadow: 5px 5px 0 var(--sunny); transform: rotate(-2deg); }
.gate-card .welcome { color: var(--muted); font-size: 1.08rem; }
.gate-form { margin-top: 28px; text-align: left; }
.gate-form .button { margin-top: 18px; }
.success-mark { width: 70px; height: 70px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; background: var(--sunny); color: var(--ink); box-shadow: 4px 4px 0 var(--accent-soft); font-size: 2rem; font-weight: 800; transform: rotate(-4deg); }
.thank-you-card > p:not(.eyebrow) { color: var(--muted); }
.thank-you-card .button { margin-top: 20px; }

.admin-main { padding-block: 50px 80px; }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.admin-heading h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 28px 0; }
.stats div { border: 1px solid var(--line); border-radius: 15px; padding: 18px; background: var(--surface); }
.stats strong { display: block; font-family: ui-rounded, "Avenir Next Rounded", "Trebuchet MS", sans-serif; font-size: 2rem; font-weight: 760; }
.stats div:nth-child(1) { border-top: 5px solid var(--accent); }
.stats div:nth-child(2) { border-top: 5px solid var(--sage); }
.stats div:nth-child(3) { border-top: 5px solid var(--sunny); }
.stats div:nth-child(4) { border-top: 5px solid var(--sky); }
.stats span { color: var(--muted); font-size: 0.9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 15px 16px; border-bottom: 1px solid #e9e2d8; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-block; padding: 4px 9px; border-radius: 999px; background: #eee; font-size: 0.84rem; white-space: nowrap; }
.status-ready { background: #e5eee2; color: #355334; }
.status-processing, .status-uploading { background: #fff1d6; color: #775015; }
.status-error { background: #fae2df; color: #7e2828; }
.muted { color: var(--muted); font-size: 0.9rem; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.player-details summary { list-style: none; }
.player-details summary::-webkit-details-marker { display: none; }
.player-wrap { width: min(680px, 80vw); margin-top: 12px; aspect-ratio: 16 / 9; }
.player-wrap iframe { width: 100%; height: 100%; border: 0; border-radius: 10px; }
code { padding: 2px 5px; border-radius: 5px; background: rgba(0,0,0,0.06); }

@media (min-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); }
  .photo-placeholder { order: 2; min-height: 460px; }
  .photo-placeholder img { min-height: 460px; }
  .video-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .header-inner { min-height: 62px; }
  .admin-page .header-inner { gap: 10px; }
  .admin-page .wordmark { font-size: 0.94rem; }
  .hero { padding-top: 28px; }
  .photo-placeholder { order: -1; }
  .form-card { border-radius: 22px; }
  .admin-heading { align-items: stretch; flex-direction: column; }
  .admin-heading .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
