*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

.wc-preview {
  padding: 8px 0;
}

.wc-img {
  width: 100%;
  border-radius: 18px;
  display: block;
  /* 使用可變數 --image-bg（若未設定則退回到 --dynamic-bg，再退回 #fff）
     這樣可以讓意象圖背景隨每日或主題背景變化而改變 */
  background: var(--image-bg, var(--dynamic-bg, #fff));
}


:root {
  --bg-1: #f6f0e6;
  --bg-2: #efe7d8;
  --bg-3: #fbfaf7;

  --ink: #1f2937;
  --muted: #6b7280;
  --line: rgba(31, 41, 55, 0.10);


  --brand-1: #9b7b5f;
  --brand-2: #c1a58a;
  --brand-soft: rgba(155, 123, 95, 0.12);


  --accent: #caa786;
  --accent-soft: rgba(202, 167, 134, 0.18);

  --ok-bg: #f3f4f6;
  --ok-text: #334155;


  --done-bg: #e3d6c6;
  --done-border: #cbb39a;
  --done-text: #6b4f3a;


  --danger-bg: #f2e6e0;
  --danger-text: #a05345;

  --dynamic-bg: #F9F8F4;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  background: radial-gradient(circle at top left, var(--bg-1), var(--bg-2), var(--bg-3));
  color: var(--ink);
  line-height: 1.6;

  transition: background-color 0.8s ease;
}

body.theme-active {
  background: var(--dynamic-bg);
}

.app {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 18px 40px;
}


.card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.transparent-card {
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
  backdrop-filter: none;
}

/* ===== Hero ===== */
.hero-card-wrapper {
  padding: 0;
  overflow: hidden;
  margin-bottom: 24px;
  text-align: center;
}

.hero-banner {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  padding: 32px 30px;
  color: #fbfaf7;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  max-width: 800px;
}

.hero-badge {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

.hero-separator {
  height: 1px;
  background: #e5e7eb;
  margin: 0 30px;
}

.hero-subtitle-area {
  padding: 24px 30px;
  display: flex;
  justify-content: center;
}

.hero-subtitle-text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  font-weight: 400;
  color: #4b5563;
  max-width: 860px;
}

@media (max-width: 768px) {
  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 24px 20px;
  }

  .hero-badge {
    position: static;
    transform: none;
    margin-bottom: 12px;
    order: -1;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-subtitle-text {
    text-align: left;
  }
}

/* ===== Flash ===== */
.flash {
  margin: 10px 0 14px;
}

.flash-item {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid rgba(148, 163, 184, 0.22);
  font-weight: 700;
  font-size: 0.88rem;
}

/* ===== Headers ===== */
.card-header {
  margin-bottom: 14px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #1f2937;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.home-container {
  margin-top: 10px;
}

.home-header {
  text-align: left;
  margin-bottom: 24px;
  padding-left: 8px;
}

.home-header h2 {
  font-size: 1.5rem;
  color: #1f2937;
  font-weight: 800;
  margin: 0 0 10px;
}

.header-separator {
  width: 60px;
  height: 3px;
  background: rgba(122, 92, 58, 0.22);
  margin-bottom: 12px;
  border-radius: 99px;
}

/* ===== Screens ===== */
.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

/* Loading state - 避免畫面閃爍 (來自 style_1.css) */
.app.loading .screen {
  display: none !important;
}

.app.loading::before {
  content: "";
  display: block;
  width: 100%;
  min-height: 60vh;
}

/* ===== Info / Guide Boxes ===== */
.info-box,
.guide-box {
  display: flex;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(239, 231, 216, 0.70);
  border: 1px solid rgba(122, 92, 58, 0.18);
  margin: 12px 0 18px;
  overflow: hidden;
}

.info-box.simple {
  background: #fff;
  border-color: #e5e7eb;
}

.info-box.no-border {
  border: none;
  background: transparent;
  padding: 0;
  margin-bottom: 16px;
}

.info-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand-1);
  font-weight: 800;
}

.info-text,
.guide-text {
  color: #0f172a;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.guide-title {
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 6px;
}

.guide-text {
  margin: 0;
  color: #374151;
}

/* ===== Weeks Layout ===== */
.weeks-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 40px;
  position: relative;
}

.week-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.week-column:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -22px;
  top: 140px;
  font-size: 24px;
  color: #94a3b8;
  font-weight: bold;
}

.week-visual-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 20px 16px 18px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

.week-visual-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.06);
}

.week-icon-large {
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.week-icon-large img {
  width: 90%;
  max-width: 280px;
  height: auto;
  object-fit: contain;
}

.week-text-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.week-label {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}

.theme-bold {
  color: var(--brand-1);
  font-weight: 900;
}

.week-desc-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #1e293b;
}

.day-card-wrapper {
  padding: 16px;
  display: flex;
  justify-content: center;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.week-days-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.day-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-circle:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-2px);
}

.circle-label {
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1;
}

.circle-sub {
  font-size: 0.7rem;
  margin-top: 3px;
  opacity: 0.8;
}

.day-circle.done {
  background: var(--done-bg);
  border-color: var(--done-border);
  color: var(--done-text);
  box-shadow: 0 4px 10px rgba(185, 155, 117, 0.25);
}

.day-circle.done:hover {
  background: #cfb99a;
}

@media (max-width: 900px) {
  .weeks-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .week-column:not(:last-child)::after {
    content: "↓";
    right: 50%;
    top: auto;
    bottom: -35px;
    transform: translateX(50%);
  }
}

/* Progress Section */
.progress-strip {
  margin-top: 0;
  padding: 16px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.progress-main {
  font-weight: 800;
  color: #111827;
  font-size: 1.4rem;
}

.progress-main .count {
  font-weight: 900;
  color: var(--brand-1);
}

.progress-main .sep {
  margin: 0 8px;
  color: #94a3b8;
}

.progress-main .ok {
  color: #166534;
}

.progress-hint {
  margin-top: 8px;
  color: #64748b;
  font-size: 0.9rem;
}

/* ===== Modes (Screen 2) ===== */
.mode-header-group {
  margin-bottom: 24px;
}

.mode-header-group h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1f2937;
  margin: 0 0 12px;
}

.mode-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.6;
}

.prominent-guide-box {
  padding: 24px;
  border-radius: 18px;
  background: rgba(239, 231, 216, 0.70);
  border: 1px solid rgba(122, 92, 58, 0.18);
  margin-bottom: 30px;
}

.guide-prompt-header {
  margin: 0 0 16px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand-1);
}

.guide-prompt-content {
  font-size: 1.3rem;
  line-height: 1.8;
  color: #1e293b;
  text-align: justify;
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.mode-tile {
  border: 1px solid rgba(122, 92, 58, 0.18);
  background: linear-gradient(180deg, #ffffff, #fbfaf7);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
  transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.mode-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(122, 92, 58, 0.32);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

.tile-icon {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-icon img {
  width: 90%;
  max-width: 280px;
  height: auto;
  object-fit: contain;
}

.tile-title {
  margin-top: 6px;
  font-weight: 800;
  color: #111827;
  font-size: 1.1rem;
}

.tile-desc-multi {
  margin-top: 12px;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-line;
}


.write-controls-container {
  display: flex;
  align-items: stretch;
  gap: 24px;
  margin-bottom: 24px;
}

.control-card-wrapper {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 0 0 150px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.write-instruction-card {
  flex: 1;
  font-size: 1rem;
  line-height: 1.7;
  color: #334155;
  background: #fff;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
}

.timer-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  min-width: 110px;
  justify-content: center;
}

.mic-circle-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ffffff, rgba(239, 231, 216, 0.85));
  box-shadow:
    0 8px 16px rgba(122, 92, 58, 0.10),
    0 0 0 1px rgba(122, 92, 58, 0.16);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--brand-1);
  padding: 0;
  margin-bottom: 16px;
}

.mic-circle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(122, 92, 58, 0.14);
}

.mic-circle-btn:active {
  transform: scale(0.96);
}

.mic-circle-btn.static-icon {
  cursor: default;
  background: #f1f5f9;
  box-shadow: none;
  border: 1px solid #e2e8f0;
  color: #64748b;
}

.mic-circle-btn.static-icon:hover {
  transform: none;
}

.mic-icon-main {
  font-size: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mic-icon-main img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  transform: scale(2);
}

.control-card-label {
  font-size: 1rem;
  font-weight: 800;
  color: #1f2937;
  line-height: 1.3;
}

.control-card-sub {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 4px;
}

.mic-circle-btn.mic-recording {
  background: var(--danger-bg);
  color: var(--danger-text);
  box-shadow: 0 0 0 4px rgba(138, 59, 47, 0.16), 0 14px 24px rgba(138, 59, 47, 0.10);
  animation: pulse-red 1.5s infinite;
}

.control-card-wrapper:has(.mic-recording) .control-card-label {
  color: var(--danger-text);
}

.control-card-wrapper:has(.mic-recording) .control-card-sub {
  color: rgba(138, 59, 47, 0.85);
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(138, 59, 47, 0.22);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(138, 59, 47, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(138, 59, 47, 0);
  }
}

/* ===== Write Screen Split Layout ===== */
.write-top-card {
  margin-bottom: 0 !important;
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.08),
    0 12px 30px rgba(15, 23, 42, 0.12);
  position: relative;
  z-index: 2;
}

.review-top-card {
  margin-bottom: 0 !important;
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.08),
    0 12px 30px rgba(15, 23, 42, 0.12);
  position: relative;
  z-index: 2;
}

.write-paper-area {
  background-color: #faf9f6;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.85)),
    url('images/paper_texture.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 20px;
  padding: 24px;
  margin-top: 16px;
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.08),
    0 14px 36px rgba(15, 23, 42, 0.13);
  border: 1px solid rgba(15, 23, 42, 0.06);
  position: relative;
}

.write-paper-area .nav-row {
  margin-top: 16px;
}

/* 即時語音辨識的 interim 獨立顯示，不覆蓋使用者正在編輯的日記。 */
.asr-live-region {
  margin: 0 16px 14px;
  padding: 12px 14px;
  border: 1px dashed rgba(122, 92, 58, 0.45);
  border-radius: 12px;
  background: rgba(239, 231, 216, 0.55);
}

.asr-live-label {
  color: var(--brand-1);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 5px;
}

.asr-live-text {
  color: #475569;
  font-size: 1.15rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.asr-live-hint {
  color: #64748b;
  font-size: 0.76rem;
  margin-top: 5px;
}

.review-paper-area {
  background-color: #faf9f6;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.85)),
    url('images/paper_texture.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 20px;
  padding: 24px;
  margin-top: 16px;
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.08),
    0 14px 36px rgba(15, 23, 42, 0.13);
  border: 1px solid rgba(15, 23, 42, 0.06);
  position: relative;
}

.review-paper-area .nav-row {
  margin-top: 16px;
}

.highlight-time {
  color: #a9845e;
  font-weight: 700;
  font-size: 1.1rem;
}

.timer-badge.vertical-layout {
  flex-direction: column;
  align-items: center;
}

.textarea-wrap {
  margin-top: 0;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: #f9fafb;
  padding: 16px;
  overflow: hidden;
}

/* Paper-textured textarea wrapper — transparent to show crumpled paper bg */
.paper-textarea-wrap {
  border: none;
  background: transparent;
  padding: 8px 16px;
}

textarea {
  width: 100%;
  display: block;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  padding: 16px;
  font-size: 1.05rem;
  font-family: inherit;
  background: #ffffff;
  min-height: 400px;
  resize: vertical;
  outline: none;
  overflow-wrap: anywhere;
  line-height: 1.8;
}

textarea::placeholder {
  color: #94a3b8;
  line-height: 1.8;
}

textarea:focus {
  border-color: rgba(122, 92, 58, 0.55);
  box-shadow: 0 0 0 3px rgba(214, 196, 167, 0.45);
}

/* Textarea on paper — transparent, blends into paper texture */
.paper-textarea-wrap textarea {
  background: transparent;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  color: #1a1a1a;
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 2.1;
  font-family: 'LXGW WenKai', 'Noto Serif TC', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", cursive;
  padding: 16px;
}

.paper-textarea-wrap textarea::placeholder {
  color: rgba(30, 30, 30, 0.45);
}

.paper-textarea-wrap textarea:focus {
  border: 1px solid #999999;
  outline: none;
}

.paper-textarea-wrap textarea.is-asr-recording {
  cursor: default;
  border-color: rgba(122, 92, 58, 0.48);
  background: rgba(255, 255, 255, 0.18);
}

.helper {
  margin-top: 8px;
  color: #64748b;
  font-size: 0.88rem;
  text-align: right;
}

.nav-row {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: transform .08s ease, box-shadow .12s ease, background .15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff;
  box-shadow: 0 12px 26px rgba(122, 92, 58, 0.28);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #8f6f55, var(--brand-1));
}

.btn.ghost {
  background: #f3f4f6;
  color: #374151;
}

.btn.ghost:hover {
  background: #e5e7eb;
}

.btn.soft {
  background: rgba(239, 231, 216, 0.85);
  color: var(--brand-1);
  border: 1px solid rgba(122, 92, 58, 0.18);
}

.btn.soft:hover {
  background: rgba(239, 231, 216, 0.95);
}

.btn.tiny {
  padding: 7px 10px;
  font-size: 0.86rem;
  border-radius: 12px;
}

/* Hourglass */
.hourglass {
  --hg-progress: 0;
  position: relative;
  display: grid;
  grid-template-rows: 1fr 1fr;
  width: 46px;
  height: 60px;
  padding: 0 4px;
  border-top: 2px solid #a8906f;
  border-bottom: 2px solid #a8906f;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
}

.hourglass.small {
  width: 40px;
  height: 54px;
}

.hourglass .top,
.hourglass .bottom {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.35);
}

.hourglass .top {
  border-radius: 0 0 50% 50%;
}

.hourglass .bottom {
  border-radius: 50% 50% 0 0;
}

.hourglass .top::before,
.hourglass .bottom::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #e7d3b0, #caa26a);
  border-radius: 50%;
  transition: transform 0.2s linear;
}

.hourglass .top::before {
  transform-origin: top;
  transform: scaleY(calc(1 - var(--hg-progress)));
}

.hourglass .bottom::before {
  transform-origin: bottom;
  transform: scaleY(var(--hg-progress));
}

.hourglass::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #caa26a;
  opacity: 0;
}

.hourglass.running::after {
  opacity: 1;
  animation: hg-drip 0.6s ease-in-out infinite;
}

@keyframes hg-drip {

  0%,
  100% {
    transform: translate(-50%, -50%) scaleY(0.6);
    opacity: 0.6;
  }

  50% {
    transform: translate(-50%, -50%) scaleY(1.2);
    opacity: 1;
  }
}

.timer-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.timer-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.timer-time {
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  color: var(--brand-1);
  font-size: 1.1rem;
}

.timer-btn {
  background: rgba(239, 231, 216, 0.85);
  color: var(--brand-1);
  border: 1px solid rgba(122, 92, 58, 0.18);
}

@media (max-width: 768px) {
  .write-controls-container {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    align-items: stretch;
    gap: 16px;
    background: transparent;
    border: none;
    padding: 0;
  }

  .control-card-wrapper {
    width: auto;
    min-width: 0;
    order: 1;
    margin-bottom: 0;
  }

  .write-instruction-card {
    grid-column: span 2;
    width: auto;
    order: 3;
    text-align: left;
  }

  .timer-card {
    width: auto;
    min-width: 0;
    padding: 12px 6px;
    flex-direction: column;
    gap: 12px;
    order: 2;
    justify-content: center;
  }

  .timer-card .timer-btn {
    padding: 4px 6px;
    font-size: 0.76rem;
    border-radius: 8px;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
  }

  .timer-card .timer-time {
    font-size: 0.95rem;
  }

  .hourglass {
    width: 38px;
    height: 50px;
  }

  .hourglass.small {
    width: 32px;
    height: 42px;
  }
}

/* ===== Welcome Screen ===== */
#screen-welcome {
  position: relative;
  overflow: hidden;
}

#screen-welcome::before {
  content: "";
  position: absolute;
  inset: -40px;
  pointer-events: none;
  opacity: 0.45;
  background:
    repeating-linear-gradient(135deg,
      rgba(15, 23, 42, 0.030) 0px,
      rgba(15, 23, 42, 0.030) 1px,
      transparent 1px,
      transparent 14px);
}

#screen-welcome::after {
  content: "";
  position: absolute;
  inset: -60px;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 25%, rgba(154, 123, 85, 0.10), transparent 55%),
    radial-gradient(circle at 82% 75%, rgba(214, 196, 167, 0.14), transparent 55%),
    radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
  opacity: 0.55;
  filter: blur(0.2px);
}

.welcome-card {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 18% 18%, rgba(154, 123, 85, 0.10), transparent 60%),
    radial-gradient(900px 520px at 85% 70%, rgba(214, 196, 167, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(251, 250, 247, 0.92));
}

.welcome-center {
  text-align: center;
  max-width: 680px;
  padding: 26px 18px;
  position: relative;
  z-index: 1;
}

.welcome-logo {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
}

.welcome-hero-logo {
  max-height: 140px !important;
}

.app-logo-img {
  max-height: 100px;
  width: auto;
  display: block;
}

.journey-footer-logo {
  max-height: 70px;
}

.welcome-title {
  font-size: 2.3rem;
  font-weight: 900;
  color: #7a5c3a;
  margin: 10px 0 12px;
  letter-spacing: 1px;
}

.welcome-desc {
  font-size: 1.3rem;
  color: #374151;
  line-height: 1.85;
  margin: 0 auto 22px;
  max-width: 560px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(239, 231, 216, 0.55);
  border: 1px solid rgba(122, 92, 58, 0.16);
}

/* User Input Styles (來自 style_1.css) */
.user-input-container {
  margin: 24px auto;
  max-width: 400px;
}

.user-id-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.05rem;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.user-id-input:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(155, 123, 95, 0.15);
}

.user-id-error {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--danger-bg);
  color: var(--danger-text);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.btn-start {
  padding: 14px 30px;
  font-size: 1.05rem;
  box-shadow: 0 16px 34px rgba(122, 92, 58, 0.30);
}


.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(245, 239, 230, 0.70);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}


.modal-card {
  width: 90%;
  max-width: 580px;
  background: #ffffff;
  border-radius: 28px;
  padding: 40px 32px 32px;
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  position: relative;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.is-open .modal-card {
  transform: translateY(0);
}

.modal-decor-bg {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(154, 123, 85, 0.10) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.instruction-group {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.instruction-icon {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.instruction-text p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.75;
  color: #334155;
  text-align: justify;
}

.highlight-text {
  color: var(--brand-1);
  font-weight: 700;
  position: relative;
}

.highlight-text::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(214, 196, 167, 0.55);
  z-index: -1;
  border-radius: 4px;
}

.highlight-text.big {
  font-size: 1.5rem;
  margin: 0 4px;
}

.instruction-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 24px 0 24px 0;
  width: 100%;
}

/* ===== Action Button (Round) ===== */
.modal-action {
  display: flex;
  justify-content: flex-end;
  margin-top: 30px;
}

.btn-circle-action {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--brand-1), var(--accent));
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(122, 92, 58, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 10;
}

.btn-circle-action::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(122, 92, 58, 0.20);
  opacity: 0.6;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

.btn-circle-action:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 16px 32px rgba(122, 92, 58, 0.45);
}

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

.action-label {
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 4px;
}

.action-sub {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}

@media (max-width: 480px) {
  .modal-card {
    padding: 30px 24px 24px;
  }

  .instruction-group {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .instruction-text p {
    text-align: center;
  }

  .modal-action {
    justify-content: center;
  }

  .btn-circle-action {
    width: 100%;
    height: auto;
    border-radius: 99px;
    padding: 16px 24px;
    flex-direction: row;
    gap: 10px;
  }

  .btn-circle-action::before {
    display: none;
  }

  .action-label::after {
    content: "：";
  }

  .action-label,
  .action-sub {
    margin: 0;
    font-size: 1.1rem;
  }
}


.review-icon-bg {
  background: rgba(239, 231, 216, 0.65);
  color: var(--brand-1);
  border: 1px solid rgba(122, 92, 58, 0.18);
}


.review-split {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.review-split.is-single {
  grid-template-columns: 1fr;
}

.review-split.is-single .review-right {
  display: none;
}

.review-left {
  min-width: 0;
}

.review-right {
  min-width: 0;
}

.review-image-card {
  /* 保持卡片背景為白色，僅讓圖片本身背景跟隨變數（視覺上較乾淨） */
  background: #ffffff;
  border: 1px solid rgba(122, 92, 58, 0.16);
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.review-image-title {
  font-weight: 900;
  color: #1f2937;
  margin: 2px 0 10px;
  letter-spacing: 0.3px;
}

.review-image-hint {
  color: #64748b;
  font-size: 0.9rem;
  margin-top: 10px;
}

.review-image {
  width: 100%;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(31, 41, 55, 0.10);
  /* 讓實際圖片區塊也跟隨變數，而非固定顏色 */
  background: var(--image-bg, var(--dynamic-bg, #fbfaf7));
  max-height: 520px;
  object-fit: contain;
  cursor: zoom-in;
}

@media (max-width: 900px) {
  .review-split {
    grid-template-columns: 1fr;
  }

  /* 手機時：圖片在下面 */
  .review-right {
    order: 2;
  }

  .review-left {
    order: 1;
  }
}

/* =========================
   Loading Overlay (分析中)
   ========================= */

body.no-scroll {
  overflow: hidden;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  /* 比 modal-overlay(9999) 更上層，避免被蓋掉 */
  display: none;
  /* JS 會切成 flex */
  align-items: center;
  justify-content: center;

  background: rgba(245, 239, 230, 0.72);
  /* 跟 modal-overlay 同系 */
  backdrop-filter: blur(10px);
}

.loading-card {
  width: min(520px, 92vw);
  border-radius: 26px;
  padding: 30px 26px 24px;
  text-align: center;

  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(122, 92, 58, 0.16);
  box-shadow:
    0 22px 55px rgba(15, 23, 42, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.75) inset;
  position: relative;
  overflow: hidden;
}

/* 上方淡淡裝飾光暈，跟你的 welcome/modal 同風格 */
.loading-card::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(154, 123, 85, 0.14) 0%, transparent 70%);
  pointer-events: none;
}

.loading-icon {
  width: 82px;
  height: 82px;
  border-radius: 22px;
  margin: 0 auto 14px;

  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;

  background: linear-gradient(135deg, rgba(122, 92, 58, 0.14), rgba(214, 196, 167, 0.18));
  border: 1px solid rgba(122, 92, 58, 0.18);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.10);
}

/* 旋轉圈圈：用你的 brand 色系 */
.loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid rgba(122, 92, 58, 0.18);
  border-top-color: var(--brand-1);
  animation: loading-spin 0.9s linear infinite;
}

.loading-dot {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.12);
  animation: loading-pulse 1.2s ease-in-out infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading-pulse {

  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.75;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.loading-title {
  font-size: 1.25rem;
  font-weight: 950;
  color: #7a5c3a;
  /* 跟 welcome-title 一致 */
  letter-spacing: 0.6px;
  margin-top: 6px;
}

.loading-desc {
  margin-top: 8px;
  color: #334155;
  font-size: 1.02rem;
  line-height: 1.75;
}

.loading-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* 進場動畫（你已經有 fade-in-up class 在 modal 上用）
   若你沒有定義 fade-in-up，可加這段保險 */
.fade-in-up {
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

.encouragement-text-box {
  padding: 30px;
  background: #fbfaf7;
  border-left: 5px solid var(--brand-1);
  border-radius: 4px 20px 20px 4px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.review-image-card img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* 上方兩欄：固定同高 */
/* 上方兩欄：同高，但不要用死 height（避免溢出蓋到下面） */
.final-top {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;

  /* ✅ 用 min-height 讓它「至少」跟右邊一樣高，但允許自然長大 */
  min-height: min(72vh, 760px);
}

/* ✅ 重要：讓 grid/flex 子元素可以被壓縮，overflow 才會生效 */
.final-left,
.final-right {
  min-width: 0;
  min-height: 0;
}

/* 左邊日記卡：固定同高 + 內容區捲動 */
.final-diary-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* ✅ 重要 */
  overflow: hidden;
  /* ✅ 避免內容溢出把下面蓋住 */
}

.final-diary-body {
  flex: 1;
  min-height: 0;
  /* ✅ 重要：不然 overflow:auto 常失效 */
  overflow: auto;
  /* ✅ 日記太長就捲 */
  padding-right: 6px;
}

/* 右邊兩張圖：平均分配高度 */
.final-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.final-media-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* ✅ 重要 */
  overflow: hidden;
  /* ✅ 圖片不撐爆 */
}

.final-media-img {
  flex: 1;
  min-height: 0;
  /* ✅ 重要 */
  width: 100%;
  max-height: none !important;
  /* 覆蓋你原本 max-height:520px */
  object-fit: contain;
}

/* ✅ 最下層鼓勵：全寬（保持自然高度即可） */
.final-encouragement {
  margin-top: 18px;
}

/* 手機：單欄 + 不固定同高（不然很難滑） */
@media (max-width: 900px) {
  .final-top {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .final-diary-body {
    max-height: 60vh;
  }
}

/* ✅ 最終總結頁：左邊日記在自己的區塊內捲動 */
#screen-final .final-top {
  /* 讓上半部不要無限長 */
  height: min(72vh, 760px);
  align-items: stretch;
}

/* grid 子元素允許被壓縮，overflow 才會生效 */
#screen-final .final-left,
#screen-final .final-right {
  min-width: 0;
  min-height: 0;
}

/* 左邊卡片固定高度，內容區內捲動 */
#screen-final .final-diary-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* ✅ 重要 */
  overflow: hidden;
  /* ✅ 避免內容把整頁撐長 */
}

/* 真正捲動的容器 */
#screen-final .final-diary-body {
  flex: 1;
  min-height: 0;
  /* ✅ 重要 */
  overflow: auto;
  /* ✅ 捲動在這裡發生 */
  padding-right: 8px;
}

/*（可選）捲軸樣式讓它更像「區塊內閱讀」 */
#screen-final .final-diary-body {
  scroll-behavior: smooth;
}

/* 手機：不要固定上半部高度，不然不好滑 */
@media (max-width: 900px) {
  #screen-final .final-top {
    height: auto;
  }
}

#screen-encouragement .encouragement-new-layout {
  padding: 24px 20px;
  max-width: 1080px;
  margin: 0 auto;
}

.encouragement-header-wrapper {
  /* 外層圓角邊框，改為帶透明度的深藍灰 */
  border: 2px solid rgba(44, 62, 80, 0.25);
  border-radius: 40px;
  padding: 14px 24px;
  margin-bottom: 14px;
  text-align: center;

  /* --- 毛玻璃質感核心 --- */
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  /* ---------------------- */

  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.06);
}

.encouragement-title-new {
  font-size: 2rem;
  color: #7a5c3a;
  margin: 0 0 14px;
  font-weight: 500;
  letter-spacing: 1px;
}

.thanks-message-box {
  /* 內層「謝謝您...」的淡細邊框，也改為透明系 */
  border: 1px solid rgba(44, 62, 80, 0.15);
  border-radius: 12px;
  padding: 12px 24px;
  display: inline-block;
  background: rgba(255, 255, 255, 0.35);
  max-width: 90%;
}

.thanks-message-content {
  margin: 0;
  font-size: 1.15rem;
  color: #1f2937;
  line-height: 1.6;
  text-align: justify;
}

.encouragement-content-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 50px;
}

.encouragement-quotes-col {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.final-quote-text {
  font-size: 1.2rem;
  font-weight: 700;
  /* 使用動態文字顏色，確保在深淺背景下都清晰 */
  color: var(--dynamic-text, #7a5c3a);
  line-height: 1.8;
  margin: 0 0 10px;
  text-align: center;
  /* 增加極微小的文字陰影，進一步提升對比度 */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.encouragement-quotes-area {
  margin-bottom: 10px;
  max-width: 900px;
}

.encouragement-image-col {
  flex: 1.3;
}

.final-bowl-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.final-bowl-image {
  width: 100%;
  max-width: 1000px;
  height: auto;
  display: block;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  /* 去掉圓角邊框感 */
}

@media (max-width: 900px) {
  .encouragement-content-bottom {
    flex-direction: column;
    gap: 30px;
    text-align: center;
  }

  .encouragement-quotes-col {
    text-align: center;
  }

  .final-quote-text {
    text-align: center;
    font-size: 1.4rem;
  }

  .encouragement-title-new {
    font-size: 2rem;
  }

  .encouragement-header-wrapper {
    padding: 30px 20px;
  }
}

/* --- Journey Screen Styles (Image 4 Style) --- */
.journey-main-card {
  border: 2px solid rgba(44, 62, 80, 0.25);
  border-radius: 40px;
  padding: 50px 40px;
  margin-bottom: 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.06);
  max-width: 460px;
  margin: 0 auto 24px;
  padding: 35px 30px;
}

.journey-thanks-text {
  font-size: 1.5rem;
  color: var(--dynamic-text, #7a5c3a);
  margin-bottom: 10px;
  line-height: 1.6;
  font-weight: 700;
}

.journey-progress-wrap {
  margin-bottom: 10px;
}

.journey-progress-text {
  font-size: 1.5rem;
  color: var(--dynamic-text, #7a5c3a);
  line-height: 1.6;
  font-weight: 700;
  margin: 0;
}

.day-count-box {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  margin: 0;
  display: inline;
  line-height: inherit;
  font-weight: inherit;
}

.journey-logo-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}



.journey-bottom-slogan {
  font-size: 1.05rem;
  color: var(--dynamic-text);
  opacity: 0.85;
  margin: 0;
  text-align: right;
  max-width: 60%;
}

.journey-footer-box {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  gap: 24px;
  width: 100%;
  margin-top: 12px;
}

.journey-main-container {
  width: 100%;
}

.journey-text-area {
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .journey-main-card {
    padding: 30px 20px;
  }

  .journey-thanks-text,
  .journey-progress-text {
    font-size: 1.4rem;
  }
}

/* --- Final Pages Universal Layout (Image 5 & 6) --- */
.final-page-container {
  padding: 18px !important;
  border-radius: 40px !important;
  background: #ffffff !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
  max-width: 1000px;
  margin: 0 auto;
}

.final-columns-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
  align-items: stretch;
}

.theme-bg-box {
  background: var(--dynamic-bg);
  /* 跟隨每一天的背景顏色 */
  border-radius: 24px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: auto;
}

.encouragement-main-container {
  width: 100%;
}

/* 確保圖片在容器中適配 */
.final-right-col .final-bowl-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.final-bowl-image {
  max-width: 100% !important;
  max-height: 320px !important;
  width: auto !important;
  object-fit: contain;
}

/* 覆蓋頂部標題區域 */
#screen-encouragement .encouragement-header-wrapper {
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 16px 20px;
  margin-bottom: 16px;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  border-radius: 20px;
}

/* 旅程頁面文字調整 */
#screen-journey .journey-thanks-text {
  font-size: 1.4rem;
  margin-bottom: 15px;
}

#screen-journey .journey-progress-text {
  font-size: 1.4rem;
  line-height: 1.8;
}

#screen-journey .journey-logo-footer {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
  flex: 0 0 auto;
}

#screen-journey .journey-bottom-slogan {
  margin-top: 0;
  font-size: 0.95rem;
  text-align: left;
  max-width: none;
}

@media (max-width: 900px) {
  .final-columns-layout {
    grid-template-columns: 1fr;
  }

  .theme-bg-box {
    min-height: auto;
  }
}

/* ==========================================================
   Feedback Score Radio Buttons
   ========================================================== */
.feedback-score-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.feedback-score-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
}

/* ==========================================================
   RWD: Medium phones & small tablets (≤600px)
   ========================================================== */
@media (max-width: 600px) {
  .app {
    padding: 16px 10px 30px;
  }

  .card {
    padding: 18px 14px;
    border-radius: 16px;
  }

  /* Hero */
  .hero-card-wrapper {
    margin-bottom: 16px;
  }

  .hero-banner {
    padding: 20px 16px;
  }

  .hero-title {
    font-size: 1.35rem;
  }

  .hero-subtitle-area {
    padding: 16px;
  }

  .hero-subtitle-text {
    font-size: 0.93rem;
  }

  /* Home header */
  .home-header {
    margin-bottom: 16px;
    padding-left: 4px;
  }

  .home-header h2 {
    font-size: 1.25rem;
  }

  /* Weeks container */
  .weeks-container {
    gap: 28px;
    margin-bottom: 24px;
  }

  .week-visual-card {
    padding: 20px 14px;
  }

  .week-icon-large {
    margin-bottom: 10px;
  }

  .week-icon-large img {
    width: 85%;
    max-width: 240px;
  }

  .week-label {
    font-size: 1rem;
  }

  .week-desc-text {
    font-size: 0.88rem;
  }

  /* Day circles */
  .day-circle {
    width: 52px;
    height: 52px;
  }

  .circle-label {
    font-size: 0.8rem;
  }

  .day-card-wrapper {
    padding: 12px;
  }

  .week-days-row {
    gap: 8px;
  }

  /* Progress section */
  .progress-strip {
    padding: 12px;
  }

  .progress-main {
    font-size: 0.95rem;
  }

  .progress-hint {
    font-size: 0.82rem;
  }

  /* Modes grid */
  .modes-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .mode-tile {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .tile-icon {
    font-size: 2.4rem;
  }

  .tile-title {
    font-size: 1rem;
  }

  .tile-desc-multi {
    font-size: 0.85rem;
  }

  /* Guide / Prompt boxes */
  .prominent-guide-box {
    padding: 16px;
    margin-bottom: 20px;
  }

  .guide-prompt-header {
    font-size: 1.05rem;
    margin-bottom: 10px;
  }

  .guide-prompt-content {
    font-size: 0.95rem;
  }

  .mode-header-group h2 {
    font-size: 1.25rem;
  }

  /* Write controls */
  .write-controls-container {
    gap: 12px;
  }

  .control-card-wrapper {
    padding: 16px 12px;
  }

  .mic-circle-btn {
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
  }

  .mic-icon-main {
    font-size: 2.2rem;
  }

  .write-instruction-card {
    padding: 16px;
    font-size: 0.92rem;
  }

  /* Textarea */
  textarea {
    min-height: 260px;
    font-size: 1rem;
    padding: 12px;
  }

  .textarea-wrap {
    padding: 12px;
  }

  /* Card headers */
  .card-header h2 {
    font-size: 1.25rem;
  }

  /* Nav row */
  .nav-row {
    margin-top: 16px;
    gap: 8px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 0.92rem;
  }

  .btn-start {
    padding: 12px 24px;
    font-size: 1rem;
  }

  /* Review */
  .review-split {
    gap: 12px;
  }

  /* Feedback */
  #screen-feedback .card {
    padding: 16px 12px;
  }

  #screen-feedback h3 {
    font-size: 1.05rem;
  }

  /* Wordcloud / Thoughtcloud images */
  #screen-wordcloud h1,
  #screen-thoughtcloud h1,
  #screen-pos-emocloud h1,
  #screen-pos-thoughtcloud h1,
  #screen-radar h1 {
    font-size: 1.3rem;
  }

  /* Encouragement */
  .encouragement-title-new {
    font-size: 1.5rem;
  }

  .thanks-message-content {
    font-size: 1rem;
  }

  .encouragement-header-wrapper {
    padding: 12px 16px;
    border-radius: 24px;
  }

  .final-quote-text {
    font-size: 1.05rem;
  }

  .theme-bg-box {
    padding: 16px;
    border-radius: 18px;
  }

  .final-page-container {
    padding: 14px !important;
    border-radius: 24px !important;
  }

  /* Journey */
  .journey-thanks-text {
    font-size: 1.2rem !important;
  }

  .journey-progress-text {
    font-size: 1.2rem !important;
  }

  .journey-footer-box {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .journey-bottom-slogan {
    text-align: center !important;
    max-width: 100% !important;
    font-size: 0.9rem !important;
  }

  .journey-logo-footer {
    align-items: center !important;
  }

  /* Welcome */
  .welcome-card {
    min-height: 60vh;
  }

  .welcome-title {
    font-size: 1.6rem;
  }

  .welcome-desc {
    font-size: 0.92rem;
    padding: 8px 12px;
  }

  .welcome-hero-logo {
    max-height: 110px !important;
  }

  /* Loading overlay */
  .loading-card {
    padding: 24px 18px 20px;
  }

  .loading-title {
    font-size: 1.1rem;
  }

  .loading-desc {
    font-size: 0.92rem;
  }
}

/* ==========================================================
   RWD: Small phones / iPhone SE-like (≤400px)
   ========================================================== */
@media (max-width: 400px) {
  .app {
    padding: 12px 8px 24px;
  }

  .card {
    padding: 14px 10px;
  }

  .hero-title {
    font-size: 1.15rem;
  }

  .hero-subtitle-text {
    font-size: 0.88rem;
  }

  .hero-banner {
    padding: 16px 12px;
  }

  .hero-subtitle-area {
    padding: 12px;
  }

  /* Smaller day circles for tiny screens */
  .day-circle {
    width: 46px;
    height: 46px;
  }

  .circle-label {
    font-size: 0.72rem;
  }

  .week-days-row {
    gap: 6px;
  }

  .week-icon-large img {
    width: 80%;
    max-width: 200px;
  }

  .week-label {
    font-size: 0.92rem;
  }

  .week-desc-text {
    font-size: 0.82rem;
  }

  /* Mode tiles */
  .mode-tile {
    padding: 14px 12px;
  }

  .tile-icon {
    font-size: 2rem;
  }

  .prominent-guide-box {
    padding: 12px;
  }

  .guide-prompt-header {
    font-size: 0.95rem;
  }

  .guide-prompt-content {
    font-size: 0.88rem;
  }

  /* Textarea */
  textarea {
    min-height: 220px;
    font-size: 0.95rem;
  }

  /* Encouragement */
  .encouragement-title-new {
    font-size: 1.3rem;
  }

  .thanks-message-box {
    max-width: 100%;
    padding: 10px 14px;
  }

  .thanks-message-content {
    font-size: 0.92rem;
  }

  .final-quote-text {
    font-size: 0.95rem;
  }

  /* Welcome */
  .welcome-title {
    font-size: 1.35rem;
  }

  .welcome-hero-logo {
    max-height: 90px !important;
  }

  .welcome-center {
    padding: 16px 10px;
  }

  /* Modal */
  .modal-card {
    padding: 24px 16px 20px;
    border-radius: 20px;
  }

  .instruction-text p {
    font-size: 0.95rem;
  }

  /* Feedback scores: make touch-friendly */
  .feedback-score-label {
    width: 38px;
  }

  /* Journey */
  .journey-thanks-text {
    font-size: 1.05rem !important;
  }

  .journey-progress-text {
    font-size: 1.05rem !important;
  }

  .journey-footer-logo {
    max-height: 50px;
  }

  /* Buttons */
  .btn {
    font-size: 0.88rem;
    padding: 9px 12px;
  }

  .btn-start {
    padding: 11px 20px;
    font-size: 0.95rem;
  }

  .nav-row {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-row .btn {
    text-align: center;
    justify-content: center;
  }
}

/* ==========================================================
   General mobile fixes: prevent horizontal overflow
   ========================================================== */
@media (max-width: 768px) {

  /* Prevent any horizontal overflow on mobile */
  html,
  body {
    overflow-x: hidden;
  }

  /* Ensure images don't overflow */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Feedback score radio buttons: better mobile wrapping */
  .feedback-score-row {
    gap: 6px;
    justify-content: center;
  }

  .feedback-score-label {
    width: 40px;
  }

  /* Radar chart container */
  #screen-radar div[style*="padding: 18px"] {
    padding: 12px !important;
  }

  /* Modes grid: ensure single column on mobile */
  .modes-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   Readability adjustments for the primary 50–60 age audience
   ========================================================== */
.hero-subtitle-text {
  font-size: 1.32rem;
  line-height: 1.85;
  color: #374151;
}

.home-day-instruction {
  font-size: 1.4rem;
  line-height: 1.85;
  color: #4b5563;
}

.progress-hint {
  font-size: 1.2rem;
  line-height: 1.75;
  color: #475569;
}

.day-circle {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
}

.circle-label {
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
}

.week-days-row {
  gap: 14px;
  flex-wrap: nowrap;
}

.write-instruction-card,
.review-instruction-card {
  font-size: 1.25rem;
  line-height: 1.9;
  color: #27364a;
  font-weight: 500;
}

.cloud-result-message {
  font-size: 1.4rem;
  line-height: 1.9 !important;
  color: #374151;
  font-weight: 500;
}

.private-space-group .instruction-text,
.modal-large-text .instruction-text {
  width: 100%;
}

.private-space-group .instruction-text p,
.modal-large-text .instruction-text p {
  font-size: 1.6rem;
  line-height: 1.85;
  font-weight: 650;
  text-align: center;
  color: #27364a;
}

.feedback-scale-help {
  font-size: 1.2rem;
  line-height: 1.8;
  color: #374151;
  font-weight: 600;
}

.review-image-title {
  font-size: 1.15rem;
}

.review-image-hint {
  font-size: 1.05rem;
  line-height: 1.7;
}

@media (max-width: 600px) {

  .day-circle {
    width: 68px;
    height: 68px;
    flex-basis: 68px;
  }

  .circle-label {
    font-size: 1rem;
  }

  .week-days-row {
    gap: 10px;
  }

  .hero-subtitle-text,
  .home-day-instruction,
  .write-instruction-card,
  .review-instruction-card,
  .cloud-result-message {
    font-size: 1.125rem;
  }

  .progress-hint,
  .feedback-scale-help {
    font-size: 1.1rem;
  }

  .private-space-group .instruction-text p,
  .modal-large-text .instruction-text p {
    font-size: 1.25rem;
    line-height: 1.8;
  }

  .review-image-title {
    font-size: 1.1rem;
  }

  .review-image-hint {
    font-size: 1rem;
  }
}

@media (max-width: 400px) {
  .day-circle {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .circle-label {
    font-size: 0.95rem;
  }

  .week-days-row {
    gap: 8px;
  }
}
