/* 朝の支度 逆算タイムライン — スマートフォンを先に。外のフォントは使わない。 */
:root {
  --ink: #1f2328;
  --muted: #4a525c;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #c9cfd6;
  --accent: #0b5cad;
  --accent-ink: #ffffff;
  --err: #b3261e;
  --warn-bg: #fff4d6;
  --warn-ink: #5c3c00;
  --focus: #ffbf47;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans CJK JP", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--panel); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; top: .5rem; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header, main, .site-footer { max-width: 48rem; margin: 0 auto; padding: 0 1rem; }
.site-header { padding-top: 1.25rem; }
h1 { font-size: 1.45rem; line-height: 1.4; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.lead { margin: 0 0 .5rem; }
.lead:last-child { margin-bottom: 1rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: .75rem; padding: 1rem; margin: 0 0 1rem; }
.notice-panel p { margin: 0 0 .5rem; }
.notice-panel p:last-child { margin-bottom: 0; }
.hint { color: var(--muted); font-size: .95rem; margin: 0 0 .75rem; }

.field { margin: 0 0 1rem; }
.field > label { display: block; font-weight: 700; margin-bottom: .25rem; }
.field.check { display: flex; gap: .5rem; align-items: center; }
.field.check > label { display: inline; margin: 0; font-weight: 400; }
input, select, button { font: inherit; color: inherit; }
input[type="time"], input[type="text"], input[type="number"], select {
  min-height: 2.75rem; padding: .4rem .6rem; border: 1px solid #6b737d; border-radius: .5rem; background: #fff; width: 100%;
}
input[type="time"] { max-width: 10rem; }
input[type="checkbox"] { width: 1.4rem; height: 1.4rem; accent-color: var(--accent); }
[aria-invalid="true"] { border-color: var(--err); border-width: 2px; }
.err { color: var(--err); font-weight: 700; margin: .25rem 0 0; font-size: .95rem; }

fieldset.items { border: 0; padding: 0; margin: 0 0 1rem; }
fieldset.items legend { font-weight: 700; padding: 0; margin-bottom: .25rem; }
.rows { list-style: none; margin: 0 0 .75rem; padding: 0; counter-reset: row; }
.row { border: 1px solid var(--line); border-radius: .6rem; padding: .75rem; margin: 0 0 .75rem; background: #fbfcfd; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.row-no { font-weight: 700; }
.row-tools { display: flex; gap: .4rem; flex-wrap: wrap; }
.row-grid { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.row-grid label { display: block; font-size: .95rem; font-weight: 700; }
.mins-wrap { display: flex; align-items: center; gap: .4rem; }
.mins-wrap input { max-width: 7rem; }

.btn {
  min-height: 2.75rem; padding: .45rem 1rem; border-radius: .5rem; border: 1px solid var(--accent);
  background: #fff; color: var(--accent); font-weight: 700; cursor: pointer;
}
.btn.small { min-height: 2.75rem; min-width: 2.75rem; padding: .3rem .6rem; font-size: .9rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn:disabled { border-color: #8a929b; color: #5b636c; background: #eef0f2; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 0; }
.status { min-height: 1.7em; margin: .75rem 0 0; }

.error-summary { border: 2px solid var(--err); border-radius: .6rem; padding: .75rem 1rem; margin: 0 0 1rem; }
.error-summary h3 { color: var(--err); }
.error-summary ul { margin: 0; padding-left: 1.2rem; }

.warn:empty { display: none; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: .5rem; padding: .6rem .8rem; font-weight: 700; margin: 0 0 .75rem; }
.start-big { margin: 0 0 .75rem; }
.start-label { display: block; font-size: 1rem; color: var(--muted); font-weight: 700; }
.start-time { font-size: 2.6rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.schedule { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.schedule th, .schedule td { border-bottom: 1px solid var(--line); padding: .5rem .4rem; text-align: left; vertical-align: top; }
.schedule thead th { font-size: .9rem; color: var(--muted); }
.schedule td:first-child { white-space: nowrap; font-weight: 700; }
.schedule td.mins { white-space: nowrap; }
.schedule td.name { overflow-wrap: anywhere; }
.schedule tr.leave td { font-weight: 800; border-bottom: 0; }

.card { border: 3px solid var(--ink); border-radius: 1rem; padding: 1rem; background: #fff; }
.card-title { font-size: 1.4rem; font-weight: 800; text-align: center; margin: 0 0 .75rem; }
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list li { display: flex; align-items: center; gap: .75rem; border-bottom: 2px dashed var(--line); padding: .55rem .25rem; }
.card-list li:last-child { border-bottom: 0; }
.card-emoji { font-size: 2rem; line-height: 1; width: 2.6rem; text-align: center; }
.card-text { flex: 1; font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.card-time { display: block; font-size: .95rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.card-box { width: 2.2rem; height: 2.2rem; border: 3px solid var(--ink); border-radius: .35rem; flex: none; }

.print-mark { display: none; }
.preview { margin-top: 1rem; }
.preview img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: .5rem; }

.site-footer { padding-bottom: 2rem; color: var(--muted); font-size: .95rem; }
.site-footer p { margin: 0 0 .25rem; }

@media (min-width: 40rem) {
  h1 { font-size: 1.8rem; }
  .row-grid { grid-template-columns: minmax(0, 1fr) 9rem 11rem; align-items: end; }
  .start-time { font-size: 3.2rem; }
}

/* 印刷：選んだほう（表かカード）だけを、A4の1枚に */
@page { size: A4; margin: 12mm; }
@media print {
  body { background: #fff; font-size: 11pt; line-height: 1.45; }
  .skip, .site-header, .notice-panel, .no-print, #main > section:not(.output), .site-footer, .preview { display: none !important; }
  main { max-width: none; padding: 0; }
  .panel { border: 0; padding: 0; margin: 0; }
  /* ボタンを使わずブラウザのメニューから印刷したときは、表だけ */
  html:not([data-print="card"]) #out-card, html[data-print="card"] #out-table { display: none !important; }
  .output { break-inside: avoid; }
  .start-time { font-size: 26pt; }
  .schedule th, .schedule td { padding: 1.2mm 1.5mm; }
  .card { border-width: 2pt; padding: 5mm; }
  .card-title { font-size: 18pt; margin-bottom: 3mm; }
  #h-card { display: none; }
  .card-list li { padding: 1.5mm 1mm; gap: 3mm; border-bottom-width: 1pt; }
  .card-emoji { font-size: 18pt; width: 10mm; }
  .card-text { font-size: 14pt; line-height: 1.35; }
  .card-time { font-size: 10.5pt; }
  .card-box { width: 8mm; height: 8mm; border-width: 1.5pt; }
  /* 行が多いときは小さくして、A4の1枚に収める */
  .card.dense .card-title { font-size: 15pt; margin-bottom: 2mm; }
  .card.dense .card-list li { padding: .7mm 1mm; }
  .card.dense .card-emoji { font-size: 13pt; width: 8mm; }
  .card.dense .card-text { font-size: 10.5pt; line-height: 1.3; }
  .card.dense .card-time { font-size: 9pt; line-height: 1.25; }
  .card.dense .card-box { width: 6mm; height: 6mm; }
  .print-mark { display: block; text-align: right; font-size: 8pt; color: #4a525c; margin: 2mm 0 0; }
  a { color: inherit; text-decoration: none; }
}
