/* ===================================================
   麻糬喵 & 水豚君 - 日系暖白奶咖 (Latte & Mochi) 療癒風格
   =================================================== */

:root {
  --bg-main: #fcf6ef;
  --bg-gradient: linear-gradient(180deg, #fdf8f3 0%, #faefe3 100%);
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.9);
  --shadow-soft: 0 8px 24px rgba(180, 145, 125, 0.12);
  --shadow-card: 0 4px 14px rgba(160, 125, 105, 0.08);
  
  --text-title: #523a28;
  --text-body: #7c624e;
  --text-muted: #aa917d;
  
  --accent-pink: #ff85a1;
  --accent-rose: #ffccd5;
  --accent-orange: #f77f00;
  --accent-gold: #f4a261;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-gradient);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft JhengHei", sans-serif;
  color: var(--text-title);
  touch-action: none;
}

/* 主畫面容器 */
.app-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 10px 14px 12px;
}

/* ================= 頂部區塊 ================= */
.top-header {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  pointer-events: auto;
}

/* 頂部兩側裝飾徽章 */
.header-decor-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: -15px;
}

.cloud-badge-left {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-body);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.discovery-badge-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.badge-pill {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-title);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.badge-subtitle {
  font-size: 9.5px;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.25;
}

/* 標題雲朵面板 */
.main-title-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-radius: 26px;
  padding: 8px 24px 6px;
  text-align: center;
  box-shadow: 
    0 8px 20px rgba(180, 140, 120, 0.12),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  z-index: 12;
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.title-text {
  font-size: 23px;
  font-weight: 800;
  color: #4a3222;
  letter-spacing: 1px;
}

.title-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-orange);
  background: #fff3e6;
  padding: 1px 7px;
  border-radius: 10px;
}

.tagline {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

/* ================= 核心畫布與引導標籤 ================= */
.pet-stage {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 240px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  margin: 2px 0 4px;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 浮動部位引導標籤層 (Guide Pins) - 預設隱藏，讓玩家隨意自由摸摸探索 */
.pins-layer {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.pins-layer.visible {
  display: block;
}

.pin-bubble {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  cursor: pointer;
}

.pin-node {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--card-border);
  box-shadow: 0 3px 8px rgba(160, 130, 110, 0.16);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-title);
  white-space: nowrap;
}

.pin-sound {
  background: rgba(255, 245, 240, 0.9);
  border: 1px dashed #ffb8c6;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  color: #d84a75;
  font-weight: 600;
  white-space: nowrap;
}

.pin-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-pink);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(255, 133, 161, 0.6);
}

/* ================= 秘密反應任務橫向列 ================= */
.secret-section {
  position: relative;
  width: 100%;
  z-index: 10;
  margin-bottom: 8px;
}

.secret-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 6px;
  padding-left: 4px;
}

.secret-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.secret-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 58px;
  cursor: pointer;
}

.secret-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.secret-card.unlocked {
  background: linear-gradient(135deg, #fffaf5 0%, #fff0f3 100%);
  border-color: #ffccd5;
}

.secret-task-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-title);
  line-height: 1.25;
}

.secret-task-desc {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.25;
  margin: 3px 0 4px;
}

.secret-badge-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f4ede4;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 11px;
  font-weight: 800;
  transition: all 0.3s ease;
}

.secret-card.unlocked .secret-badge-icon {
  background: var(--accent-pink);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(255, 117, 143, 0.45);
}

/* ================= 底部導航欄 ================= */
.bottom-nav-bar {
  position: relative;
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-soft);
  z-index: 10;
}

.nav-item-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 2px;
  border-radius: 16px;
  transition: all 0.15s ease;
  outline: none;
}

.nav-item-btn:active {
  background: rgba(255, 240, 230, 0.8);
  transform: scale(0.95);
}

.nav-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: #fdf5ec;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(170, 135, 115, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #5a3c26;
  transition: all 0.2s ease;
}

.nav-item-btn.active .nav-icon-circle {
  background: #ff758f;
  color: #ffffff;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-title);
}

.nav-sublabel {
  font-size: 8.5px;
  color: var(--text-muted);
}

/* 最底端溫柔標語 */
.bottom-quote {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ================= 模態彈窗 (圖鑑、ASMR、設定) ================= */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(40, 25, 15, 0.45);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #fffdfa;
  border-radius: 28px;
  padding: 22px 18px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 16px 36px rgba(50, 30, 15, 0.25);
  border: 2px solid #ffffff;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-title);
  text-align: center;
}

.char-switch-list {
  display: flex;
  gap: 10px;
}

.char-card {
  flex: 1;
  background: #fdf5ec;
  border: 2px solid transparent;
  border-radius: 20px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.char-card.selected {
  border-color: #ff758f;
  background: #fff0f3;
}

.char-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.char-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-title);
}

.char-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-btn-close {
  width: 100%;
  padding: 11px;
  background: #ff758f;
  color: #ffffff;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 117, 143, 0.35);
}

/* 首次發聲提示 */
.sound-banner {
  position: relative;
  margin: 4px auto 0;
  background: rgba(255, 117, 143, 0.92);
  backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 117, 143, 0.25);
  z-index: 15;
  animation: floatBounce 2.2s infinite ease-in-out;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: inline-block;
  text-align: center;
}

.sound-banner.hidden {
  display: none;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
