:root {
  --bg-top: #fffbeb;
  --bg-bottom: #fef3c7;
  --card: #ffffff;
  --honey: #f59e0b;
  --honey-dark: #d97706;
  --honey-deep: #92400e;
  --honey-soft: #fef3c7;
  --honey-border: #fde68a;
  --bee-brown: #451a03;
  --leaf: #10b981;
  --leaf-dark: #059669;
  --leaf-soft: #d1fae5;
  --pink: #f43f5e;
  --text: #451a03;
  --muted: #92400e;
  --shadow: 0 8px 20px rgba(217, 119, 6, 0.12);
  --card-shadow: 0 4px 12px rgba(180, 83, 9, 0.08);
  --tabbar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  background-color: #f59e0b;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  font-family: "PingFang TC", "Heiti TC", "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, #fff7ed 50%, var(--bg-bottom) 100%);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

body.auth-mode {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

body.has-floating-bar {
  padding-bottom: calc(var(--tabbar-h) + 98px + env(safe-area-inset-bottom, 0px));
}

body.ipad-standalone .topbar {
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-bottom: 8px;
}
body.ipad-standalone .lb-top {
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
body.ipad-standalone .app-tabbar {
  padding-bottom: max(8px, calc(env(safe-area-inset-bottom, 0px) - 6px));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: radial-gradient(#f59e0b 1.2px, transparent 1.2px), radial-gradient(#f59e0b 1.2px, #fffbeb 1.2px);
  background-size: 36px 36px;
  background-position: 0 0, 18px 18px;
  z-index: 0;
}

.floating-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.deco-item {
  position: absolute;
  font-size: 22px;
  opacity: 0.36;
  animation: floatAround 8s ease-in-out infinite;
}
.deco-item:nth-child(1) { top: 8%; left: 5%; animation-delay: 0s; }
.deco-item:nth-child(2) { top: 18%; right: 6%; animation-delay: 1.5s; font-size: 18px; }
.deco-item:nth-child(3) { top: 55%; left: 4%; animation-delay: 3s; font-size: 20px; }
.deco-item:nth-child(4) { top: 75%; right: 5%; animation-delay: 2s; }
.deco-item:nth-child(5) { top: 38%; right: 8%; animation-delay: 4s; font-size: 16px; }

@keyframes floatAround {
  0%, 100% { transform: translateY(0px) rotate(-4deg); }
  50% { transform: translateY(-12px) rotate(6deg); }
}

@keyframes beeBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.04); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 6px 22px rgba(245, 158, 11, 0.42); }
}

/* ==================== 頂部橫幅與共用導覽列 ==================== */
.line-banner {
  display: none;
  position: relative;
  z-index: 60;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border-bottom: 2px solid #f59e0b;
  color: var(--bee-brown);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
}
.line-banner.show {
  display: block;
}
.line-banner-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.line-copy-btn {
  background: #fffbeb;
  border: 2px solid #d97706;
  color: var(--bee-brown);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
}
.line-copy-feedback {
  font-size: 12px;
  color: #065f46;
  font-weight: 800;
}

.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 55%, #f59e0b 100%);
  color: var(--bee-brown);
  padding: calc(11px + var(--safe-top)) max(14px, env(safe-area-inset-right, 14px)) 11px max(14px, env(safe-area-inset-left, 14px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.22);
  border-bottom: 3px solid #d97706;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.back-btn {
  background: #fffbeb;
  border: 2px solid #d97706;
  color: var(--bee-brown);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #d97706;
  transition: transform 0.1s;
}
.back-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.topbar-title {
  font-size: 16.5px;
  font-weight: 900;
  color: var(--bee-brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: #fffbeb;
  border: 2px solid #d97706;
  color: var(--bee-brown);
  padding: 6px 10px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  box-shadow: 0 2px 0 #d97706;
}
.icon-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}
.icon-btn.fav-pill {
  background: #fff1f2;
  border-color: #fb7185;
  color: #be123c;
  box-shadow: 0 2px 0 #fda4af;
}
.icon-btn.install-pill {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  box-shadow: 0 2px 0 #6ee7b7;
}

/* ==================== 主容器與分頁外殼 ==================== */
.app-main {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.container {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 680px;
  min-width: 0;
  margin: 0 auto;
  padding: 14px max(12px, env(safe-area-inset-right, 12px)) 14px max(12px, env(safe-area-inset-left, 12px));
}

.container.wide-container {
  max-width: 1080px;
}

.tab-pane {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ==================== 安裝教學視窗 ==================== */
.install-close {
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid #f59e0b;
  color: var(--bee-brown);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.install-guide-steps {
  text-align: left;
  margin: 4px 0 10px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--bee-brown);
}
.install-guide-steps li {
  margin-bottom: 6px;
}
.install-guide-note {
  text-align: left;
  background: #fffbeb;
  border: 1.5px dashed #fcd34d;
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #92400e;
}

/* ==================== 統一登入畫面 ==================== */
.mascot-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: beeBounce 2.6s ease-in-out infinite;
}

.auth-card {
  background: #ffffff;
  border-radius: 26px;
  padding: 26px 20px;
  margin: 14px auto;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 3px solid #fbbf24;
  position: relative;
}

.auth-badge {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  font-size: 12.5px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1.5px solid #fde68a;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 21px;
  font-weight: 900;
  color: var(--bee-brown);
  margin: 6px 0 8px;
}

.auth-desc {
  font-size: 13.5px;
  color: #78350f;
  margin: 0 0 14px;
  line-height: 1.6;
  background: #fffbeb;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px dashed #fcd34d;
}

.hint-box {
  background: #fef3c7;
  border: 1.5px solid #fbbf24;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--bee-brown);
  line-height: 1.5;
}

.auth-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 16.5px;
  font-weight: 700;
  border: 2.5px solid #fcd34d;
  border-radius: 14px;
  text-align: center;
  outline: none;
  margin-bottom: 12px;
  background: #fffdf5;
  color: var(--bee-brown);
}
.auth-input:focus {
  border-color: var(--honey);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.primary-btn {
  width: 100%;
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: var(--bee-brown);
  border: 2px solid #d97706;
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 16.5px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #d97706;
  transition: transform 0.1s;
}
.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d97706;
}
.primary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.error-msg {
  color: var(--pink);
  font-size: 13.5px;
  font-weight: 800;
  margin-top: 10px;
  min-height: 20px;
}

/* ==================== 畢冊模組樣式 ==================== */
.hero-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2.5px solid #fbbf24;
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-text {
  flex: 1;
  min-width: 0;
}
.hero-title {
  font-size: 15.5px;
  font-weight: 900;
  color: var(--bee-brown);
  margin-bottom: 3px;
}
.hero-sub {
  font-size: 12.5px;
  color: #92400e;
  line-height: 1.45;
}

.honey-meter-wrap {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
  border: 1px solid #fde68a;
}
.honey-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  width: 0%;
  transition: width 0.4s ease;
}

.my-kid-shortcut {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 2.5px solid #10b981;
  border-radius: 18px;
  padding: 12px 15px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #10b981, var(--card-shadow);
}
.my-kid-shortcut:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #10b981;
}

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 2px solid #fde68a;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  color: var(--bee-brown);
  outline: none;
}
.search-input:focus {
  border-color: var(--honey);
}

.filter-select {
  padding: 10px 10px;
  border: 2px solid #fde68a;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  background: #fff;
  color: var(--bee-brown);
  flex-shrink: 0;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.folder-card {
  background: var(--card);
  border: 2.5px solid #fde68a;
  border-radius: 16px;
  padding: 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 3px 0 #fde68a, var(--card-shadow);
  transition: transform 0.12s, border-color 0.15s;
  user-select: none;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.folder-card:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #fde68a;
}
.folder-card.complete {
  border-color: #6ee7b7;
  box-shadow: 0 3px 0 #6ee7b7, 0 4px 12px rgba(16, 185, 129, 0.1);
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}
.folder-card.my-own {
  border-color: #f59e0b;
  box-shadow: 0 3px 0 #f59e0b, 0 0 0 4px rgba(245, 158, 11, 0.28);
  background: linear-gradient(180deg, #fffdf5 0%, #fef3c7 100%);
  scroll-margin-top: 90px;
  animation: pulseGlow 2.4s infinite;
}
.folder-card.locked-other {
  opacity: 0.72;
}

.folder-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.folder-name-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.bee-folder-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #fef3c7;
  border: 1.5px solid #fcd34d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.folder-card.complete .bee-folder-icon {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.folder-name {
  font-size: 15.5px;
  font-weight: 900;
  color: var(--bee-brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  color: #b45309;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.folder-card.complete .info-dot {
  background: var(--leaf);
  border-color: var(--leaf-dark);
  color: #fff;
}

.folder-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-weight: 800;
}
.badge.done {
  background: var(--leaf-soft);
  border-color: #6ee7b7;
  color: #065f46;
}
.badge.partial {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #b45309;
}

.kid-welcome-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2.5px solid #fbbf24;
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
  text-align: center;
}
.kid-welcome-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--bee-brown);
  margin: 4px 0 6px;
}
.kid-welcome-msg {
  font-size: 13.5px;
  color: #78350f;
  line-height: 1.55;
  margin: 0;
}

.honey-drops {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.honey-drop {
  font-size: 13px;
  filter: grayscale(1) opacity(0.35);
  transition: transform 0.2s, filter 0.2s;
}
.honey-drop.lit {
  filter: none;
  transform: scale(1.1);
}

.rule-banner {
  background: #ffffff;
  border: 2px solid #fde68a;
  border-radius: 16px;
  padding: 13px 15px;
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #78350f;
  box-shadow: var(--card-shadow);
}
.rule-banner strong {
  color: #b45309;
}

.batch-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.batch-box {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 2.5px dashed #f59e0b;
  border-radius: 18px;
  padding: 15px 14px;
  text-align: center;
  cursor: pointer;
  animation: pulseGlow 3s infinite;
  transition: transform 0.1s;
}
.batch-box:active {
  transform: scale(0.985);
}
.batch-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--bee-brown);
  margin-bottom: 4px;
}
.batch-sub {
  font-size: 12.5px;
  color: #92400e;
  font-weight: 600;
}

.pick-from-album-btn {
  width: 100%;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 2px solid #10b981;
  color: #065f46;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 14.5px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 3px 0 #10b981, var(--card-shadow);
}
.pick-from-album-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #10b981;
}

.slot-group-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--bee-brown);
  margin: 18px 2px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(254, 243, 199, 0.75);
  padding: 7px 12px;
  border-radius: 12px;
  border: 1.5px solid #fde68a;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.slot-card {
  background: #ffffff;
  border: 2.5px solid #fde68a;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 0 #fde68a, var(--card-shadow);
  transition: transform 0.1s;
  min-width: 0;
}
.slot-card:active {
  transform: scale(0.985);
}
.slot-card.uploaded {
  border-color: #6ee7b7;
  box-shadow: 0 3px 0 #6ee7b7, var(--card-shadow);
}
.slot-card.staged {
  border-color: var(--honey);
  box-shadow: 0 3px 0 var(--honey), 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.slot-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #fffdf5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}
.slot-preview.portrait-box {
  aspect-ratio: 3 / 4;
}
.slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cloud-thumb-overlay {
  position: absolute;
  left: 6px;
  bottom: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(69, 26, 3, 0.72);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
}

.slot-empty-wrap {
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.slot-empty-icon {
  font-size: 32px;
  margin-bottom: 6px;
}
.slot-empty-text {
  font-size: 14px;
  font-weight: 900;
  color: var(--bee-brown);
}
.slot-empty-hint {
  font-size: 11.5px;
  color: #b45309;
  margin-top: 3px;
  font-weight: 600;
}

.slot-footer {
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-top: 1.5px solid #fef3c7;
  gap: 6px;
}

.slot-filename {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  color: var(--bee-brown);
  min-width: 0;
}

.img-badge-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.slot-card.uploaded .img-badge-icon {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.slot-status-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  flex-shrink: 0;
}
.slot-card.uploaded .slot-status-tag {
  background: var(--leaf-soft);
  color: #065f46;
}
.slot-card.staged .slot-status-tag {
  background: #fef3c7;
  color: #b45309;
}

/* 蜂巢點燈牆 */
.honeycomb-section {
  background: linear-gradient(180deg, #fffdf5 0%, #fef3c7 100%);
  border: 2.5px solid #fbbf24;
  border-radius: 20px;
  padding: 12px 12px 14px;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
}
.honeycomb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.honeycomb-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--bee-brown);
  display: flex;
  align-items: center;
  gap: 5px;
}
.honeycomb-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 800;
  color: #92400e;
}
.honeycomb-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 4px 2px;
}
.hex-wrap {
  position: relative;
  width: 44px;
  height: 48px;
  cursor: pointer;
  transition: transform 0.16s ease;
  filter: drop-shadow(0 2px 3px rgba(180, 83, 9, 0.16));
}
.hex-wrap:hover, .hex-wrap:active {
  transform: translateY(-3px) scale(1.08);
  z-index: 4;
}
.hex-cell {
  width: 100%;
  height: 100%;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fffbeb;
  color: #92400e;
  font-weight: 900;
  line-height: 1.05;
  padding-top: 2px;
  position: relative;
}
.hex-cell::before {
  content: "";
  position: absolute;
  inset: 2px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  pointer-events: none;
}
.hex-cell.empty {
  background: linear-gradient(180deg, #ffffff 0%, #fef3c7 100%);
  color: #b45309;
  opacity: 0.78;
}
.hex-cell.partial {
  background: linear-gradient(180deg, #fde68a 0%, #fbbf24 100%);
  color: #451a03;
}
.hex-cell.done {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 55%, #10b981 100%);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(69, 26, 3, 0.5);
}
.hex-wrap.my-hex {
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.85));
  animation: beeBounce 2.2s ease-in-out infinite;
  z-index: 3;
}
.hex-wrap.my-hex .hex-cell {
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 100%);
  color: #451a03;
}
.hex-icon { font-size: 12px; }
.hex-no { font-size: 11px; font-weight: 900; }

/* 跨頁預覽與證書 */
.kid-magic-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}
.magic-btn {
  background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 15px;
  padding: 11px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 900;
  color: var(--bee-brown);
  cursor: pointer;
  box-shadow: 0 3px 0 #d97706, var(--card-shadow);
  transition: transform 0.1s;
}
.magic-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #d97706;
}
.magic-btn.cert-btn {
  background: linear-gradient(135deg, #ecfdf5 0%, #a7f3d0 100%);
  border-color: #10b981;
  color: #064e3b;
  box-shadow: 0 3px 0 #059669, var(--card-shadow);
}

.yearbook-book {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
.yearbook-page {
  background: radial-gradient(#fde68a 1px, #fffdf7 1px);
  background-size: 18px 18px;
  border: 2.5px solid #f59e0b;
  border-radius: 18px;
  padding: 14px 12px;
  box-shadow: inset 0 0 18px rgba(245, 158, 11, 0.12), 0 4px 12px rgba(69, 26, 3, 0.08);
  position: relative;
}
.yearbook-page-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--bee-brown);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(254, 243, 199, 0.9);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #fcd34d;
}
.polaroid-grid-life-h {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.polaroid-grid-life-v {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 74%;
  margin: 0 auto;
}
.polaroid-grid-growth {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}
.polaroid-family-wrap {
  max-width: 68%;
  margin: 0 auto;
}
.deadline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  color: #be123c;
  border: 1.5px solid #fda4af;
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 900;
  margin-top: 6px;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.1);
}
.polaroid-item {
  background: #ffffff;
  padding: 6px 6px 18px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(69, 26, 3, 0.14);
  border: 1px solid #fde68a;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s;
}
.polaroid-item:nth-child(odd) { transform: rotate(-1.3deg); }
.polaroid-item:nth-child(even) { transform: rotate(1.3deg); }
.polaroid-item:hover { transform: rotate(0deg) scale(1.03); z-index: 3; }
.polaroid-tape {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 38px;
  height: 11px;
  background: rgba(251, 191, 36, 0.55);
  border-radius: 2px;
  z-index: 2;
}
.polaroid-img-box {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #fffbeb;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #b45309;
  font-weight: 800;
}
.polaroid-img-box.vert { aspect-ratio: 3 / 4; }
.polaroid-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.polaroid-cap {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10.5px;
  font-weight: 900;
  color: #78350f;
}

.cert-frame {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #fde68a 100%);
  border: 4px double #d97706;
  border-radius: 18px;
  padding: 18px 14px;
  position: relative;
  box-shadow: inset 0 0 0 2px #fff, 0 8px 20px rgba(217, 119, 6, 0.18);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
@keyframes certPopAnim {
  0% { transform: scale(1); }
  35% { transform: scale(1.045) rotate(-1deg); box-shadow: inset 0 0 0 2px #fff, 0 0 28px rgba(245, 158, 11, 0.65); }
  70% { transform: scale(1.02) rotate(1deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.cert-frame.cert-pop { animation: certPopAnim 0.55s ease; }
.cert-seal {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 12px;
  border-radius: 99px;
  box-shadow: 0 3px 8px rgba(180, 83, 9, 0.35);
  margin-top: 8px;
}

.delete-pill {
  background: rgba(244, 63, 94, 0.92);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

/* ==================== 歷年相簿模組樣式 ==================== */
.ph-hero-banner {
  background: #ffffff;
  border: 2.5px solid #fbbf24;
  border-radius: 20px;
  padding: 13px 15px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ph-offline-card {
  background: #fff;
  border: 2.5px solid #fbbf24;
  border-radius: 22px;
  padding: 28px 20px;
  text-align: center;
  max-width: 440px;
  margin: 24px auto;
  box-shadow: var(--shadow);
}
.ph-offline-card .hero-emoji { font-size: 46px; margin-bottom: 8px; }
.ph-offline-card h2 { font-size: 19px; font-weight: 900; margin: 0 0 8px; }
.ph-offline-card p { font-size: 13.5px; color: #78350f; line-height: 1.6; margin: 0 0 16px; }

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.action-btn {
  background: #fff;
  border: 2px solid #fbbf24;
  color: var(--bee-brown);
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 #fcd34d;
  white-space: nowrap;
}
.action-btn.primary {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  border-color: #d97706;
  box-shadow: 0 2px 0 #d97706;
}
.action-btn.active {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  box-shadow: 0 2px 0 #10b981;
}
.action-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.breadcrumbs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13.5px;
  font-weight: 800;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.crumb {
  background: #fff;
  border: 1.5px solid #fde68a;
  padding: 5px 11px;
  border-radius: 99px;
  cursor: pointer;
  color: var(--bee-brown);
  flex-shrink: 0;
  white-space: nowrap;
}
.crumb.current {
  background: #fef3c7;
  border-color: #f59e0b;
  cursor: default;
}

.class-tabs {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: 7px;
  margin-bottom: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 2px 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.class-tabs::-webkit-scrollbar { display: none; }
.class-tab {
  background: #fff;
  border: 2px solid #fde68a;
  color: var(--bee-brown);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #fde68a;
}
.class-tab.active {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  border-color: #d97706;
  color: var(--bee-brown);
  box-shadow: 0 2px 0 #d97706;
}

.album-group { margin-bottom: 18px; }
.album-group:last-child { margin-bottom: 4px; }
.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 9px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid #fde68a;
  border-left: 5px solid var(--group-accent, #f59e0b);
  border-radius: 12px;
}
.group-title {
  font-size: 14.5px;
  font-weight: 900;
  color: var(--bee-brown);
  display: flex;
  align-items: center;
  gap: 6px;
}
.group-meta {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--muted);
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 2px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.theme-bee { --group-accent: #f59e0b; --group-soft: #fef3c7; --card-border: #fcd34d; --group-ink: #b45309; }
.theme-orange { --group-accent: #fb923c; --group-soft: #ffedd5; --card-border: #fdba74; --group-ink: #c2410c; }
.theme-bear { --group-accent: #b45309; --group-soft: #fef3c7; --card-border: #e5c07b; --group-ink: #78350f; }
.theme-dolphin { --group-accent: #0ea5e9; --group-soft: #e0f2fe; --card-border: #bae6fd; --group-ink: #0369a1; }
.theme-other { --group-accent: #f59e0b; --group-soft: #fef3c7; --card-border: #fde68a; --group-ink: #b45309; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
@media (min-width: 640px) {
  .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
}
@media (min-width: 900px) {
  .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
}

.album-card {
  background: #fff;
  border: 2px solid var(--card-border, #fde68a);
  border-top: 4px solid var(--group-accent, #f59e0b);
  border-radius: 16px;
  padding: 11px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.album-card:active { transform: scale(0.98); }
.album-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.album-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--group-soft, #fef3c7);
  border: 1.5px solid var(--card-border, #fcd34d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.album-date {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--group-ink, #b45309);
  background: var(--group-soft, #fffbeb);
  border: 1px solid var(--card-border, #fde68a);
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-name {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.38;
  color: var(--bee-brown);
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.album-meta {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  padding-top: 6px;
  border-top: 1px dashed #fde68a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}
.album-meta > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-arrow { color: var(--group-accent, #d97706); font-weight: 900; flex-shrink: 0; }

.dir-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 640px) { .dir-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } }
@media (min-width: 900px) { .dir-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } }
.dir-card {
  background: #fff;
  border: 2px solid #fde68a;
  border-radius: 14px;
  padding: 10px 11px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.dir-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.dir-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--bee-brown);
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.section-title {
  font-size: 14.5px;
  font-weight: 900;
  margin: 14px 0 8px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 640px) { .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } }
@media (min-width: 900px) { .media-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; } }

.media-card {
  position: relative;
  background: #fff;
  border: 2px solid #fde68a;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.08);
}
.media-card.selected {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}
.media-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #fef3c7;
}
.media-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(69, 26, 3, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  pointer-events: none;
}

/* 網格愛心收藏鈕（左上角，不與右上角多選打勾重疊） */
.fav-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  background: rgba(69, 26, 3, 0.48);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  z-index: 2;
}
.fav-btn.is-fav {
  background: #fff1f2;
  border-color: #f43f5e;
  transform: scale(1.06);
}

.check-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(69, 26, 3, 0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
}
.select-mode .check-dot,
.media-card.selected .check-dot { display: flex; }
.media-card.selected .check-dot { background: #10b981; }

.other-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.other-item {
  background: #fff;
  border: 2px solid #fde68a;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
  color: var(--bee-brown);
  font-weight: 700;
  font-size: 13.5px;
  min-width: 0;
}
.other-item > span:first-child { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.other-item > span:last-child { flex-shrink: 0; white-space: nowrap; }

.load-more-wrap { text-align: center; margin-top: 16px; }
.empty-box {
  background: #fff;
  border: 2px dashed #fcd34d;
  border-radius: 18px;
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

/* ==================== 浮動操作列（位於底部雙分頁列上方） ==================== */
.floating-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  z-index: 52;
  background: rgba(255, 251, 235, 0.97);
  backdrop-filter: blur(8px);
  border-top: 2.5px solid #f59e0b;
  padding: 9px max(14px, env(safe-area-inset-right, 14px)) 9px max(14px, env(safe-area-inset-left, 14px));
  box-shadow: 0 -4px 16px rgba(217, 119, 6, 0.16);
  display: none;
}
.floating-action-bar.show {
  display: block;
}
.bottom-bar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bottom-info {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--bee-brown);
  min-width: 0;
}
.bottom-sub {
  font-size: 11.5px;
  color: #92400e;
  font-weight: 700;
}
.bottom-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.upload-now-btn,
.bottom-btn {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  color: #fff;
  border: 2px solid #059669;
  padding: 9px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 3px 0 #059669;
}
.upload-now-btn:active,
.bottom-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* ==================== 底部原生雙分頁列 ==================== */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  background: rgba(255, 253, 245, 0.98);
  backdrop-filter: blur(10px);
  border-top: 2px solid #fcd34d;
  padding: 5px max(10px, env(safe-area-inset-right, 10px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 10px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  box-shadow: 0 -3px 14px rgba(180, 83, 9, 0.12);
}

.tab-btn {
  border: 2px solid transparent;
  background: transparent;
  color: #92400e;
  border-radius: 14px;
  padding: 6px 8px;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.tab-btn.active {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  color: var(--bee-brown);
}
.tab-btn-top {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 900;
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 99px;
  background: #fffbeb;
  border: 1px solid #fbbf24;
  color: #b45309;
}
.tab-btn.active .tab-badge {
  background: #ffffff;
}
.tab-sub {
  font-size: 10.5px;
  font-weight: 700;
  color: #b45309;
}

/* ==================== 燈箱 ==================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 10, 4, 0.95);
  display: none;
  flex-direction: column;
  color: #fff;
}
.lightbox.open { display: flex; }
.lb-top {
  padding: calc(12px + var(--safe-top)) max(14px, env(safe-area-inset-right, 14px)) 12px max(14px, env(safe-area-inset-left, 14px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.5);
}
.lb-title-wrap {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.lb-title {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-spec-badge {
  font-size: 11px;
  font-weight: 800;
  color: #fde68a;
}
.lb-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.lb-fav-btn {
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  height: 36px;
  padding: 0 11px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.lb-fav-btn.is-fav {
  background: #f43f5e;
  border-color: #fda4af;
}
.lb-close {
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.lb-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}
.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  z-index: 2;
}
.lb-prev { left: 10px; }
.lb-next { right: 10px; }

.lb-bottom {
  padding: 10px max(12px, env(safe-area-inset-right, 12px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 12px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.55);
}
.lb-yearbook-btn {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: var(--bee-brown);
  border: 2px solid #d97706;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 900;
  cursor: pointer;
}
.lb-dl {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.lb-share {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  color: #fff;
  border: 2px solid #059669;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.lb-share:disabled { opacity: 0.7; cursor: wait; }
.lb-sel {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.lb-sel.on { background: #10b981; border-color: #10b981; }

/* ==================== ❤️ 候選收藏夾面板 ==================== */
.fav-drawer {
  position: fixed;
  inset: 0;
  z-index: 88;
  background: rgba(69, 26, 3, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  justify-content: flex-end;
}
.fav-drawer.open { display: flex; }
.fav-sheet {
  background: #fffbeb;
  border-top: 3px solid #f59e0b;
  border-radius: 24px 24px 0 0;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.fav-sheet-head {
  padding: 14px 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 2px solid #fcd34d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.fav-sheet-title { font-size: 16px; font-weight: 900; color: var(--bee-brown); }
.fav-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}
.fav-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 640px) { .fav-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fav-item {
  position: relative;
  background: #fff;
  border: 2px solid #fde68a;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  cursor: pointer;
}
.fav-item.checked {
  border-color: #10b981;
  box-shadow: 0 0 0 2.5px rgba(16, 185, 129, 0.35);
}
.fav-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.fav-item-check {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(69, 26, 3, 0.55);
  border: 2px solid #fff;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fav-item.checked .fav-item-check { background: #10b981; }
.fav-item-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(244, 63, 94, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.fav-item-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(69, 26, 3, 0.72);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-sheet-foot {
  padding: 11px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 2px solid #fde68a;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

/* ==================== 共用 Modal 與 Toast ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(69, 26, 3, 0.58);
  backdrop-filter: blur(3px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal-card {
  background: #ffffff;
  border: 3px solid #fbbf24;
  border-radius: 24px;
  max-width: 440px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 18px;
  box-shadow: 0 12px 32px rgba(69, 26, 3, 0.28);
  text-align: center;
}
.modal-card.wide-modal {
  max-width: 650px;
  padding: 18px 14px;
}
.modal-title {
  font-size: 18.5px;
  font-weight: 900;
  color: var(--bee-brown);
  margin: 0 0 10px;
}
.modal-body {
  font-size: 14px;
  color: #78350f;
  line-height: 1.6;
  margin-bottom: 16px;
}
.progress-track {
  width: 100%;
  height: 14px;
  background: #fef3c7;
  border: 1.5px solid #fbbf24;
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  width: 0%;
  transition: width 0.25s;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-secondary {
  background: #fef3c7;
  color: var(--bee-brown);
  border: 2px solid #fcd34d;
  padding: 10px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: var(--bee-brown);
  border: 2px solid #d97706;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #d97706;
}
.btn-danger {
  background: linear-gradient(180deg, #fb7185 0%, #e11d48 100%);
  color: #ffffff;
  border: 2px solid #be123c;
  padding: 10px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #be123c;
}

.slot-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.slot-picker-btn {
  background: #fffbeb;
  border: 2px solid #fbbf24;
  border-radius: 12px;
  padding: 9px 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--bee-brown);
  cursor: pointer;
}
.slot-picker-btn.occupied {
  background: #fef3c7;
  border-color: #f59e0b;
}

.toast {
  position: fixed;
  top: calc(66px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 140;
  background: #451a03;
  color: #fffbeb;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 700;
  max-width: 92vw;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  display: none;
  line-height: 1.45;
  text-align: center;
}
.toast.show { display: block; }

.confetti-piece {
  position: fixed;
  top: -30px;
  z-index: 200;
  font-size: 22px;
  pointer-events: none;
  animation: fallDown 2.8s linear forwards;
}
@keyframes fallDown {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

.footer-note {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  margin-top: 22px;
  padding: 8px;
}

/* ==================== 響應式微調（手機零溢出） ==================== */
@media (max-width: 639px) {
  .toolbar { gap: 6px; }
  .toolbar .search-input {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
  .toolbar .action-btn {
    flex: 1 1 auto;
    text-align: center;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 12.5px;
  }
}

@media (max-width: 520px) {
  .folder-grid { gap: 8px; }
  .folder-card { padding: 10px 8px; gap: 6px; }
  .folder-card-top { gap: 4px; }
  .folder-name-wrap { gap: 5px; }
  .bee-folder-icon { width: 22px; height: 22px; border-radius: 7px; font-size: 13px; }
  .folder-name { font-size: 12.5px; letter-spacing: -0.02em; }
  .info-dot { width: 18px; height: 18px; font-size: 10px; }
  .badge { font-size: 10.5px; padding: 3px 6px; }
}

@media (max-width: 480px) {
  .ph-hero-banner { padding: 11px 13px; margin-bottom: 10px; border-radius: 16px; }
  .install-banner { padding: 8px 11px; margin-bottom: 10px; font-size: 12px; }
  .bottom-bar-inner { flex-direction: column; align-items: stretch; gap: 8px; }
  .bottom-actions { width: 100%; }
  .bottom-actions .action-btn,
  .bottom-actions .bottom-btn,
  .upload-now-btn { flex: 1; text-align: center; }
}

@media (max-width: 420px) {
  .topbar {
    padding: calc(10px + var(--safe-top)) max(10px, env(safe-area-inset-right, 10px)) 10px max(10px, env(safe-area-inset-left, 10px));
    gap: 5px;
  }
  .topbar-right,
  .topbar-actions { gap: 4px; }
  .topbar-title { font-size: 14.5px; }
  .back-btn { width: 32px; height: 32px; font-size: 15px; }
  .icon-btn { padding: 5px 8px; font-size: 11.5px; }
}

@media (max-width: 360px) {
  .folder-name { font-size: 11.5px; }
  .badge { font-size: 10px; padding: 2px 5px; }
  .album-card { padding: 9px; gap: 6px; }
  .album-name { font-size: 13px; }
  .album-date { font-size: 10px; padding: 2px 5px; }
}
