/* Twinco 頁的 LINE 畫面重刻區（.sim-*）。
   從舊版 twinco/styles.css 原文抽出，色值、字級、間距都是照實機抄的，改版時一律不動；
   要改是改產品端的 Flex 卡，不是改這裡（見 PRODUCT.md「LINE 對話與卡片的示意要照實機」）。
   手機外框（.sim-phone 的邊框與陰影）屬於頁面外殼，由 page.css 覆寫；
   外殼可以把整個畫面等比放大或裁切（像放大的截圖，見 page.css 的 .moment-stage），但不改這裡的比例。 */

.sim-phone {
  --green: #06c755;
  --line: #dfe5ed;
}

.sim-phone {
  width: 100%;
  max-width: 480px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #eef3f6;
  box-shadow: 0 26px 60px rgba(3, 10, 22, 0.5);
}

.sim-phone-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  color: #132238;
  background: #fff;
  border-bottom: 1px solid #dfe5ed;
}

.sim-phone-head img { border-radius: 9px; }

.sim-phone-head div { display: grid; line-height: 1.25; }

.sim-phone-head strong { font-size: 0.86rem; }

.sim-phone-head span { color: #758196; font-size: 0.66rem; }

.sim-time { margin-left: auto; color: #8b97a9; font-size: 0.7rem; }

.sim-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 18px 20px;
  background: linear-gradient(180deg, #e9f0f4, #dce7ed);
}

/* ⚠️ 直向堆疊，不是橫向。
   quick reply 那排（.sim-quick）是氣泡的**兄弟節點**，`display: flex` 會讓它跟氣泡
   並排，於是整排膠囊擠出對話框外面。改成 column 之後氣泡在上、按鈕在下，
   左右對齊改由 align-items 決定。 */
.sim-item { display: flex; flex-direction: column; align-items: flex-start; }

.sim-item--user { align-items: flex-end; }

.sim-bubble {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 16px;
  color: #17263a;
  font-size: 0.83rem;
  line-height: 1.65;
  box-shadow: 0 5px 14px rgba(45, 69, 91, 0.1);
}

.sim-bubble--user { border-bottom-right-radius: 4px; background: #9ce889; }

.sim-bubble--bot { border-bottom-left-radius: 4px; background: #fff; }

.sim-bubble--photo { display: inline-flex; align-items: center; gap: 6px; }

.sim-event {
  display: grid;
  gap: 2px;
  margin-top: 9px;
  padding: 9px 11px;
  border-left: 3px solid var(--green);
  border-radius: 8px;
  background: #f3f7f4;
}

.sim-event strong { font-size: 0.82rem; }

.sim-event small { color: #6a7789; font-size: 0.72rem; }

/* 佔滿對話框寬度並在自己內部橫向捲動——比照 LINE 的 quick reply。
   沒有 width/max-width 的話，膠囊總寬會把父層撐開而不是自己捲。 */
.sim-quick { display: flex; width: 100%; max-width: 100%; gap: 7px; margin-top: 9px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }

.sim-quick span {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid var(--green);
  border-radius: 999px;
  color: #06904a;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.72rem;
  white-space: nowrap;
}

.sim-card { width: 100%; overflow: hidden; border-radius: 16px; color: #17233a; background: #fff; box-shadow: 0 10px 26px rgba(34, 59, 87, 0.16); }

.sim-card-head { display: grid; gap: 2px; padding: 14px 16px 10px; }

.sim-card-head strong { font-size: 0.95rem; }

.sim-card-head small { color: #7c8798; font-size: 0.7rem; }

.sim-card-row { display: flex; gap: 11px; padding: 10px 16px; border-top: 1px solid #eef1f5; }

.sim-card-row strong { display: block; font-size: 0.82rem; }

.sim-card-row p { margin: 2px 0 0; color: #6c7889; font-size: 0.75rem; }

.sim-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; font-size: 0.85rem; }

.sim-icon--blue { color: #1b7fd4; background: #e3f0fb; }

.sim-icon--violet { color: #6f4fd8; background: #ece7fc; }

.sim-card-note { padding: 11px 16px 14px; border-top: 1px solid #eef1f5; color: #6c7889; font-size: 0.75rem; line-height: 1.6; }

.sim-caption {
  margin: auto 0 0;
  padding: 10px 12px;
  border-radius: 11px;
  color: #65758a;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  text-align: center;
}

.sim-typing { display: inline-flex; gap: 4px; padding: 12px 15px; border-radius: 16px; border-bottom-left-radius: 4px; background: #fff; box-shadow: 0 5px 14px rgba(45, 69, 91, 0.1); }

.sim-typing i { width: 6px; height: 6px; border-radius: 50%; background: #a9b5c5; animation: sim-blink 1.3s infinite; }

.sim-typing i:nth-child(2) { animation-delay: 0.18s; }

.sim-typing i:nth-child(3) { animation-delay: 0.36s; }

@media (max-width: 980px) {
  .sim-phone { max-width: 460px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .sim-typing i { animation: none; opacity: 0.6; }
}

/* ── 卡片上的 postback 按鈕列 ───────────────────────────────── */
.sim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e8edf2;
}

.sim-action {
  padding: 7px 14px;
  border: 1px solid #d5dde6;
  border-radius: 999px;
  color: #2f6bd8;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

/* ── 店家卡輪播 ─────────────────────────────────────────────
   真的 LINE 輪播是橫向捲動的，所以這裡也用 overflow-x。
   卡片寬度鎖住，避免被拉扁。 */
.sim-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  /* 父層是 column flex 且 align-items: flex-start，交叉軸的寬度由內容決定；
     不 stretch 的話這條會被卡片撐到比手機框還寬（實測 432 > 364） */
  align-self: stretch;
  min-width: 0;
  margin-top: 2px;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.sim-carousel::-webkit-scrollbar { display: none; }

.sim-place {
  flex: 0 0 172px;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px 13px;
  border: 1px solid #e4eaf0;
  border-radius: 14px;
  background: #fff;
}

.sim-place strong { color: #1f2a37; font-size: 0.8rem; }

.sim-place span { color: #6b7280; font-size: 0.68rem; }

.sim-place em {
  color: #b8860b;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
}

/* ── 推播簡報卡 ─────────────────────────────────────────────── */
.sim-brief { display: grid; gap: 0; }

.sim-brief-head strong { color: #1db446; font-size: 1rem; }

.sim-brief-head small { color: #aaa; font-size: 0.66rem; }

/* 實機每個區塊之間都有一條 FlexSeparator */
.sim-brief-divider { height: 1px; margin: 11px 0; background: #eceff3; }

.sim-brief-sec { padding: 0 16px; }

.sim-brief-sec > p { margin: 0; }

.sim-brief-title { color: #333; font-size: 0.82rem; font-weight: 700; }

.sim-brief-subtitle { margin-top: 8px !important; color: #333; font-size: 0.75rem; font-weight: 700; }

.sim-brief-line { margin-top: 5px !important; color: #555; font-size: 0.74rem; }

.sim-brief-meta { margin-top: 5px !important; color: #aaa; font-size: 0.66rem; }

.sim-brief-weather {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px !important;
}

.sim-brief-desc { color: #1f2a37; font-size: 0.8rem; }

.sim-brief-range {
  color: #555;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  text-align: end;
}

/* 運勢的標籤列：實機是 baseline 兩欄，標籤固定寬、內容換行 */
.sim-brief-tags {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  margin: 7px 0 0;
}

.sim-brief-tags dt { color: #555; font-size: 0.72rem; font-weight: 700; }

.sim-brief-tags dd { margin: 0; color: #555; font-size: 0.72rem; }

.sim-brief-date { margin-top: 7px !important; color: #333; font-size: 0.74rem; font-weight: 700; }

.sim-brief-agenda { display: grid; gap: 4px; margin: 5px 0 0; padding: 0; list-style: none; }

.sim-brief-agenda li { display: flex; align-items: baseline; gap: 9px; }

.sim-brief-time {
  flex: 0 0 auto;
  color: #888;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.sim-brief-time--allday { color: #1db446; font-weight: 700; }

.sim-brief-event { color: #333; font-size: 0.72rem; }

.sim-brief-source { margin-top: 9px !important; color: #aaa; font-size: 0.66rem; font-weight: 700; }

.sim-brief-news { display: grid; gap: 5px; margin: 5px 0 0; padding: 0; list-style: none; }

/* 實機的文章標題是帶 URIAction 的連結，所以給連結外觀；但示意圖
   刻意不做成真的 <a>，避免死連結與假的可聚焦元素。 */
.sim-brief-link { color: #2d6cdf; font-size: 0.72rem; text-decoration: underline; }

/* ── 卡片上的 postback 按鈕 ─────────────────────────────────── */
.sim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
  padding: 11px 16px 0;
  border-top: 1px solid #eceff3;
}

.sim-action {
  padding: 6px 13px;
  border: 1px solid #d9e0e8;
  border-radius: 999px;
  color: #2d6cdf;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ── 店家卡輪播 ─────────────────────────────────────────────
   實機是橫向捲動的輪播，兩張以上時每張左上角有 1/N 計數。 */
.sim-carousel {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  /* 同上：不 stretch 就會被卡片撐開，超出的部分靠 overflow hidden 裁掉 */
  align-self: stretch;
  min-width: 0;
  margin-top: 8px;
  padding: 0 2px 4px;
  scrollbar-width: none;
}

.sim-carousel::-webkit-scrollbar { display: none; }

.sim-place {
  flex: 0 0 138px;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid #e4eaf0;
  border-radius: 13px;
  background: #fff;
}

.sim-place-index { color: #aaa; font-size: 0.62rem; font-variant-numeric: tabular-nums; }

.sim-place strong { color: #1f2a37; font-size: 0.78rem; }

.sim-place p { margin: 0; color: #6b7280; font-size: 0.68rem; }

/* ── 帳目卡 ─────────────────────────────────────────────────
   記帳的回覆是程式碼組的固定格式，不是模型生成的。版面做得像
   收據：欄位靠左、值靠右，數字用 tabular-nums 對齊。 */
.sim-ledger-rows { display: grid; gap: 5px; margin: 10px 0 0; padding: 0 16px; }

.sim-ledger-rows > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.sim-ledger-rows dt { color: #6b7280; font-size: 0.72rem; }

.sim-ledger-rows dd {
  margin: 0;
  color: #1f2a37;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sim-ledger-total {
  margin-top: 10px;
  padding: 9px 16px 0;
  border-top: 1px solid #eceff3;
  color: #555;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

/* ── 語音訊息泡泡 ───────────────────────────────────────────
   高低不一的長條比等寬的直線更像波形。文字標示「語音訊息」保留在
   markup 裡，螢幕閱讀器才讀得到是什麼。 */
.sim-voice {
  display: inline-block;
  width: 42px;
  height: 14px;
  margin-right: 7px;
  vertical-align: -2px;
  background:
    linear-gradient(currentColor 0 0) 0     50% / 3px 40%  no-repeat,
    linear-gradient(currentColor 0 0) 20%   50% / 3px 75%  no-repeat,
    linear-gradient(currentColor 0 0) 40%   50% / 3px 100% no-repeat,
    linear-gradient(currentColor 0 0) 60%   50% / 3px 60%  no-repeat,
    linear-gradient(currentColor 0 0) 80%   50% / 3px 85%  no-repeat,
    linear-gradient(currentColor 0 0) 100%  50% / 3px 35%  no-repeat;
  opacity: 0.5;
}

/* 熱量估算的回覆是逐行清單（提示詞要求「・品項　XX 克　XXX 大卡」），
   數字用 tabular-nums 才對得齊；但程式不驗證格式，所以這只是版面配合。 */
.sim-estimate { font-variant-numeric: tabular-nums; line-height: 1.75; }
