:root {
  --paper: #f5f1dc; --paper2: #fbf8ea; --paper3: #ece6c8; --ink: #2a1f17; --muted: #86776a; --line: #d9d2b2;
  --blue: #4f7be8; --blue-d: #3b63c9; --gold: #b08d3c; --navy: #0e1424; --navy2: #172036; --navy-line: #263250;
  --danger: #a8453a; --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 var(--sans); color: var(--ink); background: #15130f;
  -webkit-tap-highlight-color: transparent; min-height: 100dvh;
}
#app {
  position: relative; max-width: 560px; margin: 0 auto; min-height: 100dvh; background: var(--paper);
  background-image: linear-gradient(90deg, #cbc4a6 0, #e4dfc4 10px, rgba(245,241,220,0) 38px);
  box-shadow: 0 0 60px rgba(0,0,0,.5);
}
#view { padding-bottom: calc(76px + var(--safe-b)); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 18px; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; }
.eyebrow { font: 600 .74rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.ico { display: inline-flex; vertical-align: middle; }

.page { padding: calc(14px + var(--safe-t)) 18px 24px 34px; }
.page-head { display: flex; align-items: flex-start; gap: 6px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1.5px solid var(--line); }
.page-head h1 { margin: 0; font: 700 1.55rem/1.15 var(--serif); letter-spacing: .06em; text-transform: uppercase; overflow-wrap: anywhere; }
.page-head h1:empty { display: none; }
.icon-btn { background: none; border: 0; width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(0,0,0,.06); color: var(--ink); outline: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper2); font-weight: 600; letter-spacing: .02em; }
.btn:hover { border-color: var(--muted); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .88rem; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; letter-spacing: .1em; text-transform: uppercase; font-size: .9rem; }
.btn.primary:hover { background: var(--blue-d); }
.btn.danger { color: var(--danger); border-color: #d9b4ae; background: #fbf0ee; }
.btn.dashed { border-style: dashed; border-color: #9fb4e8; color: var(--blue-d); background: transparent; letter-spacing: .1em; text-transform: uppercase; font-size: .86rem; min-height: 64px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--blue-d); font-weight: 600; padding: 6px 4px; display: inline-flex; align-items: center; gap: 4px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.card { background: var(--paper2); border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 14px; }
.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.note-box { background: #fff9e0; border: 1px solid #e6d58a; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font: 600 .74rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=search], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
textarea { resize: vertical; line-height: 1.5; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; } .check input { width: 18px; height: 18px; }
progress { width: 100%; height: 10px; accent-color: var(--blue); margin: 10px 0; }
ul.tips { padding-left: 18px; margin: 10px 0 14px; color: var(--muted); font-size: .92rem; }

/* Hộ chiếu */
.id-card { display: flex; gap: 16px; padding-bottom: 14px; border-bottom: 1.5px solid var(--line); }
.avatar { width: 112px; height: 132px; flex: none; border: 1.5px solid var(--line); border-radius: 8px; background: var(--paper3); padding: 6px; display: grid; place-items: center; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; filter: sepia(.25) saturate(.9); }
.avatar.big { width: 120px; height: 140px; margin: 0 auto 10px; }
dl { margin: 0; min-width: 0; } dt { font: 600 .72rem var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
dt:first-child { margin-top: 0; } dd { margin: 2px 0 0; font: 1.05rem var(--mono); overflow-wrap: anywhere; }
dd.name { font-size: 1.3rem; letter-spacing: .08em; text-transform: uppercase; }
.home-row { padding: 12px 0; border-bottom: 1.5px solid var(--line); } .home-row .big { font-size: 1.15rem; letter-spacing: .1em; }
.map-card { position: relative; margin: 16px 0; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper2); }
.map-tools { position: absolute; inset: 8px 8px auto 8px; display: flex; justify-content: space-between; z-index: 2; pointer-events: none; }
.map-tools .icon-btn { pointer-events: auto; background: var(--paper2); border: 1.5px solid var(--line); }
.mapbox { min-height: 180px; padding: 6px; } .worldmap { width: 100%; height: auto; display: block; }
.progress { display: flex; align-items: flex-end; gap: 12px; margin: 6px 0 14px; }
.count { font-size: 3.4rem; line-height: .9; font-weight: 700; }
.bar-track { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 6px 0; } .bar-fill { height: 100%; background: var(--blue); border-radius: 6px; }
.mrz { background: var(--paper2); border: 1.5px solid var(--line); border-radius: 8px; padding: 10px; font-size: .72rem; letter-spacing: .08em; line-height: 1.7; overflow: hidden; white-space: nowrap; }

/* Chuyến đi */
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 12px; border: 1.5px solid var(--gold); border-radius: 10px; background: var(--paper2); font-weight: 600; }
.trip-list { list-style: none; margin: 0; padding: 0; } .trip-list li { border-bottom: 1.5px solid var(--line); }
.trip-row { display: flex; gap: 14px; align-items: center; padding: 16px 0; } .idx { color: var(--muted); } .title { display: block; letter-spacing: .05em; overflow-wrap: anywhere; }
.end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; text-transform: uppercase; }
.badge { font: 600 .72rem var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: 2px 8px; border: 1.5px solid var(--muted); border-radius: 4px; color: var(--muted); white-space: nowrap; }
.actions-col { display: grid; gap: 12px; margin-top: 22px; }
.empty { text-align: center; padding: 36px 12px; } .empty .serif { font-size: 1.2rem; margin: 0 0 4px; }
.seg { display: inline-flex; border: 1.5px solid var(--muted); border-radius: 4px; margin: 12px 0 18px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font: 600 .8rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.seg button.on { background: var(--ink); color: var(--paper); }
.stamp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.stamp-tile { position: relative; display: block; padding: 4px; } .stamp-art svg { display: block; width: 100%; height: auto; }
.polaroid { position: absolute; top: 6%; right: 2%; width: 26%; aspect-ratio: 1; background: #fff; padding: 3px 3px 9px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.polaroid .thumb { width: 100%; height: 100%; border-radius: 0; }
.days { list-style: none; margin: 0; padding: 0; } .days li { padding: 12px 0 16px; border-bottom: 1.5px solid var(--line); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; margin: 0 6px 6px 0; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper2); font-size: .9rem; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; } .strip .thumb { width: 72px; height: 72px; flex: none; }
.sticky-cta { position: sticky; bottom: calc(76px + var(--safe-b)); padding-top: 12px; margin-top: 12px; background: linear-gradient(transparent, var(--paper) 40%); z-index: 5; }

/* Ảnh nhỏ */
.thumb { position: relative; background: var(--paper3); border-radius: 6px; overflow: hidden; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.missing::after { content: "☁"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 1.4rem; }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); z-index: 1; }

/* Chi tiết tem */
.stamp-page { padding: 0; }
.stamp-hero { padding: calc(8px + var(--safe-t)) 18px 24px 34px; text-align: center; background: #e9e4c8; }
.stamp-hero .page-head { border: 0; margin: 0; padding-bottom: 0; }
.big-stamp { max-width: 300px; margin: 0 auto 6px; } .big-stamp svg { width: 100%; height: auto; display: block; }
.stamp-hero h2 { margin: 6px 0 4px; font: 700 1.9rem/1.2 var(--serif); overflow-wrap: anywhere; }
.stamp-dark { background: var(--navy); color: #dfe5f5; padding: 24px 18px 40px 34px; min-height: 50vh; }
.stamp-dark .eyebrow { color: #7f8db3; } .stamp-dark .muted { color: #8390ad; } .stamp-dark .link { color: #7c9cf2; }
.sec-head { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 10px; } .sec-head:first-child { margin-top: 0; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cell { padding: 0; border: 0; background: none; border-radius: 8px; } .cell .thumb { border-radius: 8px; background: var(--navy2); }
.empty.dark { background: var(--navy2); border: 1.5px solid var(--navy-line); border-radius: 14px; color: #aeb8d4; width: 100%; padding: 28px 14px; }
.notes { display: grid; gap: 10px; }
.note { text-align: left; background: var(--navy2); border: 1.5px solid var(--navy-line); border-radius: 12px; padding: 12px 14px; color: #dfe5f5; }
.note p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.icon-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ip { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper2); color: var(--ink); } .ip.on { border-color: var(--blue); background: #e8eefc; }

/* Nhập ảnh */
.places { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.place-row { display: flex; gap: 10px; align-items: flex-start; } .place-row .thumb { width: 64px; height: 64px; flex: none; }
.place-row input[type=text] { min-height: 38px; margin-bottom: 4px; } .place-row.skipped { opacity: .45; }

/* Hộp thoại, bảng chọn, thông báo */
.modal-ov { position: fixed; inset: 0; z-index: 50; background: rgba(20,16,10,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; background: var(--paper); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); }
.modal h3 { margin: 0 0 12px; font-size: 1.25rem; } .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; } .modal-actions .btn { flex: 1; }
@media (min-width: 600px) { .modal-ov { align-items: center; } .modal { border-radius: 18px; } }
.sheet { display: grid; } .sheet-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 1.02rem; } .sheet-item.danger { color: var(--danger); }
.results { display: grid; gap: 6px; margin-bottom: 8px; max-height: 40dvh; overflow: auto; }
.result { display: grid; text-align: left; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper2); gap: 2px; } .result small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); z-index: 90; max-width: min(92vw, 520px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
#syncpill { position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 40; background: var(--blue); color: #fff; padding: 5px 14px; border-radius: 999px; font-size: .82rem; max-width: 92vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(251,248,234,.96); border-top: 1.5px solid var(--line); padding-bottom: var(--safe-b); backdrop-filter: blur(6px); }
#tabbar a { display: grid; justify-items: center; gap: 1px; padding: 8px 4px 6px; color: var(--muted); } #tabbar small { font: 600 .66rem var(--mono); letter-spacing: .08em; text-transform: uppercase; } #tabbar a.on { color: var(--blue-d); }

/* Toàn màn hình: bản đồ, trình xem ảnh */
.overlay, .lightbox { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; }
.overlay { background: var(--paper); } .lightbox { background: rgba(5,7,12,.97); color: #fff; }
.overlay .bar, .lightbox .bar { display: flex; align-items: center; padding: calc(8px + var(--safe-t)) 8px 8px; } .lightbox .icon-btn { color: #fff; }
.map-full { flex: 1; display: grid; place-items: center; overflow: hidden; } .map-full .worldmap { width: 100%; max-height: 100%; touch-action: none; }
.lb-stage { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 0 8px 16px; } .lb-stage img, .lb-stage video { max-width: 100%; max-height: calc(100dvh - 90px); object-fit: contain; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 10px; display: grid; place-items: center; } .lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; transform: translateY(-50%) scaleX(-1); }
@media (max-width: 420px) { .page { padding-left: 30px; } .avatar { width: 96px; height: 118px; } .count { font-size: 2.8rem; } }
@media (prefers-reduced-motion: no-preference) { .modal { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(24px); opacity: .5; } } }
