/* 旅遊隨手拍 — the app. Dark like a camera, one hand, big targets. */
:root {
  --bg: #0e1013;
  --panel: #171a1f;
  --panel-2: #20242b;
  --line: #2c313a;
  --text: #f2f3f5;
  --muted: #9aa1ad;
  --accent: #ffcf4a;      /* the warm yellow of a viewfinder frame */
  --ok: #4fd18b;
  --warn: #ffb547;
  --bad: #ff6b6b;
  --info: #6cb6ff;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, label:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.app {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  padding-top: calc(var(--safe-top) + 8px);
}

/* ---- top: where am I, is everything home ---- */
.top { display: flex; justify-content: space-between; gap: 8px; padding: 0 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; max-width: 58%;
  padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.08);
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill span { overflow: hidden; text-overflow: ellipsis; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.ok .dot { background: var(--ok); }
.pill.warn .dot { background: var(--warn); }
.pill.bad .dot { background: var(--bad); }
.pill.busy .dot { background: var(--info); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---- middle: the latest photo, then the strip ---- */
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 12px 0; gap: 12px; }
.hero {
  flex: 1; min-height: 0; border-radius: var(--radius); background: var(--panel);
  display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative;
}
.hero img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hero .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 14px 10px; font-size: 13px;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); display: flex; justify-content: space-between; gap: 8px;
}
.card { padding: 20px; max-width: 420px; width: 100%; }
.card h2 { margin: 0 0 8px; font-size: 20px; }
.card p { margin: 0 0 12px; color: #cfd3da; }
.card ol { margin: 0 0 12px; padding-left: 22px; color: #cfd3da; }
.card li { margin-bottom: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; background: var(--accent); color: #1a1400; font-weight: 600; font-size: 16px;
}
.btn.ghost { background: var(--panel-2); color: var(--text); font-weight: 500; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn + .btn { margin-left: 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px; /* 16px: iPhone does not zoom in */
}

.shots-head { display: flex; justify-content: space-between; font-size: 14px; padding: 0 2px 6px; }
.strip {
  display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; min-height: 72px; padding-bottom: 2px;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.shot {
  position: relative; flex: none; width: 72px; height: 72px; border-radius: 10px; overflow: hidden;
  background: var(--panel-2); scroll-snap-align: start;
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .badge {
  position: absolute; right: 4px; bottom: 4px; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px;
  font-size: 12px; line-height: 20px; text-align: center; background: rgba(0,0,0,.7);
}
.shot.wait .badge { color: var(--warn); }
.shot.bad .badge { color: var(--bad); }
.shot.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; width: auto; padding: 0 12px; }

/* ---- bottom: the shutter ---- */
.bottom {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 14px 20px calc(var(--safe-bottom) + 14px);
}
.side {
  justify-self: start; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 56px; min-height: 56px; font-size: 12px; color: var(--muted);
}
.side svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.side.album { justify-self: end; }
.side.album .lthumb {
  width: 44px; height: 44px; border-radius: 10px; overflow: hidden; background: var(--panel-2);
  border: 2px solid rgba(255,255,255,.25); display: block;
}
.side.album img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shutter {
  width: 84px; height: 84px; border-radius: 50%; border: 5px solid #fff; display: flex;
  align-items: center; justify-content: center; cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.shutter span { width: 64px; height: 64px; border-radius: 50%; background: #fff; transition: transform .12s; }
.shutter:active span { transform: scale(.88); }
.shutter.off { opacity: .35; pointer-events: none; }
/* Not display:none: some phones will not open the camera for an input that is not rendered. */
.cam-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: -100px; }

/* ---- sheet (我的, the queue, a new address) ---- */
.shade { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  background: var(--panel); border-radius: 20px 20px 0 0; padding: 8px 16px calc(var(--safe-bottom) + 20px);
}
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { font-size: 20px; margin: 0 0 4px; }
.sheet h3 { font-size: 15px; margin: 18px 0 6px; color: var(--muted); font-weight: 600; }
.sheet .kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.sheet .kv > :last-child { text-align: right; color: #cfd3da; overflow-wrap: anywhere; }
.sheet p { color: #cfd3da; margin: 6px 0 10px; font-size: 15px; }
.qrow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.qrow img, .qrow .ph { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; }
.qrow .what { flex: 1; min-width: 0; }
.qrow .what small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.close { position: absolute; right: 12px; top: 10px; width: 40px; height: 40px; border-radius: 50%; background: var(--panel-2); font-size: 20px; }

/* ---- one photo, full screen ---- */
.viewer { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; }
.viewer .pic { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.viewer .pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .info { padding: 12px 16px calc(var(--safe-bottom) + 16px); font-size: 14px; color: #cfd3da; background: #0b0c0e; }
.viewer .info div { padding: 2px 0; }
.viewer .close { top: calc(var(--safe-top) + 10px); z-index: 2; }

.toast {  /* above the row of looks, and taps go through it (a second look tapped at once) */
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 172px); z-index: 30;
  pointer-events: none; width: max-content;  /* left:50% leaves it half the screen to wrap in: short lines broke in two */
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: rgba(32,36,43,.96);
  font-size: 15px; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}

/* ---- stage 1: the album, a trip, a day's summary (full-screen panels over the camera) ---- */
.panel {
  position: fixed; inset: 0; z-index: 15; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 12px calc(var(--safe-bottom) + 24px);
}
.phead {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; margin: 0 -12px 8px;
  padding: calc(var(--safe-top) + 8px) 12px 8px; background: rgba(14,16,19,.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.back { width: 44px; height: 44px; flex: none; font-size: 30px; line-height: 40px; border-radius: 50%; }
.ptitle { min-width: 0; display: flex; flex-direction: column; }
.ptitle b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptitle small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pempty { padding: 24px 8px; color: #cfd3da; }
.trips { display: flex; flex-direction: column; gap: 10px; }
.tcard {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 8px; border-radius: var(--radius);
  background: var(--panel); width: 100%;
}
.tcov { width: 84px; height: 84px; flex: none; border-radius: 12px; overflow: hidden; background: var(--panel-2); }
.tcov img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tinfo { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tinfo b { font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.tinfo small { color: var(--muted); font-size: 13px; }
.tinfo em, .tag.open { font-style: normal; color: #1a1400; background: var(--accent); border-radius: 999px; padding: 1px 8px; font-size: 12px; align-self: flex-start; }
.tag { font-size: 13px; color: var(--muted); }
.pbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.pbar .btn + .btn { margin-left: 0; }
.dayb { margin: 14px 0 6px; }
.dhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dhead b { font-size: 18px; }
.dhead span { color: var(--muted); font-size: 13px; }
.dacts { margin: 6px 0 4px; }
.dacts .btn + .btn { margin-left: 0; }
.spot { margin-top: 10px; }
.shead { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.shead b { overflow-wrap: anywhere; }
.shead span { color: var(--muted); flex: none; }
.grid, .picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gcell { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.gcell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcell .who { position: absolute; left: 4px; bottom: 4px; font-size: 11px; padding: 0 5px; border-radius: 6px; background: rgba(0,0,0,.65); }
.picks .gcell { border-radius: 8px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.stats span { background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 14px; }
.plabel { font-size: 15px; color: var(--muted); margin: 18px 0 6px; }
.route { margin: 0; padding-left: 22px; }
.route li { padding: 4px 0; }
.route li span { color: var(--muted); font-size: 13px; margin-left: 6px; }
.qcard { margin: 18px 0 8px; padding: 14px; border-radius: var(--radius); background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.qcard small { color: var(--muted); }
.pfoot { margin: 18px 0 8px; }
.sel { font: inherit; font-size: 16px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.viewer .pic { position: relative; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; font-size: 34px; color: #fff; background: rgba(0,0,0,.35); }
.vnav.prev { left: 0; border-radius: 0 12px 12px 0; }
.vnav.next { right: 0; border-radius: 12px 0 0 12px; }

/* ---- stage 2: captions ---- */
.caps { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 8px; }
.cap { text-align: left; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); color: #e4e7ec; font-size: 15px; line-height: 1.4; }
.cap.on { background: rgba(255,207,74,.16); box-shadow: inset 0 0 0 1px var(--accent); color: #fff; }
.line { font-size: 17px; line-height: 1.5; margin: 4px 2px 12px; color: #f2f3f5; }
.viewer .info { max-height: 46vh; overflow-y: auto; }

/* ---- 美化後／原圖 (0.6.2): two tabs over the photo's info, one share button ---- */
.vtabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 10px; border-radius: 12px; background: #1b2029; }
.vtabs button { flex: 1; padding: 9px 0; border-radius: 9px; font-size: 15px; color: #c9ced6; }
.vtabs button.on { background: #f6e7b0; color: #1b1b1b; font-weight: 600; }
.looks { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.looks .chip { border: 1px solid #3a4150; background: #1b2029; color: #d7dbe2; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.looks .chip.on { background: #f6e7b0; border-color: #f6e7b0; color: #1b1b1b; font-weight: 600; }
.film { margin: 8px 0 14px; padding: 12px; border-radius: 14px; background: #161b23; border: 1px solid #2a313d; }
.film .fhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.film video { width: 100%; max-height: 72vh; border-radius: 10px; background: #000; display: block; }
.film p { margin: 8px 0 0; font-size: 13px; line-height: 1.5; }
.looks.infilm { align-items: center; }
.film .share { width: 100%; margin-top: 10px; }
.vshare { margin: 2px 0 10px; }
.vshare .btn { width: 100%; }
.vshare .wait { margin: 0 0 8px; font-size: 13px; line-height: 1.5; color: #f6e7b0; }
.vshare .hint { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: #8d95a3; }
.hero .endbar { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; padding: 6px 6px 6px 12px; border-radius: 12px; font-size: 14px;
  background: rgba(0,0,0,.55); color: #e6e8ec; }

