:root {
  --bg: #fbf6f3;
  --card: #ffffff;
  --ink: #2b2522;
  --muted: #7a6d66;
  --accent: #c85a6e;
  --accent-ink: #ffffff;
  --line: #eadfd8;
  --ok: #3d8b5a;
  --warn: #b26b00;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6; font-size: 16px;
}
.top { padding: 20px 16px 8px; max-width: 640px; margin: 0 auto; }
h1 { font-size: 1.35rem; margin: 0 0 6px; line-height: 1.35; }
.badge { font-size: .7rem; background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.lead { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.privacy {
  background: #eef7f0; border: 1px solid #cfe6d6; border-radius: 12px;
  padding: 10px 12px; font-size: .9rem;
}
.privacy strong { color: var(--ok); display: block; }
main { max-width: 640px; margin: 0 auto; padding: 0 12px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; }
.card h2 { font-size: 1.1rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.card h2 small { color: var(--muted); font-weight: normal; font-size: .8rem; }
.num { background: var(--accent); color: #fff; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; flex: none; }
.hint { color: var(--muted); font-size: .88rem; margin: 6px 0; }
.hidden { display: none !important; }
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 12px; padding: 10px 14px; font-size: 1rem; min-height: 44px; cursor: pointer;
  touch-action: manipulation;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; width: 100%; }
.btn:disabled { opacity: .4; }
.btn.icon { padding: 8px 10px; font-size: .9rem; flex: 1; }
.btn.toggle[aria-pressed="true"] { background: #fde8ec; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.file-btn { display: block; text-align: center; }
.status { min-height: 1.4em; font-size: .9rem; margin: 8px 0 0; }
.status.error { color: #b3261e; }
.status.warn { color: var(--warn); }

.diag-grid { display: grid; gap: 10px; }
.diag { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.diag h3 { margin: 0 0 4px; font-size: .95rem; color: var(--muted); font-weight: 600; }
.diag .result { font-size: 1.25rem; font-weight: 700; margin: 0 0 4px; }
.diag .sub { font-size: .88rem; margin: 4px 0; }
.diag .note { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.diag .warnbox { font-size: .82rem; color: var(--warn); background: #fff6e8; border-radius: 8px; padding: 6px 8px; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip { display: flex; align-items: center; gap: 6px; font-size: .82rem; }
.chip i { width: 26px; height: 26px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.1); }
.meter { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #f3b7c4, #eee, #f0c27a); position: relative; margin: 8px 0 2px; }
.meter b { position: absolute; top: -4px; width: 4px; height: 16px; background: var(--ink); border-radius: 2px; transform: translateX(-2px); }
.meter-labels { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }

.stage-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px; }
.stage-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 2px; font-size: .82rem; line-height: 1.25; min-height: 44px; }
.stage-tabs button small { color: var(--muted); font-size: .7rem; }
.stage-tabs button.on { border-color: var(--accent); background: #fde8ec; color: var(--accent); font-weight: 600; }
.canvas-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #222; touch-action: none; }
#practiceCanvas { display: block; width: 100%; height: auto; touch-action: none; }
.tools { margin-top: 8px; }
.tool-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.tool-row .label { font-size: .88rem; color: var(--muted); min-width: 2.5em; }
.tool-row input[type=range] { flex: 1; }
.switch { display: flex; align-items: center; gap: 6px; font-size: .9rem; flex: 1; min-height: 44px; }
.switch input { width: 20px; height: 20px; }
.swatches { display: flex; gap: 10px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 3px var(--accent); }
.mono { font-variant-numeric: tabular-nums; min-width: 1.5em; text-align: right; }
.score { border-radius: 12px; background: #f7f1ee; padding: 10px 12px; font-size: .92rem; }
.score h3 { margin: 0 0 6px; font-size: 1rem; }
.score table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.score td { padding: 2px 0; }
.score td:last-child { text-align: right; font-weight: 600; }

.compare { position: relative; margin-bottom: 10px; }
#compareCanvas { display: block; width: 100%; height: auto; border-radius: 12px; }
#compareRange { width: 100%; margin: 8px 0 0; }
.compare-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.about ul { padding-left: 1.2em; margin: 0; font-size: .88rem; }
.about li { margin: 4px 0; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 12px 0 28px; }
@media (min-width: 700px) { .diag-grid { grid-template-columns: 1fr 1fr; } }
.adjust { border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; margin: 8px 0; }
.adjust summary { font-size: .9rem; cursor: pointer; min-height: 32px; line-height: 32px; }
.adjust select { flex: 1; font-size: 1rem; padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.mini { font-size: .72rem; color: var(--muted); white-space: nowrap; }
