:root {
  color-scheme: light;
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  color: #533746;
  background: #fff5f4;
  line-height: 1.65;
  --rose: #7b3c58;
  --muted: #714c62;
  --line: #e9cbd5;
  --surface: #fffbf8;
  --shadow: 0 12px 30px #85446b20;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #fff0f5, #eee8fb 48%, #ffe7d9);
  background-attachment: fixed;
  overflow-x: clip;
}
button, summary { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .68; }
:focus-visible { outline: 3px solid #9c547a; outline-offset: 4px; }
.wrap { width: min(100% - 32px, 1040px); margin: 0 auto; padding: 18px 0 32px; position: relative; }
.sitehead { text-align: center; margin-bottom: 24px; }
.eyebrow {
  display: inline-block;
  margin: 0;
  padding: 6px 15px;
  color: var(--rose);
  background: #fff7f4;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .075em;
}
.sitehead h1 { font-size: clamp(1.7rem, 5vw, 3rem); color: var(--rose); margin: 8px 0 2px; line-height: 1.3; letter-spacing: .04em; }
.site-description { margin: 8px 0 0; color: var(--muted); }
.history-bar { position: sticky; top: 12px; z-index: 5; display: flex; justify-content: flex-end; margin-bottom: 10px; pointer-events: none; }
.history { pointer-events: auto; color: var(--rose); }
.history summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  list-style: none;
  padding: 7px 13px;
  background: #fff9f7;
  border: 1px solid #ddb4c6;
  border-radius: 999px;
  font-size: .92rem;
  line-height: 1.35;
  box-shadow: 0 4px 15px #71395917;
}
.history summary::-webkit-details-marker { display: none; }
.history summary strong { font-size: 1.13rem; font-variant-numeric: tabular-nums; }
.chevron { width: 8px; height: 8px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); margin-left: 3px; }
.history[open] .chevron { transform: translateY(2px) rotate(225deg); }
.history-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(24rem, 100%);
  max-height: min(54vh, 24rem);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 17px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px #65394e42;
  padding: 14px 16px;
}
.history-panel h2 { margin: 0 0 8px; color: var(--rose); font-size: 1rem; }
.history-panel p { margin: 4px 0 0; color: #533746; overflow-wrap: anywhere; }
.history-list { margin: 0; padding-left: 1.45em; color: #533746; }
.history-list li { padding: 8px 0; }
.history-list li + li { border-top: 1px solid var(--line); }
.history-list strong { display: block; color: var(--rose); }

.homegrid { display: grid; grid-template-columns: minmax(0, .98fr) minmax(0, 1.02fr); gap: 18px; }
.art { position: relative; min-height: 565px; border: 6px solid #fff9f5; box-shadow: var(--shadow); background: #f6d7e2; border-radius: 28px; overflow: hidden; display: grid; }
.art img { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.art::after { content: ""; position: absolute; inset: auto 0 0; height: 125px; background: linear-gradient(transparent, #3f223cbd); }
.artlabel { z-index: 1; align-self: end; padding: 18px 12px; text-align: center; color: #fff; font-weight: 750; }
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 28px; padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.panel h2 { font-size: 1.5rem; color: var(--rose); margin: 12px 0 4px; }
.intro { margin: 0 0 10px; max-width: 23em; }
.tube { width: 170px; height: 195px; position: relative; padding: 0; border: 0; background: none; filter: drop-shadow(0 9px 8px #a86b8b55); }
.sticks { position: absolute; top: 7px; left: 28px; width: 110px; display: flex; justify-content: space-around; align-items: flex-end; }
.stick { height: 90px; width: 14px; border-radius: 6px; background: linear-gradient(90deg, #bc7f4f, #ffe0a2, #996540); transform-origin: bottom; }
.stick:nth-child(1) { rotate: -13deg; }
.stick:nth-child(2) { rotate: -5deg; }
.stick:nth-child(3) { rotate: 6deg; }
.stick:nth-child(4) { rotate: 14deg; }
.vessel { position: absolute; top: 65px; left: 8px; width: 153px; height: 123px; border: 6px solid #ffe0bd; border-radius: 16px 16px 48px 48px; background: linear-gradient(120deg, #a55e70, #da9299 45%, #a75878); box-shadow: inset 0 -8px #98506c55; display: grid; place-items: center; font-size: 3rem; color: #fff2d2; font-weight: 900; text-shadow: 0 2px #734153; }
.tube.shake { animation: shake .15s ease-in-out infinite; opacity: 1; }
@keyframes shake { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
.primary, .secondary { min-height: 46px; border-radius: 999px; padding: 9px 16px; font-weight: 750; }
.primary { color: white; border: 1px solid #853f60; background: #904968; box-shadow: 0 4px 0 #773852; }
.primary:hover:not(:disabled) { background: #803d5b; }
.secondary { border: 1px solid #d9adc1; background: #fff8f6; color: var(--rose); }
.secondary:hover:not(:disabled) { background: #f9e7ed; }
.count { color: var(--muted); margin: 14px 0 8px; font-size: .94rem; }
.small { color: var(--muted); margin: 10px 0 0; font-size: .88rem; }

.resultbox { max-width: 860px; margin: 0 auto; }
.fortune { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); }
.fortune-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); background: #fcf1e9; }
.fortune-copy { padding: clamp(18px, 4vw, 33px); align-self: center; }
.fortune-number { margin: 0 0 7px; color: var(--rose); font-size: .875rem; font-weight: 700; letter-spacing: .04em; }
.fortune h2 { margin: 0; color: var(--rose); font-size: clamp(1.55rem, 5vw, 2.4rem); line-height: 1.22; }
blockquote { margin: 15px 0 0; color: #60384e; font-size: clamp(1.12rem, 3vw, 1.53rem); line-height: 1.65; font-weight: 750; }
.fortune-art { position: relative; min-height: 280px; background: #f5dce2; overflow: hidden; }
.fortune-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 43%; }
.fortune-hero.drawing .fortune-art img { animation: float 1.2s ease-in-out infinite; }
@keyframes float { 50% { transform: scale(1.055); } }
.fortune-body, .reminders { padding: clamp(18px, 4vw, 33px); }
.read { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.read h3, .guardian h3 { margin: 0 0 5px; font-size: 1rem; color: var(--rose); }
.read p, .guardian p { margin: 0; }
.guardian { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff3f5; margin-top: 18px; padding: 12px 16px; }
.face { font-size: 1.9rem; flex: 0 0 auto; }
.reminders { margin-top: 18px; border: 1px solid var(--line); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); }
.reminders h2 { margin: 0 0 12px; color: var(--rose); font-size: clamp(1.12rem, 3.5vw, 1.35rem); }
.guides { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 12px; margin: 0; padding: 0; counter-reset: supports; list-style: none; }
.guides li { counter-increment: supports; display: grid; grid-template-columns: 1.7rem minmax(0,1fr); align-items: baseline; gap: 7px; padding: 8px 10px; background: #fcf1f5; border-radius: 10px; overflow-wrap: anywhere; }
.guides li::before { content: counter(supports, decimal-leading-zero); color: var(--rose); font-variant-numeric: tabular-nums; font-size: .86rem; font-weight: 750; }
.resultbox > .count, footer { text-align: center; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
footer { margin-top: 22px; color: var(--muted); font-size: .86rem; }
.petal { position: fixed; pointer-events: none; top: -30px; color: #da8ca9; opacity: .46; animation: fall linear infinite; z-index: -1; }
body { isolation: isolate; }
@keyframes fall { from { transform: translateY(-35px) rotate(0); } to { transform: translate(26px, 112vh) rotate(260deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 700px) {
  .wrap { width: min(100% - 24px, 540px); padding-top: 12px; }
  .homegrid { grid-template-columns: 1fr; gap: 10px; }
  .art { min-height: clamp(225px, 72vw, 390px); }
  .art img { object-position: center 32%; }
  .panel { padding: 22px 15px; }
  .fortune-hero { grid-template-columns: 1fr; }
  .fortune-art { grid-row: 1; min-height: clamp(150px, 47vw, 250px); }
  .fortune-copy { padding-bottom: 12px; }
  .read, .guides { grid-template-columns: 1fr; }
  .guardian { margin-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
}
