:root {
  color-scheme: light;
  --ink: #302822;
  --red: #a12e23;
  --gold: #ad8d54;
  --paper: #f7f3e9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: #201d1a;
  color: var(--ink);
  font-family: 'Noto Serif JP', 'Yu Mincho', serif;
}
.page {
  max-width: 480px;
  min-height: 100vh;
  margin: auto;
  background: var(--paper) url('../assets/nikko/toshogu-luxury-background-v1.webp') center top / 100% auto no-repeat;
  box-shadow: 0 0 45px #0004;
  overflow: hidden;
}
.header {
  min-height: 60px;
  padding: 8px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #211d1a;
  border-bottom: 3px double #a78853;
  color: #f6edda;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 10px; line-height: 1.45; letter-spacing: .18em; }
.seal { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #b79a65; color: #e0c995; font-size: 12px; letter-spacing: .08em; }
.language select { max-width: 125px; min-height: 44px; padding: 5px 8px; border: 1px solid #8c7858; border-radius: 0; background: #211d1a; color: #fff8e8; font: 12px sans-serif; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html[lang="zh-Hans"] body, html[lang="zh-Hant"] body { font-family: 'Noto Serif CJK SC', 'Songti SC', 'Songti TC', serif; }
html[lang="ko"] body { font-family: 'Noto Serif CJK KR', 'Batang', serif; }
.masthead { min-height: 220px; padding: 20px 16px 25px; text-align: center; background: linear-gradient(#17120d66, #17120da6), url('../assets/nikko/toshogu-luxury-background-v1.webp') center top / 100% auto no-repeat, #171614; color: #f5ead2; }
.masthead-crest { display: block; width: 96px; height: 96px; object-fit: contain; margin: 0 auto 4px; animation: arrive .9s ease-out both; }
.masthead-place { margin: 0 0 5px; padding-left: .35em; color: #ffebc5; text-shadow: 0 1px 4px #000; font-size: 12px; letter-spacing: .35em; animation: arrive .9s ease-out both; }
.masthead h1 { margin: 0; padding-left: .14em; font-size: clamp(30px, 9.6vw, 42px); font-weight: 700; letter-spacing: .14em; line-height: 1.35; animation: arrive .9s ease-out both; }
html[lang="en"] .masthead h1 { font-size: clamp(27px, 7vw, 34px); letter-spacing: .06em; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.hero { height: 205px; padding: 10px; background: #211d1a; border-bottom: 1px solid #a78853; }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 70%; border: 1px solid #a78853; }
.entry-content, .inner { position: relative; text-align: center; padding: 42px 36px 46px; background: linear-gradient(135deg, #faf7efbf, #f4eee2bf); }
.entry-content { padding-top: 25px; padding-bottom: 30px; }
.entry-content::before, .inner::before { content: ''; position: absolute; inset: 13px; border: 1px solid #d7c7a9; pointer-events: none; }
.entry-content > *, .inner > * { position: relative; }
.eyebrow { font: 10px sans-serif; letter-spacing: .23em; color: #80663f; margin: 0 0 16px; }
h1, h2, p { margin-top: 0; }
.entry-invitation { font-size: 13px; letter-spacing: .14em; margin: 0 0 20px; }
form label { display: block; font-size: 13px; letter-spacing: .12em; margin-bottom: 12px; }
input { width: 100%; height: 54px; border: 1px solid #aa9a80; background: #fffdf8; text-align: center; color: var(--ink); font: 16px sans-serif; letter-spacing: .12em; border-radius: 0; }
input::placeholder { color: #897d70; }
.primary { width: 100%; min-height: 58px; border: 1px solid #b99454; outline: 1px solid var(--red); outline-offset: 2px; background: var(--red); color: #fff; font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: .12em; cursor: pointer; }
.primary:disabled { opacity: .55; }
.error { min-height: 1.5em; margin: 7px 0; color: #982a20; font: 12px/1.5 sans-serif; }
.subtle-link, .text-button { display: inline-block; margin-top: 23px; color: #67594a; text-decoration: underline; text-underline-offset: 5px; font-family: inherit; font-size: 12px; letter-spacing: .06em; }
.subtle-link { padding: 14px 8px; }
.text-button { border: 0; background: none; min-height: 44px; cursor: pointer; }
.inner { padding-top: 52px; min-height: 570px; }
.inner h2 { font-size: 25px; font-weight: 600; letter-spacing: .14em; line-height: 1.6; margin-bottom: 25px; }
.inner h2:focus { outline: none; }
.monkey-photo { padding: 6px; background: #211d1a; border: 1px solid #a78853; }
.monkey-photo img { display: block; width: 100%; height: auto; border: 1px solid #a78853; }
.monkey-photo img[hidden] { display: none; }
.invitation { font-size: 14px; letter-spacing: .12em; margin: 30px 0; }
.badge { display: inline-block; border: 1px solid #aa8f61; padding: 5px 11px; font-size: 10px; color: #76552b; letter-spacing: .1em; }
.choices { display: flex; gap: 6px; margin-top: 16px; }
.choices button { flex: 1; min-width: 0; min-height: 44px; background: transparent; border: 1px solid #ad9d83; color: var(--ink); font-family: inherit; font-size: 12px; cursor: pointer; }
.choices button[aria-pressed=true] { border-color: var(--red); color: #8b2119; background: #f4e5dc; }
.waiting { display: flex; flex-direction: column; justify-content: center; align-items: center; }
.waiting h2 { font-size: 17px; }
.waiting-mark { display: grid; place-items: center; width: 78px; height: 78px; border: 3px double var(--gold); color: var(--red); margin-bottom: 35px; animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .5; transform: scale(.96); } }
.fortune-card { padding: 42px 23px 30px; border: 3px double #b79a65; background: #fffdf7; min-height: 430px; }
.fortune-card::before { content: '三猿'; display: inline-grid; place-items: center; width: 38px; height: 38px; margin-bottom: 25px; border: 1px solid var(--red); color: var(--red); font-size: 11px; letter-spacing: .08em; }
.fortune-rank { font-size: 35px; letter-spacing: .18em; color: var(--red); margin-bottom: 24px; }
.rule { width: 34px; border-top: 1px solid var(--gold); margin: 0 auto 27px; }
.fortune-message { font-size: 16px; line-height: 2.1; white-space: pre-wrap; overflow-wrap: anywhere; }
.action-label { font-size: 11px; color: #80643c; letter-spacing: .14em; margin: 30px 0 10px; }
.fortune-action { font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
time { display: block; color: #756754; font: 11px sans-serif; margin-top: 28px; }
.result-actions { display: flex; gap: 10px; margin-top: 20px; }
.result-actions button { flex: 1; min-width: 0; min-height: 52px; background: transparent; border: 1px solid #9d8c72; color: var(--ink); font-family: inherit; font-size: 13px; cursor: pointer; }
.notice { font: 12px/1.5 sans-serif; color: #67594a; margin: 10px 0 0; }
footer { text-align: center; padding: 28px 20px; border-top: 3px double #a78853; color: #d5c7ad; background: #211d1a; font-size: 10px; letter-spacing: .1em; }
footer small { display: block; margin-top: 9px; color: #ad9a79; font: 9px sans-serif; letter-spacing: .16em; }
.about-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 14px; padding: 8px 12px; border-top: 1px solid #68583e; color: #f5ead2; font-size: 12px; text-decoration: none; letter-spacing: .05em; }
.about-link:hover { text-decoration: underline; text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #b8542c; outline-offset: 3px; }
@media (max-width: 350px) {
  .header { padding: 12px 18px; }
  .entry-content, .inner { padding-left: 24px; padding-right: 24px; }
  .hero { height: 185px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; scroll-behavior: auto !important; } }

#ready { padding-top: 28px; min-height: 0; }
#ready .eyebrow { margin-bottom: 8px; }
#ready h2 { margin-bottom: 16px; }
#ready .invitation { margin: 18px 0; }
#draw-again { margin-top: 22px; }

@media (max-width: 600px) {
  body:has(#ready:not([hidden])) .page { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .masthead { display: grid; grid-template-columns: 60px minmax(0, auto); grid-template-rows: auto auto; justify-content: center; align-content: center; column-gap: 14px; min-height: 90px; padding: 10px 16px; text-align: left; }
  .masthead-crest { grid-row: 1 / 3; align-self: center; width: 60px; height: 60px; margin: 0; }
  .masthead-place { align-self: end; margin: 0; font-size: 10px; }
  .masthead h1, html[lang="en"] .masthead h1 { align-self: start; font-size: clamp(22px, 6vw, 30px); line-height: 1.25; }
  #ready { padding: 14px 24px 20px; }
  #ready::before { inset: 8px; }
  #ready .eyebrow { margin-bottom: 3px; }
  #ready h2 { font-size: 20px; line-height: 1.3; margin-bottom: 8px; }
  #ready .monkey-photo { width: min(100%, clamp(130px, calc(100vh - 390px - env(safe-area-inset-bottom)), 250px)); width: min(100%, clamp(130px, calc(100svh - 390px - env(safe-area-inset-bottom)), 250px)); aspect-ratio: 1; margin: 0 auto; }
  #ready .monkey-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
  #ready .choices { margin-top: 10px; }
  #ready .invitation { margin: 10px 0 0; }
  #ready .draw-dock { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 480px); padding: 10px 24px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid #d7c7a9; box-shadow: 0 -4px 14px #201d1a1a; }
}
@media (max-width: 600px) and (max-height: 600px) {
  #ready .eyebrow, #ready .invitation { display: none; }
}
