:root {
  --blue: #CFE4FF;
  --blue-deep: #A9CEFF;
  --ink: #192447;
  --ink-soft: #3A4670;
  --paper: #FFFFFF;
  --pink: #FF4F7B;
  --green: #1F8A5B;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--blue);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  min-height: 100svh;
}
.page {
  width: min(100% - 32px, 440px);
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 0 calc(40px + env(safe-area-inset-bottom));
}

/* Intro */
.intro { margin-bottom: 28px; }
.date { margin: 0 0 6px; font-size: 15px; color: var(--ink-soft); }
h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(38px, 11vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
}
.eighteen {
  font-weight: 700;
  font-style: italic;
  font-size: 1.5em;
  line-height: 0.8;
  color: var(--pink);
  vertical-align: -0.08em;
}
.lede { margin: 0 0 10px; font-size: 18px; max-width: 34ch; }
.hint { margin: 0 0 10px; color: var(--ink-soft); font-size: 15px; }
.deadline { margin: 0; font-size: 17px; }

/* Form */
.form { display: flex; flex-direction: column; gap: 22px; }
.field { display: block; }
.field-label { display: block; font-weight: 500; margin-bottom: 8px; }
input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
input[type="text"]::placeholder { color: #8A91A8; }
input[type="text"]:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* The portrait frame: the memorable element */
.frame-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.frame {
  position: relative;
  width: min(100%, 240px);
  aspect-ratio: 9 / 16;
  border: 2px dashed var(--ink);
  border-radius: 22px;
  background: var(--paper);
  overflow: hidden;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, border-color 160ms ease;
}
.frame:hover, .frame:focus-visible { border-color: var(--pink); }
.frame:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.frame.has-video { border-style: solid; cursor: default; background: #000; }
.frame.is-done { border-style: solid; border-color: var(--green); color: var(--green); background: var(--paper); }
.frame.drag { border-color: var(--pink); transform: scale(1.02); }
.frame-done { text-align: center; padding: 24px; }
.frame-empty { position: absolute; inset: 0; display: flex; align-items: flex-start; }
.frame-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.frame-prompt {
  position: relative; width: 100%; text-align: center; padding: 14px 16px 30px; color: #fff;
  background: linear-gradient(to bottom, rgba(25,36,71,.9) 0%, rgba(25,36,71,.7) 55%, rgba(25,36,71,0) 100%);
}
.frame-prompt .frame-title { color: #fff; font-size: 15px; margin: 0; line-height: 1.3; }
.frame-prompt .frame-sub { color: rgba(255,255,255,.82); }
.frame-icon { width: 26px; height: 26px; color: var(--pink); margin-bottom: 2px; }
.frame-done svg { width: 72px; height: 72px; margin-bottom: 12px; }
.frame-title { margin: 0 0 6px; font-weight: 700; font-size: 17px; }
.frame-sub { margin: 0; color: var(--ink-soft); font-size: 14px; }
.frame-done .frame-sub { color: var(--ink-soft); }
.frame-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.filemeta { margin: 0; font-size: 14px; color: var(--ink-soft); text-align: center; }
.link {
  background: none; border: 0; padding: 4px 8px; font: inherit; font-size: 15px;
  color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: 6px;
}
.link:focus-visible { outline: 3px solid var(--pink); }

/* Progress */
.progress { display: flex; flex-direction: column; gap: 8px; }
.bar { height: 14px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--ink); border-radius: 999px; transition: width 300ms linear; }
.progress-text { margin: 0; font-size: 15px; color: var(--ink-soft); text-align: center; font-variant-numeric: tabular-nums; }

/* Messages */
.error {
  margin: 0; padding: 14px 16px; border-radius: 12px;
  background: var(--paper); border: 2px solid var(--pink); color: var(--ink); font-size: 15px;
}

/* Buttons */
.button {
  width: 100%;
  font: inherit; font-weight: 700; font-size: 18px;
  padding: 17px 20px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--ink); color: #fff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.button:hover { background: #0F183A; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.55; cursor: default; }
.button:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.button-secondary { background: var(--paper); color: var(--ink); }
.button-secondary:hover { background: #E6F1FF; }

.closed { display: flex; justify-content: center; }
.closed-photo { width: min(100%, 240px); aspect-ratio: 9 / 16; object-fit: cover; border: 2px solid var(--ink); border-radius: 22px; }
@media (min-width: 720px) { .closed-photo { width: 280px; } }

.foot { margin-top: 36px; font-size: 14px; color: var(--ink-soft); }
.foot p { margin: 0; }

@media (min-width: 720px) {
  .page { width: min(100% - 48px, 920px); padding-top: 64px; display: grid; grid-template-columns: 1fr 360px; column-gap: 72px; align-items: start; }
  .intro { position: sticky; top: 64px; margin-bottom: 0; }
  h1 { font-size: 64px; }
  .foot { grid-column: 1 / -1; }
  .frame { width: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  .frame, .button, .bar-fill { transition: none; }
}
