/* ── Fonts ─────────────────────────────────────────────────── */
@font-face {
  font-family: 'MilkyVintage';
  src: url('milkyvintage/MilkyVintage-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Vogue';
  src: url('vogue/Vogue.ttf') format('truetype');
  font-display: swap;
}

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --blue:   #295592;
  --petrol: #4c9ca7;
  --yellow: #f6c334;
  --orange: #ea751a;
  --pink:   #ca4d72;
  --cream:  #fdf6ee;
  --white:  #ffffff;
  --text:   #2c2c2c;
  --muted:  #8a7e78;
  --border: #ede6df;
  --r:      16px;
  --shadow: 0 2px 18px rgba(202,77,114,.08);
  --font:   'Nunito', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
}

/* ── App ───────────────────────────────────────────────────── */
#app { position: fixed; inset: 0; overflow: hidden; }

/* ── Progress ──────────────────────────────────────────────── */
.progress-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; background: var(--border); z-index: 100;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--orange));
  transition: width .4s ease;
  width: 0%;
}

/* ── Back button ───────────────────────────────────────────── */
.btn-back {
  position: fixed; top: 14px; left: 14px; z-index: 100;
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer;
  transition: color .2s, transform .2s;
}
.btn-back:hover { color: var(--pink); transform: translateX(-2px); }
.btn-back.hidden { opacity: 0; pointer-events: none; }

/* ── Screens ───────────────────────────────────────────────── */
.screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 22px 28px;
  opacity: 0; transform: translateX(100vw);
  transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .3s;
  pointer-events: none;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.screen.active  { opacity: 1; transform: translateX(0); pointer-events: all; }
.screen.exiting { opacity: 0; transform: translateX(-28vw); }

.screen-inner {
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 18px;
  padding-bottom: 24px;
}
.screen-inner.center { align-items: center; text-align: center; }

/* ── Font helpers ──────────────────────────────────────────── */
.font-milky { font-family: 'MilkyVintage', cursive; }
.font-vogue { font-family: 'Vogue', serif; letter-spacing: .07em; }

/* ── Welcome ───────────────────────────────────────────────── */
.deco { font-size: 44px; color: var(--pink); opacity: .5; line-height: 1; }
.title-main {
  font-size: clamp(52px,17vw,90px);
  line-height: 1.1; color: var(--blue);
}
.welcome-sub {
  font-size: 17px; line-height: 1.65;
  color: var(--muted); font-style: italic;
}

/* ── Labels / headings ─────────────────────────────────────── */
.label-small {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted);
}
.screen-h {
  font-size: clamp(26px,7vw,38px);
  line-height: 1.1; color: var(--blue);
}
.screen-sub { font-size: 14px; color: var(--muted); line-height: 1.5; }

/* ── Question styles ───────────────────────────────────────── */
.q-num {
  font-size: clamp(44px,14vw,72px);
  line-height: 1; color: var(--border);
  margin-bottom: -6px;
}
.q-text {
  font-size: clamp(19px,5.2vw,26px);
  font-weight: 700; line-height: 1.35; color: var(--text);
}
.q-sub { font-size: 13px; color: var(--muted); font-style: italic; }

/* ── Type cards ────────────────────────────────────────────── */
.type-grid { display: flex; flex-direction: column; gap: 11px; }
.type-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px;
  background: var(--white); border: 2px solid var(--border);
  border-radius: var(--r); cursor: pointer;
  font-family: var(--font); font-size: 16px; font-weight: 600;
  color: var(--text); text-align: left;
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.type-card:hover { border-color: var(--pink); transform: translateY(-2px); box-shadow: 0 6px 22px rgba(202,77,114,.15); }
.type-card.selected { border-color: var(--pink); background: #fff5f8; }
.type-icon { font-size: 20px; color: var(--pink); min-width: 38px; }

/* ── Name fields ───────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.input-text {
  padding: 15px 18px; border: 2px solid var(--border); border-radius: var(--r);
  font-family: var(--font); font-size: 17px; color: var(--text);
  background: var(--white); transition: border-color .2s;
  width: 100%; -webkit-appearance: none;
}
.input-text:focus { outline: none; border-color: var(--pink); }
.input-text::placeholder { color: #c5b8b0; }
.field-err { font-size: 12px; color: var(--pink); display: none; }
.field-err.show { display: block; }

/* ── Options ───────────────────────────────────────────────── */
.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  padding: 15px 18px; width: 100%;
  background: var(--white); border: 2px solid var(--border);
  border-radius: var(--r); text-align: left; cursor: pointer;
  font-family: var(--font); font-size: 15px; line-height: 1.4;
  color: var(--text); transition: all .17s;
  box-shadow: 0 1px 6px rgba(0,0,0,.04); position: relative;
}
.opt:hover   { border-color: var(--pink); background: #fff8fb; transform: translateX(4px); }
.opt.chosen  { border-color: var(--pink); background: #fff0f5; color: var(--pink); font-weight: 700; }
.opt.chosen::after { content: '✓'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--pink); }
.opt-other   { border-style: dashed; color: var(--muted); }
.opt-other.open { border-color: var(--petrol); background: #f4fbfc; color: var(--petrol); border-style: solid; }
.hint        { display: block; font-size: 12px; color: var(--muted); font-weight: 400; font-style: italic; }

/* Animal grid */
.animal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.opt-animal  { padding: 18px 10px; text-align: center; font-size: 13px; line-height: 1.7; }
.opt-animal .hint { display: block; }

/* Other row */
.other-row { display: flex; gap: 8px; align-items: center; margin-top: -4px; }
.input-inline {
  flex: 1; padding: 13px 16px;
  border: 2px solid var(--petrol); border-radius: var(--r);
  font-family: var(--font); font-size: 15px;
  background: var(--white); color: var(--text);
  -webkit-appearance: none;
}
.input-inline:focus { outline: none; }

/* ── Textarea ──────────────────────────────────────────────── */
.textarea-main {
  width: 100%; padding: 15px 18px;
  border: 2px solid var(--border); border-radius: var(--r);
  font-family: var(--font); font-size: 15px; line-height: 1.65;
  resize: vertical; background: var(--white); color: var(--text);
  transition: border-color .2s; -webkit-appearance: none;
}
.textarea-main:focus { outline: none; border-color: var(--pink); }
.char-count { text-align: right; font-size: 12px; color: var(--muted); margin-top: -10px; }

/* ── Upload ────────────────────────────────────────────────── */
.upload-box {
  border: 2px dashed var(--border); border-radius: var(--r);
  min-height: 90px; background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; transition: border-color .2s;
}
.upload-box:hover { border-color: var(--pink); }
.upload-box img { max-width: 100%; max-height: 200px; border-radius: 10px; }
#uploadPlaceholder { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; cursor: pointer; }
.upload-icon  { width: 28px; height: 28px; color: var(--muted); }
.upload-label { font-size: 14px; color: var(--muted); font-weight: 600; }
#photoThumbs { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; justify-content: center; width: 100%; }
#photoThumbs img { width: 80px; height: 80px; max-width: 80px; max-height: 80px; object-fit: cover; border-radius: 8px; }

/* ── Drawing ───────────────────────────────────────────────── */
.draw-box { background: var(--white); border: 2px solid var(--border); border-radius: var(--r); overflow: hidden; }
.draw-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--muted);
}
#drawingPad { display: block; width: 100%; touch-action: none; cursor: crosshair; background: #fffdf9; }
.palette { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.col-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background-color: var(--c); border: 3px solid transparent;
  cursor: pointer; transition: transform .15s, border-color .15s;
}
.col-btn.active { border-color: var(--text); transform: scale(1.2); }
.col-btn:hover  { transform: scale(1.15); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%; padding: 17px 22px;
  background: var(--pink); color: #fff; border: none; border-radius: var(--r);
  font-family: var(--font); font-size: 16px; font-weight: 700;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: background .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(202,77,114,.28);
  letter-spacing: .02em;
}
.btn-primary:hover { background: #b83d62; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(202,77,114,.38); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }

.btn-link {
  display: block; text-align: center; color: var(--muted);
  text-decoration: none; font-size: 14px; padding: 8px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font);
  transition: color .2s;
}
.btn-link:hover { color: var(--pink); }

.btn-skip {
  display: block; width: 100%; padding: 11px;
  background: transparent; border: none; color: var(--muted);
  font-family: var(--font); font-size: 13px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-align: center;
}
.btn-sm {
  padding: 13px 18px; background: var(--petrol); color: #fff;
  border: none; border-radius: var(--r);
  font-family: var(--font); font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-clear {
  background: none; border: none; font-size: 12px;
  color: var(--muted); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  font-family: var(--font); padding: 4px;
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Tablet+ ───────────────────────────────────────────────── */
@media (min-width: 600px) {
  .screen { padding: 72px 36px 36px; }
  .screen-inner { gap: 22px; }
  .opt:hover { transform: translateX(6px); }
}

/* ── Landscape phone ───────────────────────────────────────── */
@media (max-height: 520px) and (orientation: landscape) {
  .screen { align-items: flex-start; padding-top: 48px; }
  .q-num { font-size: 36px; }
  .title-main { font-size: 44px; }
}

/* ── Print (shared) ────────────────────────────────────────── */
@media print {
  body { background: #fff; overflow: auto; }
  #app { position: static; overflow: visible; }
  .progress-bar, .btn-back, .btn-primary, .btn-skip, .btn-link { display: none !important; }
}
