:root {
  color-scheme: light;
  font-family: "Zen Maru Gothic", "Hiragino Sans", sans-serif;
  color: #36281e;
  background: #fbf4e7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; }

.sitebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 max(14px, calc((100% - 904px) / 2));
  background: #3b261b;
  border-bottom: 1px solid #593c2b;
  color: #f6e4c4;
  font-size: 0.79rem;
  font-weight: 700;
}

.sitebar a {
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}

.sitebar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #f0dec2;
}

.sitebar .sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #f9d89c;
  font-size: 0.76rem;
  box-shadow: none;
}

.sitebar .sound-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.sitebar .sound-toggle[aria-pressed="false"] { color: #c9b59e; }
.sitebar a:hover { text-decoration: underline; }

.game {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px) clamp(12px, 3vw, 28px) 24px;
}

h1 {
  margin: 0 0 12px;
  font-family: "Kaisei Decol", serif;
  font-size: clamp(1.125rem, 4.55vw, 1.8rem);
  letter-spacing: 0.025em;
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.batch-count {
  color: #8c3827;
  font-size: 0.78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.steps {
  display: flex;
  align-items: end;
  gap: clamp(4px, 2vw, 14px);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(0.68rem, 2.65vw, 0.85rem);
  font-weight: 650;
}

.steps li {
  color: #6b584b;
  padding: 4px clamp(4px, 1vw, 12px) 6px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.steps [aria-current="step"] {
  color: #8c3827;
  border-color: #b85b45;
}

.instruction {
  min-height: 1.5em;
  margin: 12px 0 10px;
  font-size: clamp(0.79rem, 3.3vw, 0.96rem);
  line-height: 1.5;
}

.stage {
  position: relative;
  aspect-ratio: 2.06;
  overflow: hidden;
  border-radius: 16px;
  background: #e7cfab;
  outline: 1px solid #946d4130;
  box-shadow: 0 4px 14px #8b60331a;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage canvas.interactive {
  touch-action: none;
  cursor: grab;
}

.stage canvas.dragging { cursor: grabbing; }

.start {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #37221620;
}

.start-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.pleat-guides span {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1.5px solid #98432d;
  border-radius: 50%;
  background: #fff3d9;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.grip {
  position: absolute;
  width: 17px;
  height: 17px;
  border: 2px solid #fff3d9;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #a9573b, 0 2px 4px #6a45284a;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.grip.dragging {
  width: 12px;
  height: 12px;
}

.grip.ready {
  border: 0;
  box-shadow: none;
}

.grip.ready::after {
  position: absolute;
  inset: 0;
  width: 13px;
  height: 7px;
  margin: auto;
  border: solid #2c6049;
  border-width: 0 0 2px 2px;
  content: "";
  transform: rotate(-45deg);
  filter: drop-shadow(0 0 1px #fff9ed);
}

.pull-guide {
  position: absolute;
  height: 12px;
  translate: 0 -50%;
  transform-origin: 0 50%;
  color: #98432d;
  pointer-events: none;
  filter: drop-shadow(0 0 1px #fff7e5);
}

.pull-guide::before, .pull-guide::after {
  content: "";
  position: absolute;
}

.pull-guide::before {
  left: 0;
  right: 2px;
  top: 5px;
  border-top: 2px solid;
}

.pull-guide::after {
  right: 1px;
  top: 2.5px;
  width: 6px;
  height: 6px;
  border: solid;
  border-width: 2px 2px 0 0;
  rotate: 45deg;
}

.piece-numbers span {
  display: grid;
  place-items: center;
  position: absolute;
  transform: translate(-50%, 0);
  width: 20px;
  height: 20px;
  border: 1px solid #cf9f75;
  border-radius: 50%;
  background: #fff8e9;
  color: #74402f;
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
}

.controls, .result-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: end;
  margin-top: 12px;
}

button {
  min-height: 44px;
  padding: 8px 19px;
  border: 1px solid #843827;
  border-radius: 11px;
  background: #9e4533;
  color: #fff9ed;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 2px 1px #69381629;
}

button:hover:not(:disabled) { filter: brightness(1.16); }
button:disabled { opacity: 0.55; cursor: default; }

.control-note {
  flex: 1;
  margin: 0;
  color: #695244;
  font-size: 0.78rem;
  white-space: pre-line;
}

.result { margin-top: 12px; }

.instruction.reaction {
  color: #8c3827;
  font-size: 1rem;
  font-weight: 750;
}

.ratings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ratings > li {
  padding: 9px clamp(6px, 2.4vw, 12px);
  background: #fffaf0;
  border: 1px solid #e5d1b7;
  border-radius: 10px;
}

.ratings strong { display: block; margin-bottom: 3px; font-size: 0.72rem; }
.ratings p { margin: 0; font-size: 0.77rem; line-height: 1.5; }
.ratings .toast { font-weight: 750; color: #8b4128; }
.ratings .rupture { color: #8c3827; font-weight: 680; text-wrap: balance; }
.ratings .raw-seal { margin-top: 4px; font-size: 0.68rem; color: #675345; }
.ratings .burn-reason {
  margin-bottom: 4px;
  font-size: 0.73rem;
  font-weight: 650;
  color: #51392c;
  text-wrap: balance;
}

#save-note {
  flex: 1;
  margin: 0;
  font-size: 0.8rem;
  color: #695244;
}

.sitefoot {
  padding: 6px 16px 16px;
  text-align: center;
  color: #6c5748;
  font-size: 0.75rem;
  line-height: 1.7;
}

.sitefoot a { color: #873a2b; }

@media (max-width: 620px) {
  .stage { aspect-ratio: 1 / 1.13; }
}

/* --- batch A (2026-11-19): iOS long-press callout off + bottom reserve for Safari floating bar --- */
*{-webkit-touch-callout:none}
body{-webkit-user-select:none;user-select:none}
@media (max-width:880px){body{padding-bottom:calc(env(safe-area-inset-bottom) + 60px)}}
