:root {
  color-scheme: light;
  --paper: #f7f0df;
  --paper-light: #fcf9f1;
  --ink: #2e3028;
  --muted: #777365;
  --red: #a33a2e;
  --red-dark: #762c25;
  --gold: #b49453;
  --line: #dcd2bb;
  font-family: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 9%, rgba(255, 255, 255, .72), transparent 48rem),
    var(--paper);
}

button {
  font: inherit;
}

.page-shell {
  width: min(100% - 56px, 1120px);
  margin: 0 auto;
}

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(164, 146, 111, .25);
  font-size: 12px;
  letter-spacing: .12em;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 15px;
}

.series-label {
  color: var(--muted);
}

.hero {
  min-height: 432px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  position: relative;
  padding: 38px 8% 40px;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 10px;
  letter-spacing: .22em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 19px;
}

.eyebrow span {
  width: 20px;
  height: 1px;
  background: var(--gold);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 500;
  letter-spacing: .13em;
  line-height: 1.45;
}

h1 span {
  color: var(--red);
}

.lead {
  color: #57554c;
  font-size: 14px;
  letter-spacing: .08em;
  line-height: 2.1;
}

.hero-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
}

.note-symbol {
  color: var(--gold);
  font-size: 30px;
  line-height: 1;
}

.hero-art {
  width: min(100%, 325px);
  aspect-ratio: 1;
  justify-self: end;
  position: relative;
  display: grid;
  place-items: center;
}

.sun-disc {
  position: absolute;
  width: 54%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(180, 148, 83, .12);
}

.orbit {
  position: absolute;
  width: 75%;
  height: 75%;
  border: 1px solid rgba(164, 146, 111, .47);
  border-radius: 50%;
}

.orbit-one {
  transform: rotate(-27deg) scaleX(.76);
}

.orbit-two {
  transform: rotate(27deg) scaleX(.76);
}

.art-seal {
  z-index: 1;
  display: grid;
  width: 100px;
  height: 100px;
  place-items: center;
  border: 1px solid var(--red);
  outline: 1px solid rgba(163, 58, 46, .42);
  outline-offset: 6px;
  color: var(--red);
  font-size: 56px;
  font-weight: 500;
}

.art-caption {
  position: absolute;
  bottom: 5%;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .3em;
}

.omikuji-section {
  padding: 54px 0 62px;
  text-align: center;
}

.section-heading {
  margin-bottom: 25px;
}

.section-heading .section-kicker {
  display: block;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin-bottom: 10px;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: .12em;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
}

.omikuji-stage {
  height: 145px;
  width: 190px;
  position: relative;
  margin: -7px auto 17px;
  isolation: isolate;
}

.omikuji-glow {
  position: absolute;
  width: 145px;
  height: 28px;
  left: 50%;
  bottom: 8px;
  border-radius: 50%;
  background: rgba(89, 61, 36, .12);
  filter: blur(7px);
  transform: translateX(-50%);
}

.omikuji-box {
  position: absolute;
  z-index: 2;
  width: 112px;
  height: 83px;
  left: 50%;
  bottom: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #75452e;
  border-radius: 3px 3px 6px 6px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .08), transparent 18%, rgba(47, 24, 15, .11) 78%, rgba(255, 255, 255, .04)),
    linear-gradient(155deg, #895735, #68412e 58%, #563727);
  box-shadow: 0 8px 12px rgba(68, 43, 28, .2), inset 0 1px rgba(255, 235, 193, .35);
  transform: translateX(-50%);
}

.omikuji-box::before {
  position: absolute;
  top: -8px;
  left: -4px;
  width: 118px;
  height: 13px;
  border: 1px solid #75452e;
  border-radius: 3px;
  background: linear-gradient(#a7774f, #815535);
  content: "";
}

.omikuji-box::after {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(224, 191, 137, .27);
  border-radius: 2px;
  content: "";
  pointer-events: none;
}

.box-slot {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 34px;
  height: 4px;
  border-radius: 50%;
  background: #39251b;
  box-shadow: 0 1px 0 rgba(255, 226, 176, .35);
  transform: translateX(-50%);
}

.box-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(230, 198, 144, .75);
  color: #f0d6a7;
  font-size: 19px;
}

.omikuji-stick {
  position: absolute;
  z-index: 1;
  left: calc(50% - 7px);
  bottom: 75px;
  width: 14px;
  height: 83px;
  display: grid;
  place-items: start center;
  padding-top: 7px;
  border: 1px solid #d5bb83;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, #e5d3a9, #fff8e6 48%, #d9c395);
  box-shadow: 0 0 0 2px rgba(252, 249, 241, .4);
  color: var(--red);
  font-size: 9px;
  opacity: 0;
  transform: translateY(32px) rotate(-5deg);
}

.omikuji-stage.is-drawing .omikuji-box {
  animation: shake-box .34s ease-in-out 3;
}

.omikuji-stage.is-drawing .omikuji-glow {
  animation: shake-shadow .34s ease-in-out 3;
}

.omikuji-stage.is-drawing .omikuji-stick,
.omikuji-stage.is-revealed .omikuji-stick {
  opacity: 1;
  transform: translateY(-31px) rotate(5deg);
}

.omikuji-stage.is-drawing .omikuji-stick {
  transition: transform .5s cubic-bezier(.2, .85, .3, 1), opacity .18s ease;
  transition-delay: .55s;
}

.omikuji-stage.is-revealed .omikuji-stick {
  transition: transform .35s ease, opacity .35s ease;
  transition-delay: 1.4s;
  opacity: 0;
  transform: translateY(-55px) rotate(10deg);
}

.draw-button:disabled {
  cursor: wait;
  background: var(--red-dark);
  box-shadow: none;
}

.draw-button:disabled:hover {
  transform: none;
}

.draw-button {
  min-width: 258px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 0 24px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fffaf0;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: .12em;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.draw-button:hover {
  transform: translateY(-2px);
  background: var(--red-dark);
  box-shadow: 0 8px 18px rgba(118, 44, 37, .17);
}

.draw-button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.button-icon {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid rgba(255, 250, 240, .58);
  font-size: 13px;
}

.button-arrow {
  margin-left: 6px;
  font-family: Arial, sans-serif;
  font-size: 19px;
  transition: transform .2s ease;
}

.draw-button:hover .button-arrow {
  transform: translateX(3px);
}

.draw-hint {
  margin: 12px 0 0;
  color: #898373;
  font-size: 10px;
  letter-spacing: .06em;
}

.result-card {
  width: min(100%, 690px);
  margin: 34px auto 0;
  padding: 22px 28px 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 255, 255, .42), rgba(255, 255, 255, .42)),
    var(--paper-light);
  text-align: left;
  animation: reveal .45s ease both;
}

.result-card[hidden] {
  display: none;
}

.result-topline,
.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .1em;
}

.result-topline {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.result-label {
  color: var(--red);
}

.result-content {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px;
  align-items: center;
  padding: 22px 3px;
}

.result-flag-wrap {
  text-align: center;
}

.result-flag {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(46, 48, 40, .12);
}

.flag-caption {
  display: inline-block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .1em;
}

.result-reading {
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: .16em;
}

.result-fortune {
  margin-bottom: 13px;
  color: var(--red);
  font-size: 37px;
  font-weight: 500;
  letter-spacing: .18em;
}

.result-message {
  margin-bottom: 17px;
  color: #555247;
  font-size: 13px;
  line-height: 2;
}

.result-advice {
  display: flex;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #65583c;
  font-size: 11px;
  line-height: 1.8;
}

.advice-mark {
  color: var(--gold);
}

.result-footer {
  justify-content: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.flags-section {
  padding: 35px 0 50px;
  border-top: 1px solid var(--line);
}

.section-heading.compact {
  margin-bottom: 20px;
  text-align: center;
}

.section-heading.compact h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.flag-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px;
}

.legend-item + .legend-item {
  border-left: 1px solid var(--line);
}

.legend-item img {
  flex: 0 0 auto;
  width: 44px;
  height: 30px;
  object-fit: cover;
  border: 1px solid rgba(46, 48, 40, .12);
}

.legend-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.legend-name {
  font-size: 12px;
  letter-spacing: .1em;
  line-height: 1.2;
}

.legend-country {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .02em;
  line-height: 1.3;
}

.legend-dot {
  width: 5px;
  height: 5px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--gold);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 75px;
  border-top: 1px solid rgba(164, 146, 111, .25);
  color: #817a68;
  font-size: 10px;
  letter-spacing: .08em;
}

.site-footer p {
  margin: 0;
}

.site-footer p span {
  color: #a29a87;
}

.footer-symbol {
  color: var(--gold);
  font-size: 11px;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake-box {
  0%, 100% {
    transform: translateX(-50%) rotate(0);
  }

  20%, 60% {
    transform: translateX(calc(-50% - 5px)) rotate(-4deg);
  }

  40%, 80% {
    transform: translateX(calc(-50% + 5px)) rotate(4deg);
  }
}

@keyframes shake-shadow {
  0%, 100% {
    transform: translateX(-50%) scaleX(1);
  }

  20%, 60% {
    transform: translateX(-50%) scaleX(.92);
  }

  40%, 80% {
    transform: translateX(-50%) scaleX(1.08);
  }
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 34px, 540px);
  }

  .topbar {
    height: 66px;
    font-size: 10px;
  }

  .hero {
    min-height: 0;
    grid-template-columns: 1fr;
    padding: 52px 5% 38px;
  }

  .hero-art {
    width: min(72%, 260px);
    justify-self: center;
    margin-top: 28px;
  }

  h1 {
    font-size: clamp(36px, 10vw, 50px);
  }

  .omikuji-section {
    padding: 44px 0 48px;
  }

  .section-heading h2 {
    font-size: 20px;
  }

  .section-heading p {
    line-height: 1.9;
  }

  .result-card {
    padding: 18px 16px 14px;
  }

  .result-content {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 0;
  }

  .result-flag-wrap {
    width: min(100%, 270px);
    justify-self: center;
  }

  .result-copy {
    text-align: center;
  }

  .result-advice {
    text-align: left;
  }

  .result-footer {
    gap: 6px;
    font-size: 8px;
  }

  .flag-legend {
    grid-template-columns: repeat(2, 1fr);
  }

  .legend-item {
    padding: 12px 10px;
  }

  .legend-item:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .legend-item:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .site-footer {
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }
}
