/* --- 全域變數與重置 --- */
:root {
  --primary-blue: #1e3a8a;
  --light-blue: #3b82f6;
  --bg-dark: #111827;
  --bg-gradient-start: #312e81;
  /* indigo-900 */
  --bg-gradient-mid: #1e3a8a;
  /* blue-900 */
  --bg-gradient-end: #0f172a;
  /* slate-900 */
  --accent-yellow: #facc15;
  /* yellow-400 */
  --text-dark: #1f2937;
  --text-light: #f3f4f6;
  --danger: #ef4444;
  --success: #22c55e;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft JhengHei",
    "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  height: 100vh;
  /* fallback for very old browsers */
  /* dvh 動態配合行動瀏覽器工具列，避免底部被裁切 */
  height: 100dvh;
  width: 100vw;
}

/* 修正：Root 必須佔滿畫面，否則子元素 height: 100% 會失效導致畫面空白 */
#root {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 隱藏捲軸但保持功能 */
::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* --- 通用工具類 --- */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* --- 手機外框與佈局 --- */
.app-frame {
  width: 100%;
  max-width: 480px;
  /* max-w-md */
  height: 100%;
  background-color: white;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  /* 補上 iPhone home indicator / 底部安全區，避免內容被遮蓋 */
  padding-bottom: env(safe-area-inset-bottom);
}

/* 電腦版時的圓角與邊框 */
@media (min-width: 768px) {
  .app-frame {
    height: 90vh;
    border-radius: 2.5rem;
    border: 4px solid #1f2937;
    padding-bottom: 0;
    /* 電腦版不需要安全區 padding */
  }

  /* 瀏海 */
  .notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 24px;
    background-color: #1f2937;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    z-index: 50;
    pointer-events: none;
  }
}

.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: 100%;
  background-color: #f3f4f6;
}

.view-section {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- 1. 主頁面 (Home / 大廳) --- */
.view-home {
  background: url("../images/home-bg.png") center center / cover no-repeat;
  color: #2d3748;
  text-align: center;
  padding: 1.5rem;
  align-items: center;
  /* 標題、按鈕組、Footer 三區塊上中下均勻分配 */
  justify-content: space-evenly;
  z-index: 10;
}

/* 按鈕群組容器 */
.home-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.home-bg-watercolor {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(147, 197, 253, 0.25), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(167, 243, 208, 0.2), transparent),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(253, 230, 138, 0.15), transparent);
  pointer-events: none;
}

.home-header {
  z-index: 10;
}

.home-title {
  font-size: 1.875rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
  color: #1e3a5f;
}

.home-subtitle {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
}

/* 大廳三按鈕（不規則筆觸風格） */
.home-btn-stack {
  width: 100%;
  max-width: 16rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
}

.btn-lobby {
  width: 100%;
  padding: 1rem 1.5rem;
  font-weight: bold;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  position: relative;
}

.btn-lobby:active {
  transform: scale(0.98);
}

.btn-lobby-img {
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.btn-lobby-img img {
  width: 100%;
  height: auto;
  display: block;
}

.red-dot {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 0.625rem;
  height: 0.625rem;
  background-color: var(--danger);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.footer-copy {
  flex-shrink: 0;
  margin: 0;
  font-size: 0.65rem;
  color: #9ca3af;
  z-index: 10;
}

/* --- 2. 地圖頁面 (Map / 關卡大廳) --- */
.view-map {
  background: url("../images/scene-bg.png") center center / cover no-repeat;
  background-color: #f1f5f9;
  z-index: 20;
}

/* 暗號解鎖滿版頁（與背包 view-collection 同背景與區塊節奏） */
.view-map-unlock {
  background: #fef9c3 url(../images/bag-bg.png) center / cover no-repeat;
  z-index: 20;
}

.map-unlock-page-body {
  flex: 1;
  margin: 1rem;
  padding: 1.5rem;
  border-radius: 0.5rem;
  overflow-y: auto;
}

.map-unlock-page-desc {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.55;
}

.map-unlock-trigger-icon {
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.map-unlock-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.map-unlock-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-direction: column;
}

.map-unlock-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.map-unlock-input::placeholder {
  color: #94a3b8;
}

.map-unlock-btn {
  
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem;
  background: #3a7683;
  color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.map-unlock-btn:hover {
  background: #152a45;
}

.map-unlock-message {
  margin: 0.4rem 0 0;
  min-height: 1.25em;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.35;
}

.header-bar {
  padding: 1rem 1.5rem;
  /* background-color: rgba(255, 255, 255, 0.8); */
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  width: 100%;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title {
  font-size: 1.125rem;
  font-weight: bold;
  color: var(--text-dark);
  margin: 0;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  /* 瀏覽器預設 button padding 會讓圓形內圖片（大頭貼）周圍露出底色 */
  padding: 0;
}

.icon-btn-gray {
  background: none;
  color: #374151;
}

/* .icon-btn-gray:hover {
  background-color: #e5e7eb;
} */

.icon-btn-yellow {
  background-color: #d9d9d9;
  color: #374151;
  font-size: 1.125rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.icon-btn-yellow:hover {
  background-color: #c9c9c9;
}

/* 大廳頂欄大頭貼（與返回鈕同為 gray，僅此鈕套底色） */
.header-bar .icon-btn:has(#map-user-avatar) {
  background-color: #d9d9d9;
}

.header-bar .icon-btn:has(#map-user-avatar):hover {
  background-color: #c9c9c9;
}

.btn-bag {
  padding: 0;
}

.bag-btn-icon {
  width: 72%;
  height: 72%;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.back-btn-icon,
.close-btn-icon {
  width: 12px;
  height: 12px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

/* 返回／關閉：Figma Stroke 0.5px inside、#3F3F3F */
.icon-btn-gray:has(.back-btn-icon),
.icon-btn-gray:has(.close-btn-icon) {
  box-sizing: border-box;
  border: 0.5px solid #3f3f3f;
}

.game-header-btn .back-btn-icon,
.game-header-btn .close-btn-icon {
  filter: brightness(0) invert(1);
}

.level-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.level-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  width: 100%;
}

.level-wrapper.left {
  justify-content: flex-start;
}

.level-wrapper.right {
  justify-content: flex-end;
}

.level-item {
  width: 9rem;
  height: 9rem;
  border-radius: 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  text-align: center;
  position: relative;
  transition: transform 0.2s;
  border: 2px solid #3A7683;
  cursor: pointer;
  overflow: hidden;
}

.level-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  margin: 0;
  border-radius: 0;
  pointer-events: none;
}

.level-title {
  position: relative;
  z-index: 1;
  font-weight: bold;
  /* 與劇情對話框 .dialogue-text 一致 */
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
}

/* 有縮圖的關卡：標題疊在圖片底部 */
.level-item:has(.level-thumb) .level-title {
  color: #fff;
  text-align: center;
  padding: 1.35rem 0.5rem 0.5rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  margin-top: auto;
}

.level-completed {
  background-color: white;
  border-color: var(--success);
  box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.2);
}

.check-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  font-size: 0.75rem;
  z-index: 1;
}

.level-unlocked {
  background-color: white;
  border-color: #3A7683;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2);
  animation: pulseSlow 3s infinite;
}

.level-unlocked:hover {
  transform: scale(1.05);
}

.level-locked {
  background-color: transparent;
  border-color: #5b5c5c7b;
  cursor: not-allowed;
  padding: 1rem;
  align-items: center;
  justify-content: center;
}

/* 底層：灰底 + 去色 + 淡化（僅此層，isolation 避免影響鎖頭合成） */
.level-locked-muted {
  position: absolute;
  inset: 0;
  background-color: #e5e7eb;
  border-radius: inherit;
  filter: grayscale(100%);
  opacity: 0.8;
  z-index: 0;
  pointer-events: none;
  isolation: isolate;
}

/* 前景：疊在底層之上，鎖頭不套用任何 filter */
.level-locked-front {
  position: relative;
  z-index: 1;
  flex: 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  filter: none;
}

.level-locked .level-title {
  position: relative;
  color: #1f2937;
  padding: 0;
  margin-top: 0.5rem;
  background: none;
  text-shadow: none;
  filter: grayscale(100%);
  opacity: 0.8;
}

.level-locked .lock-icon {
  filter: none;
  opacity: 1;
}

.lock-icon {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

@keyframes pulseSlow {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.03);
  }
}

/* --- 3. 遊戲頁面 (Game) --- */
.view-game {
  background-color: black;
  z-index: 30;
}

.game-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 60;
  color: white;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

.game-header-btn {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
}

.game-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.game-header .btn-bag {
  background-color: #d9d9d9;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  backdrop-filter: none;
}

.game-header .btn-bag:hover {
  background-color: #c9c9c9;
}

.game-header .game-header-btn.game-header-avatar {
  background-color: #d9d9d9;
  backdrop-filter: none;
}

.game-header .game-header-btn.game-header-avatar:hover {
  background-color: #c9c9c9;
}

.game-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-header-avatar {
  overflow: hidden;
  padding: 0;
}

.game-title-display {
  font-weight: bold;
  font-size: 0.875rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.progress-container {
  position: absolute;
  top: 3.5rem;
  left: 0;
  width: 100%;
  height: 4px;
  z-index: 50;
}

.progress-bar {
  height: 100%;
  background-color: #DBF074;
  width: 0%;
  transition: width 0.5s;
  box-shadow: 0 0 10px rgba(140, 150, 80, 0.75);
}

.game-content {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.hint-btn-wrapper {
  position: absolute;
  bottom: 2rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hint-btn {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-blue);
  border-radius: 2rem;
  padding: 0.5rem 0.5rem;
  border: 2px solid #3A7683;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.hint-icon-img {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
}

.hint-btn:active {
  transform: scale(0.95);
}

.reset-btn {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border-radius: 1.5rem;
  padding: 0.35rem 0.65rem;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.reset-btn:hover {
  background: rgba(220, 38, 38, 0.95);
}

.reset-btn:active {
  transform: scale(0.95);
}

.hint-modal {
  position: absolute;
  bottom: 5.5rem;
  right: 1rem;
  z-index: 50;
  width: 16rem;
  background: rgba(255, 255, 255, 0.98);
  padding: 1rem;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #bfdbfe;
  font-size: 0.875rem;
}

.hint-modal-text {
  color: #374151;
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}

/* Game Templates Styles */
/* Dialogue */
.scene-container {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #111827;
}

.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-char-container {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 300px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.scene-char-img {
  height: 85vh;
  width: auto;
  object-fit: contain;
  /* 白色描邊感：對應設計稿 Drop shadow x/y/blur 0、spread 1、#fff 50%（drop-shadow 無 spread，以 1px blur 近似） */
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.5)) drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  transition: transform 0.5s ease-out, opacity 0.5s;
  opacity: 0;
  transform: translateY(30px);
}

.dialogue-box-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 1rem;
  padding-bottom: 6rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
}

.dialogue-box {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.808);
  backdrop-filter: blur(8px);
  border: 2px solid #3A7683;
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  position: relative;
}

/* .dialogue-box.dialogue-bubble {
  border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
} */
.bubble-tail {
  position: absolute;
  bottom: -10px;
  left: 1.5rem;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.dialogue-box:active {
  transform: scale(0.99);
}

.speaker-tag {
  display: inline-block;
  font-weight: bold;
  color: #3f3f3f;
  background: #dbf074;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  /* Figma：Drop shadow 0/0、blur 0、spread 1、#FFFFFF 50% */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.dialogue-text {
  color: #1f2937;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.click-hint {
  text-align: right;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #9ca3af;
  animation: bounce 1s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

/* Choice */
.choice-container {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #1f2937;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.choice-question-box {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem;
  border-radius: 1.5rem;
  text-align: center;
  color: white;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 20rem;
  position: relative;
  z-index: 10;
}

.choice-options-grid {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 20rem;
  position: relative;
  z-index: 10;
}

.choice-btn {
  background-color: white;
  color: #1f2937;
  font-family: inherit;
  font-weight: bold;
  /* 與劇情對話框 .dialogue-text 一致 */
  font-size: 1rem;
  line-height: 1.6;
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  border: none;
  border-left: 4px solid #3A7683;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s;
}

.choice-btn:hover {
  background-color: #eff6ff;
}

.choice-btn:active {
  transform: scale(0.98);
}

/* Puzzle */
.puzzle-container {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: black;
  display: flex;
  flex-direction: column;
}

.camera-view {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.camera-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0a1628;
}

.scan-frame {
  width: 16rem;
  height: 16rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 1.5rem;
  position: relative;
}

.scan-corner {
  position: absolute;
  width: 2rem;
  height: 2rem;
  border-color: var(--success);
  border-style: solid;
}

.tl {
  top: -2px;
  left: -2px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 0.75rem;
}

.tr {
  top: -2px;
  right: -2px;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 0.75rem;
}

.bl {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 0.75rem;
}

.br {
  bottom: -2px;
  right: -2px;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 0.75rem;
}

.scan-line {
  background: linear-gradient(to bottom, transparent, #22c55e, transparent);
  height: 20%;
  width: 100%;
  position: absolute;
  animation: scan 2s linear infinite;
}

@keyframes scan {
  0% {
    top: -20%;
    opacity: 0;
  }

  100% {
    top: 100%;
    opacity: 0;
  }
}

.puzzle-ui {
  background-color: #111827;
  padding: 1.5rem;
  border-top-left-radius: 1.5rem;
  border-top-right-radius: 1.5rem;
  z-index: 20;
  padding-bottom: 4rem;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* 僅一顆按鈕時（如掃描 QR）水平置中 */
.puzzle-grid:has(> :only-child) {
  grid-template-columns: 1fr;
  justify-items: center;
}

.puzzle-btn {
  padding: 1rem;
  border-radius: 1rem;
  font-weight: bold;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.btn-green {
  background-color: var(--success);
}

.btn-blue {
  background-color: #2563eb;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.code-input {
  flex: 1;
  background: #1f2937;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #374151;
  outline: none;
}

.code-submit {
  background-color: #374151;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

/* Complete（與個人中心 .view-profile 同一背景） */
.complete-container {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #f5f0e8;
  /* 圖片上方疊淡淡黑色遮罩，提升前景可讀性（多層背景：前者畫在上層） */
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.22),
      rgba(255, 255, 255, 0.22)
    ),
    url(../images/scene-bg.png);
  background-position: center, center;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.celebrate-icon {
  width: 8rem;
  height: 8rem;
  background-color: #fef9c3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  margin-bottom: 1.5rem;
  animation: bounce 2s infinite;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.complete-title {
  font-size: 1.875rem;
  font-weight: 900;
  margin-bottom: 1.25rem;
  color:#2f3b58;

}

.complete-desc {
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 2.5rem;
}

.complete-card {
  width: 100%;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
  background: #f5f3ed;
  border: 1px solid #3a7683;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.complete-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.complete-stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  white-space: nowrap;
}

.complete-stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: #db4b41;
  letter-spacing: 0.05em;
}

.complete-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.85rem 0;
}

.complete-badges-row {
  align-items: flex-start;
}

.complete-badges-value {
  font-size: 0.85rem;
  color: #9ca3af;
}

.complete-badges-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.complete-badge-item {
  font-size: 0.8rem;
  background: #fdffef;
  color: #3a7683;
  border: 1px solid #3a7683;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-weight: 500;
}

.complete-lobby-hint {
  width: 100%;
  max-width: 20rem;
  margin: 0 0 1.25rem;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #4b5563;
  font-weight: 500;
  text-align: center;
}

.complete-lobby-hint-emphasis-place {
  color: #3a7683;
  font-weight: 600;
}

.complete-lobby-hint-emphasis-code {
  color: #d95c4c;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.btn-dark {
  width: 100%;
  padding: 0.85rem;
  background: #2f3b58;
  color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-dark:hover {
  background-color: black;
  transform: scale(1.02);
}

/* Input（姓名輸入） */
.input-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.input-container .scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
  /* 避免背景圖層在部分裝置上攔截點擊／聚焦，導致無法點進輸入框 */
  pointer-events: none;
}

.input-box-wrapper {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 1.5rem;
  width: 100%;
  max-width: min(20rem, 100%);
  min-width: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.input-prompt {
  font-size: 1.125rem;
  font-weight: bold;
  color: #1f2937;
  margin: 0 0 1rem 0;
  text-align: center;
  overflow-wrap: break-word;
}

.input-field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  min-width: 0;
  width: 100%;
}

.input-prefix {
  font-size: 1rem;
  color: #6b7280;
  white-space: nowrap;
}

.input-name {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
}

.btn-submit-name {
  width: 100%;
}

/* Timer（計時選擇） */
.timer-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.timer-container .scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
}

.timer-content-box {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 1.5rem;
  width: 100%;
  max-width: 20rem;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.timer-text {
  font-size: 1rem;
  color: #374151;
  margin: 0 0 1.5rem 0;
  line-height: 1.6;
}

.btn-timer-finish {
  width: 100%;
}

/* Handbook（手冊閱讀） */
.handbook-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.handbook-container .scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
}

.handbook-content-box {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.98);
  padding: 2rem;
  border-radius: 1.5rem;
  width: 100%;
  max-width: 22rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 2px solid #e5e7eb;
}

.handbook-title {
  font-size: 1.25rem;
  font-weight: bold;
  color: #1e40af;
  margin: 0 0 1rem;
  text-align: center;
}

.handbook-instruction {
  font-size: 1rem;
  color: #374151;
  margin: 0 0 1rem;
  line-height: 1.6;
}

.handbook-page-preview {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.6;
}

.btn-handbook-done {
  width: 100%;
}

/* CodeInput（暗號輸入） */
.code-input-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.code-input-container .scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
}

.code-input-box {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.808);
  padding: 2rem;
  backdrop-filter: blur(8px);
  border: 2px solid #3A7683;
  border-radius: 1.5rem;
  width: 100%;
  max-width: 20rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.code-input-title {
  font-size: 1.125rem;
  font-weight: bold;
  color: #1f2937;
  margin: 0 0 0.5rem;
}

.code-input-desc {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

/* Confirm（確認按鈕） */
.confirm-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.confirm-container .scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
}

.confirm-content-box {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.98);
  padding: 2rem;
  border-radius: 1.5rem;
  width: 100%;
  max-width: 20rem;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.confirm-text {
  font-size: 1rem;
  color: #374151;
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

/* Badge（徽章彈窗） */
.badge-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 1.5rem;
  pointer-events: auto;
}

.badge-modal {
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  padding: 2rem;
  border-radius: 1.5rem;
  text-align: center;
  max-width: 18rem;
  width: 100%;
  border: 3px solid #f59e0b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 61;
}

.badge-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.75rem;
}

.badge-name {
  font-size: 1.25rem;
  font-weight: bold;
  color: #92400e;
  margin: 0 0 0.5rem;
}

.badge-desc {
  font-size: 0.9rem;
  color: #78350f;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

/* --- 4. 個人中心 (Profile) --- */
.view-profile {
  background: #f5f0e8 url(../images/member-bg.png) center / cover no-repeat;
  z-index: 20;
}

.profile-card {
  background: transparent;
  padding: 1rem 1.5rem;
  position: relative;
  z-index: 1;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.profile-meta {
  flex: 1;
}

.avatar-wrapper {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background-color: #e5e7eb;
  overflow: hidden;
  border: 2px solid #d1d5db;
  flex-shrink: 0;
}

.avatar-wrapper-upload {
  position: relative;
  display: block;
  cursor: pointer;
}

.avatar-wrapper-upload:focus-within {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.55);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 50%;
  pointer-events: none;
}

.avatar-wrapper-upload:hover .avatar-upload-overlay,
.avatar-wrapper-upload:active .avatar-upload-overlay {
  opacity: 1;
}

/* 觸控裝置勿常駐半透明遮罩（會讓大頭貼一直發灰）；僅在按下時顯示「更換」提示 */
@media (hover: none) {
  .avatar-wrapper-upload:active .avatar-upload-overlay {
    opacity: 1;
  }
}

.avatar-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.username {
  font-size: 1.125rem;
  font-weight: bold;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
}

.edit-btn {
  color: #9ca3af;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.lv-badge {
  display: flex;
  align-items: center;
}

.user-title-badge {
  color: #166534;
  font-weight: 600;
  font-size: 0.8rem;
  background: #bbf7d0;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

.profile-progress-card {
  background: #f5f3ed;
  border: 1px solid #3a7683;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.profile-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.section-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.75rem;
}

.section-label-progress {
  margin: 0;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.bar-track-explore {
  flex: 1;
  width: 100%;
  background-color: #e5e7eb;
  height: 0.5rem;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-pct {
  font-size: 1rem;
  font-weight: bold;
  color: #d95c4c;
  min-width: 2.5rem;
  text-align: right;
  flex-shrink: 0;
}

.bar-fill-explore {
  height: 100%;
  border-radius: 9999px;
  background: #d95c4c;
}

.btn-share-card {
  /* 與 .btn-auth-primary 一致：主色青綠、白邊、底部立體陰影 */
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem;
  background: #3a7683;
  color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.btn-share-card:hover {
  background: #326873;
}

.btn-share-card:focus-visible {
  outline: 2px solid #3a7683;
  outline-offset: 2px;
}

.profile-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-change-pwd {
  box-sizing: border-box;
  padding: 0.85rem;
  background: #ffffff;
  color: #3a7683;
  border: 1px solid #3a7683;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-change-pwd:hover {
  background: rgba(58, 118, 131, 0.06);
}

.btn-change-pwd:focus-visible {
  outline: 2px solid #3a7683;
  outline-offset: 2px;
}

.btn-logout {
  /* 與 .btn-google-auth 一致：珊瑚色、白邊、底部立體陰影 */
  box-sizing: border-box;
  padding: 0.85rem;
  background: #d95c4c;
  color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-logout:hover {
  background: #c54e3f;
}

.btn-logout:focus-visible {
  outline: 2px solid #d95c4c;
  outline-offset: 2px;
}

/* --- 5. 收藏品頁面 (Collection / 背包) --- */
.view-collection {
  background: #fef9c3 url(../images/bag-bg.png) center / cover no-repeat;
  z-index: 20;
}

.collection-notebook {
  flex: 1;
  margin: 1rem;
  padding: 1.5rem;
  /* border: 2px dashed #dc2626; */
  border-radius: 0.5rem;
  /* background: rgba(255, 255, 255, 0.5); */
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.collection-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.collection-tab {
  flex: 1;
  padding: 0.55rem 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #57534e;
  background: rgba(255, 255, 255, 0.65);
  border: 2px solid #d6d3d1;
  border-radius: 0.5rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.collection-tab:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: #a8a29e;
}

.collection-tab-active {
  color: #991b1b;
  background: #fef2f2;
  border-color: #b91c1c;
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.12);
}

.collection-tab:focus-visible {
  outline: 2px solid #b91c1c;
  outline-offset: 2px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  align-content: flex-start;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.collection-grid-badges {
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
}

.collection-grid-empty-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 10rem;
}

.collection-tab-empty {
  margin: 0;
  padding: 0 1rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #57534e;
  max-width: 22rem;
}

.collect-item {
  aspect-ratio: 1/1;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #d1d5db;
  background: rgba(255, 255, 255, 0.8);
  cursor: default;
}

.collect-item.collect-has {
  border-color: #b91c1c;
  border-style: solid;
  cursor: pointer;
  background: #fef2f2;
}

.collect-item.collect-has:not(.collect-badge-item) {
  position: relative;
  overflow: hidden;
  padding: 0;
}

.collect-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.collect-item:not(.collect-badge-item) .collect-thumb {
  position: absolute;
  inset: 0;
  padding: 0.35rem;
}

.collect-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.25rem;
  pointer-events: none;
}

.collect-thumb-fallback-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.collect-badge-item {
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem;
  text-align: center;
  aspect-ratio: auto;
  min-height: 5.25rem;
}

.collect-badge-item .collect-thumb {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
}

.collect-badge-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #44403c;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.collect-empty {
  background: #f3f4f6;
}

.collect-q {
  color: #9ca3af;
  font-size: 1.25rem;
  font-weight: bold;
  opacity: 0.6;
}

/* --- 6. 排行榜頁面 (Ranking) --- */
.view-ranking {
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
  z-index: 20;
}

.ranking-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.ranking-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: #166534;
  margin: 0 0 1rem;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid #dcfce7;
}

.ranking-item-me {
  border-color: #22c55e;
  background: #f0fdf4;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.ranking-rank {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #22c55e;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.ranking-item:nth-child(1) .ranking-rank {
  background: #eab308;
}

.ranking-item:nth-child(2) .ranking-rank {
  background: #94a3b8;
}

.ranking-item:nth-child(3) .ranking-rank {
  background: #b45309;
}

.ranking-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #e5e7eb;
  background: #f3f4f6;
}

.ranking-item-me .ranking-avatar {
  border-color: #22c55e;
}

.ranking-name {
  flex: 1;
  font-weight: 600;
  color: #1f2937;
}

.ranking-title {
  font-size: 0.75rem;
  color: #16a34a;
  background: #dcfce7;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

.ranking-progress {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.fact-card {
  background: linear-gradient(to bottom right, #f0fdf4, #ecfdf5);
  padding: 1.5rem;
  border-radius: 1.5rem;
  font-size: 0.875rem;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid #dcfce7;
}

/* --- Modal --- */
.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-card {
  background-color: white;
  border-radius: 1.5rem;
  padding: 2rem;
  width: 100%;
  max-width: 20rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #1f2937;
  margin-bottom: 0.25rem;
  text-align: center;
}

/* 登入/註冊全頁面（未登入首頁） */
.view-auth {
  background: url("../images/login-bg.png") center center / cover no-repeat;
  background-color: #e0f2fe;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 2rem 1.5rem;
  overflow-y: auto;
}

.auth-page-illustration {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.auth-page-card {
  width: 100%;
  max-width: 22rem;
  background: url("../images/login-bgw.png") center center / cover no-repeat;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
}

.auth-input {
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  background: #f9fafb;
}

.auth-input::placeholder {
  color: #9ca3af;
}

.auth-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  cursor: pointer;
}

.auth-forgot {
  font-size: 0.875rem;
  color: var(--light-blue);
}

.btn-auth-primary {
  background: #3a7683;
  color: #ffffff;
  border: 1px solid #ffffff;
  padding: 0.85rem;
  border-radius: 8px;
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.btn-auth-primary:hover {
  background: #326873;
}

.btn-auth-primary:focus-visible {
  outline: 2px solid #3a7683;
  outline-offset: 2px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: #9ca3af;
  font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.btn-google-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem;
  border: 1px solid #ffffff;
  border-radius: 8px;
  background: #d95c4c;
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  box-sizing: border-box;
}

.btn-google-auth:hover {
  background: #c54e3f;
}

.btn-google-auth:focus-visible {
  outline: 2px solid #d95c4c;
  outline-offset: 2px;
}

.google-icon {
  font-weight: bold;
  font-size: 1.1rem;
}

.auth-switch {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  margin: 1rem 0 0;
}

.auth-switch a {
  color: var(--light-blue);
  margin-left: 0.25rem;
  font-weight: 500;
}

/* 通用訊息 Modal（alert / confirm / prompt） */
.app-modal-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.75rem 1.5rem 1.5rem;
}

.app-modal-text {
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.65;
  margin: 0;
  text-align: center;
  white-space: pre-wrap;
}

.app-modal-input-row {
  display: flex;
}

.app-modal-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid #d1d5db;
  border-radius: 0.6rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.app-modal-input:focus {
  border-color: var(--light-blue);
}

.app-modal-btns {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
}

.app-modal-btn {
  padding:  0.85rem;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  width: 100%;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}

.app-modal-btn:active {
  opacity: 0.75;
}

.app-modal-btn-cancel {
  box-sizing: border-box;
  padding: 0.85rem;
  background: #ffffff;
  color: #3a7683;
  border: 1px solid #3a7683;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.app-modal-btn-ok {
  box-sizing: border-box;
  padding: 0.85rem;
  background: #3a7683;
  color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

/* 登入/註冊 Modal（參考設計） */
.modal-auth {
  max-width: 22rem;
}

.auth-illustration {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-line {
  background-color: #06c755;
  color: white;
  border: none;
  padding: 0.85rem;
  border-radius: 0.75rem;
  font-weight: bold;
  cursor: pointer;
}

.btn-google {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 0.85rem;
  border-radius: 0.75rem;
  font-weight: bold;
  cursor: pointer;
}

.btn-cancel {
  margin-top: 1rem;
  color: #9ca3af;
  font-size: 0.875rem;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  cursor: pointer;
}

/* 物品展開彈窗（筆記本風格） */
.modal-item-card {
  background: #fefce8;
  border: 2px dashed #dc2626;
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: 20rem;
  width: 90%;
  position: relative;
}

.modal-item-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  box-sizing: border-box;
  border: 0.5px solid #3f3f3f;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-item-img {
  width: 100%;
  max-height: 12rem;
  object-fit: contain;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.modal-item-img:not([src]),
.modal-item-img[src=""] {
  display: none;
}

.modal-item-name {
  font-size: 1.25rem;
  font-weight: bold;
  color: #1f2937;
  margin: 0 0 0.5rem;
}

.modal-item-desc {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
}