@font-face {
  font-family: "GenSenMaruGothicTW";
  src: url("/fonts/GenSenMaruGothicTW-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --accent2: #5DADE2;
  --accent2-text: #FFFFFF;
  --page-bg2: #FAFAFA;
  --card: #FFFFFF;
  --ink: #2C2A29;
  --ink-title: #5C534C;
  --ink-soft: #A09C98;
  --radius2: 32px;
  --shadow2: 0px 8px 24px rgba(0,0,0,0.04);
  --hairline: #F0EBE8;
  --font-main: "GenSenMaruGothicTW", -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  color: var(--ink);
}
.hidden { display: none !important; }
.brand-font { font-family: var(--font-main); font-weight: 700; }
button { font-family: inherit; }

/* ---------- 按鈕 ---------- */
.btn-cta, .btn-secondary {
  display: flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 20px; width: 100%;
  background: var(--accent2); color: var(--accent2-text);
  border: none; border-radius: 999px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-secondary { background: #EFEFEF; color: var(--ink); }

/* ---------- 登入 / 註冊 ---------- */
.auth-screen {
  position: fixed; inset: 0; background: var(--page-bg2);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--card); border-radius: var(--radius2);
  box-shadow: var(--shadow2); padding: 32px 24px;
}
.auth-title { font-size: 24px; text-align: center; margin-bottom: 20px; color: var(--ink-title); }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; text-align: center; padding: 10px; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: var(--ink-soft); background: #F2F2F7; cursor: pointer;
}
.auth-tab.on { background: var(--accent2); color: var(--accent2-text); }
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.form-field { padding: 12px 2px; border-bottom: 1px solid var(--hairline); }
.form-label { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: 6px; }
.form-input {
  width: 100%; font-size: 15px; font-weight: 600; color: var(--ink);
  text-align: left; border: none; outline: none; background: none; padding: 0;
}
.auth-error { color: #D64545; font-size: 12.5px; min-height: 16px; margin: 6px 0; }
.auth-form.hidden { display: none; }
.auth-form .btn-cta { margin-top: 16px; }

/* ---------- 地圖主畫面 ---------- */
.app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; background: #dce9f0; }

.nav-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1000;
  padding: 16px 16px 12px;
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.35), rgba(0,0,0,0));
  pointer-events: none;
}
.nav-header > * { pointer-events: auto; }
.nav-icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(30,28,26,0.55); backdrop-filter: blur(6px);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; border: none; cursor: pointer;
}
.layer-switch {
  display: flex; justify-self: center; gap: 4px; max-width: 60vw; overflow-x: auto;
  background: rgba(30,28,26,0.55); backdrop-filter: blur(6px);
  padding: 4px; border-radius: 999px;
}
.layer-switch .opt {
  padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: rgba(255,255,255,0.65); white-space: nowrap; cursor: pointer; flex: none;
}
.layer-switch .opt.on { background: var(--accent2); color: var(--accent2-text); }

.lang-switch {
  position: absolute; top: 66px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; gap: 4px;
  background: rgba(30,28,26,0.55); backdrop-filter: blur(6px);
  padding: 4px; border-radius: 999px;
}
.lang-switch .opt {
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: rgba(255,255,255,0.65); cursor: pointer;
}
.lang-switch .opt.on { background: var(--accent2); color: var(--accent2-text); }

.unlocated-badge {
  position: absolute; left: 16px; bottom: 24px; z-index: 1000;
  background: rgba(20,18,16,0.75); backdrop-filter: blur(6px); color: #fff;
  border: none; border-radius: 999px; padding: 10px 16px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ---------- 明信片疊 ---------- */
.postcard-group { position: absolute; transform: translate(-50%, -100%); cursor: pointer; text-align: center; }
.postcard-stack { position: relative; width: 78px; height: 96px; margin: 0 auto; }
.postcard-stack .card {
  position: absolute; top: 8px; left: 0; width: 78px; height: 88px;
  background: #fff; border-radius: 5px; box-shadow: 0 4px 10px rgba(0,0,0,0.45);
  padding: 4px 4px 3px;
}
.postcard-stack .card img { width: 100%; height: 68px; object-fit: cover; border-radius: 2px; display: block; }
.postcard-stack .card .cap {
  font-size: 8px; color: #8a8580; margin-top: 3px; text-align: left; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.postcard-stack .card:not(.top) img, .postcard-stack .card:not(.top) .cap { visibility: hidden; }

.place-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(20,18,16,0.72); backdrop-filter: blur(4px);
  color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; margin-top: 6px; white-space: nowrap;
}
.place-tag .count { color: rgba(255,255,255,0.6); font-weight: 400; }

/* ---------- 底部拉起面板（相簿 / 上傳進度） ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1100;
  background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
  max-height: 33%; transform: translateY(100%);
  transition: transform .28s ease; display: flex; flex-direction: column;
}
.sheet.open { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: #e5e0da; border-radius: 99px; margin: 10px auto 4px; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 18px 10px; }
.sheet-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.sheet-title .n { color: var(--ink-soft); font-weight: 400; font-size: 12.5px; }
.sheet-close { color: var(--ink-soft); font-size: 18px; background: none; border: none; cursor: pointer; }
.sheet-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 0 14px 20px; overflow-y: auto;
}
.photo-tile { position: relative; cursor: pointer; }
.photo-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.photo-date {
  position: absolute; right: 4px; bottom: 4px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 9px; font-weight: 600;
  padding: 2px 5px; border-radius: 5px; letter-spacing: .02em;
}
.photo-heart {
  position: absolute; left: 4px; top: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.4); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer; padding: 0;
}
.photo-heart.on { color: #FF6B6B; background: rgba(255,255,255,0.85); }

/* ---------- 上傳進度 ---------- */
.upload-list { padding: 0 18px 18px; overflow-y: auto; }
.upload-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.upload-row .name { flex: 1; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-row .status { font-size: 12px; font-weight: 700; flex: none; }
.upload-row .status.ok { color: var(--accent2); }
.upload-row .status.fail { color: #D64545; }
.upload-row .status.pending { color: var(--ink-soft); }

/* ---------- 設定畫面 / 全螢幕面板共用 ---------- */
.settings-panel, .fullscreen-panel {
  position: absolute; inset: 0; z-index: 2000;
  background: var(--page-bg2);
  transform: translateX(100%);
  transition: transform .28s ease;
  display: flex; flex-direction: column;
}
.settings-panel.open, .fullscreen-panel.open { transform: translateX(0); }
.settings-header {
  padding: 18px 16px 14px;
  display: grid; grid-template-columns: 32px 1fr 32px;
  align-items: center; gap: 12px;
  border-bottom: 1px solid var(--hairline);
  background: var(--card); flex: none;
}
.settings-header > div { text-align: center; font-size: 19px; font-weight: 700; color: var(--ink); }
.settings-back { font-size: 18px; color: var(--ink-soft); background: none; border: none; cursor: pointer; justify-self: start; }
.settings-body { padding: 18px 16px; overflow-y: auto; }
.settings-section-label { font-size: 14px; font-weight: 700; color: var(--ink); margin: 4px 4px 10px; }
.settings-card {
  background: var(--card); border-radius: var(--radius2);
  box-shadow: 0px 8px 24px rgba(0,0,0,0.04);
  padding: 6px 18px; margin-bottom: 24px;
}
.share-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--hairline); gap: 10px;
}
.share-row:last-child { border-bottom: none; }
.share-phone { font-size: 15px; font-weight: 600; color: var(--ink); }
.share-status { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.share-remove { background: none; border: none; color: var(--ink-soft); font-size: 15px; cursor: pointer; }
.share-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.share-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.share-agree-btn {
  background: var(--accent2); color: var(--accent2-text);
  border: none; border-radius: 999px; padding: 8px 18px;
  font-size: 13px; font-weight: 700; cursor: pointer; flex: none;
}
.share-add-row { display: flex; gap: 8px; padding: 14px 0 16px; }
.share-input {
  flex: 1; font-size: 14px; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--hairline); background: #F2F2F7; outline: none;
}
.share-add-btn {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--accent2); color: var(--accent2-text);
  border: none; font-size: 14px; cursor: pointer;
}
.empty-hint { text-align: center; font-size: 12.5px; color: var(--ink-soft); padding: 16px 0; }

/* ---------- 待定位 ---------- */
.unlocated-hint { font-size: 12.5px; color: var(--ink-soft); text-align: center; padding: 12px 24px 4px; flex: none; }
.unlocated-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 12px 16px 90px; overflow-y: auto;
}
.unlocated-tile { position: relative; border-radius: 10px; overflow: hidden; cursor: pointer; }
.unlocated-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.unlocated-tile .check {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.85); border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; color: transparent; font-size: 12px;
}
.unlocated-tile.selected .check { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.unlocated-tile.selected img { opacity: 0.85; }
.locate-fab {
  position: absolute; right: 20px; bottom: 24px; z-index: 10;
  background: var(--accent2); color: var(--accent2-text); border: none;
  border-radius: 999px; padding: 12px 22px; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.pick-hint {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: rgba(20,18,16,0.8); color: #fff; font-size: 13px; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; z-index: 2500;
}

/* ---------- 大圖檢視 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 3000; background: rgba(10,10,10,0.96);
  display: none; align-items: center; justify-content: center; flex-direction: column;
}
.lightbox.open { display: flex; }
.lb-img { max-width: 92vw; max-height: 72vh; object-fit: contain; border-radius: 6px; }
.lb-close { position: absolute; top: 18px; right: 18px; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 50%; font-size: 16px; cursor: pointer;
}
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-bar {
  display: flex; align-items: center; gap: 10px; width: 92vw; max-width: 460px; margin-top: 18px;
}
.lb-heart, .lb-delete {
  width: 40px; height: 40px; border-radius: 50%; flex: none; border: none; cursor: pointer;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 15px;
}
.lb-heart.on { color: #FF6B6B; }
.lb-delete { color: #ff8a8a; }
.lb-caption {
  flex: 1; background: rgba(255,255,255,0.12); border: none; border-radius: 999px;
  padding: 10px 16px; color: #fff; font-size: 13px; outline: none;
}
.lb-caption::placeholder { color: rgba(255,255,255,0.5); }
