:root {
  --church-yellow: #f8c500;
  --church-yellow-deep: #e7af0e;
  --church-blue: #0f3290;
  --church-blue-dark: #0a246b;
  --blessing-gold: #ebb02b;
  --blessing-gold-deep: #d9960d;
  --paper: #fffdf8;
  --paper-soft: #fbf4e8;
  --paper-panel: #fffaf2;
  --line: rgba(204, 170, 111, 0.28);
  --text: #4a4034;
  --muted: #726758;
  --shadow-sm: 0 10px 24px rgba(120, 86, 25, 0.10);
  --shadow-md: 0 18px 42px rgba(113, 78, 20, 0.12);
  --shadow-lg: 0 28px 66px rgba(91, 61, 14, 0.16);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --content-width: 1360px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: linear-gradient(180deg, #fffdf9 0%, #fbf5ea 100%);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.local-origin-warning {
  padding: 10px 18px;
  color: #5a4022;
  background: #fff3cc;
  border-bottom: 1px solid rgba(180, 133, 39, 0.24);
  font-size: 0.9rem;
}

.site-header {
  min-height: 88px;
  padding: 12px clamp(18px, 3vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--church-yellow);
  box-shadow: 0 4px 20px rgba(106, 76, 5, 0.16);
}
.brand { text-decoration: none; display: inline-flex; align-items: center; }
.brand-logo { width: 266px; height: auto; }

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 24px);
}
.main-nav a {
  position: relative;
  color: #2f2a14;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
}
.main-nav a:not(.donate-link)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 0;
  height: 2px;
  background: var(--church-blue);
  border-radius: 999px;
  transform: translateX(-50%);
  transition: width 0.2s ease;
}
.main-nav a:hover,
.main-nav a:focus-visible { color: var(--church-blue); }
.main-nav a:hover::after,
.main-nav a:focus-visible::after { width: 100%; }
.main-nav a[href="login.html"] { display: none; }
.donate-link {
  padding: 11px 16px;
  border: 1.5px solid rgba(24, 53, 88, 0.55);
  border-radius: 999px;
  background: rgba(255,255,255,0.2);
}
.donate-link:hover { background: rgba(255,255,255,0.33); }
.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  color: var(--church-blue);
  font-size: 1.9rem;
}

main { display: block; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  min-height: 620px;
  padding: 56px max(22px, calc((100vw - var(--content-width)) / 2 + 24px)) 48px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0.15)),
    url("webitems/hero-background.png") center/cover no-repeat;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 90px;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,251,243,0.8));
  pointer-events: none;
}
.hero-decor {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  opacity: 0.95;
}
.hero-decor-left {
  left: 0;
  bottom: 0;
  width: 230px;
  height: 290px;
  background: url("webitems/hero-floral-left.png") left bottom/contain no-repeat;
}
.hero-decor-right {
  right: 0;
  top: 24px;
  width: 330px;
  height: 360px;
  background: url("webitems/hero-floral-right.png") right top/contain no-repeat;
}
.hero-copy,
.hero-visual,
.ai-fab { position: relative; z-index: 1; }
.hero-copy { max-width: 660px; }
.hero h1 {
  margin: 0;
  color: var(--church-blue);
  font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  line-height: 1.14;
  letter-spacing: 0.04em;
  font-weight: 900;
}
.hero h1::after {
  content: "♡";
  display: inline-block;
  margin-left: 8px;
  color: #e9ab45;
  font-size: 0.46em;
  transform: translateY(-0.65em) rotate(6deg);
}
.subtitle {
  margin: 18px 0 36px;
  color: #5f564a;
  font-size: clamp(1.05rem, 1.5vw, 1.45rem);
  line-height: 1.7;
}

.draw-button {
  position: relative;
  width: min(100%, 660px);
  min-height: 182px;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 160px 1fr 74px;
  align-items: center;
  gap: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.88);
  border-radius: 30px;
  overflow: hidden;
  background: transparent;
  box-shadow:
    0 14px 34px rgba(217, 163, 43, 0.28),
    0 0 0 2px rgba(252, 243, 212, 0.62) inset,
    0 0 22px rgba(255, 248, 225, 0.95);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.draw-button:focus-visible { outline: 3px solid rgba(10, 74, 146, 0.18); outline-offset: 2px; }
.draw-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 20px 40px rgba(217, 163, 43, 0.34),
    0 0 0 2px rgba(252, 243, 212, 0.72) inset,
    0 0 26px rgba(255, 248, 225, 1);
}
.draw-button:active {
  transform: translateY(2px) scale(0.992);
  box-shadow:
    0 10px 22px rgba(217, 163, 43, 0.25),
    0 0 0 2px rgba(252, 243, 212, 0.62) inset;
}
.draw-bg,
.draw-sparkles {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.draw-bg {
  background: url("webitems/draw-card-bg.png") center/cover no-repeat;
}
.draw-sparkles {
  background: url("webitems/draw-card-sparkles.png") center/cover no-repeat;
  opacity: 0.92;
}
.draw-envelope,
.draw-text,
.arrow { position: relative; z-index: 1; }
.draw-envelope {
  align-self: center;
  justify-self: start;
  filter: drop-shadow(0 14px 18px rgba(153, 100, 17, 0.14));
}
.draw-envelope img {
  width: 168px;
  max-width: 100%;
  height: auto;
}
.draw-text { color: #fff; text-align: left; }
.draw-text strong {
  display: block;
  font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
  font-size: clamp(2rem, 2.8vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(143, 92, 10, 0.20);
}
.draw-text small {
  display: block;
  margin-top: 10px;
  font-size: clamp(0.95rem, 1vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.arrow {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffc52f, #eea700);
  border: 1px solid rgba(255,255,255,0.72);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(194, 126, 0, 0.26), inset 0 1px 0 rgba(255,255,255,0.52);
  transition: transform 0.18s ease, background 0.18s ease;
}
.draw-button:hover .arrow { transform: translateX(4px); background: linear-gradient(135deg, #ffd55c, #f0ab05); }

.hero-visual { display: flex; justify-content: center; align-items: center; }
.hero-bible-image {
  width: min(100%, 550px);
  height: auto;
  filter: drop-shadow(0 20px 30px rgba(122, 88, 32, 0.12));
}

.ai-fab {
  position: absolute;
  right: max(22px, calc((100vw - var(--content-width)) / 2 + 8px));
  bottom: 28px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  z-index: 2;
  transition: transform 0.18s ease, filter 0.18s ease;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.ai-fab.is-dragging {
  cursor: grabbing;
  transform: scale(1.03);
  filter: drop-shadow(0 12px 18px rgba(55, 42, 17, 0.18));
}
.ai-fab:hover,
.ai-fab:focus-visible { transform: translateY(-3px); }
.robot-face-image {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}
.ai-fab span {
  padding: 9px 14px;
  border-radius: 999px;
  color: #5b5247;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(214, 187, 141, 0.4);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

.feature-grid {
  max-width: calc(var(--content-width) + 48px);
  margin: 0 auto;
  padding: 26px 24px 50px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
.panel {
  position: relative;
  min-height: 390px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,252,0.98), rgba(248,240,225,0.96));
  box-shadow: var(--shadow-sm);
}
.panel h2 {
  margin: 0 0 10px;
  color: var(--church-blue);
  font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1.25;
}
.panel > p { margin: 0; color: var(--muted); line-height: 1.7; }

.care-panel {
  display: flex;
  align-items: flex-start;
  isolation: isolate;
  background: linear-gradient(180deg, rgba(255,255,252,0.98), rgba(248,240,225,0.96));
}
.care-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("webitems/care-church-background.png") left bottom / contain no-repeat;
  opacity: 1;
}
.care-panel::after {
  content: "♡";
  position: absolute;
  top: 22px;
  right: 26px;
  z-index: 2;
  color: #e8ab46;
  font-size: 2.6rem;
  font-family: cursive;
  opacity: 0.95;
}
.care-content {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100%;
  padding: 6px 0 0;
  display: flex;
  flex-direction: column;
}
.care-content p {
  max-width: 74%;
}
.care-link-button {
  margin-top: auto;
  margin-left: auto;
  min-width: 154px;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #ffc52f, #eea700);
  box-shadow: 0 12px 22px rgba(213, 142, 0, 0.20);
  font-weight: 900;
  letter-spacing: 0.04em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.care-link-button:hover { transform: translateY(-1px); filter: brightness(1.02); }
.care-link-button:active { transform: translateY(2px) scale(0.985); box-shadow: 0 6px 12px rgba(213, 142, 0, 0.16); }
.care-link-button span { margin-left: 4px; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.panel-heading a {
  color: #6b6255;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
}
.event-list {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}
.event-card {
  display: grid;
  grid-template-columns: 124px 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(216, 185, 136, 0.25);
  background: rgba(255,255,255,0.5);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.event-card:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.72);
  box-shadow: 0 10px 20px rgba(97, 73, 34, 0.08);
}
.event-thumb {
  width: 124px;
  height: 74px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 16px rgba(82, 58, 21, 0.10);
}
.event-info {
  display: grid;
  gap: 4px;
}
.event-date { color: #6f665a; font-weight: 800; font-size: 0.92rem; }
.event-title { color: #463c31; font-weight: 900; font-size: 1rem; line-height: 1.4; }
.event-desc { color: #867a6b; font-size: 0.86rem; line-height: 1.55; }

.share-panel {
  display: flex;
  flex-direction: column;
}
.share-art {
  width: min(100%, 320px);
  margin: 22px auto 18px;
}
.share-buttons {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(138px, 1fr));
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.share-buttons button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 999px;
  overflow: visible;
  transition: transform 0.16s ease, filter 0.16s ease;
}
.share-buttons button:hover { transform: translateY(-2px); filter: brightness(1.04); }
.share-buttons button:active { transform: translateY(2px) scale(0.985); }
.share-buttons button img { width: 100%; height: auto; max-height: 46px; object-fit: contain; }
.share-status {
  min-height: 1.5em;
  margin-top: 10px;
  color: var(--church-blue);
  font-size: 0.88rem;
}

.ai-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  width: min(410px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid rgba(211, 178, 119, 0.46);
  border-radius: 26px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}
.ai-panel.ai-panel-left {
  left: 24px;
  right: auto;
}
.ai-panel.ai-panel-right {
  right: 24px;
  left: auto;
}
.ai-panel-header {
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(135deg, #ffd447, #f5b300);
}
.ai-panel-header strong { color: var(--church-blue); font-size: 1.04rem; }
.ai-panel-header small { display: block; margin-top: 5px; color: #5d503d; line-height: 1.4; }
.ai-panel-header button {
  border: 0;
  background: transparent;
  color: #4a3d23;
  font-size: 1.8rem;
  line-height: 1;
}
.ai-panel-body { padding: 20px; display: grid; gap: 14px; }
.ai-messages {
  max-height: 340px;
  overflow-y: auto;
  display: grid;
  gap: 12px;
}
.ai-message {
  padding: 14px 15px;
  border: 1px solid rgba(212, 181, 127, 0.34);
  border-radius: 17px;
  background: #fffaf0;
  line-height: 1.65;
}
.ai-message p { margin: 6px 0 0; }
.ai-action-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-action,
.ai-action:link,
.ai-action:visited {
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid rgba(201, 170, 116, 0.36);
  background: rgba(255,255,255,0.88);
  color: #5a4a35;
  font-size: 0.86rem;
  font-weight: 700;
}
.ai-action.emphasis {
  border-color: transparent;
  background: linear-gradient(135deg, #ffc52f, #eea700);
  color: #fff;
}
.ai-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.ai-input-row textarea {
  width: 100%;
  min-height: 52px;
  max-height: 140px;
  padding: 14px 15px;
  resize: none;
  overflow-y: auto;
  line-height: 1.6;
  border: 1px solid rgba(196, 164, 110, 0.42);
  border-radius: 14px;
  background: rgba(255,255,255,0.94);
}
.ai-input-row button {
  min-width: 88px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--church-blue);
  font-weight: 800;
}
.ai-notice { margin: 0; color: #847767; font-size: 0.76rem; line-height: 1.6; }

.card-dialog {
  width: min(980px, calc(100vw - 44px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
}
.card-dialog::backdrop { background: rgba(24, 28, 35, 0.58); backdrop-filter: blur(5px); }
.dialog-shell {
  position: relative;
  padding: 28px;
  border: 1px solid rgba(224, 189, 120, 0.48);
  border-radius: 30px;
  background: radial-gradient(circle at 15% 12%, rgba(246,198,83,0.13), transparent 12rem), linear-gradient(180deg, #fffdf8, #fff6e6);
  box-shadow: var(--shadow-lg);
}
.dialog-close {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  color: #5a4c38;
  font-size: 1.5rem;
}
.result-card {
  padding: 36px 30px 26px;
  border: 1px solid rgba(210, 174, 107, 0.42);
  border-radius: 24px;
  text-align: center;
  background: repeating-linear-gradient(0deg, rgba(117,83,40,0.018) 0 1px, transparent 1px 4px), linear-gradient(145deg, #fffdf4, #f8e4b9);
}
.result-card h2 {
  margin: 18px 0;
  color: var(--church-blue);
  font-family: "Noto Serif TC", serif;
  font-size: 2rem;
}
.result-card blockquote {
  margin: 0;
  color: #433729;
  font-family: "Noto Serif TC", serif;
  font-size: 1.2rem;
  line-height: 1.95;
}
.drawn-card-image {
  display: block;
  width: min(100%, 860px);
  max-width: 100%;
  margin: 18px auto 0;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(106, 75, 17, 0.14);
}
.result-badge {
  display: inline-flex;
  padding: 7px 13px;
  border-radius: 999px;
  color: #7b5313;
  background: rgba(255,255,255,0.68);
  font-weight: 900;
}
.reference { color: #765f3f; font-weight: 800; }
.divider { width: 74px; height: 2px; margin: 22px auto; background: linear-gradient(90deg, transparent, #d9a847, transparent); }
.encouragement { line-height: 1.8; }
.dialog-actions { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dialog-actions button {
  padding: 11px 18px;
  border: 1px solid rgba(194, 155, 91, 0.45);
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  color: #4a3b29;
  font-weight: 800;
}
#drawAgain { border-color: transparent; color: #fff; background: linear-gradient(135deg, #ffc52c, #ee9f00); }
.copy-status { min-height: 1.4em; margin: 12px 0 0; color: var(--church-blue); text-align: center; font-size: 0.9rem; }

.site-footer {
  min-height: 120px;
  padding: 26px max(22px, calc((100vw - var(--content-width)) / 2 + 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-top: 1px solid rgba(197, 159, 94, 0.24);
  background: linear-gradient(180deg, rgba(255,253,248,0.96), rgba(248,240,226,0.96));
  color: #665a4c;
}
.site-footer a { color: inherit; }
.footer-brand img { width: 220px; height: auto; }
.footer-contact,
.footer-links { display: grid; gap: 5px; }

@media (max-width: 1180px) {
  .site-header { flex-wrap: wrap; }
  .menu-toggle { display: block; margin-left: auto; }
  .main-nav {
    width: 100%;
    display: none;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-top: 12px;
    border-top: 1px solid rgba(31, 61, 67, 0.15);
  }
  .main-nav.open { display: flex; }
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 42px;
    padding-bottom: 44px;
  }
  .hero-copy { max-width: 100%; }
  .hero-visual { justify-content: center; }
  .ai-fab {
    right: 18px;
    bottom: 18px;
    position: fixed;
  }
  .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .site-header { min-height: 74px; padding: 10px 16px; }
  .brand-logo { width: 216px; }
  .hero {
    padding-left: 18px;
    padding-right: 18px;
    gap: 26px;
    text-align: left;
  }
  .hero-decor-left { width: 150px; height: 210px; }
  .hero-decor-right { width: 200px; height: 240px; top: 40px; }
  .draw-button {
    min-height: 152px;
    grid-template-columns: 112px 1fr 54px;
    padding: 20px 18px;
    border-radius: 24px;
  }
  .draw-envelope img { width: 120px; }
  .draw-text strong { font-size: 1.8rem; }
  .draw-text small { font-size: 0.9rem; }
  .arrow { width: 46px; height: 46px; font-size: 1.55rem; }
  .panel { min-height: 360px; }
  .care-content p { max-width: 84%; }
  .site-footer {
    padding: 24px 18px;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .main-nav { gap: 12px 18px; }
  .main-nav a { font-size: 0.88rem; }
  .hero { padding-left: 14px; padding-right: 14px; }
  .hero h1 { font-size: clamp(2.5rem, 10vw, 3.4rem); }
  .subtitle { margin-bottom: 24px; font-size: 1rem; }
  .draw-button {
    grid-template-columns: 86px 1fr 44px;
    min-height: 132px;
    gap: 10px;
    padding: 16px 14px;
  }
  .draw-envelope img { width: 92px; }
  .draw-text strong { font-size: 1.35rem; letter-spacing: 0.04em; }
  .draw-text small { font-size: 0.8rem; margin-top: 6px; }
  .arrow { width: 40px; height: 40px; font-size: 1.35rem; }
  .hero-bible-image { width: 100%; }
  .panel { min-height: 332px; padding: 22px; }
  .panel h2 { font-size: 1.4rem; }
  .share-buttons { grid-template-columns: 1fr; gap: 9px; }
  .share-buttons button { width: min(100%, 230px); justify-self: center; }
  .care-content p { max-width: 100%; }
  .care-link-button { min-width: 142px; min-height: 46px; padding: 0 18px; }
  .event-card { grid-template-columns: 96px 1fr; gap: 10px; }
  .event-thumb { width: 96px; height: 64px; }
  .robot-face-image { width: 72px; height: 72px; }
  .ai-fab span { display: none; }
  .ai-panel {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
  .dialog-shell { padding: 16px; }
  .result-card { padding: 34px 18px 22px; }
}


body.dialog-open {
  overflow: hidden;
}

@media (max-width: 820px) {
  .hero {
    padding-top: 32px;
    padding-bottom: 34px;
    gap: 22px;
  }

  .hero-copy {
    max-width: 100%;
  }

  .hero h1 {
    font-size: clamp(2.6rem, 11vw, 4rem);
    line-height: 1.08;
    letter-spacing: 0.02em;
  }

  .subtitle {
    margin: 14px 0 22px;
    max-width: 30rem;
    font-size: 1.02rem;
    line-height: 1.65;
  }

  .draw-button {
    width: 100%;
    min-height: 140px;
    grid-template-columns: 100px minmax(0, 1fr) 54px;
    gap: 14px;
    padding: 18px 16px;
    border-radius: 24px;
  }

  .draw-envelope img {
    width: 112px;
  }

  .draw-text {
    min-width: 0;
  }

  .draw-text strong {
    font-size: clamp(1.58rem, 6.1vw, 2.1rem);
    line-height: 1.15;
    letter-spacing: 0.04em;
  }

  .draw-text small {
    margin-top: 8px;
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .arrow {
    width: 52px;
    height: 52px;
    font-size: 1.65rem;
    background: linear-gradient(135deg, #ffc52f, #eea700);
  }

  .hero-visual {
    justify-content: center;
  }

  .hero-bible-image {
    width: min(100%, 480px);
    margin: 0 auto;
  }

  .feature-grid {
    padding-top: 16px;
    gap: 18px;
  }

  .panel {
    min-height: initial;
  }

  .care-panel {
    min-height: 420px;
  }

  .care-panel::before {
    background-size: min(58%, 220px) auto;
    background-position: left 14px bottom 14px;
  }

  .care-content {
    min-height: 360px;
  }

  .care-content p {
    max-width: 100%;
    padding-right: 42px;
    font-size: 1rem;
    line-height: 1.75;
  }

  .care-link-button {
    min-width: 180px;
    min-height: 54px;
    font-size: 1.02rem;
  }

  .event-card {
    grid-template-columns: 102px 1fr;
    align-items: start;
    gap: 12px;
    padding: 12px;
  }

  .event-thumb {
    width: 102px;
    height: 74px;
    border-radius: 16px;
  }

  .event-info {
    gap: 6px;
  }

  .event-date {
    font-size: 0.95rem;
  }

  .event-title {
    font-size: 1.12rem;
    line-height: 1.35;
  }

  .event-desc {
    font-size: 0.94rem;
    line-height: 1.6;
  }

  .share-art {
    width: min(100%, 280px);
    margin: 16px auto 20px;
  }

  .share-buttons {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .share-buttons button {
    width: min(100%, 280px);
    justify-self: center;
  }

  .share-buttons button img {
    max-height: 60px;
  }

  .share-status {
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .ai-fab {
    position: fixed;
    right: 14px !important;
    left: auto !important;
    top: auto !important;
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    gap: 6px;
  }

  .robot-face-image {
    width: 82px;
    height: 82px;
  }

  .ai-fab span {
    display: none;
  }

  .ai-panel,
  .ai-panel.ai-panel-left,
  .ai-panel.ai-panel-right {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    max-height: min(78dvh, 720px);
    border-radius: 28px;
  }

  .ai-panel-header {
    padding: 18px 18px 16px;
  }

  .ai-panel-header strong {
    font-size: 1.35rem;
  }

  .ai-panel-header small {
    margin-top: 6px;
    font-size: 0.96rem;
    line-height: 1.55;
  }

  .ai-panel-body {
    padding: 16px;
    gap: 12px;
    max-height: calc(min(78dvh, 720px) - 108px);
    display: flex;
    flex-direction: column;
  }

  .ai-messages {
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
  }

  .ai-input-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ai-input-row textarea {
    min-height: 56px;
    max-height: 160px;
    font-size: 16px;
    line-height: 1.55;
  }

  .ai-input-row button {
    width: 100%;
    min-width: 0;
    min-height: 54px;
    font-size: 1.06rem;
  }

  .card-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
  }

  .card-dialog::backdrop {
    background: rgba(15, 12, 8, 0.92);
    backdrop-filter: blur(6px);
  }

  .dialog-shell {
    min-height: 100dvh;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
    border-radius: 0;
    border: 0;
    background: rgba(17, 15, 11, 0.96);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .dialog-close {
    right: 14px;
    top: calc(12px + env(safe-area-inset-top));
    z-index: 2;
    background: rgba(255,255,255,0.88);
  }

  .result-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 64px 0 16px;
    border: 0;
    background: transparent;
  }

  .result-card.image-result-mode {
    text-align: center;
  }

  .drawn-card-image {
    width: auto;
    max-width: 100%;
    max-height: min(70dvh, 760px);
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 18px 38px rgba(0,0,0,0.26);
  }

  .dialog-actions {
    margin-top: 8px;
    padding-top: 10px;
    background: linear-gradient(180deg, rgba(17,15,11,0), rgba(17,15,11,0.94) 28%);
  }

  .dialog-actions button {
    min-height: 46px;
    padding: 11px 16px;
    font-size: 1rem;
    color: #47361f;
    background: rgba(255,250,242,0.96);
  }

  #drawAgain {
    color: #fff;
  }

  .copy-status {
    color: #fff3ce;
  }
}

@media (max-width: 560px) {
  .site-header {
    min-height: 72px;
    padding: 10px 14px;
  }

  .brand-logo {
    width: min(68vw, 250px);
  }

  .menu-toggle {
    font-size: 2.05rem;
  }

  .hero {
    padding: 24px 14px 30px;
    gap: 18px;
  }

  .hero-decor-left {
    width: 110px;
    height: 170px;
    opacity: 0.9;
  }

  .hero-decor-right {
    width: 140px;
    height: 185px;
    top: 22px;
  }

  .hero h1 {
    font-size: clamp(2.35rem, 13vw, 3.3rem);
  }

  .subtitle {
    margin-bottom: 18px;
    font-size: 0.98rem;
  }

  .draw-button {
    min-height: 128px;
    grid-template-columns: 84px minmax(0, 1fr) 48px;
    gap: 12px;
    padding: 14px;
    border-radius: 22px;
  }

  .draw-envelope img {
    width: 96px;
  }

  .draw-text strong {
    font-size: clamp(1.38rem, 8vw, 1.9rem);
    line-height: 1.15;
  }

  .draw-text small {
    margin-top: 6px;
    font-size: 0.86rem;
    line-height: 1.45;
  }

  .arrow {
    width: 48px;
    height: 48px;
    font-size: 1.55rem;
  }

  .hero-bible-image {
    width: min(100%, 380px);
  }

  .panel {
    padding: 22px 20px;
    border-radius: 24px;
  }

  .panel h2 {
    font-size: 1.8rem;
  }

  .care-panel {
    min-height: 400px;
  }

  .care-panel::before {
    background-size: 168px auto;
    background-position: left 8px bottom 10px;
  }

  .care-content {
    min-height: 338px;
  }

  .care-panel::after {
    top: 18px;
    right: 20px;
    font-size: 2.35rem;
  }

  .care-link-button {
    min-width: 170px;
    min-height: 52px;
    font-size: 1rem;
  }

  .event-card {
    grid-template-columns: 96px 1fr;
  }

  .event-thumb {
    width: 96px;
    height: 72px;
  }

  .event-title {
    font-size: 1.02rem;
  }

  .event-desc {
    font-size: 0.9rem;
  }

  .share-art {
    width: min(100%, 250px);
  }

  .share-buttons button {
    width: min(100%, 300px);
  }

  .share-buttons button img {
    max-height: 62px;
  }

  .ai-panel-header strong {
    font-size: 1.22rem;
  }

  .ai-panel-header small {
    font-size: 0.92rem;
  }

  .ai-message {
    padding: 12px 13px;
    font-size: 0.95rem;
  }

  .ai-input-row {
    grid-template-columns: 1fr;
  }

  .ai-input-row textarea {
    min-height: 58px;
    max-height: 160px;
    padding: 14px 14px;
  }

  .ai-input-row button {
    min-height: 56px;
    font-size: 1rem;
  }

  .drawn-card-image {
    max-height: 56dvh;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .dialog-actions button:last-child {
    grid-column: 1 / -1;
    width: min(170px, 100%);
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* =========================================================
   V6.4｜沉浸式恩典卡閱覽與分享按鈕穩定版
   ========================================================= */

/* 分享按鈕：鎖定相同容器，避免桌機寬度變化造成視覺一大一小 */
.share-buttons {
  margin-top: 14px;
  grid-template-columns: repeat(2, 220px);
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.share-buttons button {
  width: 220px;
  height: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.share-buttons button img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

/* 桌機：恩典卡像照片檢視器，讓圖片本身成為畫面主角 */
.card-dialog {
  width: min(1240px, 96vw);
  max-width: 96vw;
  max-height: 94dvh;
  border-radius: 0;
}

.card-dialog::backdrop {
  background: rgba(12, 10, 8, 0.88);
  backdrop-filter: blur(7px);
}

.dialog-shell {
  min-height: 0;
  max-height: 94dvh;
  padding: 54px 24px 18px;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: rgba(17, 15, 12, 0.96);
  box-shadow: 0 30px 80px rgba(0,0,0,0.36);
}

.result-card,
.result-card.image-result-mode {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-card.image-result-mode h2,
.result-card.image-result-mode blockquote,
.result-card.image-result-mode .reference,
.result-card.image-result-mode .encouragement {
  display: none;
}

.drawn-card-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(1180px, 92vw);
  max-height: calc(94dvh - 150px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 24px 54px rgba(0,0,0,0.34);
  opacity: 0;
  transform: scale(0.955);
  filter: blur(7px);
}

.dialog-actions {
  margin-top: 16px;
  opacity: 0;
  transform: translateY(8px);
}

.card-dialog.is-revealing .drawn-card-image {
  animation: graceCardReveal 1s cubic-bezier(.2,.72,.22,1) forwards;
}

.card-dialog.is-revealing .dialog-actions {
  animation: graceActionsReveal .46s ease .62s forwards;
}

@keyframes graceCardReveal {
  0% {
    opacity: 0;
    transform: scale(0.955);
    filter: blur(7px);
  }
  58% {
    opacity: 1;
    filter: blur(1.5px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

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

.copy-status {
  color: #fff0c8;
}

@media (max-width: 900px) {
  .share-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .share-buttons button {
    width: 100%;
    max-width: 220px;
    justify-self: center;
  }
}

@media (max-width: 820px) {
  .card-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
  }

  .dialog-shell {
    min-height: 100dvh;
    max-height: 100dvh;
    padding: calc(54px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom));
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: auto;
  }

  .result-card,
  .result-card.image-result-mode {
    flex: 0 0 auto;
    min-height: 0;
    padding: 0;
    justify-content: flex-start;
  }

  .drawn-card-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100dvh - 188px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: 0 auto;
    object-fit: contain;
    border-radius: 16px;
  }

  .dialog-actions {
    flex: 0 0 auto;
    margin-top: 10px;
    padding-top: 4px;
  }

  .share-buttons {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .share-buttons button {
    width: min(100%, 300px);
    height: 58px;
    min-height: 58px;
    max-width: 300px;
    justify-self: center;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .dialog-shell {
    padding-top: calc(48px + env(safe-area-inset-top));
  }

  .drawn-card-image {
    max-height: calc(100dvh - 105px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .dialog-actions {
    position: fixed;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    max-width: 170px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dialog-actions button,
  .dialog-actions button:last-child {
    width: 100%;
    min-width: 140px;
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drawn-card-image,
  .dialog-actions,
  .card-dialog.is-revealing .drawn-card-image,
  .card-dialog.is-revealing .dialog-actions {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none !important;
  }
}

/* V6.4.1：LINE 內建瀏覽器長按儲存提示 */
.drawn-card-image.save-hint {
  animation: saveHintGlow 0.9s ease-in-out 2;
}

@keyframes saveHintGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .drawn-card-image.save-hint { animation: none; }
}

/* =========================================================
   V6.4.2｜LINE 直接抽卡、分享按鈕防溢出、圖片載入穩定化
   ========================================================= */

/* 兩張分享素材保持相同寬度與原始比例，不再用固定高度硬塞。 */
.share-buttons {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 220px));
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2vw, 18px);
}

.share-buttons button {
  width: 100%;
  max-width: 220px;
  min-width: 0;
  height: auto;
  min-height: 0;
  aspect-ratio: 904 / 200;
  padding: 0;
  overflow: hidden;
}

.share-buttons button img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.draw-button.is-loading,
#drawAgain.is-loading {
  cursor: wait;
  opacity: 0.72;
  pointer-events: none;
}

/* ?mode=draw：CSS 載入後就隱藏完整首頁，避免 LINE 中先閃出首頁。 */
html.line-draw-mode,
html.line-draw-mode body {
  min-height: 100%;
  background: #110f0c;
}

html.line-draw-mode body > .site-header,
html.line-draw-mode body > main,
html.line-draw-mode body > .ai-panel,
html.line-draw-mode body > .site-footer,
html.line-draw-mode body > .ai-fab {
  display: none !important;
}

html.line-draw-mode body::before {
  content: "正在為你準備一張恩典卡…";
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff3d2;
  font-size: clamp(1rem, 2vw, 1.2rem);
  letter-spacing: 0.08em;
  text-align: center;
  background: radial-gradient(circle at 50% 40%, rgba(244, 190, 64, 0.16), transparent 34%), #110f0c;
}

html.line-draw-mode body.dialog-open::before {
  display: none;
}

@media (max-width: 560px) {
  .share-buttons {
    grid-template-columns: 1fr;
  }

  .share-buttons button {
    width: min(100%, 300px);
    max-width: 300px;
  }
}
