/* Mint I Ching — Mint 系列 tokens，accent 改為紫色 */
/* Mint I Ching — Mint 系列 tokens；主色 #B28FCE，副色：薄荷、蜜桃、霧粉、暖沙 */
:root {
  --font: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --num: "Outfit", var(--font);
  --serif: "Noto Serif TC", "Songti TC", serif;

  --ink: #1D1C1A; --ink-2: #4E4A55; --ink-3: #7A7480;
  --bg-a: #F6F1EE; --bg-b: #ECE6EF;
  --line: rgba(29,28,26,.07);
  --solid: #1E1D1B; --on-solid: #FFF;
  --danger: #C8574F;

  --accent: #B28FCE; --accent-deep: #7A55A3; --accent-soft: #E6D7F1;
  --mint: #A9E3D6; --peach: #FFB98A; --blush: #F4C6D3; --sand: #EFE3D3;
  --tint: rgba(178,143,206,.18);
  --blob-1: #CDB0E6; --blob-2: #B4E6D8; --blob-3: #FFCBA8; --blob-4: #F2BED0;

  --glass: linear-gradient(155deg, rgba(255,255,255,.62) 0%, rgba(255,255,255,.26) 42%, rgba(255,255,255,.20) 60%, rgba(255,255,255,.42) 100%);
  --glass-strong: linear-gradient(155deg, rgba(255,255,255,.82), rgba(255,255,255,.48));
  --rim: linear-gradient(150deg, #fff, rgba(255,255,255,.35) 25%, rgba(255,255,255,.04) 50%, rgba(255,255,255,.25) 75%, #fff);
  --rim-shadow: inset 0 2px 2px rgba(255,255,255,1), inset 0 -2px 2px rgba(255,255,255,.55), inset 6px 0 14px -8px rgba(255,255,255,.8), inset -6px 0 14px -8px rgba(255,255,255,.6), inset 0 -22px 40px -16px rgba(150,110,190,.22), inset 0 18px 36px -18px rgba(255,255,255,.7);
  --drop: 0 30px 60px -32px rgba(90,62,120,.40), 0 6px 16px -8px rgba(90,62,120,.14);
  --drop-sm: 0 14px 28px -18px rgba(90,62,120,.38), 0 2px 8px -4px rgba(90,62,120,.10);
  --well: inset 0 1px 3px rgba(60,40,80,.10), inset 0 0 0 1px rgba(60,40,80,.04);

  --radius-lg: 32px; --radius: 24px; --radius-sm: 18px;
  color-scheme: light;
}
html.dark {
  --ink: #F5F1F7; --ink-2: #D6CDDF; --ink-3: #ADA3B8;
  --bg-a: #121015; --bg-b: #0B0A0D;
  --line: rgba(255,255,255,.08);
  --solid: #F1EAF6; --on-solid: #1B1720;
  --accent: #C7A9E0; --accent-deep: #DCC6EE; --accent-soft: #3A2E47;
  --tint: rgba(199,169,224,.16);
  --blob-1: #2A1F38; --blob-2: #142823; --blob-3: #2E211D; --blob-4: #2B1B24;
  --glass: linear-gradient(155deg, rgba(255,255,255,.09), rgba(255,255,255,.015) 45%, rgba(255,255,255,.05));
  --glass-strong: linear-gradient(155deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  --rim: linear-gradient(150deg, rgba(255,255,255,.55), rgba(255,255,255,.06) 35%, rgba(255,255,255,0) 60%, rgba(255,255,255,.35));
  --rim-shadow: inset 0 1px 1px rgba(255,255,255,.28), inset 0 -1px 1px rgba(255,255,255,.08), inset 0 18px 36px -18px rgba(255,255,255,.10);
  --drop: 0 30px 60px -30px rgba(0,0,0,.75), 0 4px 12px -6px rgba(0,0,0,.4);
  --drop-sm: 0 14px 28px -18px rgba(0,0,0,.6);
  --well: inset 0 1px 3px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.05);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--ink); font-weight: 400;
  background: linear-gradient(170deg, var(--bg-a), var(--bg-b)) fixed;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blobs i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(60px); opacity: 1; animation: drift 26s ease-in-out infinite alternate; }
.blobs i:nth-child(2) { animation-duration: 32s; } .blobs i:nth-child(3) { animation-duration: 38s; }
@keyframes drift { to { transform: translate(4vmax, -3vmax) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .blobs i { animation: none; } }
.blobs i:nth-child(1) { background: var(--blob-1); top: -12vmax; left: -10vmax; }
.blobs i:nth-child(2) { background: var(--blob-2); top: 20vmax; right: -16vmax; }
.blobs i:nth-child(3) { background: var(--blob-3); bottom: -18vmax; left: 10vmax; }
.blobs i:nth-child(4) { background: var(--blob-4); top: 40%; left: 30%; width: 30vmax; height: 30vmax; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
/* 液態玻璃：半透明霧面 + 漸層光邊 + 上緣高光 */
.glass { position: relative; isolation: isolate; background: var(--glass); backdrop-filter: blur(22px) saturate(210%) brightness(1.04); -webkit-backdrop-filter: blur(22px) saturate(210%) brightness(1.04); box-shadow: var(--rim-shadow), var(--drop); }
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.6px; background: var(--rim); pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.glass::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(130% 55% at 50% 0%, rgba(255,255,255,.55), rgba(255,255,255,0) 70%); }
html.dark .glass::after { opacity: .12; }
/* 霧化色球：放在玻璃後方的柔焦光暈 */
.mist { position: absolute; border-radius: 50%; filter: blur(22px); pointer-events: none; z-index: -1; opacity: .9; }
.mist.violet { background: radial-gradient(circle at 35% 35%, #EBDDF7, var(--accent) 60%, transparent 72%); }
.mist.peach { background: radial-gradient(circle at 35% 35%, #FFE3CF, var(--peach) 60%, transparent 72%); }
.mist.mint { background: radial-gradient(circle at 35% 35%, #E0F6F0, var(--mint) 60%, transparent 72%); }
html.dark .mist { opacity: .45; }

/* Header & tabs */
.app { max-width: 760px; margin: 0 auto; padding: 20px 20px 120px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 42px; height: 42px; border-radius: 13px; box-shadow: var(--drop-sm); }
.brand b { font-family: var(--num); font-weight: 500; font-size: 19px; letter-spacing: .01em; display: block; }
.brand small { color: var(--ink-3); font-size: 12px; }
nav.tabs { display: flex; gap: 4px; padding: 5px; border-radius: 999px; }
nav.tabs button { display: flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; color: var(--ink-2); font-size: 14px; }
nav.tabs button svg { width: 18px; height: 18px; }
nav.tabs button.on { background: var(--solid); color: var(--on-solid); }
@media (max-width: 640px) {
  .app { padding: 16px 16px calc(132px + env(safe-area-inset-bottom)); }
  nav.tabs { position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; justify-content: space-around; }
  nav.tabs button { flex-direction: column; gap: 2px; font-size: 11px; padding: 8px 14px; flex: 1; }
}

/* Generic */
.card { border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; }
@media (max-width: 640px) { .card { border-radius: 26px; padding: 20px; } }
h2.sec { font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: .08em; margin: 0 0 12px; }
.muted { color: var(--ink-3); }
.main-btn { display: inline-flex; align-items: center; justify-content: center; gap: 14px; background: var(--solid); color: var(--on-solid); border-radius: 999px; padding: 8px 8px 8px 30px; min-width: 170px; min-height: 54px; font-weight: 500; box-shadow: var(--drop-sm); transition: transform .15s; }
.main-btn .arrow { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); }
html.dark .main-btn .arrow { background: rgba(0,0,0,.08); }
.main-btn .arrow svg { width: 16px; height: 16px; }
.main-btn:active { transform: scale(.97); }
.main-btn:disabled { opacity: .5; }
.ghost-btn { border-radius: 999px; padding: 10px 18px; font-size: 14px; }
.ghost-btn.danger { color: var(--danger); }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; box-shadow: var(--well); background: rgba(0,0,0,.03); }
.seg button { padding: 8px 18px; border-radius: 999px; font-size: 14px; color: var(--ink-2); }
.seg button { transition: all .25s; }
.seg button.on { background: linear-gradient(160deg, #D7BEEA, var(--accent)); color: #fff; box-shadow: inset 0 1px 1px rgba(255,255,255,.7), 0 8px 18px -8px rgba(122,85,163,.6); }
html.dark .seg button.on { background: linear-gradient(160deg, #8F6CB0, #6A4D8A); }
textarea { width: 100%; font: inherit; color: var(--ink); border: 0; border-radius: var(--radius-sm); padding: 14px 18px; background: rgba(255,255,255,.5); box-shadow: var(--well); resize: none; outline: none; transition: box-shadow .2s; }
textarea:focus { box-shadow: var(--well), 0 0 0 3px var(--tint); }
html.dark textarea { background: rgba(255,255,255,.05); }

/* Draw view */
.draw-head { display: flex; justify-content: space-between; align-items: flex-start; text-align: left; margin-bottom: 18px; }
.bigdate { font-family: var(--num); font-weight: 300; font-size: 44px; line-height: 1; letter-spacing: -.01em; }
.bigdate span { display: block; margin-top: 8px; font-family: var(--font); font-size: 14px; font-weight: 400; letter-spacing: .12em; color: var(--ink-2); }
.draw-head .note { font-size: 12px; color: var(--ink-3); text-align: right; line-height: 1.6; }
.draw { text-align: center; overflow: hidden; }
.draw .opts { display: flex; flex-direction: column; gap: 14px; align-items: center; margin: 14px 0 6px; }
.mode-hint { font-size: 13px; color: var(--ink-3); min-height: 1.4em; }
.deck { position: relative; width: 210px; height: 315px; margin: 26px auto 28px; perspective: 1200px; }
.tcard { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3,.7,.2,1); }
.tcard.flip { transform: rotateY(180deg); }
.tcard .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 18px; overflow: hidden; box-shadow: var(--drop); }
.tcard .front { transform: rotateY(180deg); }
.deck.shuffle .tcard { animation: shuf .35s ease-in-out 4 alternate; }
.deck .ghost { position: absolute; inset: 0; border-radius: 18px; overflow: hidden; box-shadow: var(--drop-sm); }
.deck .ghost:nth-child(1) { transform: rotate(-7deg) translateX(-14px); opacity: .6; }
.deck .ghost:nth-child(2) { transform: rotate(6deg) translateX(14px); opacity: .7; }
@keyframes shuf { from { transform: translateX(-22px) rotate(-4deg); } to { transform: translateX(22px) rotate(4deg); } }
.line-pick { display: flex; gap: 8px; justify-content: center; margin: -6px 0 18px; }
.line-pick span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--num); font-size: 14px; box-shadow: var(--well); color: var(--ink-3); transition: all .2s; }
.line-pick span.on { background: linear-gradient(160deg, #D7BEEA, var(--accent)); color: #fff; box-shadow: var(--drop-sm); transform: scale(1.12); }

/* Card art */
.card-art { width: 100%; height: 100%; display: block; object-fit: cover; }

/* Result */
.res-head { position: relative; display: flex; gap: 20px; align-items: center; }
.res-head .thumb { width: 120px; flex: none; aspect-ratio: 2/3; border-radius: 14px; overflow: hidden; box-shadow: var(--drop); }
.res-head h1 { margin: 4px 0; font-family: var(--serif); font-weight: 600; font-size: 30px; letter-spacing: .06em; }
.res-head .sub { color: var(--ink-2); font-size: 14px; }
.badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--tint); color: var(--accent-deep); margin-right: 6px; }
.question { font-size: 14px; color: var(--ink-2); margin-top: 10px; }
.hexlines { display: flex; flex-direction: column-reverse; gap: 5px; width: 64px; margin-top: 8px; }
.hexlines i { display: flex; gap: 8px; height: 7px; }
.hexlines i b { flex: 1; background: var(--ink); border-radius: 2px; }
.hexlines i.hl b { background: var(--accent); }
.classic { font-family: var(--serif); font-size: 16px; line-height: 1.95; margin: 0 0 10px; }
.classic em { font-style: normal; color: var(--accent-deep); font-weight: 600; margin-right: 6px; }
.plain { line-height: 1.95; font-size: 15px; color: var(--ink); margin: 0; }
.prose { --prose: #3E3748; max-width: 34em; }
html.dark .prose { --prose: #D9D0E2; }
.prose p { margin: 0 0 1.1em; font-size: 15px; line-height: 2.05; letter-spacing: .03em; font-weight: 300; color: var(--prose); }
.prose p:last-child { margin-bottom: 9px; }
.prose .lead { font-size: 17px; line-height: 2; margin: calc(1.4em + 6px) 0 1.4em; font-weight: 400; color: var(--accent-deep); padding-left: 16px; position: relative; }
.prose .lead::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--accent); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .fields { grid-template-columns: 1fr; } }
.field { position: relative; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--rim-shadow), var(--drop-sm);
  background: radial-gradient(120px 90px at 100% 100%, color-mix(in srgb, var(--c, var(--accent)) 55%, transparent), transparent 75%), var(--glass-strong); }
.field:nth-child(2) { --c: var(--blush); } .field:nth-child(3) { --c: var(--peach); } .field:nth-child(4) { --c: var(--mint); } .field:nth-child(5) { --c: #BFD4F2; } .field:nth-child(6) { --c: var(--sand); }
.field h3, .field p { position: relative; z-index: 1; }
html.dark .field { background: rgba(255,255,255,.04); }
.field h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.field h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 0 3px rgba(255,255,255,.5); }
.field p { margin: 0; line-height: 1.85; font-size: 14px; color: var(--ink-2); }
.change { border-left: 3px solid var(--accent); padding-left: 14px; }
.pending { color: var(--ink-3); font-size: 14px; }
details.lines summary { cursor: pointer; color: var(--ink-2); font-size: 14px; padding: 4px 0; }
.back-row { display: flex; justify-content: space-between; margin-bottom: 14px; }

/* History */
.hist-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.item { display: flex; gap: 14px; align-items: center; border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.item .thumb { width: 52px; aspect-ratio: 2/3; border-radius: 9px; overflow: hidden; flex: none; cursor: pointer; }
.item .meta { flex: 1; min-width: 0; cursor: pointer; }
.item .meta b { font-family: var(--serif); font-size: 17px; }
.item .meta small { display: block; color: var(--ink-3); font-family: var(--num); font-size: 12px; margin-top: 2px; }
.item .meta p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .acts { display: flex; flex-direction: column; gap: 4px; }
.item .acts button { font-size: 12px; padding: 6px 12px; }
.empty { text-align: center; padding: 50px 10px; color: var(--ink-3); }

/* Settings */
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }

/* Sheet dialog + toast */
dialog.sheet { border: 0; border-radius: var(--radius-lg); padding: 24px; max-width: 360px; width: calc(100% - 32px); color: var(--ink); background: linear-gradient(155deg, rgba(255,255,255,.88), rgba(246,240,250,.78)); backdrop-filter: blur(30px); box-shadow: var(--rim-shadow), var(--drop); }
html.dark dialog.sheet { background: linear-gradient(155deg, rgba(48,40,56,.92), rgba(30,26,34,.88)); }
dialog.sheet::backdrop { background: rgba(20,15,30,.35); backdrop-filter: blur(4px); }
dialog.sheet h3 { margin: 0 0 8px; }
dialog.sheet p { color: var(--ink-2); line-height: 1.7; margin: 0 0 18px; }
dialog.sheet .btns { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; transition: all .3s; background: var(--solid); color: var(--on-solid); padding: 10px 20px; border-radius: 999px; font-size: 14px; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.update-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; gap: 12px; align-items: center; padding: 8px 8px 8px 18px; border-radius: 999px; font-size: 14px; }
.update-bar button { background: var(--solid); color: var(--on-solid); border-radius: 999px; padding: 6px 14px; }
[hidden] { display: none !important; }


/* 延伸閱讀：六爻細讀 */
.deep-intro { font-size: 13px; line-height: 1.8; margin: -4px 0 12px; }
.yao { border-top: 1px solid var(--line); }
.yao summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 12px; padding: 14px 2px; }
.yao summary::-webkit-details-marker { display: none; }
.yao summary::after { content: "+"; margin-left: auto; font-family: var(--num); font-weight: 300; font-size: 20px; color: var(--ink-3); transition: transform .25s; }
.yao[open] summary::after { transform: rotate(45deg); }
.yname { flex: none; font-family: var(--serif); font-weight: 600; color: var(--accent-deep); min-width: 2.6em; }
.ytext { font-family: var(--serif); font-size: 15px; line-height: 1.8; color: var(--ink); }
.yao .badge { flex: none; margin: 0; }
.yao p { margin: 0 0 16px; padding-left: calc(2.6em + 12px); font-size: 14px; line-height: 2; letter-spacing: .03em; font-weight: 300; color: var(--prose, #4B4356); }
html.dark .yao p { color: #D9D0E2; }
.yao.hl summary { background: var(--tint); border-radius: 14px; padding-left: 10px; padding-right: 10px; }

/* 縮圖可放大 */
.thumb.zoomable { position: relative; padding: 0; cursor: zoom-in; display: block; }
.zoom-ico { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: rgba(40,28,56,.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: inset 0 1px 1px rgba(255,255,255,.4); }
.zoom-ico svg { width: 13px; height: 13px; }
dialog.viewer { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100dvh; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
dialog.viewer[open] { display: flex; animation: vin .3s ease; }
dialog.viewer::backdrop { background: rgba(28,20,40,.55); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }
.viewer-card { width: min(88vw, calc((100dvh - 140px) * 2 / 3), 560px); aspect-ratio: 2/3; border-radius: 22px; overflow: hidden; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6), inset 0 1px 1px rgba(255,255,255,.6); touch-action: pinch-zoom; }
.viewer-cap { margin: 0; color: #fff; font-size: 14px; letter-spacing: .08em; opacity: .9; }
.viewer-close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; width: 44px; height: 44px; border-radius: 50%; color: #fff; font-size: 24px; line-height: 1;
  background: rgba(255,255,255,.16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 1px 1px rgba(255,255,255,.45); }
@keyframes vin { from { opacity: 0; transform: scale(.96); } }

/* 卦典 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { padding: 7px 14px; border-radius: 999px; font-size: 13px; color: var(--ink-2); background: rgba(255,255,255,.35); box-shadow: var(--rim-shadow); }
html.dark .chips button { background: rgba(255,255,255,.05); }
.chips button.on { background: linear-gradient(160deg, #D7BEEA, var(--accent)); color: #fff; }
.book-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 640px) { .book-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
.book-item { display: block; text-decoration: none; color: inherit; border-radius: 20px; padding: 8px 8px 10px; text-align: center; }
.book-item .thumb { aspect-ratio: 2/3; border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.book-item b { font-family: var(--serif); font-size: 16px; display: block; }
.book-item small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.book-item .soon { position: absolute; top: 14px; left: 14px; font-size: 10px; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.75); color: var(--ink-3); }

.book-name { display: flex; align-items: center; justify-content: center; gap: 8px; }
.book-name b { display: inline; }
.hexlines.mini { width: 20px; gap: 2.5px; margin: 0; flex: none; }
.hexlines.mini i { height: 3px; gap: 3px; }
.hexlines.mini i b { border-radius: 1px; background: var(--accent-deep); }


.prose p:not(.lead) { line-height: 2.15; }

/* 變爻轉變解讀：三段流程 */
.tflow { position: relative; display: flex; flex-direction: column; gap: 18px; }
.tflow::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), var(--mint)); opacity: .6; }
.tstep { position: relative; display: flex; gap: 16px; }
.tdot { flex: none; width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: linear-gradient(160deg, #EBDDF7, var(--accent)); box-shadow: 0 0 0 4px rgba(255,255,255,.6); z-index: 1; }
html.dark .tdot { box-shadow: 0 0 0 4px rgba(0,0,0,.3); }
.tstep small { display: block; font-size: 12px; letter-spacing: .08em; color: var(--ink-3); }
.tstep b { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 2px 0 4px; }
.tstep b a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 14px; margin-left: -2px; border-radius: 999px; text-decoration: none;
  color: var(--accent-deep); background: linear-gradient(160deg, rgba(255,255,255,.75), rgba(230,215,241,.75));
  box-shadow: inset 0 1px 1px #fff, 0 0 0 1px rgba(178,143,206,.45), 0 6px 14px -8px rgba(122,85,163,.5); transition: transform .15s, box-shadow .2s; }
.tstep b a::after { content: "›"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-family: var(--num); font-size: 15px; line-height: 1;
  color: #fff; background: linear-gradient(160deg, #D7BEEA, var(--accent)); }
.tstep b a:hover { transform: translateX(2px); }
.tstep b a:active { transform: scale(.97); }
html.dark .tstep b a { color: #EBDDF7; background: rgba(199,169,224,.18); box-shadow: inset 0 1px 1px rgba(255,255,255,.15), 0 0 0 1px rgba(199,169,224,.45); }
.tstep p { margin: 0; font-size: 14px; line-height: 2; letter-spacing: .03em; font-weight: 300; color: var(--prose, #4B4356); }
html.dark .tstep p { color: #D9D0E2; }

/* 日期與時間分開 */
.time { margin-left: .9em; }

/* 換頁：柔和淡入／占卜完淡出 */
#view.enter { animation: viewIn .45s cubic-bezier(.2,.7,.2,1); }
#view.leave { transition: opacity .3s ease, transform .3s ease; opacity: 0; transform: translateY(-6px) scale(.99); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { #view.enter { animation: none; } #view.leave { transition: none; } }

/* 圖片載入前先有柔和底色，不會出現空白方塊 */
.thumb, .tcard .face, .viewer-card, .deck .ghost { background: linear-gradient(160deg, #EFE6F7, #CDB6E3); }
html.dark .thumb, html.dark .tcard .face { background: linear-gradient(160deg, #3A2E47, #2A2233); }

/* 深色模式：提高次要文字與說明文字的可讀性 */
html.dark .prose p, html.dark .tstep p, html.dark .yao p { color: #E4DCEC; }
html.dark .prose .lead { color: #E2CFF3; }
html.dark .classic em, html.dark .yname { color: #D9C2EE; }
html.dark .badge { background: rgba(199,169,224,.22); color: #EBDDF7; }
html.dark h2.sec { color: #BFB4CA; }
html.dark textarea::placeholder { color: #9D93A8; }
html.dark .field p { color: #DCD3E4; }
html.dark .chips button { color: #DCD3E4; }

/* 深色模式：背景色暈與光球再暗一點，突顯文字 */
html.dark .blobs i { opacity: .7; }
html.dark .mist { opacity: .28; }

html:not(.dark) .field p { color: #4A4452; }


/* 周易原文：標題下方留白與卡片底部一致 */
.sec-classic + .classic { margin-top: 20px; }
.sec-classic { margin-bottom: 0; }

/* 設定頁：占卜須知 */
.notes { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.notes li { position: relative; padding-left: 18px; font-size: 14px; line-height: 1.95; letter-spacing: .02em; color: var(--ink-2); }
.notes li::before { content: ""; position: absolute; left: 2px; top: .8em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.notes b { display: block; font-weight: 500; color: var(--ink); font-size: 15px; margin-bottom: 2px; }

/* 淺色模式：保留彩色色暈，文字用較深的顏色確保好讀 */
html:not(.dark) .yao p, html:not(.dark) .tstep p { color: #3E3748; }
