:root {
  --background: #f2eee3;
  --foreground: #243128;
  --card: #fffdf7;
  --card-foreground: #243128;
  --popover: #fffdf7;
  --popover-foreground: #243128;
  --primary: #285443;
  --primary-foreground: #fffdf7;
  --secondary: #e7e0ce;
  --secondary-foreground: #243128;
  --muted: #eee8da;
  --muted-foreground: #687168;
  --accent: #dce5d8;
  --accent-foreground: #244638;
  --destructive: #a84135;
  --border: #d8cfb9;
  --input: #d8cfb9;
  --ring: #6f8d78;
  --chart-1: #285443;
  --chart-2: #a84135;
  --chart-3: #a98b4f;
  --chart-4: #69836d;
  --chart-5: #856d5b;
  --radius: 0.9rem;
  --paper: #fffdf7;
  --ink: #243128;
  --matcha: #285443;
  --matcha-soft: #e4ebe1;
  --vermilion: #a84135;
  --gold: #a98b4f;
  --line: #d8cfb9;
  --wash: #f2eee3;
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 6px);
  --font-sans: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--wash);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(169, 139, 79, 0.12), transparent 26rem),
    radial-gradient(circle at 92% 18%, rgba(40, 84, 67, 0.1), transparent 30rem),
    var(--wash);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

.hidden {
  display: none !important;
}

body.is-drawing {
  overflow: hidden;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

main {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image: repeating-linear-gradient(
    100deg,
    transparent 0,
    transparent 4px,
    rgba(65, 78, 67, 0.025) 5px,
    transparent 6px
  );
  mix-blend-mode: multiply;
}

.page-shell {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 56px;
  position: relative;
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 10px 4px 28px;
}

.brand-mark {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: contain;
}

.brand-copy h1,
.paper-heading h2,
.result-heading h3,
.how-to h2 {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
}

.brand-copy h1 {
  margin: 2px 0 4px;
  font-size: clamp(2rem, 5vw, 3.45rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.08;
}

.brand-copy > p:last-child {
  margin: 0;
  color: #687168;
  line-height: 1.7;
}

.eyebrow {
  margin: 0;
  color: var(--vermilion);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.draw-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--matcha) 28%, transparent);
  border-radius: 18px 18px 6px 6px;
  background: rgba(255, 253, 247, 0.84);
  box-shadow: 0 14px 34px rgba(46, 59, 46, 0.07);
  backdrop-filter: blur(12px);
}

.draw-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px;
  color: var(--matcha);
  font-weight: 700;
}

.draw-kicker svg,
.draw-button svg {
  width: 17px;
  height: 17px;
}

.draw-note {
  margin: 0;
  color: #737b72;
  font-size: 0.84rem;
  line-height: 1.65;
}

.draw-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  min-width: 224px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--matcha);
  color: #fffdf7;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  box-shadow: 0 8px 20px rgba(40, 84, 67, 0.2);
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.draw-button:hover:not(:disabled) {
  background: #1f4738;
  box-shadow: 0 10px 26px rgba(40, 84, 67, 0.27);
  transform: translateY(-1px);
}

.draw-button:disabled {
  opacity: 1;
  background: #476859;
  color: #fffdf7;
  cursor: wait;
}

.spinning-icon {
  animation: icon-turn 520ms linear infinite;
}

.omikuji-waiting {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(25, 35, 29, 0.7);
  backdrop-filter: blur(7px);
  animation: waiting-fade-in 180ms ease both;
}

.omikuji-waiting-content {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
}

.omikuji-waiting-content > p {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  width: max-content;
  max-width: calc(100vw - 48px);
  margin: 0;
  color: #fffdf7;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
}

.omikuji-box-motion {
  display: block;
  width: min(260px, 62vw);
  height: auto;
  filter: drop-shadow(0 22px 25px rgba(0, 0, 0, 0.28));
  animation: omikuji-box-shake 440ms ease-in-out infinite;
  transform-origin: 50% 72%;
}

.omikuji-frame {
  width: min(780px, 100%);
  margin: 22px auto 0;
  perspective: 1200px;
}

.omikuji-paper {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(168, 65, 53, 0.7);
  background:
    linear-gradient(rgba(255, 253, 247, 0.93), rgba(255, 253, 247, 0.93)),
    repeating-linear-gradient(0deg, #f5efe2 0, #f5efe2 2px, #fffdf7 3px, #fffdf7 7px);
  box-shadow:
    inset 0 0 0 5px #fffdf7,
    inset 0 0 0 6px rgba(168, 65, 53, 0.35),
    0 20px 48px rgba(69, 58, 39, 0.1);
  color: var(--ink);
  transform-origin: 50% 0;
  writing-mode: horizontal-tb;
}

.paper-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 6px 0;
  padding: 15px 18px 13px;
  border-bottom: 1px solid rgba(168, 65, 53, 0.38);
  text-align: center;
}

.paper-heading p {
  position: absolute;
  left: 18px;
  margin: 0;
  color: #8e5b51;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.paper-heading h2 {
  margin: 0;
  color: var(--vermilion);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.paper-body {
  padding: 24px 30px 26px;
  transition: opacity 160ms ease, filter 160ms ease, transform 160ms ease;
}

.empty-paper {
  min-height: 265px;
  display: grid;
  place-items: center;
}

.empty-message {
  max-width: 460px;
  text-align: center;
}

.empty-message svg {
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  color: var(--gold);
  stroke-width: 1.5;
}

.empty-message h3 {
  margin: 0 0 8px;
  color: #3c5044;
  font-size: 1.12rem;
}

.empty-message p {
  margin: 0;
  color: #6c756d;
  font-size: 0.9rem;
  line-height: 1.75;
}

.phase-revealing .omikuji-paper {
  animation: omikuji-open 520ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.phase-revealing .paper-body {
  animation: paper-content-in 350ms 130ms ease both;
}

.result-heading {
  padding: 2px 8px 22px;
  text-align: center;
}

.result-heading > p:first-child {
  margin: 0 0 7px;
  color: var(--vermilion);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.result-heading h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin: 0;
  color: #263c30;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.25;
}

.result-heading h3 span {
  color: var(--gold);
  font-size: 0.7em;
  font-weight: 400;
}

.result-heading > p:last-child {
  max-width: 650px;
  margin: 12px auto 0;
  color: #59655d;
  font-size: 0.92rem;
  line-height: 1.8;
}

.result-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.4fr 0.8fr;
  margin: 0;
  border-top: 1px solid rgba(169, 139, 79, 0.45);
  border-bottom: 1px solid rgba(169, 139, 79, 0.45);
}

.result-grid > div {
  min-width: 0;
  padding: 16px 15px;
}

.result-grid > div + div {
  border-left: 1px solid rgba(169, 139, 79, 0.34);
}

.result-grid dt {
  margin: 0 0 7px;
  color: var(--vermilion);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.result-grid dd {
  margin: 0;
}

.result-grid strong,
.result-grid span {
  display: block;
}

.result-grid strong {
  color: #30483a;
  font-size: 0.94rem;
  line-height: 1.5;
}

.result-grid span {
  margin-top: 5px;
  color: #73786f;
  font-size: 0.73rem;
  line-height: 1.65;
}

.play-block {
  margin-top: 21px;
  padding: 18px 19px;
  background: rgba(228, 235, 225, 0.68);
}

.play-block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--matcha);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.play-block h3 svg {
  width: 17px;
  height: 17px;
}

.play-block ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.play-block li {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 10px;
}

.play-block li > span,
.how-to li > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #bda875;
  border-radius: 50%;
  color: #826b38;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 0.75rem;
}

.play-block li p {
  margin: 2px 0 0;
  color: #46564c;
  font-size: 0.9rem;
  line-height: 1.7;
}

.first-line,
.response-note {
  margin-top: 14px;
  padding: 13px 15px;
}

.first-line {
  border-left: 3px solid rgba(168, 65, 53, 0.58);
  background: #f7f0e8;
}

.response-note {
  border: 1px dashed #b9c7b7;
  background: #f2f6ef;
}

.first-line span,
.response-note span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.first-line span {
  color: var(--vermilion);
}

.response-note span {
  color: #4c7259;
}

.first-line p,
.response-note p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.7;
}

.first-line p {
  color: #66514a;
  font-weight: 600;
}

.response-note p {
  color: #526258;
}

.how-to {
  margin-top: 34px;
  padding: 25px 28px;
  border-top: 1px solid rgba(169, 139, 79, 0.52);
  border-bottom: 1px solid rgba(169, 139, 79, 0.52);
}

.how-to h2 {
  margin: 5px 0 19px;
  color: #2e4336;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 600;
}

.how-to ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-to li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.how-to li > span {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  font-size: 0.8rem;
}

.how-to li p {
  margin: 1px 0 0;
  color: #5f685f;
  font-size: 0.84rem;
  line-height: 1.75;
}

.vr-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px dashed #b9c7b7;
  border-radius: 8px;
  background: rgba(242, 246, 239, 0.82);
  color: #526258;
  font-size: 0.8rem;
  line-height: 1.7;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 24px 4px 0;
  color: #7b7c73;
  text-align: center;
}

.site-footer svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.site-footer p {
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.65;
}

@keyframes omikuji-box-shake {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  18% {
    transform: translate3d(-12px, -5px, 0) rotate(-4deg);
  }
  38% {
    transform: translate3d(11px, 3px, 0) rotate(4deg);
  }
  58% {
    transform: translate3d(-8px, -3px, 0) rotate(-3deg);
  }
  78% {
    transform: translate3d(8px, 2px, 0) rotate(3deg);
  }
}

@keyframes waiting-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes omikuji-open {
  0% {
    opacity: 0.22;
    transform: translateY(-24px) rotateX(-8deg) scaleY(0.08);
  }
  58% {
    opacity: 1;
    transform: translateY(2px) rotateX(0deg) scaleY(1.025);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) scaleY(1);
  }
}

@keyframes paper-content-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes icon-turn {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 24px, 600px);
    padding-top: 20px;
  }

  .site-header {
    grid-template-columns: auto 1fr;
    gap: 13px;
    padding-bottom: 20px;
  }

  .brand-mark {
    width: 54px;
    height: 54px;
  }

  .brand-copy h1 {
    font-size: 2.15rem;
  }

  .brand-copy > p:last-child {
    font-size: 0.79rem;
  }

  .draw-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

  .draw-button {
    width: 100%;
    min-width: 0;
  }

  .paper-heading {
    padding: 13px 12px 12px;
  }

  .paper-heading h2 {
    font-size: 1.15rem;
    letter-spacing: 0.1em;
  }

  .paper-heading p {
    left: 12px;
    font-size: 0.63rem;
    letter-spacing: 0.06em;
  }

  .paper-body {
    padding: 21px 18px 23px;
  }

  .result-heading {
    padding-left: 0;
    padding-right: 0;
  }

  .result-heading h3 {
    gap: 8px;
    font-size: clamp(1.6rem, 8vw, 2.1rem);
  }

  .result-heading > p:last-child {
    font-size: 0.85rem;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-grid > div {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 10px;
    padding: 13px 8px;
  }

  .result-grid > div + div {
    border-top: 1px solid rgba(169, 139, 79, 0.34);
    border-left: 0;
  }

  .result-grid dt {
    margin: 2px 0 0;
  }

  .play-block {
    padding: 16px 14px;
  }

  .how-to {
    padding: 23px 6px;
  }

  .how-to ol {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .omikuji-box-motion,
  .phase-revealing .omikuji-paper,
  .phase-revealing .paper-body,
  .spinning-icon {
    animation: none;
  }

  .draw-button,
  .paper-body {
    transition: none;
  }
}
