/* らくばる君のリズム配達 — 見た目の設定
   配色は「ポスティング大作戦」とそろえて、藍色の夜道に朱色とチラシの黄色 */
:root {
  --ink: #1b2340;
  --panel: #252f57;
  --line: #3a4677;
  --text: #f4f1ff;
  --muted: #aab3d6;
  --vermilion: #e8541e;
  --flyer: #ffd23f;
  --display: "Dela Gothic One", "M PLUS Rounded 1c", "Hiragino Sans", Meiryo, sans-serif;
  --body: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", Meiryo, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.7;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding-block: 20px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 16px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.25;
}
h1 span { color: var(--flyer); }
.sub { margin: 0; color: var(--muted); font-size: 0.9rem; }

.back {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
}
.back:hover { color: var(--text); }

.stage {
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid var(--panel);
  box-shadow: 0 10px 0 var(--panel);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  touch-action: none;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 設定パネル */
.panel {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 16px 24px;
  align-items: center;
  background: var(--panel);
  border-radius: 14px;
  padding: 16px 20px;
}
.panel.playing { opacity: 0.45; pointer-events: none; }
@media (max-width: 760px) {
  .panel { grid-template-columns: 1fr; }
}

.diff { border: 0; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.diff legend, .opt > span {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--flyer);
  padding: 0;
  margin-bottom: 4px;
}
.diff label { flex: 1 1 0; min-width: 0; cursor: pointer; }
.diff input { position: absolute; opacity: 0; pointer-events: none; }
.diff label span {
  display: grid;
  text-align: center;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 6px 8px;
  line-height: 1.35;
}
.diff b { font-size: 1rem; white-space: nowrap; }
@media (max-width: 420px) { .diff b { font-size: 0.9rem; } .diff label span { padding: 6px 4px; } }
.diff small { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.diff input:checked + span { border-color: var(--flyer); background: rgba(255, 210, 63, 0.12); }
.diff input:focus-visible + span { outline: 3px solid var(--flyer); outline-offset: 2px; }

.opts { display: grid; gap: 6px; }
.opt { display: grid; font-size: 0.85rem; }
.opt > span { display: flex; justify-content: space-between; margin: 0; }
.opt output { color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.opt small { color: var(--muted); font-size: 0.72rem; }
.opt input { accent-color: var(--flyer); width: 100%; }
.check { font-size: 0.85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.check input { accent-color: var(--flyer); }

.start {
  font: 400 1.25rem var(--display);
  color: #fff;
  background: var(--vermilion);
  border: 0;
  border-bottom: 5px solid #a83510;
  border-radius: 14px;
  padding: 14px 32px;
  cursor: pointer;
  touch-action: manipulation;
}
.start:active { transform: translateY(3px); border-bottom-width: 2px; }
button:focus-visible { outline: 3px solid var(--flyer); outline-offset: 2px; }

.howto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 32px;
  color: var(--muted);
  font-size: 0.92rem;
}
.howto h2 { margin: 0 0 4px; font-size: 0.8rem; letter-spacing: 0.12em; color: var(--flyer); }
.howto dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.howto dt { white-space: nowrap; }
.howto dd { margin: 0; color: var(--text); }
.howto p { margin: 0 0 6px; color: var(--text); }
.howto .note { color: var(--muted); font-size: 0.8rem; }

kbd {
  font: 700 0.8rem var(--body);
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 0 6px;
}
