/**
 * 打字農場｜全螢幕手作紙藝 UI 設計系統 V3
 * 重點更新：
 * 1. 全螢幕電腦視窗下顯著放大底部懸浮棉紙打字捲軸（字體、高度與寬度自適應放大）
 * 2. 開局動態紙雕選角舞台 (.char-select-card) ＋ 獨立設定頁 (#modal-settings)
 * 3. 金幣飛入錢包 Q 彈跳動動畫 (.coin-pop) ＋ 智慧防卡關提示氣泡 (.coach-pill)
 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "PingFang TC", "Microsoft JhengHei UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  background: #75966e;
  color: #2c241d;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.world-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #75966e;
}

.hud-bar {
  display: contents;
}

.stage-body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.canvas-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

#farm-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

.stamp-btn.mobile-menu-btn,
.mobile-menu-btn,
.stamp-label,
.energy-compact-text {
  display: none;
}

.hud-right-drawer {
  display: contents;
}

.coin-svg {
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

.dom-coin-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  overflow: hidden;
}

.dom-flying-coin {
  position: fixed;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  margin-top: -11px;
  pointer-events: none;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 4px rgba(120, 53, 15, 0.35));
}

.gold-tag {
  position: relative;
}

.hud-gold-delta {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 6px);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(28, 22, 16, 0.2);
}

.hud-gold-delta.earn {
  background: #fef9c3;
  color: #854d0e;
  border: 1.5px solid #eab308;
  animation: goldDeltaPop 1.25s ease-out forwards;
}

.hud-gold-delta.spend {
  background: #ffe4e6;
  color: #be123c;
  border: 1.5px solid #fb7185;
  animation: goldDeltaPop 1.25s ease-out forwards;
}

.zhuyin-pad-toggle {
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid #d4c4ab;
  background: #f5efe3;
  color: #4a3b2c;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.zhuyin-pad-toggle[aria-expanded="true"] {
  background: #d97706;
  border-color: #b45309;
  color: #fff;
}

.zhuyin-keypad {
  width: min(860px, 94vw);
  margin: 0 auto 8px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(250, 246, 239, 0.98);
  border: 2px solid #cbbba4;
  box-shadow: 0 6px 18px rgba(28, 22, 16, 0.2);
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  touch-action: manipulation;
}

.zy-key {
  min-height: 40px;
  border-radius: 10px;
  border: 1.5px solid #d6c7b2;
  background: #fffdf8;
  color: #2c241d;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 #c9b8a1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.zy-key:active {
  transform: translateY(1.5px);
  background: #fef3c7;
  box-shadow: none;
}

.zy-key.zy-del {
  grid-column: span 2;
  background: #f3ece0;
  color: #6b5a49;
  font-size: 0.92rem;
}

.zy-key.zy-send {
  grid-column: span 2;
  background: #c85a38;
  border-color: #a34326;
  color: #fff;
  box-shadow: 0 2px 0 #8f391f;
  font-size: 0.96rem;
}

.toast-badge.toast-warn {
  background: #fff1f2;
  border-color: #fb7185;
  color: #9f1239;
}

.toast-badge.toast-gold {
  background: #fffbeb;
  border-color: #eab308;
  color: #854d0e;
}

/* === 左上：統一手作厚棉紙牧場狀態牌組 === */
.hud-left {
  position: absolute;
  top: 16px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  z-index: 15;
}

.craft-tag {
  background: #faf6ef;
  color: #3a2e23;
  border: 2px solid #cbbba4;
  border-radius: 15px;
  padding: 7px 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(0.95rem, 1.05vw, 1.12rem);
  font-weight: 900;
  box-shadow: 0 3px 0 #b3a28b, 0 6px 14px rgba(32, 24, 16, 0.14);
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tag-mini-icon {
  font-size: 0.92rem;
  line-height: 1;
}

.gold-tag {
  background: #fffbeb;
  border-color: #dec282;
  box-shadow: 0 3px 0 #c4a45e, 0 6px 14px rgba(32, 24, 16, 0.14);
  color: #78350f;
  font-variant-numeric: tabular-nums;
}

.gold-tag.coin-pop {
  animation: coinHudPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.combo-tag {
  background: #fff4ed;
  border-color: #e08d6d;
  color: #b83b1d;
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.energy-pips {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pip {
  width: 10px;
  height: 15px;
  border-radius: 3px;
  background: #6da364;
  border: 1px solid #4c7c44;
  box-shadow: 0 1.5px 0 #3f6938;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, background 0.2s ease;
}

.pip.empty {
  background: #e6ded1;
  border-color: #cfc4b4;
  box-shadow: none;
  transform: scale(0.86);
}

/* === 右上：極簡 3 顆郵票工具列 === */
.hud-right {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  z-index: 15;
}

.stamp-btn {
  position: relative;
  width: 46px;
  height: 44px;
  background: #faf6ef;
  color: #3d3126;
  border: 2px solid #cbbba4;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #b3a28b, 0 6px 14px rgba(32, 24, 16, 0.14);
  transition: transform 0.14s ease, background 0.14s ease;
}

.stamp-btn:hover {
  background: #ffffff;
  transform: translateY(-2px);
}

.stamp-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #b3a28b;
}

.stamp-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  font-style: normal;
  background: #c85a38;
  color: #ffffff;
  border: 1.5px solid #faf6ef;
  border-radius: 99px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 0.72rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === 智慧防卡關／閒置溫馨提示氣泡（浮於打字框正上方） === */
.coach-pill {
  position: absolute;
  bottom: calc(clamp(14px, 2vh, 26px) + clamp(70px, 5.8vw, 94px));
  left: 50%;
  transform: translateX(-50%);
  background: #fffbeb;
  border: 2.5px solid #e59f28;
  border-radius: 999px;
  padding: 9px 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #5c3410;
  font-size: clamp(1rem, 1.25vw, 1.2rem);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 5px 0 rgba(146, 84, 20, 0.25), 0 14px 28px rgba(32, 20, 10, 0.26);
  z-index: 22;
  pointer-events: none;
  animation: coachFloat 1.8s infinite ease-in-out;
}

.coach-word-chip {
  background: #29221d;
  color: #fde047;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
}

/* === 底部加大版：全螢幕自適應手作車縫棉紙打字捲軸 === */
.floating-typing-dock {
  position: absolute;
  bottom: clamp(14px, 2vh, 26px);
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, 60vw);
  min-width: min(560px, calc(100vw - 28px));
  z-index: 20;
}

.paper-input-scroll {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #faf6ef;
  border: 3px solid #c9b79c;
  border-radius: 26px;
  padding: clamp(8px, 1vh, 13px) clamp(10px, 1.2vw, 16px);
  box-shadow:
    0 6px 0 #9e8c74,
    0 18px 38px rgba(24, 20, 14, 0.34),
    inset 0 0 0 2.5px rgba(255, 255, 255, 0.8);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.paper-input-scroll:focus-within {
  background: #fffefb;
  border-color: #c85a38;
  box-shadow:
    0 6px 0 #9e4225,
    0 18px 40px rgba(24, 20, 14, 0.36),
    0 0 0 5px rgba(200, 90, 56, 0.18);
}

.paper-input-scroll.shake-error {
  border-color: #e11d48;
  animation: shakeX 0.34s ease;
}

.zhuyin-stamp {
  flex-shrink: 0;
  background: #efe8dc;
  color: #4a3d31;
  border: 2px solid #cbbba4;
  border-radius: 15px;
  padding: clamp(10px, 1.1vh, 14px) clamp(14px, 1.3vw, 20px);
  font-family: inherit;
  font-size: clamp(0.95rem, 1.05vw, 1.12rem);
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

/* The track shape and thumb position communicate state without relying on color. */
.zhuyin-switch-track {
  position: relative;
  display: block;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: #74685d;
}

.zhuyin-switch-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fffaf1;
  transition: transform 0.15s ease;
}

.zhuyin-stamp[aria-checked="true"] .zhuyin-switch-track {
  background: #396847;
}

.zhuyin-stamp[aria-checked="true"] .zhuyin-switch-track::before {
  transform: translateX(13px);
}

.zhuyin-stamp:focus-visible {
  outline: 2px solid #396847;
  outline-offset: 2px;
}

/* This line belongs to the game, not to the browser's keyboard toolbar. */
.typing-submit-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  margin: 0;
}

.word-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: clamp(2rem, 2.55vw, 2.7rem);
  font-weight: 900;
  text-align: center;
  color: #241c15;
  background: transparent;
  user-select: text;
}

.word-input::placeholder {
  font-size: clamp(1.1rem, 1.35vw, 1.38rem);
  font-weight: 700;
  color: #a89b8c;
}

/* === 開局立體紙雕選角舞台 === */
.char-select-card {
  background: #faf6ef;
  border: 3px solid #cbb89d;
  border-radius: 30px;
  padding: 30px 36px 28px;
  max-width: 680px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow:
    0 9px 0 #a39076,
    0 28px 64px rgba(24, 18, 12, 0.45),
    inset 0 0 0 3px rgba(255, 255, 255, 0.75);
  animation: popBounce 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.char-select-title {
  font-size: 1.65rem;
  font-weight: 900;
  color: #2c2219;
}

.char-select-sub {
  font-size: 0.94rem;
  font-weight: 700;
  color: #7a6b5b;
  margin-top: -6px;
}

.char-select-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  margin: 6px 0;
}
.mode-select-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 8px;
  flex-wrap: wrap;
}
.mode-pill {
  padding: 9px 18px;
  border-radius: 999px;
  border: 2px solid rgba(101, 79, 53, 0.18);
  background: #fdfbf5;
  color: #5c4b37;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.mode-pill:hover {
  transform: translateY(-1px);
  border-color: #d97706;
}
.mode-pill.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #b45309;
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

.char-choice {
  background: #f1ebe0;
  border: 2.5px solid #d6cab8;
  border-radius: 22px;
  padding: 12px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.char-choice:hover {
  transform: translateY(-4px);
  background: #fffcf5;
}

.char-choice.active {
  background: #fffefb;
  border-color: #c85a38;
  box-shadow: 0 6px 0 rgba(200, 90, 56, 0.25), 0 12px 24px rgba(200, 90, 56, 0.16);
}

.char-preview-cv {
  width: 150px;
  height: 158px;
  display: block;
}

.char-choice strong {
  font-size: 1.02rem;
  font-weight: 900;
  color: #2c241d;
}

/* === 黃昏返家紙籤橫幅 === */
.dusk-banner {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #faf6ef;
  border: 2.5px solid #d99b43;
  border-radius: 999px;
  padding: 13px 30px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #4a2c18;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 6px 0 rgba(88, 52, 28, 0.24), 0 18px 40px rgba(32, 20, 14, 0.34);
  z-index: 30;
  pointer-events: none;
  animation: duskFloatIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.dusk-sun-dot {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: #e76f51;
}

/* === 情境式「大尺寸視覺圖解引導卡」 === */
.guide-popup-card {
  background: #faf6ef;
  border: 3px solid #cbb89d;
  border-radius: 28px;
  padding: 28px 34px 26px;
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  box-shadow:
    0 8px 0 #a39076,
    0 28px 60px rgba(24, 18, 12, 0.42),
    inset 0 0 0 3px rgba(255, 255, 255, 0.7);
  animation: popBounce 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.guide-visual-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #f2ebe0;
  border: 2px dashed #d5c5ae;
  border-radius: 20px;
  padding: 16px 20px;
  width: 100%;
}

.g-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.g-icon-box {
  width: 72px;
  height: 72px;
  background: #fffefb;
  border: 2px solid #d8c8b0;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 0 #c4b299;
}

.g-icon-box img {
  width: 58px;
  height: 58px;
}

.g-step span {
  font-size: 0.88rem;
  font-weight: 900;
  color: #4a3b2e;
}

.g-arrow {
  font-size: 1.35rem;
  font-weight: 900;
  color: #c85a38;
}

.guide-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #2c2219;
}

.guide-sub {
  font-size: 0.95rem;
  font-weight: 700;
  color: #6e5f50;
  line-height: 1.45;
}

.guide-ok-btn {
  margin-top: 4px;
  background: #c85a38;
  color: #ffffff;
  border: 2px solid #9e4225;
  border-radius: 15px;
  padding: 12px 38px;
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #82331b;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.guide-ok-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* === 星夜破曉紙雕睡眠遮罩 === */
.sleep-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #252238 0%, #3a314c 58%, #6e5268 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: sleepSequence 1.35s ease forwards;
}

.sleep-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.moon-halo {
  padding: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(254, 240, 138, 0.22) 0%, rgba(254, 240, 138, 0) 70%);
}

.moon-svg {
  animation: floatMoon 1.6s infinite ease-in-out;
}

.sleep-day-label {
  color: #fef9c3;
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: 4px;
}

/* === 解鎖通知紙籤 === */
.toast-container {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
}

.toast-badge {
  background: #faf6ef;
  color: #3a2e23;
  border: 2px solid #d99b43;
  border-radius: 999px;
  padding: 7px 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(92, 64, 32, 0.22), 0 10px 24px rgba(0, 0, 0, 0.2);
  animation: popBounce 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-badge img {
  width: 30px;
  height: 30px;
}

/* === 手作紙藝彈窗與設定頁 === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 24, 18, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
}

.modal-box {
  background: #faf6ef;
  border: 2.5px solid #cbb89d;
  border-radius: 24px;
  width: 100%;
  max-width: 820px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 0 #a39076, 0 26px 56px rgba(24, 18, 12, 0.4);
  animation: popIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.settings-box {
  max-width: 680px;
}

.modal-top {
  padding: 13px 20px;
  background: #efe7d8;
  border-bottom: 2px solid #dcd0bd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-top h2 {
  font-size: 1.15rem;
  color: #3a2e23;
}

.journal-tabs {
  display: flex;
  gap: 8px;
}

.j-tab {
  background: #e5dac7;
  color: #5c4d3e;
  border: 1.5px solid #cbbba4;
  border-radius: 12px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.14s ease;
}

.j-tab.active {
  background: #faf6ef;
  color: #c85a38;
  border-color: #c85a38;
  box-shadow: 0 2px 0 #c85a38;
}

.diff-select {
  border: 1.5px solid #cbbba4;
  border-radius: 10px;
  padding: 7px 12px;
  font-family: inherit;
  font-weight: 800;
  background: #fffefb;
  color: #3a2e23;
  cursor: pointer;
}

.close-btn {
  width: 34px;
  height: 34px;
  background: #4a6b5d;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 0 #2f473d;
}

.modal-scroll {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section h3 {
  font-size: 0.96rem;
  font-weight: 900;
  color: #4a3b2e;
  margin-bottom: 10px;
}

.settings-row-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.setting-item {
  background: #fffefb;
  border: 2px solid #dfd5c5;
  border-radius: 15px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 900;
  color: #3a2e23;
}

.setting-toggle-btn {
  background: #4a6b5d;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 7px 18px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 #2f473d;
}

.setting-toggle-btn.off {
  background: #d6cab8;
  color: #5c4e40;
  box-shadow: 0 2px 0 #b8aa96;
}

.settings-footer {
  border-top: 1.5px dashed #dcd0bd;
  padding-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.danger-reset-btn {
  background: #efe6dc;
  color: #9a3412;
  border: 1.5px solid #d9b8a3;
  border-radius: 11px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.danger-reset-btn:hover {
  background: #fee2e2;
}

.pets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pet-tile {
  background: #f2ece1;
  border: 2px dashed #d6cab8;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease;
}

.pet-tile.owned {
  background: #fffefb;
  border: 2px solid #d6c5ad;
  cursor: pointer;
}

.pet-tile.owned:hover {
  transform: translateY(-2px);
}

.pet-tile.active {
  background: #fffbf0;
  border-color: #c85a38;
  box-shadow: 0 4px 0 rgba(200, 90, 56, 0.22);
}

.sprite-thumb {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}

.sprite-thumb.silhouette {
  filter: brightness(0) opacity(0.14);
}

.pet-meta h4 {
  font-size: 0.9rem;
  color: #2c241d;
}

.pet-badge-pill {
  display: inline-block;
  margin-top: 4px;
  background: #efe8dc;
  color: #6e5842;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.album-item {
  background: #f2ece1;
  border: 2px dashed #d8ccba;
  border-radius: 15px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.album-item.unlocked {
  background: #fffefb;
  border: 2px solid #d6c5ad;
}

.album-item.unlocked.tier-傳說 {
  background: linear-gradient(180deg, #fffdf5 0%, #fef3c7 100%);
  border-color: #d99b43;
}

.album-title {
  font-size: 0.84rem;
  font-weight: 900;
  color: #2c241d;
}

.album-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 99px;
  background: #e3dacb;
  color: #5c4e40;
}

.tier-閃亮 .album-tag { background: #fde68a; color: #854d0e; }
.tier-傳說 .album-tag { background: #d97706; color: #ffffff; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kpi-tile {
  background: #fffefb;
  border: 1.5px solid #dfd5c5;
  border-radius: 15px;
  padding: 12px;
  text-align: center;
}

.kpi-tile span {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6e6052;
}

.kpi-tile strong {
  display: block;
  font-size: 1.5rem;
  color: #2c241d;
  margin-top: 3px;
}

.kpi-tile small {
  font-size: 0.74rem;
  color: #8c7e6e;
}

.teacher-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-block {
  background: #fffefb;
  border: 1.5px solid #dfd5c5;
  border-radius: 15px;
  padding: 12px 14px;
}

.info-block h3 {
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: #3d3126;
}

.clean-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.86rem;
}

.clean-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #dfd5c5;
  padding-bottom: 5px;
}

.weak-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.weak-row {
  display: flex;
  justify-content: space-between;
  background: #fef7ed;
  border: 1px solid #eccba7;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.84rem;
}

@keyframes coinHudPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); background: #fef08a; }
  100% { transform: scale(1); }
}

@keyframes coachFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

@keyframes duskFloatIn {
  0% { opacity: 0; transform: translate(-50%, -32%) scale(0.92); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes sleepSequence {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0.95; }
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

@keyframes floatMoon {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(3deg); }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes popBounce {
  0% { opacity: 0; transform: scale(0.86); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes goldDeltaPop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.82); }
  18% { opacity: 1; transform: translate(-50%, 4px) scale(1.08); }
  75% { opacity: 1; transform: translate(-50%, -2px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.95); }
}

@keyframes shopCardGlow {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.8); background: #fffbeb; border-color: #eab308; }
  45% { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(250, 204, 21, 0.28); background: #fef08a; border-color: #d97706; }
  100% { transform: scale(1); box-shadow: 0 2px 0 #c9b8a1; background: #fffefb; }
}

/* ============================================================================
   iPhone Safari 優先・地圖為主角的手機響應式系統（桌面 > 820px 完全維持原貌）
   - 拿掉下方重複任務/商店卡清單與焦點條，文字與價格直接顯示在地圖物件上（像桌面、字卡比例適度放大易按）
   - 頂部圖鑑／紀錄／設定收進右上小選單，開鍵盤自動平滑收起，剩餘可視高度全部留給農場地圖與底部輸入列
   ============================================================================ */
@media (max-width: 820px), (max-height: 500px) and (max-width: 960px) {
  html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #75966e;
    -webkit-text-size-adjust: 100%;
  }

  /* 單一可視視窗容器：精準鎖定 visualViewport 的 height / width / offsetTop / offsetLeft */
  .world-viewport {
    position: fixed;
    top: var(--vvt, 0px);
    left: var(--vvl, 0px);
    width: var(--vvw, 100%);
    height: var(--vvh, 100dvh);
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #75966e;
  }

  /* 頂部懸浮精簡 HUD：直接浮在農場天空上方，不浪費額外底條高度 */
  .hud-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: calc(max(6px, var(--kb-top-safe, env(safe-area-inset-top)))) calc(max(8px, env(safe-area-inset-right))) 4px calc(max(8px, env(safe-area-inset-left)));
    background: transparent;
    pointer-events: none;
    z-index: 25;
  }

  .hud-left {
    position: static;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
    min-width: 0;
    pointer-events: auto;
  }

  .hud-right {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    pointer-events: auto;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .stamp-btn.mobile-menu-btn,
  .mobile-menu-btn {
    display: inline-flex;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border-width: 1.5px;
    box-shadow: 0 2px 0 #b8a790, 0 4px 10px rgba(28, 22, 16, 0.16);
  }

  .hud-right-drawer {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(250, 246, 239, 0.98);
    border: 2px solid #cbbba4;
    box-shadow: 0 10px 24px rgba(28, 22, 16, 0.24);
    opacity: 0;
    transform: translateY(-6px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
    z-index: 40;
  }

  .hud-right.menu-open .hud-right-drawer {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .hud-right-drawer .stamp-btn {
    width: auto;
    min-width: 132px;
    height: 40px;
    padding: 0 12px;
    gap: 8px;
    justify-content: flex-start;
    border-radius: 12px;
    border-width: 1.5px;
    box-shadow: 0 2px 0 #cbbba4;
    white-space: nowrap;
  }

  .hud-right-drawer .stamp-label {
    display: inline;
    font-size: 0.9rem;
    font-weight: 800;
    color: #3d3126;
    white-space: nowrap;
  }

  .hud-right-drawer .stamp-badge {
    position: static;
    margin-left: auto;
  }

  .craft-tag {
    padding: 4px 9px;
    border-radius: 12px;
    border-width: 1.5px;
    gap: 4px;
    font-size: 0.82rem;
    background: rgba(250, 246, 239, 0.94);
    box-shadow: 0 2px 0 #b8a790, 0 4px 10px rgba(28, 22, 16, 0.14);
    white-space: nowrap;
  }

  .gold-tag {
    background: rgba(255, 251, 235, 0.96);
  }

  .craft-tag svg {
    width: 15px;
    height: 15px;
  }

  .energy-pips {
    display: none;
  }

  .energy-compact-text {
    display: inline;
    font-variant-numeric: tabular-nums;
  }

  /* 中段主體：100% 留給實景立體紙雕農場地圖！ */
  .stage-body {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #75966e;
  }

  .canvas-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    background: #75966e;
    overflow: hidden;
  }

  .dusk-banner {
    font-size: 0.92rem;
    padding: 8px 16px;
    white-space: normal;
    text-align: center;
    max-width: 88%;
  }

  /* 防卡關提示氣泡緊貼底部輸入列上方 */
  .coach-pill {
    position: absolute;
    left: 50%;
    bottom: 66px;
    transform: translateX(-50%);
    animation: none;
    max-width: calc(100% - 20px);
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: 14px;
    flex-wrap: wrap;
    justify-content: center;
    z-index: 28;
  }

  /* 底部輸入列：只留輸入、送出與必要的注音鍵盤，不浪費多餘空間 */
  .floating-typing-dock {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    flex-shrink: 0;
    padding: 6px calc(max(8px, env(safe-area-inset-right))) calc(max(7px, env(safe-area-inset-bottom))) calc(max(8px, env(safe-area-inset-left)));
    background: rgba(246, 240, 228, 0.97);
    border-top: 1.5px solid #d5c7b2;
    box-shadow: 0 -4px 14px rgba(32, 24, 16, 0.12);
    z-index: 30;
  }

  .paper-input-scroll {
    width: 100%;
    height: auto;
    min-height: 48px;
    padding: 4px 5px 4px 7px;
    border-radius: 16px;
    gap: 6px;
    box-shadow: 0 2.5px 0 #b8a790;
  }

  .zhuyin-stamp {
    height: 38px;
    padding: 0 9px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .zhuyin-pad-toggle {
    height: 38px;
    padding: 0 9px;
    font-size: 0.78rem;
  }

  /* 至少 16px 字級，避免 iOS Safari 聚焦輸入框時自動縮放頁面 */
  .word-input {
    font-size: 16px;
    min-width: 0;
    padding: 5px 4px;
    text-align: left;
  }

  .zhuyin-keypad {
    width: 100%;
    margin: 0 0 6px;
    padding: 6px;
    gap: 4px;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    max-height: 34dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .zy-key {
    min-height: 36px;
    font-size: 1.02rem;
    border-radius: 9px;
  }

  .toast-container {
    top: calc(var(--vvt, 0px) + max(46px, var(--kb-top-safe, env(safe-area-inset-top)) + 42px));
    left: var(--vvl, 0px);
    right: auto;
    width: var(--vvw, 100%);
    padding: 0 10px;
    transform: none;
    align-items: center;
  }

  .toast-badge {
    max-width: 100%;
    padding: 6px 14px;
    font-size: 0.88rem;
  }

  /* 所有遮罩與飛幣層同步對齊 visualViewport */
  .modal-backdrop,
  .sleep-overlay,
  .dom-coin-layer {
    top: var(--vvt, 0px);
    left: var(--vvl, 0px);
    right: auto;
    bottom: auto;
    width: var(--vvw, 100%);
    height: var(--vvh, 100dvh);
  }

  /* === 鍵盤開啟時：自動收起右上選單，剩餘可視高度幾乎全給農場地圖＋單列輸入 === */
  body.kb-open .hud-bar {
    padding-top: calc(max(4px, var(--kb-top-safe, 0px)));
  }

  body.kb-open .hud-right {
    opacity: 0;
    transform: translateY(-6px) scale(0.88);
    pointer-events: none;
  }

  body.kb-open .craft-tag {
    padding: 3px 7px;
    border-radius: 10px;
    font-size: 0.78rem;
    gap: 3px;
    box-shadow: 0 1.5px 0 #b8a790;
  }

  body.kb-open .craft-tag svg {
    width: 14px;
    height: 14px;
  }

  body.kb-open .coach-pill {
    bottom: 56px;
    font-size: 0.78rem;
    padding: 4px 10px;
  }

  body.kb-open:not(.kb-ultra) .typing-submit-hint {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    margin: 4px 2px 0;
    border-radius: 7px;
    background: #e1eadb;
    color: #34523a;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 2px 4px;
  }

  /* 鍵盤已覆蓋底部安全區，不可再多留 env(safe-area-inset-bottom) 空白 */
  body.kb-open .floating-typing-dock {
    padding: 4px calc(max(8px, env(safe-area-inset-right))) 4px calc(max(8px, env(safe-area-inset-left)));
  }

  body.kb-open .paper-input-scroll {
    min-height: 44px;
    padding: 3px 4px 3px 6px;
    border-radius: 14px;
    gap: 5px;
    box-shadow: 0 2px 0 #b8a790;
  }

  body.kb-open .zhuyin-stamp,
  body.kb-open .zhuyin-pad-toggle {
    height: 36px;
    padding: 0 8px;
    font-size: 0.76rem;
  }

  body.kb-open .toast-container {
    top: calc(var(--vvt, 0px) + 38px);
  }

  body.kb-open .hud-gold-delta {
    z-index: 65;
    font-size: 0.78rem;
    padding: 2px 7px;
  }

  /* 手機彈窗：全部可捲、無橫向溢出、選角 2×2 */
  .modal-backdrop {
    padding: calc(max(10px, var(--kb-top-safe, env(safe-area-inset-top)))) 10px calc(max(10px, env(safe-area-inset-bottom)));
    align-items: center;
  }

  .char-select-card {
    width: 100%;
    max-width: 440px;
    max-height: calc(var(--vvh, 100dvh) - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 14px 16px;
    border-radius: 22px;
    gap: 10px;
  }

  .char-select-title {
    font-size: 1.3rem;
  }

  .char-select-sub {
    font-size: 0.82rem;
  }

  .mode-select-row {
    gap: 6px;
    margin: 2px 0 4px;
  }

  .mode-pill {
    padding: 8px 12px;
    font-size: 0.88rem;
    min-height: 40px;
  }

  .char-select-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 2px 0;
  }

  .char-choice {
    padding: 8px 6px 10px;
    border-radius: 18px;
  }

  .char-preview-cv {
    width: 104px;
    height: 112px;
  }

  .char-choice strong {
    font-size: 0.88rem;
  }

  .guide-popup-card {
    width: 100%;
    max-width: 400px;
    max-height: calc(var(--vvh, 100dvh) - 18px);
    overflow-y: auto;
    padding: 18px 16px 16px;
    border-radius: 22px;
  }

  body.kb-open .guide-popup-card {
    padding: 12px 14px 12px;
    border-radius: 18px;
    gap: 8px;
  }

  body.kb-open .guide-visual-flow {
    padding: 8px 10px;
    gap: 6px;
  }

  body.kb-open .guide-node-icon {
    width: 46px;
    height: 46px;
    font-size: 1.4rem;
    border-radius: 12px;
  }

  body.kb-open .guide-title {
    font-size: 1.08rem;
  }

  body.kb-open .guide-sub {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  body.kb-open .guide-ok-btn {
    padding: 10px 18px;
    font-size: 0.95rem;
  }

  .guide-visual-flow {
    gap: 8px;
    flex-wrap: wrap;
  }

  .g-icon-box {
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
  }

  .guide-title {
    font-size: 1.24rem;
  }

  .guide-ok-btn {
    width: 100%;
    min-height: 48px;
    font-size: 1.05rem;
  }

  .modal-box,
  .journal-box,
  .settings-box {
    width: 100%;
    max-width: 520px;
    max-height: calc(var(--vvh, 100dvh) - 24px);
    border-radius: 22px;
  }

  .modal-top {
    padding: 12px 14px;
    gap: 8px;
  }

  .journal-tabs {
    flex-wrap: wrap;
    gap: 6px;
  }

  .j-tab {
    padding: 7px 11px;
    font-size: 0.84rem;
    min-height: 38px;
  }

  .modal-scroll {
    padding: 12px 14px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .pets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .teacher-split {
    grid-template-columns: 1fr;
  }

  .setting-item {
    min-height: 46px;
  }

  .setting-toggle-btn,
  .diff-select,
  .danger-reset-btn {
    min-height: 40px;
    font-size: 0.92rem;
  }
}

/* 手機橫式（>= 560px 寬）：同樣維持地圖為主角的全畫布視角，開局選角排成 4 欄 */
@media (min-width: 560px) and (max-height: 500px) and (max-width: 960px) and (orientation: landscape) {
  .hud-bar {
    padding-top: max(4px, var(--kb-top-safe, env(safe-area-inset-top)));
  }

  .floating-typing-dock {
    padding-top: 4px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .paper-input-scroll {
    min-height: 42px;
  }

  .char-select-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .char-preview-cv {
    width: 74px;
    height: 82px;
  }
}

/* 尊重系統「減少動態效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  .gold-tag.coin-pop,
  .hud-gold-delta.earn,
  .hud-gold-delta.spend,
  .coach-pill,
  .combo-tag,
  .hud-right,
  .hud-right-drawer,
  .paper-input-scroll.shake-error {
    animation: none !important;
    transition: none !important;
  }
}


/* ============================================================================
   v20261127r1｜首購試用條、行動預覽、農務單工作台、三章與結局、自然停點與靜態動態模式
   ============================================================================ */
body.motion-reduced *,
body.motion-static * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

.coach-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
}

.coach-mini-btn {
  border: 1.5px solid #d99b43;
  background: #fef3c7;
  color: #78350f;
  font-weight: 800;
  font-size: 0.76rem;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.coach-mini-btn.ghost {
  background: #f5efe6;
  border-color: #cbbba4;
  color: #5c4e41;
}

.trial-banner {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 32;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 16px;
  background: #fffbeb;
  border: 2px solid #d99b43;
  box-shadow: 0 6px 18px rgba(32, 24, 16, 0.2);
  color: #3d2e1e;
  font-size: 0.88rem;
  font-weight: 800;
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
  justify-content: center;
}

.trial-banner-actions {
  display: flex;
  gap: 6px;
}

.trial-btn {
  border: 1.5px solid #cbbba4;
  background: #faf6ef;
  color: #4a3c30;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 5px 11px;
  border-radius: 10px;
  cursor: pointer;
}

.trial-btn.primary {
  background: #c85a38;
  border-color: #9f3e21;
  color: #fff;
}

.coverage-pill {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 26;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(41, 34, 29, 0.9);
  color: #fef08a;
  border: 1.5px solid #facc15;
  font-size: 0.8rem;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
}

/* 農務單工作台與章節／全解鎖清單 */
.journal-tabs {
  flex-wrap: wrap;
  gap: 6px;
}

.contract-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f5efe4;
  border: 1.5px solid #d7c9b4;
  font-size: 0.84rem;
}

.contract-family-block {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 16px;
  background: #fffdf9;
  border: 1.5px solid #d7c9b4;
}

.contract-family-block.locked {
  opacity: 0.72;
  background: #f6f1e8;
}

.contract-family-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.contract-family-head h3 {
  font-size: 0.98rem;
  color: #3a2e23;
}

.contract-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
}

.contract-card-tile {
  text-align: left;
  padding: 10px 11px;
  border-radius: 13px;
  border: 1.5px solid #cbbba4;
  background: #faf6ef;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #3a2e23;
}

.contract-card-tile.done {
  background: #eef7ef;
  border-color: #7ca877;
}

.contract-card-tile.locked {
  cursor: not-allowed;
  opacity: 0.65;
}

.contract-card-tile strong {
  font-size: 0.9rem;
}

.contract-card-tile small {
  font-size: 0.78rem;
  color: #6b5c4d;
  line-height: 1.35;
}

.contract-active-panel {
  padding: 14px;
  border-radius: 16px;
  background: #fffdf8;
  border: 2px solid #d99b43;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contract-board-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: #ede2cf;
  border: 1.5px dashed #b9a487;
}

.contract-board-cell {
  padding: 8px 6px;
  border-radius: 10px;
  background: #faf6ef;
  border: 1.5px solid #cbbba4;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: #6e5f50;
}

.contract-board-cell.done {
  background: #dcfce7;
  border-color: #4d9a5b;
  color: #166534;
}

.contract-board-cell.current {
  background: #fef9c3;
  border-color: #ca8a04;
  color: #854d0e;
}

.contract-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contract-choice-btn {
  flex: 1 1 130px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1.5px solid #cbbba4;
  background: #faf6ef;
  color: #3a2e23;
  font-weight: 800;
  font-size: 0.84rem;
  cursor: pointer;
}

.contract-choice-btn.active {
  background: #fef3c7;
  border-color: #d97706;
  color: #78350f;
}

.contract-prompt-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #29221d;
  color: #fef08a;
  border: 2px solid #facc15;
}

.contract-prompt-zy {
  font-size: 0.88rem;
  color: #fde68a;
}

.contract-prompt-word {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.contract-input-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.contract-word-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid #cbbba4;
  background: #fffefb;
  font-size: 16px;
  font-weight: 700;
  color: #2c241d;
}

.saved-chest-card,
.legacy-clear-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fffbeb;
  border: 1.5px solid #d99b43;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
}

/* 章節與有限全解鎖清單 */
.unlock-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.unlock-metric-tile {
  padding: 10px 12px;
  border-radius: 14px;
  background: #faf6ef;
  border: 1.5px solid #cbbba4;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.unlock-metric-tile.complete {
  background: #eef7ef;
  border-color: #6ca16a;
}

.unlock-metric-tile span {
  font-size: 0.78rem;
  color: #6b5c4d;
  font-weight: 700;
}

.unlock-metric-tile strong {
  font-size: 1.08rem;
  color: #2c241d;
}

.chapter-card {
  padding: 10px 12px;
  border-radius: 14px;
  background: #fffdf9;
  border: 1.5px solid #d5c7b2;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chapter-card.done {
  background: #eef7ef;
  border-color: #6ca16a;
}

.album-guarantee-hint {
  margin-top: 3px;
  font-size: 0.7rem;
  color: #78695a;
  line-height: 1.25;
}

/* 首購示範田、結局與自然停點封面 */
.trial-modal-card,
.ending-card,
.rest-cover-card {
  max-width: 460px;
  width: 100%;
  gap: 12px;
}

.trial-plots-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.trial-plot-box {
  padding: 12px 10px;
  border-radius: 14px;
  background: #e9f2e4;
  border: 2px solid #86a77e;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.trial-plot-box.done {
  background: #dcfce7;
  border-color: #2d6a4f;
}

.trial-plot-word {
  font-size: 1.25rem;
  font-weight: 900;
  color: #2c241d;
}

.trial-input-row {
  display: flex;
  width: 100%;
  gap: 8px;
  align-items: center;
}

.trial-word-input {
  flex: 1 1 auto;
  border: 2px solid #cbbba4;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  font-size: 16px;
}

.trial-footer-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ending-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fef3c7;
  border: 1.5px solid #d97706;
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 800;
}

.ending-checklist,
.rest-next-box {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f5efe4;
  border: 1.5px solid #d5c7b2;
  text-align: left;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #3a2e23;
}

.ending-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.settings-footer-multi {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-backup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

@media (max-width: 820px), (max-height: 500px) and (max-width: 960px) {
  .trial-banner {
    position: absolute;
    bottom: 66px;
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  body.kb-open .trial-banner {
    bottom: 56px;
  }
  .coverage-pill {
    position: absolute;
    bottom: 64px;
    font-size: 0.76rem;
  }
  body.kb-open .coverage-pill {
    bottom: 54px;
  }
  .contract-board-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v20261127r2：開局與輸入列旁「短題單字」易發現切換鈕（玩家主動選用，不減獎勵、不佔地圖高度） */
.short-stamp {
  height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1.5px solid #cbbba4;
  background: #f6efe2;
  color: #5c4e41;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.short-stamp.active {
  background: #dcfce7;
  border-color: #4d9a5b;
  color: #166534;
}

.chinese-pace-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: -2px;
}

.pace-chip {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid #cbbba4;
  background: #faf6ef;
  color: #4f4135;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.pace-chip.active {
  background: #dcfce7;
  border-color: #4d9a5b;
  color: #166534;
}

@media (max-width: 820px), (max-height: 500px) and (max-width: 960px) {
  .short-stamp {
    height: 38px;
    padding: 0 8px;
    font-size: 0.78rem;
    border-radius: 11px;
  }
  body.kb-open .short-stamp {
    height: 36px;
    padding: 0 7px;
    font-size: 0.75rem;
  }
}

/* ============================================================================
   v20261127r3｜Part A 單注音實體鍵直打狀態提示 & Part B 數值／升級／里程碑回饋強化
   ============================================================================ */
.canvas-stage:focus {
  outline: none;
}

.input-mode-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 6px;
  max-width: 100%;
  flex-wrap: wrap;
}

.input-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(41, 34, 29, 0.9);
  border: 1.5px solid #facc15;
  color: #fef08a;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(28, 22, 16, 0.22);
  white-space: nowrap;
}

.input-mode-pill.mode-ime {
  background: #fffbeb;
  border-color: #c85a38;
  color: #7c2d12;
}

.input-mode-switch {
  padding: 4px 11px;
  border-radius: 999px;
  border: 1.5px solid #cbbba4;
  background: #faf6ef;
  color: #3d3126;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 #b3a28b;
  white-space: nowrap;
}

.input-mode-switch:hover {
  background: #fffefb;
}

.paper-input-scroll.direct-key-mode {
  border-color: #d99b43;
  background: #fffcf5;
}

.paper-input-scroll.direct-key-mode .word-input {
  cursor: default;
  caret-color: transparent;
}

.paper-input-scroll.direct-hit {
  border-color: #4d9a5b;
  box-shadow: 0 6px 0 #3a7a46, 0 0 0 5px rgba(77, 154, 91, 0.22);
}

.zy-key.key-hit {
  background: #dcfce7;
  border-color: #4d9a5b;
  color: #166534;
  transform: translateY(1px);
}

.zy-key.key-miss {
  background: #ffe4e6;
  border-color: #e11d48;
  color: #9f1239;
}

/* ============================================================================
   v20261127r4｜防壓蓋輔助列、季節徽章、獨立雙農場切換、最終風車櫻花慶典遮罩
   ============================================================================ */
.dock-assist-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  width: 100%;
  pointer-events: none;
}

.dock-assist-stack .trial-banner,
.dock-assist-stack .coach-pill,
.dock-assist-stack .coverage-pill {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  margin: 0 auto;
  max-width: 100%;
  animation: none;
}

.dock-assist-stack .trial-banner,
.dock-assist-stack .coach-pill .coach-actions {
  pointer-events: auto;
}

.season-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  border: 1.5px solid #cbd5e1;
  background: #f1f5f9;
  color: #1e3a5f;
}

.season-badge.season-winter {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0c4a6e;
}

.season-badge.season-spring {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #831843;
}

.season-badge.season-summer {
  background: #fef9c3;
  border-color: #facc15;
  color: #854d0e;
}

.sleep-season-label {
  margin-top: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fef3c7;
  font-size: 1rem;
  font-weight: 800;
}

/* 獨立農場切換清單 */
.farm-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.farm-slot-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid #d5c7b2;
  background: #faf6ef;
  text-align: left;
  cursor: pointer;
  color: #3a2e23;
  font-family: inherit;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.farm-slot-card:hover {
  transform: translateY(-1px);
  border-color: #c85a38;
}

.farm-slot-card.active {
  background: #fffbeb;
  border-color: #d97706;
  box-shadow: 0 3px 0 rgba(217, 119, 6, 0.25);
}

.farm-slot-card strong {
  font-size: 0.94rem;
}

.farm-slot-card small {
  font-size: 0.78rem;
  color: #6b5c4d;
  font-weight: 700;
}

/* 最終風車首次解鎖：櫻花飄落＋全動物歡呼慶典遮罩 */
.windmill-finale-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 241, 242, 0.08) 0%, rgba(253, 242, 248, 0.18) 55%, rgba(41, 34, 29, 0.36) 100%);
  pointer-events: auto;
}

.finale-skip-btn {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 94;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid #f9a8d4;
  background: rgba(255, 253, 250, 0.94);
  color: #831843;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(41, 22, 32, 0.22);
}

.finale-credits-card {
  width: min(480px, 100%);
  padding: 20px 24px 18px;
  border-radius: 26px;
  background: rgba(255, 252, 248, 0.95);
  border: 3px solid #f472b6;
  box-shadow: 0 8px 0 rgba(190, 24, 93, 0.22), 0 22px 48px rgba(41, 22, 32, 0.34);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: popBounce 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.finale-ribbon {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: #fce7f3;
  border: 1.5px solid #f472b6;
  color: #9d174d;
  font-size: 0.84rem;
  font-weight: 900;
}

.finale-title {
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  font-weight: 900;
  color: #3a261f;
  letter-spacing: 0.08em;
}

.finale-producer {
  font-size: 1.12rem;
  font-weight: 900;
  color: #be185d;
  background: #fff1f2;
  padding: 4px 16px;
  border-radius: 999px;
  border: 1.5px solid #fbcfe8;
}

.finale-sub {
  font-size: 0.88rem;
  font-weight: 700;
  color: #6b584d;
  line-height: 1.45;
}

.finale-actions {
  margin-top: 4px;
  width: 100%;
  display: flex;
  justify-content: center;
}

body.finale-active .floating-typing-dock {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 820px), (max-height: 500px) and (max-width: 960px) {
  .dock-assist-stack {
    gap: 4px;
    margin-bottom: 4px;
  }
  .dock-assist-stack .trial-banner {
    padding: 5px 9px;
    font-size: 0.78rem;
  }
  .dock-assist-stack .coverage-pill {
    font-size: 0.74rem;
    padding: 3px 9px;
  }
  .dock-assist-stack .coach-pill {
    font-size: 0.76rem;
    padding: 4px 10px;
  }
  .season-badge {
    font-size: 0.72rem;
    padding: 1px 6px;
  }
  .windmill-finale-overlay {
    top: var(--vvt, 0px);
    left: var(--vvl, 0px);
    right: auto;
    bottom: auto;
    width: var(--vvw, 100%);
    height: var(--vvh, 100dvh);
  }
  .finale-credits-card {
    padding: 16px 16px 14px;
    border-radius: 20px;
  }
}

.gold-tag.gold-rolling {
  border-color: #eab308;
  background: #fef9c3;
}

.hud-gold-delta .delta-detail {
  font-size: 0.74rem;
  font-weight: 800;
  opacity: 0.92;
  padding-left: 3px;
}

.pip.pip-grown {
  background: #f59e0b;
  border-color: #b45309;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.45);
}

.toast-badge.toast-milestone {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2.5px solid #ca8a04;
  color: #78350f;
  padding: 9px 22px;
  font-size: 1rem;
  box-shadow: 0 5px 0 rgba(161, 98, 7, 0.35), 0 14px 30px rgba(32, 20, 8, 0.28);
  animation: milestonePop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes milestonePop {
  0% { opacity: 0; transform: translateY(-10px) scale(0.86); }
  70% { opacity: 1; transform: translateY(1px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 820px), (max-height: 500px) and (max-width: 960px) {
  .input-mode-bar {
    gap: 5px;
    margin: 0 auto 4px;
  }
  .input-mode-pill {
    font-size: 0.72rem;
    padding: 3px 9px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .input-mode-switch {
    font-size: 0.72rem;
    padding: 3px 9px;
  }
  body.kb-open .input-mode-bar {
    margin-bottom: 3px;
  }
  .toast-badge.toast-milestone {
    font-size: 0.9rem;
    padding: 7px 14px;
  }
}

/* =========================================================
 * R5 精簡視覺系統：入口等權重雙語大卡、無文字前→後短動畫、圖示剪影手札
 * ========================================================= */
.lang-big-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 4px 0 14px;
  width: 100%;
}

.lang-big-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 2.5px solid #cbbba4;
  background: #fffdf8;
  color: #3a2e23;
  font-size: 1.38rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 0 #d5c7b2;
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.lang-big-btn:hover {
  border-color: #c85a38;
  transform: translateY(-1px);
}

.lang-big-btn.active {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #c85a38;
  color: #9a3412;
  box-shadow: 0 4px 0 #c85a38, 0 8px 18px rgba(200, 90, 56, 0.22);
}

.lang-check-mark {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #c85a38;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.lang-big-btn.active .lang-check-mark {
  opacity: 1;
  transform: scale(1);
}

/* 無文字、左右並列「前→後」短動畫卡片 */
.visual-demo-backdrop {
  background: rgba(32, 24, 18, 0.24);
  backdrop-filter: blur(2px);
}

.visual-ba-card {
  width: min(320px, 86vw);
  padding: 20px 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.visual-ba-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  padding: 10px 6px;
}

.ba-stage {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  background: #faf6ef;
  border: 2px solid #d5c7b2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #cbbba4;
}

.ba-stage img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.ba-stage .ba-emoji,
.ba-stage svg {
  font-size: 2.3rem;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ba-before {
  animation: baPulseBefore 1.5s ease-in-out infinite;
}

.ba-after {
  border-color: #d99b43;
  background: #fffbeb;
  animation: baPulseAfter 1.5s ease-in-out infinite;
}

.ba-arrow {
  font-size: 1.65rem;
  font-weight: 900;
  color: #c85a38;
  animation: baArrowSlide 1.5s ease-in-out infinite;
}

.visual-ba-close {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 2px solid #9a3412;
  background: #c85a38;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #9a3412;
}

@keyframes baPulseBefore {
  0%, 100% { transform: scale(1); }
  28% { transform: scale(1.07); }
  55% { transform: scale(0.96); }
}

@keyframes baArrowSlide {
  0%, 100% { transform: translateX(0); opacity: 0.72; }
  45% { transform: translateX(5px); opacity: 1; }
}

@keyframes baPulseAfter {
  0%, 35% { transform: scale(0.96); }
  68% { transform: scale(1.09); box-shadow: 0 4px 12px rgba(217, 155, 67, 0.35); }
  100% { transform: scale(1); }
}

body.motion-reduced .ba-before,
body.motion-reduced .ba-arrow,
body.motion-reduced .ba-after,
body.motion-static .ba-before,
body.motion-static .ba-arrow,
body.motion-static .ba-after {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .ba-before,
  .ba-arrow,
  .ba-after {
    animation: none !important;
  }
}

/* 精簡圖示＋數字＋剪影手札 */
.unlock-icon-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.icon-stat-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 6px;
  border-radius: 14px;
  background: #faf6ef;
  border: 1.5px solid #cbbba4;
  font-size: 0.96rem;
  color: #2c241d;
}

.icon-stat-pill.complete {
  background: #eef7ef;
  border-color: #6ca16a;
  color: #166534;
}

.chapter-badge-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chapter-icon-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #faf6ef;
  border: 1.5px solid #cbbba4;
  font-size: 0.95rem;
  color: #5c4b3b;
}

.chapter-icon-pill.done {
  background: #eef7ef;
  border-color: #6ca16a;
  color: #166534;
}

.chapter-icon-pill .ch-check {
  font-style: normal;
  font-weight: 900;
  color: #15803d;
}

.mini-sil-section {
  margin-bottom: 10px;
}

.mini-sil-grid {
  display: grid;
  gap: 6px;
}

.mini-sil-grid.pets-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.mini-sil-grid.items-24 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.mini-sil-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: #f5efe6;
  border: 1.5px solid #d5c7b2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.mini-sil-cell.owned {
  background: #fffdf8;
  border-color: #a99276;
}

.mini-sil-cell.tier-閃亮 {
  border-color: #eab308;
  background: #fefce8;
}

.mini-sil-cell.tier-傳說 {
  border-color: #c85a38;
  background: #fff7ed;
}

.mini-sil-img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.mini-sil-img.silhouette {
  filter: brightness(0) opacity(0.22);
}

#teacher-kpi-grid.kpi-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* R6：無事可做簡短提示、新商品單圖標、雙頁互動圖鑑懸停／點按／聚焦說明卡 */
.idle-nav-hint {
  align-self: center;
  margin-bottom: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 251, 235, 0.94);
  border: 1.5px solid #d99b43;
  color: #78350f;
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(42, 34, 27, 0.14);
}

.new-item-spotlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.new-item-stage {
  width: 92px;
  height: 92px;
}

.new-item-stage img {
  width: 66px;
  height: 66px;
}

.new-item-caption {
  font-size: 1.15rem;
  font-weight: 900;
  color: #9a3412;
  letter-spacing: 0.08em;
}

.collection-top-bar {
  margin-bottom: 10px;
}

.interactive-card {
  position: relative;
  cursor: pointer;
  outline: none;
}

.interactive-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(200, 90, 56, 0.45);
}

.card-hover-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 210px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(41, 34, 29, 0.95);
  color: #fef9c3;
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 8px 20px rgba(24, 18, 12, 0.34);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.card-hover-tip .card-tip-bonus {
  margin-top: 3px;
  color: #fde047;
  font-weight: 800;
}

.interactive-card:hover .card-hover-tip,
.interactive-card:focus-visible .card-hover-tip,
.interactive-card.info-open .card-hover-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.import-confirm-card {
  width: min(420px, 92vw);
  text-align: left;
}

.import-file-hint {
  font-size: 0.78rem;
  color: #6b5c4d;
  margin-bottom: 8px;
}

.import-slot-label {
  font-size: 0.86rem;
  font-weight: 800;
  color: #3a2e23;
  margin-bottom: 8px;
}

.import-slot-options {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.import-diff-box {
  background: #faf6ef;
  border: 1.5px solid #cbbba4;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: #2c241d;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

#btn-confirm-import-ok:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.settings-version-tag {
  margin-top: 8px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: #8c7b6b;
  letter-spacing: 0.03em;
}

.mini-sil-lvl {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 900;
  color: #78350f;
}

.journal-action-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

/* 桌機窄視窗保護：非 touch-mobile 不套用手機 kb-open 壓縮，確保桌機點擊／輸入零縮放！ */
body:not(.touch-mobile).kb-open .hud-bar,
body:not(.touch-mobile).kb-open .floating-typing-dock {
  transform: none;
}

@media (max-width: 520px) {
  .unlock-icon-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mini-sil-grid.items-24 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.new-item-purpose { max-width: 20rem; color: #594337; font-size: .95rem; font-weight: 700; text-align: center; }
.pet-detail-panel { margin-bottom: 10px; padding: 10px 12px; border: 1px solid #cfb994; border-radius: 12px; color: #34281f; background: #fff8e6; font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.pet-detail-panel > strong { display: block; margin-bottom: 2px; }
.pet-detail-panel .card-tip-bonus { color: #784416; font-weight: 800; }
