:root {
  color-scheme: light;
  --paper: #f8f5ed;
  --paper-bright: #fffcf5;
  --ink: #2f493c;
  --ink-soft: #496354;
  --secondary: #777d6d;
  --gold: #cfac72;
  --sage: #9cae92;
  --line: #dedbce;
  --shadow: 0 18px 50px rgba(63, 70, 49, .12);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; background: var(--paper); color: var(--ink); font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
.paper-texture { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: .35; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' opacity='.18' filter='url(%23n)'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }
.ambient { position: fixed; z-index: 0; pointer-events: none; width: 440px; height: 440px; border-radius: 50%; filter: blur(15px); }
.ambient--top { top: -270px; right: -130px; background: radial-gradient(circle, rgba(227, 210, 175, .36), transparent 70%); }
.ambient--bottom { bottom: -300px; left: -190px; background: radial-gradient(circle, rgba(172, 194, 155, .22), transparent 70%); }
.page { isolation: isolate; z-index: 1; position: relative; min-height: 100vh; min-height: 100dvh; width: min(100%, 1020px); padding: 0 clamp(20px, 6vw, 70px); margin-inline: auto; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 26px 0 14px; min-height: 80px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--ink); }
.brand-mark svg { width: 42px; height: 42px; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-main { font-size: 13px; letter-spacing: .20em; font-weight: 750; }
.brand-sub { color: #818273; font-size: 9px; letter-spacing: .20em; font-weight: 650; }
.header-tag { display: flex; gap: 9px; align-items: center; margin-left: auto; color: #7d8775; font-size: 11px; letter-spacing: .12em; }
.tag-sparkle { color: var(--gold); font-size: 24px; }
.main { display: flex; flex: 1; align-items: center; justify-content: center; }
.scene { width: 100%; }
.scene--welcome { max-width: 650px; margin: 18px auto 28px; text-align: center; animation: emerge .65s ease both; }
.welcome-ornament { width: min(300px, 78%); margin: 0 auto 5px; }
.welcome-ornament svg { width: 100%; height: auto; }
.eyebrow { text-transform: uppercase; color: #8e8d75; font-weight: 700; letter-spacing: .2em; font-size: 10px; display: flex; align-items: center; justify-content: center; gap: 13px; }
.little-dot { border-radius: 50%; background: var(--gold); width: 4px; height: 4px; }
.display-title { margin: 29px 0 15px; font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif; font-weight: 650; line-height: 1.55; letter-spacing: .085em; font-size: clamp(40px, 7.5vw, 69px); }
.display-title em, .result-title em { font-style: normal; color: #6c866c; }
.ellipsis { font-family: inherit; letter-spacing: .12em; }
.welcome-subtitle { font-size: clamp(14px, 2.5vw, 17px); letter-spacing: .11em; color: var(--ink-soft); margin: 0; line-height: 2; }
.draw-indicator { margin: 58px auto 16px; display: flex; align-items: center; justify-content: center; gap: 11px; color: #73816d; font-size: 12px; letter-spacing: .14em; }
.draw-dots { display: flex; gap: 4px; }
.draw-dots i { width: 5px; height: 5px; display: block; border-radius: 50%; background: var(--sage); animation: dots 1.1s infinite ease-in-out; }
.draw-dots i:nth-child(2) { animation-delay: .16s; }
.draw-dots i:nth-child(3) { animation-delay: .32s; }
.tiny-note { font-size: 11px; color: #a0a08d; letter-spacing: .1em; display: flex; justify-content: center; align-items: center; gap: 8px; }
.tiny-note svg { color: var(--gold); }
.scene--result { max-width: 760px; text-align: center; padding: 12px 0 20px; animation: emerge .7s ease both; }
.result-head { margin-bottom: 27px; }
.result-title { font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif; font-size: clamp(35px, 6vw, 55px); font-weight: 650; letter-spacing: .085em; line-height: 1.35; margin: 15px 0 10px; }
.result-subtitle { margin: 0; color: var(--ink-soft); font-size: clamp(13px, 2.2vw, 16px); letter-spacing: .12em; line-height: 1.8; }
.photo-wrap { position: relative; max-width: 580px; margin: 0 auto; }
.photo-card { margin: 0; background: var(--paper-bright); padding: clamp(10px, 2.7vw, 16px) clamp(10px, 2.7vw, 16px) 0; border-radius: 3px; border: 1px solid rgba(82, 91, 70, .06); box-shadow: var(--shadow); transform: rotate(-1.1deg); }
.photo-frame { background: #e1e7d9; overflow: hidden; aspect-ratio: 1.31; }
.photo-frame img { width: 100%; height: 100%; display: block; object-fit: contain; }
.photo-caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px 6px 19px; }
.photo-label { letter-spacing: .2em; font-size: 10px; font-weight: 700; color: #7c8171; }
.photo-number { font-size: 11px; font-family: "Georgia",serif; letter-spacing: .12em; color: #acaa96; }
.scribble-star { position: absolute; color: #cbb07f; font-size: 36px; font-family: Georgia,serif; }
.scribble-star--left { top: 14%; left: -42px; transform: rotate(-16deg); }
.scribble-star--right { right: -38px; top: 48%; transform: rotate(15deg); }
.leaf-accent { width: 68px; height: 83px; position: absolute; right: -48px; bottom: -39px; color: #8b9e80; transform: rotate(11deg); }
.result-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 18px 26px; max-width: 570px; margin: 34px auto 0; text-align: left; }
.photo-description { flex: 1 1 170px; }
.small-label { font-size: 10px; font-weight: 750; color: #9f9b81; letter-spacing: .17em; }
.photo-description h2 { font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif; font-size: clamp(22px, 3.4vw, 28px); letter-spacing: .07em; font-weight: 650; margin: 8px 0 3px; }
.photo-description p { font-size: 12px; line-height: 1.8; color: var(--secondary); margin: 2px 0 0; }
.actions { flex: 0 1 245px; min-width: 226px; text-align: center; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 49px; width: 100%; padding: 11px 18px; background: var(--ink); color: #fffdf7; border: 1px solid var(--ink); border-radius: 7px; text-decoration: none; font-size: 14px; letter-spacing: .09em; font-weight: 600; box-shadow: 0 7px 18px rgba(42, 73, 52, .12); cursor: pointer; font-family: inherit; transition: transform .18s ease, background .18s ease; }
.primary-button:hover { transform: translateY(-2px); background: #425f4d; }
.primary-button:focus-visible, .text-link:focus-visible { outline: 3px solid #d5b574; outline-offset: 3px; }
.primary-button svg { width: 18px; height: 18px; }
.button-sparkle { font-size: 14px; margin-left: auto; color: #d7c9a8; }
.text-link { display: inline-block; margin-top: 11px; color: var(--ink-soft); text-decoration: none; text-underline-offset: 4px; font-size: 12px; letter-spacing: .05em; }
.text-link:hover { text-decoration: underline; }
.save-help { margin: 7px 0 0; font-size: 10px; line-height: 1.65; color: #919387; }
.scene--error { max-width: 440px; text-align: center; padding: 40px 10px; }
.error-stamp { font-size: 45px; color: var(--gold); }
.scene--error h1 { font-family: "Noto Serif TC",serif; font-size: 27px; }
.scene--error p { font-size: 14px; color: var(--secondary); line-height: 2; margin-bottom: 25px; }
.scene--error .primary-button { max-width: 220px; margin: auto; }
.footer { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 22px 0 27px; }
.footer p { margin: 0; color: #a2a18e; font-size: 10px; white-space: nowrap; letter-spacing: .12em; }
.footer-line { width: 32px; height: 1px; background: #d6d2be; }
.noscript { position: fixed; left: 10px; bottom: 10px; right: 10px; z-index: 10; padding: 16px; background: #fff; border: 1px solid #a44; font-size: 13px; }
@keyframes dots { 0%, 100% { transform: translateY(1px); opacity: .45; } 50% { transform: translateY(-3px); opacity: 1; } }
@keyframes emerge { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 750px) { .scene--result { padding-top: 24px; padding-bottom: 45px; } }
@media (max-width: 560px) {
  .topbar { padding-top: 16px; min-height: 65px; }
  .header-tag span:last-child { display: none; }
  .header-tag { font-size: 20px; }
  .main { align-items: center; }
  .scene--welcome { margin-top: 0; }
  .welcome-ornament { width: min(250px, 76%); margin-bottom: 15px; }
  .display-title { margin-top: 20px; }
  .welcome-subtitle { max-width: 310px; margin-inline: auto; }
  .draw-indicator { margin-top: 38px; }
  .scene--result { padding-top: 10px; }
  .result-head { margin-bottom: 23px; }
  .photo-card { transform: rotate(-.7deg); }
  .scribble-star--left { left: -14px; top: 8%; font-size: 24px; }
  .scribble-star--right { right: -15px; top: 41%; font-size: 25px; }
  .leaf-accent { right: -12px; bottom: -24px; width: 43px; height: 56px; }
  .photo-caption { padding: 12px 3px 15px; }
  .result-bottom { text-align: center; justify-content: center; gap: 18px; margin-top: 26px; }
  .photo-description { flex-basis: 100%; }
  .actions { width: 100%; flex: 1 1 100%; max-width: 430px; }
  .footer { padding-bottom: 18px; gap: 11px; }
  .footer p { font-size: 9px; }
  .footer-line { width: 20px; }
}
@media (max-width: 355px) { .eyebrow { letter-spacing: .13em; } .welcome-subtitle { font-size: 13px; } .footer-line { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Five preassigned cards, with a centered reveal. */
.scene--welcome { max-width: 650px; }
.scene--welcome .display-title { font-size: clamp(38px, 6vw, 58px); margin: 20px 0 12px; }
.choose-hint { font-size: 14px; line-height: 1.9; letter-spacing: .1em; color: var(--ink-soft); margin: 24px 0 0; }
.card-deck { --step: 86px; position: relative; height: 292px; margin: 12px auto 0; perspective: 1100px; }
.choice-card { position: absolute; left: 50%; top: 28px; width: 140px; height: 208px; padding: 0; border: 0; border-radius: 11px; background: transparent; color: #e8d7af; cursor: pointer; transform: translateX(calc(-50% + var(--i) * var(--step))) translateY(var(--rise)) rotate(var(--angle)); transition: transform .45s ease, opacity .35s ease; transform-origin: 50% 100%; }
.card-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .65s cubic-bezier(.2,.7,.2,1); }
.card-back, .card-front { position: absolute; inset: 0; border-radius: 11px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 10px 22px #243e3424; overflow: hidden; }
.card-back { background: #315141; border: 5px solid #f7f1e2; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card-back::before { content: ''; position: absolute; inset: 7px; border: 1px solid #c5b4828a; border-radius: 5px 24px 5px 24px; }
.card-star { font-size: 16px; }
.card-orbit { font-family: Georgia, serif; font-size: 66px; line-height: 1.35; }
.card-word { font-size: 9px; letter-spacing: .2em; }
.card-index { position: absolute; top: 14px; left: 14px; font: 10px Georgia, serif; }
.card-front { transform: rotateY(180deg); background: var(--paper-bright); padding: 6px; display: grid; place-items: center; }
.card-front img { width: 100%; height: 100%; object-fit: contain; }
.choice-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 5px; z-index: 8; }
@media (hover:hover) { .choice-card:not(:disabled):hover { transform: translateX(calc(-50% + var(--i) * var(--step))) translateY(calc(var(--rise) - 15px)) rotate(var(--angle)); z-index: 7; } }
.has-selection .choice-card:not(.is-selected) { opacity: 0; pointer-events: none; }
.has-selection .is-selected { z-index: 9; transform: translateX(-50%) translateY(0) rotate(0) scale(1.1); cursor: default; }
.is-flipped .card-inner { transform: rotateY(180deg); }
.selection-status { min-height: 24px; font-size: 12px; color: #7d8775; letter-spacing: .08em; margin: 0 0 12px; }
@media (max-width:560px) {
 .card-deck { --step: 48px; height: 240px; margin-top: 8px; }
 .choice-card { width: 100px; height: 155px; top: 23px; }
 .card-orbit { font-size: 46px; }
 .card-word { font-size: 7px; }
 .card-index { top: 12px; left: 12px; font-size: 8px; }
 .choose-hint { margin-top: 20px; font-size: 13px; }
 .scene--welcome .welcome-subtitle { font-size: 13px; letter-spacing: .04em; }
}
@media (max-width:355px) { .card-deck { --step: 40px; } .choice-card { width: 90px; } }
@media (prefers-reduced-motion: reduce) { .choice-card, .card-inner { transition: none; } }
