:root {
  /* 森林綠配色（取代原本的桃杏＋珊瑚配色——珊瑚紅偏向刻板印象裡「女性向」的粉色系，
     改用沉穩的森林綠當主色，不分性別、也更符合「溝通中間人」這種需要信任感的定位）。
     --accent 是舊變數名稱，這裡刻意保留、指到新的 --brand，避免整份 CSS 上百處引用都要跟著改名——
     新寫的規則請直接用 --brand，--accent 只是為了不動到既有規則而留著的相容別名。 */
  --cream: #f3f0e6;
  --paper: #fbfaf6;
  --paper-raised: #fff;
  --ink: #26332c;
  --muted: #6b7a6e;
  --faint: #aebcae;
  --line: #dbe3da;

  --brand: #2f6b52;       /* 主色（森林綠）：行銷/導覽層 CTA、App 內所有主要操作按鈕 */
  --brand-tint: #e1ebe3;
  --brand-soft: #24543f;  /* hover 用 */
  --brand-ink: #1d4433;   /* 綠色文字疊在 brand-tint 或白/米色底時用這個，直接用 --brand 對比度不夠 */

  --a-color: #2f6b52;     /* A 使用者＝主色本人 */
  --a-tint: #e1ebe3;
  --b-color: #b5793f;     /* 暖赭色，唯一不是使用者指定、專門讓 A/B 在逐字稿能區分開的互補色（跟綠色主色拉開對比） */
  --b-tint: #f6ead9;
  --b-ink: #6b4423;       /* 赭色文字疊在 b-tint 或白底時用這個 */

  --love-color: #c99a3a;  /* 只用在跟錢有關的東西：幣值、解鎖按鈕、收據文字 */
  --love-tint: #f8f0dd;
  --love-ink: #7d5c19;    /* 金色文字疊在 love-tint 或白底時用這個 */
  --on-love: #26332c;     /* 金色實心按鈕上的文字要用深色，不能像白底按鈕那樣直接用白字 */

  --ai-color: #6b7a6e;    /* 中性灰綠：AI 已經改用角色圖識別，不再靠顏色，這裡只是備援值 */
  --ai-tint: #eef1ec;

  --danger: #b23a2e;
  --accent: var(--brand); /* 相容別名，見上方說明 */

  --radius: 18px;
  --shadow: 0 10px 30px rgba(30, 45, 35, 0.08);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", -apple-system,
    BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--brand) 100%);
  color: var(--ink);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* 每個畫面（.screen）預設都用這組規則置中卡片——寬螢幕/桌機瀏覽器下才不會貼在左上角。
   #room 是唯一例外（header/body/controls 上下排列的整頁版面，不是單一置中卡片），
   下面 #room 的規則會覆寫 align-items/justify-content。 */
.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---------------- AI 引導員吉祥物（共用元件，房間中央的圓球跟每處 AI 對話泡泡都用它） ----------------
   SVG 本體只在 index.html 定義一次（<symbol id="mascot-icon">），這裡的規則只負責容器大小/背景/呼吸動畫，
   每個使用的地方各自用行內 style 或外層 class 決定要多大（房間中央 46px、對話泡泡 20px 左右）。 */

.mascot-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--paper-raised);
  flex-shrink: 0;
}

.mascot-svg { display: block; }

@keyframes mascot-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.mascot-idle { animation: mascot-breathe 3.2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .mascot-idle { animation: none; }
}

/* ---------------- 大廳 / 帳號 / 配對 ---------------- */

.card {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  border: 1px solid var(--line);
}

/* ---------------- 品牌素材（跟 ChatGPT 協作產出的森林綠版本圖像，取代原本純文字/emoji） ---------------- */

.logo-icon {
  height: 30px;
  width: auto;
  vertical-align: middle;
  margin-right: 4px;
}

.btn-icon-img {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 6px;
  object-fit: contain;
}

/* 首頁展示頁專用：大幅 Hero 圖，三張照片自動淡入淡出輪播當背景，
   文字疊在漸層上——取代原本的三張並排小縮圖，讓整個板塊更凸顯、更有份量 */
.landing-hero {
  position: relative;
  height: 260px;
  border-radius: 16px;
  overflow: hidden;
  margin: 4px 0 18px;
}

/* 每張輪播照片都是一個 .hero-slide（照片 + 那張搭配的標題/副標），整格淡入淡出切換，
   不是照片跟文字分開輪播——這樣才能讓每張照片配到專屬的文案。 */
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.hero-slide.active { opacity: 1; }

.hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.landing-hero-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, rgba(29, 68, 51, 0) 0%, rgba(20, 41, 31, 0.55) 45%, rgba(15, 33, 24, 0.88) 100%);
}

.landing-hero-title {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 6px;
  text-wrap: balance;
}

.landing-hero-title .hero-text-highlight {
  color: var(--love-color);
  font-weight: 800;
}

.landing-hero-subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0;
}

/* ---------------- 桌機專屬排版：展示頁／配對頁在夠寬的螢幕上改成左右雙欄 ----------------
   手機/窄螢幕維持原本單欄（Hero 疊在最上面），這條規則只在螢幕真的夠寬時生效——
   Hero 圖固定在左欄、右欄放其餘內容（功能介紹、狀態文字、操作按鈕），
   兩欄用同一個 flex 容器對齊高度，不用另外量高度或用 JS 算。 */
@media (min-width: 880px) {
  #landingScreen .card,
  #pairingScreen .card {
    max-width: 1040px;
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    column-gap: 36px;
  }

  #landingScreen .pairing-head,
  #pairingScreen .pairing-head {
    flex: 1 1 100%;
  }

  #landingScreen .landing-hero,
  #pairingScreen .landing-hero {
    flex: 1 1 380px;
    min-width: 0;
    height: auto;
    margin: 0;
  }

  #landingScreen .content-column,
  #pairingScreen .content-column {
    flex: 1 1 380px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  #landingScreen .landing-hero-title,
  #pairingScreen .landing-hero-title {
    font-size: 24px;
  }
}

/* 進房前自評頁（checkinScreen）比照首頁做桌機雙欄：左邊放「進房間之後會怎麼樣？」步驟走馬燈，
   右邊放實際自評表單——手機版維持單欄，DOM 上表單先寫、走馬燈接在下面，桌機再用 order 把走馬燈搬到左邊。 */
@media (min-width: 880px) {
  #checkinScreen .card {
    max-width: 1040px;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    column-gap: 36px;
  }

  #checkinScreen .pairing-head {
    flex: 1 1 100%;
  }

  #checkinScreen .content-column {
    flex: 1 1 380px;
    min-width: 0;
    order: 2;
  }

  #checkinScreen .checkin-usage-column {
    flex: 1 1 380px;
    min-width: 0;
    order: 1;
  }

  #checkinScreen .checkin-usage-column .usage-steps {
    margin: 0;
  }
}

/* 首頁展示頁專用：五步驟 icon 功能介紹（深綠底跟卡片本身的米白底拉出對比），
   桌機/手機共用同一組排版，不特別為手機拆版——卡片本身寬度本來就固定，兩邊看起來一樣 */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: var(--brand-soft);
  border-radius: 14px;
  padding: 16px 6px;
  margin: 4px 0 12px;
}

.feature-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.feature-tile img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  margin-bottom: 2px;
}

.feature-title {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.feature-desc {
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.35;
}

.feature-tagline {
  text-align: center;
  font-size: 13px;
  color: var(--brand-ink);
  background: var(--brand-tint);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 18px;
}

/* ---------------- 操作說明：手機截圖三連拍，放在「進入房間」按鈕下面 ---------------- */
.usage-steps {
  margin: 8px 0 20px;
}

.usage-steps-title {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 14px;
}

/* 一次只顯示一張，左右箭頭按鈕切換步驟——桌機/手機共用同一組（卡片本身寬度固定，
   兩邊本來就長一樣），phone 可以放大一點，反正同時只有一張在畫面上 */
.usage-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.usage-carousel-nav {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.usage-carousel-nav:hover { background: var(--cream); }

.usage-carousel-viewport {
  width: 190px;
  flex-shrink: 0;
}

.usage-carousel-slide {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.usage-carousel-slide.active { display: flex; }

.usage-phone {
  background: #17231d;
  border-radius: 24px;
  padding: 6px;
  box-shadow: var(--shadow);
  width: 190px;
}

.usage-phone-zoomable { cursor: zoom-in; }

.usage-phone-screen {
  background: var(--cream);
  border-radius: 17px;
  overflow: hidden;
}

.usage-phone-shot {
  width: 100%;
  display: block;
  height: 335px;
  object-fit: cover;
  object-position: top;
}

.usage-step-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.usage-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 4px;
}

.usage-carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  border: none;
  padding: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.usage-carousel-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.usage-zoom-hint {
  text-align: center;
  font-size: 11px;
  color: var(--faint);
  margin: 0;
}

@media (max-width: 420px) {
  .usage-carousel-viewport,
  .usage-phone { width: 168px; }
  .usage-phone-shot { height: 296px; }
}

/* 點截圖放大看的浮層 */
.usage-zoom-card {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
}

.usage-zoom-card img {
  display: block;
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(0, 0, 0, 0.35));
}

.usage-zoom-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-mascot {
  display: flex;
  justify-content: center;
  margin: 16px 0 2px;
}

.landing-mascot img {
  width: 76px;
  height: auto;
}

/* 訪客最先看到的兩個畫面，角落露出一點淡淡的裝飾花紋，不搶內容的注意力 */
#authScreen, #landingScreen {
  background-image: url("images/decoration-hearts-faint.png");
  background-repeat: no-repeat;
  background-position: right -80px bottom -80px;
  background-size: 420px;
}

h1 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
}

h1 .subtitle {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 4px;
}

.logo-coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  background: var(--love-tint);
  color: var(--love-ink); /* 跟錢有關的文字用 love 色系，不用 brand */
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}

.logo-coin-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--love-color);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}

.logo-coin-add-btn:hover { background: var(--love-ink); }

.lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 14px 0 22px;
}

.field {
  display: block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}

.field > span {
  display: block;
  margin-bottom: 6px;
}

.quiz-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-ink);
  text-decoration: none;
}

.quiz-link:hover { text-decoration: underline; }

.field-section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-section-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--line);
}

.personality-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.personality-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}

.personality-chip input { width: auto; margin: 0; }

.personality-chip:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-ink);
}

input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-family: inherit;
}

textarea { resize: vertical; }

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

.inline-field {
  display: flex;
  gap: 8px;
}

.inline-field input { flex: 1; min-width: 0; }

.btn-primary, .btn-ghost, .control-btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-weight: 600;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  margin-top: 6px;
}

.btn-primary:hover { background: var(--brand-soft); }

/* 「進入我們之間」按鈕裡的「之間」（品牌名）用顯眼的金色跳出來，其餘文字維持白色 */
.btn-brand-highlight {
  color: var(--love-color);
  font-weight: 800;
}

.btn-ghost {
  padding: 10px 14px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.btn-ghost:hover { background: var(--cream); }

.share-box {
  margin-top: 18px;
  padding: 14px;
  background: var(--cream);
  border-radius: 12px;
  font-size: 13px;
}

.share-box p { margin: 0 0 8px; color: var(--muted); }

/* ---------------- 帳號 tabs ---------------- */

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
}

.auth-tab.active {
  /* 文字用 --brand-ink 不用 --accent：珊瑚色直接當文字疊在白底上對比度不夠，底線本身是圖形元素不受這限制 */
  color: var(--brand-ink);
  border-bottom-color: var(--accent);
}

.auth-form.hidden { display: none; }

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-oauth:hover { background: var(--cream); }

.oauth-icon { width: 18px; height: 18px; flex-shrink: 0; }

.auth-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -6px 0 16px;
  font-size: 13px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-field input { width: auto; margin: 0; }

.btn-text-link-inline {
  background: none;
  border: none;
  color: var(--brand-ink);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.btn-text-link-inline:hover { text-decoration: underline; }

/* ---------------- 配對畫面 ---------------- */

.pairing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.pairing-head h1 { min-width: 0; }

.pairing-head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* .btn-ghost 原本是給 <button> 用的，這裡疊給 <a> 用要補上連結會多帶的預設樣式 */
.pairing-head-actions a.btn-ghost {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.saved-note {
  color: #2f6e4f;
  font-size: 13px;
  margin-top: 12px;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 20px 0;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--line);
}

.divider span { padding: 0 12px; }

.invite-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  background: var(--cream);
  border-radius: 12px;
  margin-bottom: 14px;
}

.invite-code-box span {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.waiting-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot-blink 1.4s infinite ease-in-out;
}

@keyframes pulse-dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------------- 錢包 / 儲值 ---------------- */

.package-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}

.package-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  gap: 10px;
}

.package-card:hover { border-color: var(--accent); }
.package-card.loading { opacity: 0.5; pointer-events: none; }
.package-card[disabled] { opacity: 0.5; cursor: default; }

.package-name { font-weight: 700; font-size: 14px; }

.package-coin {
  font-size: 14px;
  font-weight: 700;
  color: var(--love-ink); /* 幣值用 love 色系，不用 brand（brand 保留給主要操作按鈕） */
  flex: 1;
  text-align: center;
}

.package-coin em {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  font-style: normal;
}

.package-price {
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- 我有話說 ---------------- */

.btn-block-ghost {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 10px;
}

/* 首頁最常用的三個功能（我有話說／心情筆記／我們之間）並排成大按鈕，比下面的列狀按鈕更顯眼 */
.home-btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.home-btn-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  min-width: 0;
}

.home-btn-grid-item:hover { background: var(--cream); }

.home-btn-grid-item img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.home-btn-grid-item span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  line-height: 1.3;
}

.inbox-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--a-tint);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.mood-reminder-banner { background: var(--love-tint); }

/* ---------------- 心情筆記：提醒設定 + 手動記錄 ---------------- */
.mood-reminder-block {
  background: var(--cream);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.mood-reminder-time-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.mood-reminder-time-row select {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13.5px;
  background: #fff;
}

.mood-reminder-hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

#moodManualForm {
  background: var(--cream);
  border-radius: 12px;
  padding: 16px;
  margin: 10px 0 16px;
}

/* 進房前自評（綠色）跟手動記錄（金色）用左邊粗線區分來源，一眼就看得出來 */
.notes-item.mood-entry-checkin { border-left: 4px solid var(--brand); }
.notes-item.mood-entry-manual { border-left: 4px solid var(--love-color); }

.mood-entry-source {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.mood-entry-checkin .mood-entry-source { background: var(--brand-tint); color: var(--brand-ink); }
.mood-entry-manual .mood-entry-source { background: var(--love-tint); color: var(--love-ink); }

.cost-note {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--cream);
  padding: 10px 12px;
  border-radius: 10px;
  margin: 14px 0;
}

.recording-timer {
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  margin: 20px 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse-dot-blink 1.4s infinite ease-in-out;
}

.playback-row { margin: 14px 0; }
.playback-row audio { width: 100%; }

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
  margin-bottom: 12px;
}

.cbubble {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.cbubble.ai {
  align-self: flex-start;
  background: var(--ai-tint);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cbubble.ai .mascot-avatar { margin-top: 1px; }

.cbubble.me {
  align-self: flex-end;
  background: var(--a-tint);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.chat-input-row input { flex: 1; min-width: 0; }

.whs-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-text-danger {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  padding: 6px;
  font-family: inherit;
}

.btn-text-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
  margin-bottom: 10px;
  font-family: inherit;
  text-align: center;
}

.whs-schedule-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.whs-schedule-row input[type="datetime-local"] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
}

.whs-drafts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
  max-height: 320px;
  overflow-y: auto;
}

.whs-draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--cream);
  border-radius: 12px;
  font-size: 13.5px;
}

.whs-draft-meta { color: var(--muted); }

.whs-draft-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-text-link:hover { text-decoration: underline; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
}

.disclaimer {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 20px;
  text-align: center;
}

/* ---------------- 房間 ---------------- */

#room {
  /* bug 修復：原本用 min-height:100vh，內容一多就整頁被撐高，變成「整個網頁在捲動」
     而不是逐字稿框自己捲動，手機上網址列收合/展開又會讓版面重排、按鈕點擊座標對不上。
     改成固定 height（dvh 會正確反映行動裝置實際可視高度，不受網址列收合影響；
     不支援 dvh 的舊瀏覽器會 fallback 用上一行的 100vh）才能讓下面 .transcript 的
     overflow-y:auto 真正產生自己的內部捲軸。
     align-items/justify-content 要明確覆寫成 stretch/flex-start：
     不然會繼承 .screen 基礎規則的 center/center，讓 header/body/controls
     這些直接子項被壓縮成內容寬度置中，橫向版面直接壞掉。 */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.room-header strong {
  font-size: 15px;
  margin-right: 10px;
}

.status-pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--cream);
  padding: 4px 10px;
  border-radius: 100px;
}

.status-pill.connected {
  color: #2f6e4f;
  background: #e3f2e7;
}

.room-body {
  flex: 1;
  min-height: 0; /* 讓這個 flex 子項可以真正縮小，不會把 #room 撐超過視窗高度 */
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  gap: 18px;
}

/* .room-body 直接坐在 body 的深綠底上（不是白色卡片），.disclaimer 預設的 --muted
   是給淺色底用的，疊在深綠上對比不夠，這裡覆寫成半透明白字 */
.room-body .disclaimer,
.room-body .ai-orb-label {
  color: rgba(255, 255, 255, 0.72);
}

.people-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.person-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 0;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.avatar-a { background: var(--a-color); }
.avatar-b { background: var(--b-color); }

.person-meta { min-width: 0; }

.person-name {
  font-weight: 600;
  font-size: 14px;
}

.live-caption {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 16px;
}

.ai-orb {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 72px;
}

.ai-orb-core {
  /* 底色/光暈交給 .mascot-avatar 提供（角色圖本身的橢圓身體已經是 --paper-raised 底），
     這裡只負責大小、外框跟「思考中/說話中」的脈動光暈——脈動色沿用中性的 --ai-color 系列，不是金色。 */
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 0 rgba(140, 116, 104, 0.5);
  transition: box-shadow 0.3s ease;
}

.ai-orb-core .mascot-svg { width: 34px; height: 34px; }

.ai-orb.thinking .ai-orb-core {
  animation: pulse 1.1s infinite ease-in-out;
}

.ai-orb.speaking .ai-orb-core {
  animation: pulse 0.6s infinite ease-in-out;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(140, 116, 104, 0.45); }
  70% { box-shadow: 0 0 0 14px rgba(140, 116, 104, 0); }
  100% { box-shadow: 0 0 0 0 rgba(140, 116, 104, 0); }
}

.ai-orb-label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.transcript {
  flex: 1;
  min-height: 0; /* 不設一個「不能再小」的下限，才不會在小螢幕/軟鍵盤彈出時又把版面撐爆 */
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
}

.bubble .who {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
  opacity: 0.75;
}

.bubble .who.who-with-avatar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.bubble.a { align-self: flex-start; background: var(--a-tint); color: var(--brand-ink); }
.bubble.b { align-self: flex-end; background: var(--b-tint); color: var(--b-ink); }
.bubble.ai {
  align-self: center;
  background: var(--ai-tint);
  color: var(--ink);
  max-width: 90%;
  border: 1px dashed var(--faint);
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 16px 20px 6px;
  flex-wrap: wrap;
}

.control-btn {
  padding: 12px 18px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.control-btn:hover { background: var(--cream); }

.control-btn.active {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.control-btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.control-btn-accent:hover { background: var(--brand-soft); }

@media (max-width: 560px) {
  .people-row { flex-direction: column; }
  .ai-orb { width: auto; flex-direction: row; }
}

/* ---------------- 情緒自評（進房前 + 房內浮層共用） ---------------- */

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.emoji-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.emoji-btn .e { font-size: 26px; line-height: 1; }
.emoji-btn .t { font-size: 11px; color: var(--muted); }

.emoji-btn:hover { border-color: var(--accent); }
.emoji-btn.selected { border-color: var(--accent); background: var(--a-tint); }

.intensity-block { margin: 4px 0 18px; }

.intensity-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.intensity-buttons { display: flex; gap: 8px; }

.intensity-btn {
  flex: 1;
  padding: 10px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}

.intensity-btn:hover { border-color: var(--accent); }
.intensity-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.checkin-mine-row, .checkin-both-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 22px 0 14px;
}

.checkin-both-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.checkin-both-label {
  font-size: 12px;
  color: var(--muted);
}

.checkin-emoji-big { font-size: 40px; line-height: 1; }

.checkin-mine-label {
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- 房間內：心情徽章 / 錢包狀態 / 餘額不足提示 ---------------- */

.room-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.room-header-actions > * { flex-shrink: 0; }

.wallet-pill { font-weight: 700; white-space: nowrap; color: var(--love-ink); }

.mood-badge {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 17px;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mood-badge.own {
  cursor: pointer;
  border-color: var(--accent);
}

.mood-badge.own:hover { background: var(--cream); }

.payment-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 20px;
  background: var(--brand-tint);
  color: var(--brand-ink);
  font-size: 13px;
  flex-wrap: wrap;
}

.payment-banner .btn-ghost {
  background: #fff;
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ---------------- 通用浮層 modal（房間內更新心情用） ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(51, 41, 31, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
  border: 1px solid var(--line);
}

.modal-card h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn-primary, .modal-actions .btn-ghost { flex: 1; margin-top: 0; }

/* ---------------- 新手導覽（首次訪客彈窗） ---------------- */

.onboarding-card { text-align: center; }

.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}

.onboarding-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s ease, transform 0.2s ease;
}

.onboarding-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.onboarding-emoji {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
}

.onboarding-card h2 { margin: 0 0 10px; }
.onboarding-card .lead { margin: 0 0 22px; }

.onboarding-card .modal-actions #onboardingPrevBtn.hidden { display: none; }

.onboarding-card #onboardingSkipBtn {
  margin: 14px 0 0;
}

/* ---------------- 房間標頭裡的「結束通話」小按鈕 ---------------- */

.btn-small {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
  margin-top: 0;
  white-space: nowrap;
}

/* ---------------- 通話結束畫面 ---------------- */

#sessionEndScreen, #notesScreen {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
}

.card-wide { max-width: 720px; }

.summary-card {
  background: var(--cream);
  border-radius: 14px;
  padding: 18px 18px 14px;
  margin: 4px 0 18px;
}

.summary-card h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--muted);
  font-weight: 700;
}

.summary-card .lead { margin: 0; }

.consensus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.consensus-chip {
  /* 共識是雙方共同達成的，不是「A 的東西」，這裡改用 brand-tint 而不是 a-tint，語意才對 */
  background: var(--brand-tint);
  color: var(--ink);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
}

.encouragement-text {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--brand-ink); /* 珊瑚色文字疊在 summary-card 的米色底上，用安全對比度版本 */
  font-style: italic;
}

/* ---------------- 「我們之間」未解鎖時的說明區塊 ---------------- */
.records-why {
  margin-top: 20px;
  padding: 18px;
  background: var(--cream);
  border-radius: 14px;
}

.records-why h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.records-why ul {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.records-why li { margin-bottom: 4px; }

.records-quote {
  margin: 0;
  padding: 12px 14px;
  background: var(--brand-tint);
  border-radius: 10px;
  color: var(--brand-ink);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
}

.records-quote span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.unlock-block {
  margin-top: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ---------------- 談心筆記：入口清單 + 各自獨立頁面 ---------------- */

.trend-note {
  background: var(--cream);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 16px;
}

.notes-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
}

.notes-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.notes-item-body { font-size: 14px; line-height: 1.6; }

.notes-item-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--muted);
}

.notes-item-note-input {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

.notes-item-note-input input { flex: 1; min-width: 0; font-size: 13px; padding: 8px 10px; }
.notes-item-note-input button { padding: 8px 12px; font-size: 12.5px; }

.notes-item.dream-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notes-item.dream-item.done .notes-item-body {
  text-decoration: line-through;
  color: var(--muted);
}

.dream-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}

.dream-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.notes-item-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  padding: 2px 4px;
  flex-shrink: 0;
}

.notes-item-delete:hover { color: var(--danger); }

.notes-item-gcal-link {
  background: none;
  border: none;
  color: var(--brand-ink);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 4px;
  flex-shrink: 0;
  text-decoration: none;
  white-space: nowrap;
}

.notes-item-gcal-link:hover { text-decoration: underline; }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.inline-form input { flex: 1 1 160px; min-width: 0; }
.inline-form button { flex-shrink: 0; }

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cream);
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
}

.chip button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px;
}

.chip button:hover { color: var(--danger); }
