:root {
  --bg: #0d0c0f;
  --stage: #0a090c;
  --paper: #f1e8d6;
  --paper-2: #e6dbc5;
  --ink: #2b221c;
  --text: #e4dccd;
  --muted: #a39a8c;
  --accent: #d4693f;
  --hand: "Klee One", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --mincho: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --garamond: "EB Garamond", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--hand);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }

/* ---- stage ---------------------------------------------------------------- */
#stage {
  position: relative;
  width: 100%;
  height: min(100vh, 56.25vw);
  height: min(100svh, 56.25vw);
  min-height: 200px;
  display: grid;
  place-items: center;
  background: var(--stage);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
#stage:fullscreen { height: 100vh; }
#film { display: block; background: #0a090c; }
#stage.idle { cursor: none; }

.veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 45%, rgba(10, 9, 12, 0.2), rgba(10, 9, 12, 0.78) 75%);
  z-index: 3;
}
.veil.soft { background: radial-gradient(ellipse at 50% 45%, rgba(10, 9, 12, 0.05), rgba(10, 9, 12, 0.6) 80%); }
#loading { background: var(--stage); }
.load-text { font-size: 18px; letter-spacing: 0.1em; color: var(--muted); text-align: center; }
.load-text span { display: block; font-family: var(--garamond); font-style: italic; font-size: 14px; margin-top: 4px; opacity: 0.7; }
.bar { width: 180px; height: 2px; background: rgba(255, 255, 255, 0.08); margin: 14px auto 0; }
.bar i { display: block; height: 100%; width: 4%; background: var(--accent); transition: width 0.3s; }

.card { text-align: center; }
.card h1 {
  font-family: var(--mincho);
  font-weight: 900;
  font-size: clamp(40px, 7.4vw, 96px);
  letter-spacing: 0.08em;
  margin: 0;
  color: #f1e4c8;
  text-shadow: 3px 5px 0 rgba(0, 0, 0, 0.35), 0 14px 30px rgba(0, 0, 0, 0.5);
}
.card .sub { font-family: var(--garamond); font-style: italic; font-size: clamp(18px, 2.4vw, 28px); margin: 0.2em 0 0; color: #efe4cc; }
.card .tag { font-size: clamp(13px, 1.5vw, 17px); color: var(--muted); margin: 0.6em 0 1.6em; letter-spacing: 0.08em; }
.card .fin { font-family: var(--mincho); font-size: clamp(26px, 4vw, 44px); margin: 0 0 0.8em; color: #f1e4c8; }
.card .fin small, .card button small { font-family: var(--garamond); font-style: italic; font-size: 0.6em; opacity: 0.7; margin-left: 0.3em; }

.card button {
  font-family: var(--hand);
  font-weight: 600;
  font-size: clamp(16px, 1.8vw, 21px);
  color: var(--ink);
  background: var(--paper);
  border: 0;
  padding: 0.8em 1.7em;
  cursor: pointer;
  transform: rotate(-1.2deg);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35), 0 12px 26px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s, box-shadow 0.12s;
}
.card button:hover { transform: rotate(-1.2deg) translate(-1px, -3px); box-shadow: 4px 8px 0 rgba(0, 0, 0, 0.3), 0 20px 34px rgba(0, 0, 0, 0.45); }
.card button:active { transform: rotate(-1.2deg) translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4); }
.card button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 1.6em; letter-spacing: 0.04em; line-height: 2; }
kbd {
  font-family: var(--garamond);
  font-size: 0.95em;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 0.35em;
  margin: 0 0.12em;
}

/* ---- controls ---------------------------------------------------------------- */
#controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 14px 10px;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.62));
  transition: opacity 0.45s;
}
#stage.idle #controls { opacity: 0; pointer-events: none; }
#loading:not([hidden]) ~ #controls,
#start:not([hidden]) ~ #controls { display: none; }
#controls button {
  font-family: var(--hand);
  font-size: 13px;
  color: var(--text);
  background: rgba(20, 18, 22, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
#controls button:hover { border-color: rgba(255, 255, 255, 0.45); }
#controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#pp { min-width: 40px; }
#scrub { flex: 1; min-width: 60px; accent-color: var(--accent); cursor: pointer; }
#counter { font-family: var(--garamond); font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
body.clean #controls, body.clean .veil { display: none !important; }

/* ---- about ----------------------------------------------------------------------- */
#about {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 24px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  line-height: 2;
  font-size: 15.5px;
  color: #d8cfc0;
}
#about h2 { font-family: var(--mincho); font-weight: 700; font-size: 20px; letter-spacing: 0.08em; color: #efe4cc; margin: 0 0 0.8em; }
#about .en { font-family: var(--garamond); font-size: 17.5px; line-height: 1.75; }
#about .en h2 { font-family: var(--garamond); font-style: italic; font-weight: 500; letter-spacing: 0.02em; font-size: 22px; }
#about .tech { color: var(--muted); font-size: 0.92em; }
#about .credit { color: var(--muted); font-size: 0.86em; letter-spacing: 0.04em; margin-top: 1.6em; }
footer { text-align: center; font-family: var(--garamond); font-style: italic; color: var(--muted); opacity: 0.6; padding: 12px 16px 44px; font-size: 14px; }
.noscript { text-align: center; padding: 40px 16px; }

.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;
}

@media (max-width: 720px) {
  .card h1 { font-size: clamp(26px, 8vw, 44px); }
  .card .sub { font-size: clamp(13px, 3.6vw, 18px); }
  .card .tag { font-size: 11px; margin: 0.3em 0 0.9em; }
  .card .fin { font-size: 22px; margin-bottom: 0.5em; }
  .card button { font-size: 14px; padding: 0.55em 1.2em; }
  #about { grid-template-columns: 1fr; gap: 32px; padding-top: 40px; }
  #controls { gap: 6px; padding: 16px 8px 6px; }
  #controls button { font-size: 11.5px; padding: 4px 7px; }
  #counter { display: none; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card button, #controls { transition: none; }
}
