@font-face {
  font-family: "Klee One";
  src: url("fonts/KleeOne-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}
:root {
  color-scheme: dark;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: #f0e6d4;
  background: #171512;
  --muted: #b7ab97;
  --line: #ddc6a231;
  --paper-font: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "Noto Serif JP", serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 50% 45%, #2d261e 0, #1a1714 55%, #151311 83%);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible, .paper input:focus-visible { outline: 2px solid #daa46e; outline-offset: 4px; }
.topbar {
  width: min(1120px, 100%);
  margin: auto;
  padding: max(22px, env(safe-area-inset-top)) clamp(22px, 5vw, 68px) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand h1 {
  margin: 0;
  font: 500 clamp(1.8rem, 3.3vw, 2.45rem)/1.12 var(--paper-font);
  letter-spacing: .12em;
}
.brand span { display: block; margin-top: 7px; font-size: .68rem; letter-spacing: .24em; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sound, .duration-control select {
  display: inline-flex;
  min-height: 44px;
  background: #17141155;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 24px;
  font-size: .875rem;
}
.sound { gap: 9px; min-width: 90px; align-items: center; justify-content: center; }
.sound:hover { color: #f5e5cd; border-color: #ddc6a266; }
.duration-control { position: relative; color: var(--muted); }
.duration-control::after {
  content: "";
  position: absolute;
  top: calc(50% - 4px);
  right: 13px;
  width: 5px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
.duration-control select { appearance: none; min-width: 76px; padding: 0 27px 0 12px; cursor: pointer; }
.duration-control select:disabled { opacity: .65; cursor: default; }
.speaker { position: relative; width: 15px; height: 16px; display: inline-block; }
.speaker::before {
  content: "";
  position: absolute;
  inset: 2px 3px 2px 0;
  background: currentColor;
  clip-path: polygon(0 30%, 32% 30%, 80% 3%, 80% 97%, 32% 70%, 0 70%);
}
.speaker::after {
  content: "";
  position: absolute;
  height: 12px;
  right: 0;
  top: 2px;
  border-right: 1px solid currentColor;
  transform: rotate(-35deg);
}
[aria-pressed="true"] .speaker::after { border-radius: 50%; transform: none; width: 9px; }
main { margin: clamp(16px, 5vh, 64px) auto 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.stage {
  position: relative;
  width: min(1160px, 100%);
  height: clamp(248px, 55dvh, 520px);
  margin: 0 auto;
}
canvas { width: 100%; height: 100%; display: block; }
.paper, .hold-area {
  position: absolute;
  z-index: 1;
  inset: 49% 0 auto;
  margin: 0 auto;
  transform: translateY(-50%);
}
.paper {
  width: var(--paper-input-width, 55%);
  height: var(--paper-input-height, 46px);
}
.paper[hidden] { display: none; }
/* The paper is a touch target once armed. Keep native selection in the editor. */
body[data-phase="armed"], body[data-phase="burning"], .hold-area {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.hold-area {
  width: var(--paper-width);
  height: var(--paper-height);
  cursor: crosshair;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.paper input {
  color-scheme: light;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 3px;
  text-align: center;
  background: transparent;
  color: #292118;
  caret-color: #9b4a22;
  font: 500 var(--ink-size, 24px)/1 var(--paper-font);
}
.paper input.ink-font-loaded {
  font-family: "Klee One", var(--paper-font);
  font-weight: 400;
}
.paper input::placeholder { color: #635540; opacity: .85; font-size: var(--prompt-size, 16px); }
.paper input:disabled { opacity: .82; }
.paper input:focus-visible { outline: 1px solid #92795966; outline-offset: 5px; }
.stage[data-unavailable] .paper {
  background: #ddcba5;
  border-radius: 2px;
  box-shadow: 0 18px 54px #0007;
  height: max(85px, var(--paper-input-height, 46px));
}
.controls {
  min-height: 109px;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 0 18px;
  gap: 12px;
}
.fire-actions { display: flex; justify-content: center; gap: 10px; }
.action {
  min-height: 48px;
  min-width: 148px;
  padding: 9px 24px;
  border: 1px solid #bc916a85;
  border-radius: 40px;
  background: #493022;
  color: #fff0db;
  box-shadow: inset 0 1px #f6bc8540, 0 7px 24px #0004;
  font-size: 1rem;
  letter-spacing: .05em;
}
.action:not(:disabled):hover { background: #5a3a28; }
.action:disabled { background: #312820; border-color: #b8926e3d; color: #d2b99db3; }
.action[data-quiet] { background: #18161288; border-color: var(--line); box-shadow: none; }
.action.secondary { min-width: 0; padding-inline: 16px; background: transparent; border-color: var(--line); box-shadow: none; }
.action.secondary:not(:disabled):hover { background: #312820; }
.guide { min-height: 1.5em; margin: 0; color: var(--muted); font-size: .875rem; text-align: center; line-height: 1.55; }
@media (prefers-reduced-motion: no-preference) {
  .guide.afterglow { animation: afterglow-appear .45s ease-out both; }
  @keyframes afterglow-appear { from { opacity: 0; } to { opacity: 1; } }
}
noscript { color: var(--muted); text-align: center; }
@media (max-width: 600px) {
  .topbar { padding-inline: max(21px, env(safe-area-inset-left)) max(21px, env(safe-area-inset-right)); }
  main { margin-top: clamp(12px, 5dvh, 42px); }
  .stage { height: clamp(232px, 49dvh, 435px); }
}
@media (max-height: 520px) {
  main { margin-top: 2px; }
  .stage { height: clamp(156px, 53dvh, 278px); }
}
