:root {
  --paper: #F4EBD9;
  --desk: #E4D6BC;
  --card: #FBF4E6;
  --ink: #2A2420;
  --sepia: #6E5A46;
  --muted: #9C8A72;
  --red: #C0413A;
  --red-deep: #8f2d28;
  --jade: #3C7A67;
  --gold: #B4832B;
  --line: #D9C8A8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #cdbd9c;
  font-family: 'Instrument Sans', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

input, textarea, button { font-family: inherit; }
textarea { resize: none; }
button { cursor: pointer; }

@keyframes pageIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sealIn { 0% { opacity: 0; transform: scale(1.7) rotate(-14deg); } 55% { opacity: 1; } 100% { opacity: 1; transform: scale(1) rotate(-8deg); } }

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 100% at 50% 0%, #efe2c8 0%, #e0d0b2 55%, #cdbb99 100%);
}

.phone-card {
  position: relative;
  width: 440px;
  max-width: 100%;
  height: 880px;
  max-height: 100vh;
  background: var(--paper);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  box-shadow: 0 34px 70px -24px rgba(60,40,20,.55), 0 2px 0 rgba(255,255,255,.45) inset;
}

@media (min-width: 480px) {
  .app-shell { padding: 22px; }
  .phone-card { height: min(880px, calc(100vh - 44px)); }
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(130% 120% at 50% 40%, transparent 62%, rgba(90,60,30,.13) 100%);
}

/* header / progress chrome */
.chrome-header { padding: 16px 22px 8px; flex: none; position: relative; z-index: 4; }
.chrome-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: 'Courier Prime', monospace; font-size: 11px; letter-spacing: .16em;
  color: var(--muted); text-transform: uppercase;
}
.progress-track { position: relative; height: 11px; margin-top: 11px; }
.progress-rail {
  position: absolute; top: 4px; left: 0; right: 0; height: 2px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 12px);
}
.progress-fill {
  position: absolute; top: 4px; left: 0; height: 2px;
  background-image: repeating-linear-gradient(90deg, var(--red) 0 6px, transparent 6px 12px);
  transition: width .55s cubic-bezier(.4,0,.1,1);
}
.progress-dot {
  position: absolute; top: 0; width: 11px; height: 11px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 3px var(--paper), 0 2px 4px rgba(0,0,0,.25);
  transform: translateX(-5px); transition: left .55s cubic-bezier(.4,0,.1,1);
}

main.step { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; z-index: 3; animation: pageIn .55s cubic-bezier(.2,.7,.2,1) both; }

/* footer / global nav */
.chrome-footer {
  flex: none; padding: 14px 22px 20px; display: flex; justify-content: flex-end; align-items: center;
  position: relative; z-index: 4; background: linear-gradient(0deg, var(--paper) 70%, transparent);
}
.btn-primary {
  background: var(--red); color: #fdf3e3; border: none; padding: 13px 28px; border-radius: 30px;
  font-size: 15px; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 11px 22px -11px rgba(150,45,40,.85); transition: all .25s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 15px 26px -11px rgba(150,45,40,.95); }
.btn-ghost { background: none; border: none; color: var(--sepia); font-size: 14px; padding: 10px 4px; font-weight: 500; }
.btn-ghost.left { margin-right: auto; }

/* intro */
.intro-screen {
  position: absolute; inset: 0; background: linear-gradient(158deg, #ad3a33 0%, #7f2723 68%, #6b1f1c 100%);
  color: #f2e2c2; display: flex; flex-direction: column; padding: 34px 32px 36px; overflow: hidden;
}
.intro-frame { position: absolute; inset: 14px; border: 1px solid rgba(228,196,120,.32); border-radius: 16px; pointer-events: none; }
.intro-stamp {
  position: absolute; top: 26px; right: 26px; border: 1.5px dashed rgba(228,196,120,.5); border-radius: 5px;
  padding: 5px 8px; font-family: 'Courier Prime'; font-size: 10px; letter-spacing: .14em;
  color: rgba(232,205,150,.85); transform: rotate(7deg);
}
.intro-body { flex: 1; display: flex; flex-direction: column; justify-content: center; position: relative; z-index: 2; }
.intro-eyebrow { font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .3em; color: rgba(232,205,150,.9); margin-bottom: 22px; }
.intro-title { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 58px; line-height: .94; color: #f0dcaa; letter-spacing: -.01em; }
.intro-divider { width: 64px; height: 2px; background: rgba(228,196,120,.6); margin: 26px 0; }
.intro-copy { font-size: 15.5px; line-height: 1.6; color: rgba(242,226,198,.92); max-width: 300px; margin: 0; }
.intro-history { margin-top: 18px; font-family: 'Courier Prime', monospace; font-size: 11px; letter-spacing: .05em; color: rgba(232,205,150,.7); }
.intro-history-list { margin-top: 4px; color: rgba(232,205,150,.9); }
.intro-tags {
  display: flex; align-items: center; gap: 10px; font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .14em;
  color: rgba(232,205,150,.85); margin-bottom: 20px; border-top: 1px dashed rgba(228,196,120,.4);
  border-bottom: 1px dashed rgba(228,196,120,.4); padding: 9px 0;
}
.intro-tags span:nth-child(2) { flex: 1; text-align: center; opacity: .7; }
.intro-btn {
  width: 100%; background: rgba(240,220,170,.12); border: 1.5px solid rgba(232,205,150,.85); color: #f2e1b6;
  padding: 16px; border-radius: 34px; font-size: 16px; letter-spacing: .02em; transition: all .25s;
}
.intro-btn:hover { background: rgba(240,220,170,.22); transform: translateY(-1px); }

/* reis */
.reis-wrap { padding: 18px 22px 26px; min-height: 100%; display: flex; flex-direction: column; }
.reis-head { display: flex; justify-content: space-between; align-items: baseline; }
.reis-head .label { font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .24em; color: var(--red); }
.reis-head .count { font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.day-pills { display: flex; gap: 6px; overflow-x: auto; padding: 12px 2px 4px; }
.day-pill {
  min-width: 30px; height: 30px; border-radius: 8px; font-family: 'Courier Prime', monospace; font-size: 12px;
  flex: none; padding: 0 6px; background: #f0e4cc; color: var(--muted); border: 1px solid #e2d1b2;
}
.day-pill.active { background: var(--red); color: #fdf3e3; border: none; }
.day-card { position: relative; margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 16px 18px; overflow: hidden; }
.day-card .weather {
  position: absolute; top: 12px; right: 12px; transform: rotate(6deg); border: 1.5px dashed rgba(60,122,103,.55);
  border-radius: 6px; padding: 5px 9px; font-family: 'Courier Prime'; font-size: 10px; letter-spacing: .08em;
  color: var(--jade); text-align: center; line-height: 1.35;
}
.day-place { font-family: 'Courier Prime'; font-size: 10.5px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.day-title { font-family: 'Instrument Serif', serif; font-size: 26px; line-height: 1.06; margin: 6px 0 0; color: var(--ink); font-weight: 400; max-width: 250px; }

.photo-area { display: flex; flex-direction: column; align-items: center; padding: 18px 0 4px; }
.polaroid { animation: floatUp .4s cubic-bezier(.2,.7,.2,1) both; }
.polaroid-frame {
  background: #fdfaf1; padding: 12px 12px 0; border-radius: 4px; box-shadow: 0 18px 30px -16px rgba(60,40,20,.55);
  transform: rotate(-1.5deg); width: 230px; max-width: 72vw; position: relative;
}
.polaroid-tape { position: absolute; top: -9px; left: 50%; transform: translateX(-50%) rotate(2deg); width: 70px; height: 21px; background: rgba(206,176,116,.5); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.polaroid-photo { position: relative; width: 100%; aspect-ratio: 4/5; overflow: hidden; background: #e6dcc6; }
.polaroid-photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.85) contrast(1.02); }
.polaroid-caption { font-family: 'Caveat', cursive; font-size: 21px; color: #6a5540; text-align: center; padding: 8px 4px 12px; line-height: 1; }
.photo-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
.photo-nav-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid #d8c4a0; background: #fbf4e6; color: var(--sepia);
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; flex: none;
}
.photo-dots { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 150px; }
.photo-dot { width: 6px; height: 6px; border-radius: 3px; background: #cbb894; transition: all .3s; border: none; padding: 0; }
.photo-dot.active { width: 16px; background: var(--red); }

.day-text { font-size: 15px; line-height: 1.62; color: var(--ink); margin: 14px 2px 0; }

.review-block { margin-top: 18px; border: 1px solid #e6d4b2; border-radius: 13px; background: linear-gradient(180deg, #fbf4e6, #f5ead2); padding: 13px 16px 8px; }
.review-title { font-family: 'Courier Prime'; font-size: 10px; letter-spacing: .18em; color: var(--red); text-transform: uppercase; margin-bottom: 4px; }
.review-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #e0cfae; }
.review-who { font-family: 'Instrument Serif', serif; font-size: 17px; width: 60px; flex: none; }
.review-who.senna { color: var(--red); }
.review-quote { flex: 1; font-size: 13px; color: var(--sepia); }
.review-score { font-family: 'Courier Prime'; font-size: 14px; color: var(--gold); flex: none; }

.last-day-note { margin-top: 18px; text-align: center; font-family: 'Caveat', cursive; font-size: 19px; color: var(--muted); }

.day-footer { display: flex; align-items: center; gap: 10px; margin-top: 22px; }

/* list_input */
.list-screen { padding: 26px 26px 34px; }
.list-eyebrow { font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .24em; color: var(--red); }
.list-title { font-family: 'Instrument Serif', serif; font-size: 29px; line-height: 1.12; margin: 8px 0 4px; color: var(--ink); font-weight: 400; }
.list-sub { font-size: 13.5px; color: var(--muted); margin: 0 0 20px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed #d9c8a8; }
.list-num { font-family: 'Courier Prime'; font-size: 13px; color: var(--red); width: 22px; flex: none; }
.list-input { flex: 1; border: none; background: transparent; font-size: 16px; color: var(--ink); padding: 2px 0; outline: none; }

/* ranking */
.rank-screen { padding: 26px 24px 34px; }
.rank-eyebrow { font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .24em; color: var(--red); }
.rank-title { font-family: 'Instrument Serif', serif; font-size: 27px; line-height: 1.14; margin: 8px 0 4px; color: var(--ink); font-weight: 400; }
.rank-hint { font-family: 'Caveat', cursive; font-size: 18px; color: var(--sepia); margin: 2px 0 18px; display: flex; align-items: center; gap: 7px; }
.rank-hint .mark { color: var(--red); }
.rank-list { position: relative; list-style: none; margin: 0; padding: 0; }
.rank-row {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid #e6d4b2; border-radius: 13px;
  padding: 0 14px 0 6px; height: 64px; box-shadow: 0 7px 16px -11px rgba(60,40,20,.6); position: relative; margin-bottom: 12px;
}
.rank-row[draggable="true"] { cursor: grab; }
.rank-grip { width: 30px; height: 100%; display: flex; align-items: center; justify-content: center; flex: none; }
.rank-grip-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(192,65,58,.18), 0 2px 4px rgba(0,0,0,.3); }
.rank-num { font-family: 'Courier Prime'; font-size: 13px; color: var(--muted); width: 20px; flex: none; }
.rank-name { font-family: 'Instrument Serif', serif; font-size: 19px; line-height: 1.1; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.rank-tag { font-family: 'Courier Prime'; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; flex: none; }
.rank-tag.laos { color: var(--jade); border: 1px solid rgba(60,122,103,.42); }
.rank-tag.thailand { color: var(--red); border: 1px solid rgba(192,65,58,.42); }
.rank-top-badge {
  position: absolute; top: -9px; right: 12px; background: var(--gold); color: #3a2b12; font-family: 'Courier Prime';
  font-size: 9px; letter-spacing: .12em; padding: 3px 9px; border-radius: 3px; box-shadow: 0 5px 9px -4px rgba(0,0,0,.4); transform: rotate(2deg);
}

/* open_text (postcard) */
.postcard-screen { padding: 26px 24px 34px; min-height: 100%; display: flex; flex-direction: column; }
.postcard-eyebrow { font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .24em; color: var(--red); }
.postcard {
  position: relative; margin-top: 16px; background: #fdfaf1; border: 1px solid #e6d5b4; border-radius: 10px;
  box-shadow: 0 16px 30px -18px rgba(60,40,20,.5); padding: 20px 20px 18px; flex: 1; display: flex; flex-direction: column;
}
.postcard-icon {
  position: absolute; top: -9px; right: 16px; width: 58px; height: 64px; border: 2px dashed rgba(192,65,58,.5);
  border-radius: 6px; display: flex; align-items: center; justify-content: center; transform: rotate(6deg); background: rgba(192,65,58,.05);
}
.postcard-prompt { font-family: 'Caveat', cursive; font-weight: 700; font-size: 29px; line-height: 1.1; color: var(--ink); max-width: 230px; margin-bottom: 14px; }
.postcard-lines {
  flex: 1; background-image: repeating-linear-gradient(#fdfaf1 0 31px, #e9d8b8 31px 32px); border-top: 1px solid #ece0c4;
  padding-top: 2px; min-height: 150px;
}
.postcard-lines textarea { width: 100%; height: 100%; min-height: 150px; border: none; background: transparent; outline: none; font-size: 16px; line-height: 32px; color: var(--ink); }

/* closing */
.closing-screen {
  position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 12%, #f7edd7, #efe1c2 58%, #e6d4b0);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 34px;
}
.closing-eyebrow { font-family: 'Courier Prime'; font-size: 11px; letter-spacing: .3em; color: var(--red); margin-bottom: 16px; }
.closing-title { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 52px; line-height: .96; color: var(--ink); }
.closing-copy { font-size: 16px; line-height: 1.6; color: var(--sepia); max-width: 290px; margin: 22px 0 30px; }
.seal {
  width: 112px; height: 112px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #c94a41, #8f2d28);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 26px -10px rgba(120,30,26,.7), 0 2px 0 rgba(255,255,255,.2) inset; animation: sealIn .6s cubic-bezier(.2,.8,.3,1) both;
}
.seal-inner {
  border: 1.5px dashed rgba(240,220,180,.6); border-radius: 50%; width: 88px; height: 88px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #f3e2bf; font-family: 'Courier Prime'; font-size: 12px; letter-spacing: .14em; line-height: 1.5;
}
.closing-final-title { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 38px; line-height: 1; color: var(--ink); margin-top: 28px; }
.closing-final-copy { font-family: 'Caveat', cursive; font-size: 22px; color: var(--sepia); margin: 14px 0 0; }

/* admin review page */
.admin-page { max-width: 640px; margin: 0 auto; padding: 32px 24px 80px; background: var(--paper); min-height: 100vh; }
.admin-title { font-family: 'Instrument Serif', serif; font-size: 32px; font-weight: 400; color: var(--ink); margin: 0 0 24px; }
.admin-empty { color: var(--muted); }
.admin-submission { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 18px 20px; margin-bottom: 20px; }
.admin-submission-date { font-family: 'Courier Prime'; font-size: 13px; letter-spacing: .08em; color: var(--red); margin: 0 0 14px; font-weight: 400; }
.admin-answer-row { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.admin-answer-row:last-child { border-bottom: none; }
.admin-answer-label { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.admin-answer-value { font-size: 15px; color: var(--ink); line-height: 1.5; white-space: pre-wrap; }
