/* Sainome website. Palette, fonts and the dice screen follow the app (app/ios/App/UI/Theme.swift).
   Type: two styles only.
   1. Mincho (Shippori Mincho 500): headings, numerals, Japanese.
   2. Sans (Zen Kaku Gothic New, 400 and 700): everything else, at two sizes (text and small). */

@font-face { font-family: "Sainome Mincho"; src: url("/assets/fonts/mincho-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Sainome Sans"; src: url("/assets/fonts/sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Sainome Sans"; src: url("/assets/fonts/sans-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light dark;
  --paper: #F4F2EE;
  --sheet: #FBFAF7;
  --tray: #EAE7E1;
  --tray-line: #E0DCD4;
  --sep: #E0DCD4;
  --ink: #1B1B1B;
  --body: #4A4741;
  --sec: #6A665F;
  --red: #C4302B;
  --die: #FFFFFF;
  --die-line: #D8D3CA;
  --held: #1B1B1B;
  --held-pip: #F4F2EE;
  --held-line: #1B1B1B;
  --btn: #1B1B1B;
  --btn-ink: #F4F2EE;
  --disabled: #8E8A83;
  --on-disabled: #F4F2EE;
  --orbit-ring: #C9C4BA;
  --orbit-red: #C4302B;
  --shadow: rgba(27, 27, 27, 0.10);
  --shot-line: rgba(27, 27, 27, 0.10);

  --mincho: "Sainome Mincho", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --sans: "Sainome Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --small: 0.9375rem;
  --h: clamp(2rem, 1.35rem + 2.6vw, 3rem);
  --h-xl: clamp(2.75rem, 1.4rem + 5.6vw, 5.5rem);
  --gutter: clamp(1rem, 4vw, 1.5rem);
  --section: clamp(4.5rem, 3rem + 7vw, 8rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141413;
    --sheet: #1A1917;
    --tray: #1E1D1B;
    --tray-line: #2C2A27;
    --sep: #2C2A27;
    --ink: #F2EFE9;
    --body: #CBC6BD;
    --sec: #A8A39A;
    --red: #F0665E;
    --die: #ECE8E1;
    --die-line: #C9C3B8;
    --held: #3A3632;
    --held-pip: #F2EFE9;
    --held-line: #F2EFE9;
    --btn: #F2EFE9;
    --btn-ink: #141413;
    --disabled: #5A5751;
    --on-disabled: #F2EFE9;
    --orbit-ring: #4A4741;
    --orbit-red: #E0574F;
    --shadow: rgba(0, 0, 0, 0.45);
    --shot-line: rgba(242, 239, 233, 0.12);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }
p, h1, h2, h3, ul, ol, dl, dd, figure, figcaption { margin: 0; }
strong, b { font-weight: 700; color: var(--ink); }

/* ---------- Type ---------- */
.h-xl, .h, .mincho { font-family: var(--mincho); font-weight: 500; }
.h-xl { font-size: var(--h-xl); line-height: 1.05; letter-spacing: -0.01em; text-wrap: balance; }
.h { font-size: var(--h); line-height: 1.2; text-wrap: balance; }
.title { font-size: var(--text); font-weight: 700; line-height: 1.4; }
.body { color: var(--body); max-width: 36em; }
.small { font-size: var(--small); line-height: 1.55; color: var(--sec); }
.kicker { font-size: var(--small); font-weight: 700; line-height: 1.4; color: var(--sec); }
.num { font-variant-numeric: tabular-nums lining-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: calc(1120px + 2 * var(--gutter)); margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
.section { padding-block: var(--section); }
.section + .section { border-top: 1px solid var(--sep); }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--btn); color: var(--btn-ink); padding: 0.75rem 1rem; border-radius: 12px; }
.skip:focus { top: 1rem; }

/* ---------- Header and footer ---------- */
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; font-weight: 700; text-decoration: none; min-height: 44px; }
.brand:hover { color: inherit; }
.brand .glyph { width: 26px; }
.nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem); font-size: var(--small); }
.nav a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 560px) { .nav .wide { display: none; } }

.site-footer { border-top: 1px solid var(--sep); padding-block: 2.5rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Dice (same drawing as the app) ---------- */
.die { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--die); border: 1px solid var(--die-line); border-radius: 20%; }
.pip { position: absolute; width: 14%; height: 14%; border-radius: 50%; background: #1B1B1B; transform: translate(-50%, -50%); }
.pip.one { width: 30%; height: 30%; background: #C4302B; left: 50%; top: 50%; }
.pip.tl { left: 27%; top: 27%; } .pip.tr { left: 73%; top: 27%; }
.pip.ml { left: 27%; top: 50%; } .pip.c { left: 50%; top: 50%; } .pip.mr { left: 73%; top: 50%; }
.pip.bl { left: 27%; top: 73%; } .pip.br { left: 73%; top: 73%; }
.die.held { background: var(--held); border-color: var(--held-line); }
.die.held .pip { background: var(--held-pip); }
.die.held .pip.one { background: #E0574F; }
.glyph { flex: none; }
.glyph .pip.one { width: 34%; height: 34%; }

/* ---------- Launch status: a beating pip, not a button ---------- */
.status { display: inline-flex; align-items: center; gap: 0.75rem; font-weight: 700; line-height: 1.3; }
.beat { position: relative; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: heartbeat 1.6s ease-in-out infinite; }
.beat::after { content: ""; position: absolute; inset: 0; border-radius: 50%; animation: heartring 1.6s ease-out infinite; }
@keyframes heartbeat { 0%, 50%, 100% { transform: scale(1); } 12% { transform: scale(1.4); } 24% { transform: scale(1); } 36% { transform: scale(1.25); } }
@keyframes heartring { 0%, 8% { box-shadow: 0 0 0 0 rgba(196, 48, 43, 0.45); } 45%, 100% { box-shadow: 0 0 0 10px rgba(196, 48, 43, 0); } }
@media (prefers-reduced-motion: reduce) { .beat, .beat::after { animation: none; } }

/* ---------- Hero: the app's dice screen, on the page ---------- */
.hero { padding-block: clamp(1.5rem, 5vw, 4rem) var(--section); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: clamp(2.5rem, 7vw, 6rem); }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } }
.hero-copy { display: flex; flex-direction: column; gap: 1.75rem; }
.lede { display: flex; flex-direction: column; gap: 0.4rem; }

.app { width: 100%; max-width: 440px; justify-self: center; display: flex; flex-direction: column; }
.app-bar { display: flex; align-items: center; gap: 0.25rem; min-height: 44px; }
.app-bar .glyph { width: 20px; margin-right: 0.35rem; border-radius: 5px; }
.count { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--sec); font: inherit; font-size: var(--small); font-weight: 400; cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.count span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.count[aria-pressed="true"] { color: var(--btn-ink); }
.count[aria-pressed="true"] span { background: var(--btn); }
.app-top { position: relative; height: clamp(104px, 22vw, 128px); display: grid; place-items: center; }
.total { font-family: var(--mincho); font-weight: 500; font-size: clamp(4.5rem, 3rem + 6vw, 6rem); line-height: 1; }
.orbit { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; border: 1px solid var(--orbit-ring); animation: orbit 0.9s linear infinite; }
.orbit::before { content: ""; position: absolute; left: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--orbit-red); }
@keyframes orbit { to { transform: rotate(360deg); } }
.app .tray { position: relative; width: 100%; aspect-ratio: 1 / 0.9; overflow: hidden; background: var(--tray); border: 1px solid var(--tray-line); border-radius: 28px; box-shadow: inset 0 2px 6px rgba(27, 27, 27, 0.05); }
.app .tray .die { position: absolute; width: 24%; padding: 0; cursor: pointer; box-shadow: 0 8px 18px var(--shadow), 0 2px 4px var(--shadow); transition: left 0.14s ease-out, top 0.14s ease-out, transform 0.14s ease-out; -webkit-tap-highlight-color: transparent; }
.app .tray .die:focus-visible { outline-offset: 4px; border-radius: 20%; }
.held-tag { position: absolute; transform: translateX(-50%); font-size: 0.8125rem; letter-spacing: 0.08em; color: var(--sec); pointer-events: none; }
.roll { margin-top: 1.25rem; width: 100%; min-height: 64px; border: 0; border-radius: 16px; background: var(--btn); color: var(--btn-ink); font: inherit; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.roll:disabled { background: var(--disabled); color: var(--on-disabled); cursor: default; }
.app-hint { margin-top: 0.75rem; text-align: center; }
.no-js .app-live { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .app .tray .die { transition: none; }
  .orbit { animation: none; }
}
@media (max-width: 560px) { .app .tray { aspect-ratio: 1 / 0.78; } }

/* ---------- How it plays: real screenshots ---------- */
.how-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem 2rem; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.shots { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 3vw, 2.5rem); }
.shot { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.shot:nth-child(2) { margin-top: clamp(1.5rem, 4vw, 3rem); }
.shot img { width: 100%; height: auto; border-radius: clamp(20px, 3vw, 36px); border: 1px solid var(--shot-line); box-shadow: 0 24px 50px var(--shadow); }
.shot figcaption { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 0.9rem; align-items: baseline; }
.shot .n { font-family: var(--mincho); font-size: var(--h); line-height: 1; grid-row: span 2; }
@media (max-width: 760px) {
  .shots { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 1rem; padding-bottom: 1rem; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scrollbar-width: none; }
  .shots::-webkit-scrollbar { display: none; }
  .shot { flex: 0 0 68%; scroll-snap-align: center; }
  .shot:nth-child(2) { margin-top: 0; }
}

/* ---------- Why it feels real ---------- */
.feel .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
@media (max-width: 860px) { .feel .wrap { grid-template-columns: minmax(0, 1fr); } }
.feel-list { display: flex; flex-direction: column; gap: 1.25rem; }

/* ---------- The name ---------- */
.name { background: var(--sheet); }
.name .wrap { display: flex; align-items: flex-start; gap: clamp(2.5rem, 6vw, 4.5rem); }
.mark { font-family: var(--mincho); font-weight: 500; writing-mode: vertical-rl; font-size: clamp(6rem, 3rem + 9vw, 10.5rem); line-height: 1; letter-spacing: 0.06em; flex: none; }
.name-copy { display: flex; flex-direction: column; gap: 2rem; min-width: 0; flex: 1; }
.parts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; max-width: 560px; }
.part { border-top: 1px solid var(--ink); padding-top: 0.9rem; display: flex; flex-direction: column; gap: 0.15rem; }
.part .mincho { font-size: var(--h); line-height: 1.2; }
.part.me { border-color: var(--red); }
.part.me .mincho { color: var(--red); }
@media (max-width: 720px) {
  .name .wrap { flex-direction: column; gap: 2rem; }
  .mark { writing-mode: horizontal-tb; font-size: clamp(4.5rem, 22vw, 7rem); letter-spacing: 0.04em; }
}

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 2rem clamp(2rem, 6vw, 5rem); align-items: start; }
@media (max-width: 860px) { .faq-grid { grid-template-columns: minmax(0, 1fr); } }
.faq { border-top: 1px solid var(--sep); }
.faq details { border-bottom: 1px solid var(--sep); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 64px; padding: 0.75rem 0; font-weight: 700; line-height: 1.4; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 12px; height: 12px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform 0.2s; }
.faq details[open] summary::after { transform: translateY(3px) rotate(-135deg); }
.faq details > div { padding: 0 0 1.5rem; }

/* ---------- Close ---------- */
.close .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2rem 4rem; }
.close-copy { display: flex; flex-direction: column; gap: 1.5rem; }
.qr { display: none; flex-direction: column; gap: 0.75rem; max-width: 180px; }
.qr img { width: 132px; height: 132px; background: #FFFFFF; border-radius: 16px; padding: 10px; border: 1px solid var(--die-line); }
@media (hover: hover) and (pointer: fine) and (min-width: 900px) { .qr { display: flex; } }
@media (max-width: 860px) { .close .wrap { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Document pages (privacy, terms, support) ---------- */
.doc { padding-block: clamp(2.5rem, 6vw, 5rem) var(--section); }
.doc .wrap { max-width: calc(720px + 2 * var(--gutter)); }
.doc header { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 2rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--sep); }
.prose { display: flex; flex-direction: column; gap: 1.1rem; color: var(--body); }
.prose h2 { font-family: var(--mincho); font-weight: 500; font-size: calc(var(--h) * 0.72); line-height: 1.25; color: var(--ink); margin-top: 1.75rem; }
.prose ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: 0.5rem; }
