/* 「わたしの一日」の画面。上に団地、下に手元の紙。 */
body.day { background: linear-gradient(var(--sky-top), var(--sky-bottom) 70%) fixed; min-height: 100dvh; display: flex; flex-direction: column; }
.day .top { background: transparent; color: var(--sky-ink); }
.day .word { font-weight: 800; font-size: 1.05rem; letter-spacing: .04em; text-decoration: none; padding: 10px 0; }
.steps { display: flex; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: .8rem; }
.steps li { padding: 3px 2px; border-bottom: 2px solid transparent; opacity: .6; }
.steps li[aria-current] { opacity: 1; font-weight: 800; border-color: currentColor; }

.day main { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; max-width: 520px; margin: 0 auto; }
.view { flex: 0 0 auto; min-height: 0; display: flex; justify-content: center; padding: 0 16px; }
#building { display: block; width: 100%; height: 100%; min-height: 250px; }
.panel {
  flex: 1 0 auto; background: var(--panel); color: var(--ink); border-radius: 22px 22px 0 0; min-width: 0;
  padding: 20px max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}
.step { display: grid; gap: 12px; }
.step .me { margin-top: 2px; }
.step h1 { font-size: 1.75rem; line-height: 1.3; font-weight: 800; letter-spacing: .01em; }
.step h2 { font-size: 1.25rem; font-weight: 800; }
.small { font-size: .84rem; color: var(--ink-2); }

/* 団地が1画面に収まる段 */
body[data-step="start"] #building, body[data-step="key"] #building { height: min(54dvh, 520px); }
body[data-step="live"] #building, body[data-step="stop"] #building { height: min(40dvh, 460px); min-height: 220px; }
body[data-step="result"] #building { height: min(44dvh, 460px); }
body[data-step="paint"] .view { display: none; }
body[data-step="paint"] .panel { padding-top: 14px; }
#step-paint { gap: 9px; }
#step-paint .presets { gap: 6px; }
body[data-step="live"] { --dim: .42; }
body[data-step="stop"] { --dim: .2; }
body[data-step="result"] { --dim: .2; }

/* 鍵 */
.key { display: flex; align-items: center; gap: 18px; }
.tag {
  flex: none; width: 112px; height: 66px; background: #ffc247; color: #2b1d00; border-radius: 12px 33px 33px 12px; position: relative;
  display: grid; place-items: center; padding-right: 22px; transform: rotate(-4deg); font: 800 1.7rem/1 var(--num);
}
.tag::after { content: ""; position: absolute; right: 14px; top: 26px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); }

/* 塗る */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { min-height: 38px; border: 0; background: transparent; font-size: .9rem; border-left: 1.5px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); font-weight: 800; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.presets button { min-height: 38px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; font-size: .86rem; padding: 0 4px; }
.presets button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 800; }
.grid { display: grid; gap: 4px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.g-row { display: grid; grid-template-columns: repeat(24, 1fr); height: 37px; border-radius: 6px; overflow: hidden; position: relative; box-shadow: 0 0 0 1px var(--line); }
.g-row i { display: block; position: relative; border-left: 1px solid transparent; }
.g-row i:nth-child(4n + 1) { border-left-color: rgb(128 140 170 / .55); }
.g-row i:first-child { border-left: 0; }
.g-row i svg { position: absolute; left: 1px; top: 11px; width: 15px; height: 15px; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.g-scale { display: grid; grid-template-columns: repeat(6, 1fr); font-size: .72rem; line-height: 1; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.palette button {
  display: grid; justify-items: center; gap: 3px; min-height: 50px; padding: 5px 1px 3px; border-radius: 10px; border: 1.5px solid var(--line);
  background: transparent; font-size: .72rem; line-height: 1.15;
}
.palette .sw { width: 25px; height: 25px; border-radius: 7px; display: grid; place-items: center; }
.palette .sw svg { width: 17px; height: 17px; }
.palette button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 800; }
.paint-tools { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: start; font-size: .86rem; color: var(--ink-2); }
.paint-tools summary { cursor: pointer; padding: 8px 0; }
.paint-tools details[open] { flex-basis: 100%; }
.byhand { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px 0; }
.byhand label { display: grid; gap: 4px; }
.byhand select { min-height: 44px; font: inherit; color: var(--ink); background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 10px; padding: 0 8px; }
.byhand .ghost { grid-column: 1 / -1; }

#step-paint > .me { position: sticky; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 2; box-shadow: 0 0 0 8px var(--panel); min-height: 52px; }

/* 生きる */
.live-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.clock { font: 800 2.5rem/1 var(--num); font-variant-numeric: tabular-nums; }
.doing { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.1rem; }
.doing .sw { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; }
.doing .sw svg { width: 18px; height: 18px; }
.together { font-size: 1.35rem; font-weight: 800; line-height: 1.35; font-variant-numeric: tabular-nums; min-height: 1.9rem; }
.together b { font-family: var(--num); font-size: 1.7rem; }
.caption { min-height: 3.2em; color: var(--ink-2); font-size: .95rem; line-height: 1.6; }
.bar { position: relative; height: 8px; border-radius: 4px; background: var(--panel-2); }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: var(--accent); }
.bar span b { position: absolute; top: -2px; width: 4px; height: 12px; margin-left: -2px; border-radius: 2px; background: var(--ink-2); }
.live-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.live-tools .ghost { padding: 0 6px; min-height: 44px; font-size: .9rem; }
.stop-kind { font-size: .85rem; font-weight: 700; color: var(--ink-2); }
.step#step-stop h2 { font-size: 1.2rem; line-height: 1.5; }
.options { display: grid; gap: 7px; }
#step-stop { gap: 9px; }
.options button {
  min-height: 49px; border-radius: 14px; border: 1.5px solid var(--line); background: transparent; font-weight: 800; font-size: 1.02rem; padding: 5px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; color: var(--ink);
}
.options button small { font-weight: 500; font-size: .85rem; color: var(--ink-2); }
.options.three { grid-template-columns: repeat(3, 1fr); }
.options.three button { justify-content: center; text-align: center; padding: 4px; }
.options button:disabled { cursor: default; }
.options button.right { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.options button.picked { box-shadow: inset 0 0 0 2px var(--ink); }
.options button.faded { opacity: .5; }
.later { visibility: hidden; }
.stop-answer { min-height: 3em; font-weight: 700; line-height: 1.5; font-size: .96rem; }
#step-stop .me { min-height: 50px; }

/* 結末 */
.r-room { font-size: .9rem; color: var(--ink-2); }
.step h2.r-type { font-size: clamp(1.7rem, 8vw, 2.2rem); line-height: 1.25; }
.spots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.spots button { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; font-size: .86rem; line-height: 1.25; padding: 4px; }
.spots button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); font-weight: 800; }
.spot-text { font-weight: 700; line-height: 1.6; min-height: 3.2em; }
#ring { width: 100%; max-width: 320px; height: auto; margin: 4px auto 0; }
#ring text { fill: var(--ink-2); font: 600 12px/1 var(--num); text-anchor: middle; dominant-baseline: central; }
#ring .mid { fill: var(--ink); font: 800 30px/1 var(--num); }
#ring .mid2 { fill: var(--ink-2); font: 600 12.5px/1 var(--font); }
#ring .pin { fill: none; stroke: var(--ink); stroke-width: 3; }
.facts { margin: 0; display: grid; }
.facts > div { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--ink-2); font-size: .88rem; align-self: center; }
.facts dd { margin: 0; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.facts dd small { display: block; font-weight: 500; color: var(--ink-2); font-size: .8rem; }
.join { margin-top: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.calendar { border-top: 1px solid var(--line); padding-top: 14px; }
.calendar h3 { margin: 0; font-size: 1rem; }
.cal-row { display: grid; grid-template-columns: 3.6em 1fr; gap: 10px; align-items: center; padding: 7px 0; font-size: .82rem; }
.cal-strip { height: 18px; border-radius: 4px; box-shadow: 0 0 0 1px var(--line); }
.cal-row em { grid-column: 2; font-style: normal; color: var(--ink-2); line-height: 1.3; }
.source { line-height: 1.7; }

@media (min-width: 960px) {
  .day main { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 40px; align-items: center; }
  .day .top { width: 100%; max-width: 1072px; margin: 0 auto; }
  .view, .panel { align-self: start; }
  .view { position: sticky; top: 12px; }
  body.day #building { height: min(82dvh, 640px); }
  .panel { border-radius: 22px; padding: 26px; margin: 20px 0 40px; }
  body[data-step="paint"] main { grid-template-columns: minmax(0, 560px); justify-content: center; }
}
