:root {
  --sponge: #ffd84d;
  --ink: #23262f;
  --me: #d0371e;
  --partner: #2457c5;
  --paper: #ffffff;
  --line: #d9dbe1;
  --sub: #5a5f6b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sponge); color: var(--ink);
  font: 1rem/1.7 "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  overflow-wrap: anywhere;
}
main {
  max-width: 30rem; min-height: 100vh; min-height: 100dvh; margin: 0 auto;
  padding: calc(1.25rem + env(safe-area-inset-top)) 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 1rem;
}
h1 { font-size: 1.75rem; line-height: 1.4; margin: 0; text-wrap: balance; word-break: auto-phrase; }
h1:focus { outline: none; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
p { margin: 0; word-break: auto-phrase; }
.brand { font-weight: 700; }
.note { font-size: .85rem; }
.center { text-align: center; }
.push { margin-top: auto; }
.card { background: var(--paper); border-radius: 1.25rem; padding: 1.25rem; }
.percent { font-size: 4.5rem; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.percent small { font-size: 2rem; }
.type { font-size: 1.35rem; font-weight: 700; }

/* ボタン */
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.btn {
  display: block; width: 100%; min-height: 3.5rem; padding: .7rem 1rem; border-radius: 1rem;
  border: 2px solid var(--ink); background: var(--paper); font-weight: 700;
}
.btn.main { background: var(--ink); color: #fff; }
.btn:active, .choice:active, .chore:active { transform: translateY(1px); }
.link { background: none; border: 0; padding: .7rem .25rem; min-height: 2.75rem; text-decoration: underline; }
:focus-visible { outline: 3px solid var(--partner); outline-offset: 2px; }
.stack { display: grid; gap: .75rem; }

/* 使い方と、今だれの番か */
ol.how, ol.steps { list-style: none; margin: 0; display: grid; }
ol.how { gap: .6rem; padding: .9rem 1rem; counter-reset: n; }
ol.how li { counter-increment: n; display: grid; grid-template-columns: 1rem 3rem 1fr; gap: .5rem; align-items: center; font-size: .85rem; line-height: 1.4; }
ol.how li::before { content: counter(n); font-size: 1.1rem; font-weight: 800; }
ol.how svg { width: 100%; }
ol.how strong { display: block; font-size: 1.05rem; }
ol.steps { grid-template-columns: repeat(4, 1fr); gap: .3rem; padding: 0; font-size: .85rem; }
ol.steps li { text-align: center; padding: .3rem .2rem; border-radius: 2rem; border: 2px solid var(--ink); }
ol.steps li[aria-current] { background: var(--ink); color: #fff; font-weight: 700; }
.ask { margin: .25rem 0 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* 質問 */
progress { width: 100%; height: .6rem; appearance: none; border: 0; border-radius: 1rem; background: #fff; overflow: hidden; }
progress::-webkit-progress-bar { background: #fff; }
progress::-webkit-progress-value { background: var(--ink); }
progress::-moz-progress-bar { background: var(--ink); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: .5rem; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.choice {
  min-height: 3.5rem; padding: .4rem .2rem; border-radius: .9rem; border: 2px solid var(--line);
  background: var(--paper); font-weight: 700;
}
.choice.wide { grid-column: 1 / -1; min-height: 2.9rem; font-weight: 400; }
.choice[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* てんびん */
.scale { display: block; width: 100%; max-width: 24rem; margin: 0 auto; }
.scale .beam { transform-origin: 160px 34px; transition: transform .9s cubic-bezier(.3, 1.6, .5, 1); }
.scale .pan { transition: transform .9s cubic-bezier(.3, 1.6, .5, 1); }
.scale .pan.me { transform-origin: 50px 34px; }
.scale .pan.partner { transform-origin: 270px 34px; }
.scale text { font-weight: 700; text-anchor: middle; }

/* 分担表・比較 */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; align-items: start; }
.cols .card { padding: .9rem .7rem; }
.who-me h2 { color: var(--me); }
.who-partner h2 { color: var(--partner); }
.chore {
  display: flex; justify-content: space-between; gap: .4rem; width: 100%; min-height: 2.9rem; margin-bottom: .4rem;
  padding: .45rem .55rem; border-radius: .7rem; border: 2px solid var(--line); background: var(--paper);
  text-align: left; font-size: .9rem; line-height: 1.4; word-break: auto-phrase;
}
.chore span:last-child { font-weight: 700; white-space: nowrap; }
.big { font-size: 2rem; font-weight: 800; line-height: 1.3; }
ul.plain { margin: 0; padding-left: 1.2rem; }

#toast {
  position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 2rem); background: var(--ink); color: #fff; border-radius: .8rem; padding: .7rem 1rem;
}
#toast:empty { display: none; }
dialog { border: 0; border-radius: 1.25rem; padding: 1.25rem; width: min(26rem, calc(100vw - 2rem)); max-height: 90vh; color: var(--ink); }
dialog::backdrop { background: rgb(35 38 47 / .6); }
dialog img { display: block; max-width: 100%; max-height: 50vh; margin: 0 auto; border-radius: .7rem; -webkit-touch-callout: default; }
dialog textarea { width: 100%; font: inherit; font-size: 1rem; border: 2px solid var(--line); border-radius: .7rem; padding: .6rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
