/* 金玲雅居 — 前台基礎樣式（品牌色沿用 Astro 版設計 token） */
:root {
    --brand-500: #c0392b;
    --brand-600: #a02a1e;
    --washi: #f7f2e7;
    --washi-2: #efe8d6;
    --cream: #fdfaf3;
    --shoji: #e8e0d0;
    --ink: #2a241e;
    --sumi: #4a4137;
    --cha: #847261;
    --gold: #a48857;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    color: var(--ink);
    background: var(--washi);
    -webkit-font-smoothing: antialiased;
    line-height: 1.7;
}

h1, h2, h3, h4 {
    font-family: "Noto Serif TC", serif;
    letter-spacing: 0.04em;
}

/* —— 補 astro.css 未編譯的任意值 class（前台新增元件用到） —— */
.text-\[var\(--color-cream\)\] { color: var(--color-cream); }
/* 關於頁直書裝飾：手機隱藏、桌機才顯示（避免擠版） */
.about-deco { display: none; }
@media (min-width: 1024px) { .about-deco { display: flex; gap: 0.5rem; } }
.hover\:text-\[var\(--color-cream\)\]:hover { color: var(--color-cream); }
/* 「返回X」等外框按鈕：hover 反黑（底色變深＋邊框變深），避免米白文字配淺底看不清 */
.hover\:bg-\[var\(--color-ink\)\]:hover { background-color: var(--color-ink); }
.hover\:border-\[var\(--color-ink\)\]:hover { border-color: var(--color-ink); }
/* 觸控裝置無 hover：點擊時不殘留只變字色的半套狀態 */
@media (hover: none) {
    .hover\:text-\[var\(--color-cream\)\]:active { color: var(--color-cream); }
    .hover\:bg-\[var\(--color-ink\)\]:active { background-color: var(--color-ink); }
}
.hero-visual { position: relative; height: 180px; overflow: hidden; }
.hero-text { position: relative; min-height: 300px; }
.hero-kanji { font-size: 7rem; line-height: 1; }
@media (min-width: 640px) { .hero-visual { height: 240px; } .hero-kanji { font-size: 10rem; } }
@media (min-width: 1024px) { .hero-visual { height: 380px; } .hero-text { min-height: 360px; } .hero-kanji { font-size: 14rem; } }

/* a 預設不強制顏色（避免覆蓋按鈕/Tailwind 連結色造成對比問題）；連結色由各元件自訂 */
a { color: inherit; text-decoration: none; }
/* 簡易頁面（登入/註冊/會員）的純文字連結才上品牌色 */
.auth-foot a, .member-link, .site-footer a { color: var(--brand-600); }
.auth-foot a:hover, .member-link:hover { color: var(--brand-500); text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* 頁首 */
.site-header {
    background: var(--cream);
    border-bottom: 1px solid var(--shoji);
}
.site-header .container {
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.brand {
    font-family: "Noto Serif TC", serif;
    font-weight: 700; font-size: 22px; color: var(--brand-500);
    letter-spacing: 0.1em;
}
.nav a { color: var(--sumi); margin-left: 20px; font-size: 15px; }
.nav a:hover { color: var(--brand-500); text-decoration: none; }

/* 印章落款 */
.seal {
    display: inline-block;
    padding: 4px 8px;
    background: var(--brand-500);
    color: var(--cream);
    font-family: "Noto Serif TC", serif; font-weight: 700;
    letter-spacing: 0.15em; line-height: 1;
    transform: rotate(-3deg);
}

/* 區塊 */
.section { padding: 48px 0; }
.section-title {
    font-size: 26px; color: var(--ink); margin: 0 0 4px;
}
.section-eyebrow {
    color: var(--gold); font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase;
}

/* 文章卡 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card {
    background: var(--cream); border: 1px solid var(--shoji); border-radius: 6px;
    overflow: hidden; transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 6px 20px rgba(42,36,30,.08); transform: translateY(-2px); }
.card .thumb { aspect-ratio: 16/9; background: var(--washi-2); width: 100%; object-fit: cover; display: block; }
.card .body { padding: 14px; }
.card .body h3 { font-size: 16px; margin: 0 0 6px; line-height: 1.5; }
.card .body .date { color: var(--cha); font-size: 12px; }

/* 表單卡 */
.auth-wrap { min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card {
    background: var(--cream); border: 1px solid var(--shoji); border-radius: 10px;
    width: 100%; max-width: 420px; padding: 36px 32px;
    box-shadow: 0 10px 40px rgba(42,36,30,.06);
}
.auth-card h1 { font-size: 24px; text-align: center; margin: 0 0 6px; color: var(--brand-500); }
.auth-card .sub { text-align: center; color: var(--cha); font-size: 14px; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--sumi); margin-bottom: 6px; }
.field input {
    width: 100%; padding: 11px 13px; font-size: 15px;
    border: 1px solid var(--shoji); border-radius: 6px; background: #fff; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--brand-400, #dc6166); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }

.btn {
    display: inline-block; width: 100%; padding: 12px; font-size: 16px; cursor: pointer;
    background: var(--brand-500); color: #fff; border: none; border-radius: 6px;
    font-family: inherit; font-weight: 500; transition: background .2s;
}
.btn:hover { background: var(--brand-600); }
.btn-line { background: transparent; color: var(--brand-500); border: 1px solid var(--brand-500); }

.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--cha); }

/* Flash 訊息 */
.flash { max-width: 1080px; margin: 16px auto 0; padding: 0 20px; }
.flash .msg {
    background: #fbe4e4; border: 1px solid #f6c7c9; color: var(--brand-600);
    padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; font-size: 14px;
}

/* 頁尾 */
.site-footer {
    margin-top: 48px; padding: 28px 0; background: var(--ink); color: var(--washi-2);
    font-size: 13px; text-align: center;
}

.muted { color: var(--cha); }
.center { text-align: center; }

/* YouTube 響應式嵌入 */
.yt-embed { position: relative; width: 100%; padding-top: 56.25%; margin: 24px 0; border-radius: 8px; overflow: hidden; background: #000; }
.yt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* 文章正文排版（沿用 Astro .prose-jinlin） */
.prose-jinlin { color: var(--sumi); line-height: 1.85; font-size: 16px; }
.prose-jinlin h2 {
    font-family: "Noto Serif TC", serif; font-size: 1.5rem; color: var(--ink);
    margin-top: 2.5em; margin-bottom: 1em; padding-bottom: 0.3em;
    border-bottom: 1px solid var(--shoji); letter-spacing: 0.05em;
}
.prose-jinlin h3 {
    font-family: "Noto Serif TC", serif; font-size: 1.2rem; color: var(--ink);
    margin-top: 2em; margin-bottom: 0.8em; letter-spacing: 0.05em;
}
.prose-jinlin p { margin: 1.2em 0; }
.prose-jinlin ul, .prose-jinlin ol { margin: 1.2em 0; padding-left: 1.5em; }
.prose-jinlin ul { list-style: disc; }
.prose-jinlin ol { list-style: decimal; }
.prose-jinlin li { margin: 0.4em 0; }
.prose-jinlin a { color: var(--brand-500); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose-jinlin a:hover { color: var(--brand-600); }
.prose-jinlin img { display: block; margin: 1.5em auto; max-width: 100%; height: auto; border: 1px solid var(--shoji); }
.prose-jinlin blockquote { border-left: 3px solid var(--brand-500); padding-left: 1.2em; margin: 1.5em 0; color: var(--cha); font-style: italic; }
.prose-jinlin iframe { width: 100%; max-width: 100%; aspect-ratio: 16/9; height: auto; margin: 1.5em 0; border: 1px solid var(--shoji); }
.prose-jinlin strong { color: var(--ink); font-weight: 700; }
.prose-jinlin sup { font-size: 0.7em; }
.prose-jinlin .formula {
    text-align: center; font-family: "Noto Serif TC", Georgia, "Times New Roman", serif;
    font-size: 1.12em; line-height: 1.9; margin: 1.6em 0; padding: 0.9em 1.2em;
    background: var(--washi-2); border-left: 3px solid var(--brand-500); border-radius: 4px;
    letter-spacing: 0.04em; color: var(--ink);
}

/* 文末免責注解（科普詩意類比提醒） */
.prose-jinlin .article-note {
    margin-top: 2.8em; padding-top: 1.3em; border-top: 1px dashed var(--shoji);
    font-size: 0.85em; line-height: 1.75; color: var(--cha);
}
.prose-jinlin .article-note p { margin: 0; }
.prose-jinlin .article-note strong { color: var(--cha); font-weight: 600; }

/* 文章內頁（舊版，保留相容） */
.article-container { max-width: 800px; }
.article-title { font-size: 30px; line-height: 1.4; margin: 8px 0 10px; }
.article-meta { font-size: 14px; margin-bottom: 8px; }
.article-cover { width: 100%; border-radius: 8px; margin: 20px 0; }
.article-body { font-size: 17px; line-height: 1.9; color: var(--sumi); margin-top: 16px; }
.article-body p { margin: 1em 0; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; }
.article-body h2, .article-body h3 { color: var(--ink); margin-top: 1.6em; }
.article-body a { color: var(--brand-500); text-decoration: underline; }
.article-body iframe { max-width: 100%; }
.article-body blockquote { border-left: 3px solid var(--brand-500); padding-left: 16px; color: var(--cha); margin: 1.2em 0; }

/* ———— 求籤：神明卡牆 ———— */
.deity-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 768px) { .deity-grid { grid-template-columns: repeat(3, 1fr); } }
.deity-card {
    position: relative; background: var(--cream); border: 1px solid var(--shoji); border-radius: 8px;
    padding: 16px; display: flex; align-items: center; justify-content: center; min-height: 96px;
    transition: box-shadow .2s, transform .2s;
}
.deity-card:hover { box-shadow: 0 8px 24px rgba(192,57,43,.12); transform: translateY(-2px); text-decoration: none; }
.deity-card img { max-width: 100%; height: auto; }
.deity-text { text-align: center; padding: 10px 0; }
.deity-text .dn { font-family: "Noto Serif TC", serif; font-size: 28px; color: var(--brand-500); font-weight: 700; letter-spacing: 3px; line-height: 1.2; }
.deity-text .dc {
    display: inline-block; margin-top: 12px; padding: 5px 20px;
    background: linear-gradient(180deg, #b23121, #7f2218);
    color: var(--cream); font-family: "Noto Serif TC", serif; font-size: 16px;
    letter-spacing: 4px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.deity-soon { position: absolute; top: 8px; right: 8px; font-size: 11px; background: var(--cha); color: #fff; padding: 2px 7px; border-radius: 10px; }
.deity-card img { width: 100%; height: auto; }
.deity-cap { margin-top: 8px; font-family: "Noto Serif TC", serif; color: var(--brand-500); font-weight: 700; font-size: 15px; }
.deity-portrait { max-width: 230px; width: 60%; border-radius: 10px; margin: 16px auto 0; display: block; box-shadow: 0 6px 20px rgba(42,36,30,.12); }

/* ———— 擲筊 ———— */
.qian-wrap { max-width: 640px; }
.qian-step { margin-top: 28px; text-align: center; }
.qian-label { display: block; font-size: 15px; color: var(--sumi); margin-bottom: 10px; }
.qian-input { width: 100%; max-width: 460px; padding: 12px 14px; border: 1px solid var(--shoji); border-radius: 8px; font-size: 15px; }
.qian-btn { width: auto; min-width: 160px; padding: 12px 32px; }

.bei-stage { position: relative; display: flex; gap: 18px; justify-content: center; margin: 10px 0 18px; min-height: 220px; align-items: flex-end; padding-bottom: 6px; }
/* 地面陰影 */
.bei-stage::after {
    content: ''; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
    width: 250px; height: 12px; border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(60,30,20,.16), transparent 72%);
}
/* 筊杯：真實紅漆筊圖（去背 PNG），尖端朝內相對 */
.bei {
    width: 70px; height: 122px;
    background-size: contain; background-repeat: no-repeat; background-position: center bottom;
    filter: drop-shadow(0 4px 4px rgba(70,18,8,.28));
}
/* 左塊：尖朝右 */
#bei1            { background-image: url('../qian/bei-round-l.png'); } /* 預設/擲筊中＝凸面 */
#bei1.flat      { background-image: url('../qian/bei-flat-l.png'); }
/* 右塊：尖朝左 */
#bei2            { background-image: url('../qian/bei-round-r.png'); }
#bei2.flat      { background-image: url('../qian/bei-flat-r.png'); }
/* 拋擲落地動畫（拋起→下落→輕彈→定） */
.bei.spin { animation: beitoss .72s cubic-bezier(.33,.66,.4,1) both; }
.bei.spin.b2 { animation-name: beitoss2; animation-duration: .82s; }
@keyframes beitoss {
    0%   { transform: translateY(0) rotate(0); }
    28%  { transform: translateY(-82px) rotate(-9deg); }
    50%  { transform: translateY(-100px) rotate(5deg); }
    78%  { transform: translateY(0) rotate(-3deg); }
    88%  { transform: translateY(-9px) rotate(1deg); }
    100% { transform: translateY(0) rotate(0); }
}
@keyframes beitoss2 {
    0%   { transform: translateY(0) rotate(0); }
    30%  { transform: translateY(-92px) rotate(11deg); }
    52%  { transform: translateY(-110px) rotate(-6deg); }
    80%  { transform: translateY(0) rotate(4deg); }
    90%  { transform: translateY(-7px) rotate(-1deg); }
    100% { transform: translateY(0) rotate(0); }
}

.bei-result { font-family: "Noto Serif TC", serif; font-size: 26px; font-weight: 700; height: 34px; }
.bei-result.sheng { color: var(--brand-500); }
.bei-result.xiao { color: var(--gold); }
.bei-result.yin { color: var(--cha); }
.bei-progress { color: var(--cha); margin: 8px 0 16px; }
.bei-progress span { color: var(--brand-500); font-weight: 700; font-size: 18px; }

/* 籤詩卡 */
.poem-card { background: var(--cream); border: 1px solid var(--shoji); border-radius: 12px; padding: 28px; text-align: center; box-shadow: 0 8px 30px rgba(42,36,30,.07); }
.poem-head { font-family: "Noto Serif TC", serif; font-size: 24px; color: var(--brand-500); font-weight: 700; }
.poem-level { font-size: 16px; background: var(--brand-500); color: #fff; padding: 2px 10px; border-radius: 12px; margin-left: 6px; vertical-align: middle; }
.poem-title { font-size: 17px; color: var(--ink); margin: 8px 0; }
.poem-img { display: block; margin: 16px auto; max-width: 100%; max-height: 70vh; width: auto; height: auto; border-radius: 8px; }
.poem-text { font-family: "Noto Serif TC", serif; font-size: 19px; line-height: 2; color: var(--ink); margin: 16px 0; white-space: pre-line; }
.poem-interp { text-align: left; background: var(--washi); border-radius: 8px; padding: 16px; color: var(--sumi); line-height: 1.9; margin-top: 16px; }
.poem-interp strong { color: var(--brand-500); }
.poem-empty { font-size: 18px; color: var(--cha); line-height: 2; padding: 30px 0; }
