/* ======= Base / Reset ======= */
*,
*::before,
*::after { box-sizing: border-box; }

html { font-size: 62.5%; } /* 1rem = 10px */
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  font-size: 1.6rem;
  line-height: 1.6;
  color: #0f172a;            /* slate-900 */
  background: #f8fafc;       /* slate-50 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: #0ea5e9; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #22d3ee; outline-offset: 2px; }

/* ======= Layout ======= */
.container {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 2rem 1.6rem;
}

.header {
  display: grid;
  align-items: center;
  gap: 1.2rem;
  grid-template-columns: auto 1fr;
  margin: 1rem 0 2rem;
}
.header img { width: clamp(48px, 10vw, 72px); }
.header-title {
  font-size: clamp(2.0rem, 1.2rem + 1.5vw, 3.0rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

/* ======= Cards / Sections ======= */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0; /* slate-200 */
  border-radius: 1.2rem;
  padding: clamp(1.6rem, 1.2rem + 1vw, 2.4rem);
  box-shadow: 0 1px 2px rgba(2, 6, 23, 0.05);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 1.2rem;
  color: #0f172a;
}

/* ======= Controls (labels, inputs, buttons) ======= */
.controls {
  display: grid;
  gap: 1.2rem;
}

label {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  color: #0f172a;
}

/* Number inputs & selects */
input[type="number"],
select {
  appearance: none;
  border: 1px solid #cbd5e1; /* slate-300 */
  background: #fff;
  color: #0f172a;
  border-radius: .8rem;
  padding: .8rem 1rem;
  min-height: 3.6rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
  width: min(100%, 22rem);
}
input[type="number"]:hover,
select:hover { border-color: #94a3b8; }      /* slate-400 */
input[type="number"]:focus,
select:focus { border-color: #0ea5e9; box-shadow: 0 0 0 4px rgba(14,165,233,.15); }

/* Radio / checkbox as pill buttons */
.choice-group {
  display: flex; flex-wrap: wrap; gap: .8rem;
}
.choice {
  --c:#0284c7; /* sky-700 */
  display: inline-flex; align-items: center; gap: .6rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: .6rem 1.2rem;
  cursor: pointer;
  user-select: none;
  background: #fff;
  transition: border-color .15s, background .15s, color .15s;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:hover { border-color:#94a3b8; }
.choice:has(input:checked) {
  background: #e0f2fe;            /* sky-100 */
  border-color: var(--c);
  color: #0c4a6e;                  /* sky-900 */
}

/* Range slider (if使っていれば) */
input[type="range"] {
  width: 100%;
  accent-color: #0284c7;
}

/* Buttons */
.button, button, [type="submit"] {
  --bg:#0284c7; --bgH:#0369a1;
  display: inline-flex; align-items:center; justify-content:center;
  gap:.6rem;
  border: 1px solid transparent;
  background: var(--bg);
  color: #fff;
  font-weight: 700;
  padding: .9rem 1.4rem;
  border-radius: .9rem;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 6px rgba(2,6,23,0.12);
}
.button:hover, button:hover, [type="submit"]:hover { background: var(--bgH); }
.button:active, button:active, [type="submit"]:active { transform: translateY(1px); }
.button.secondary {
  --bg:#e2e8f0; --bgH:#cbd5e1; color:#0f172a; border-color:#cbd5e1; box-shadow:none;
}

/* ======= Grid for weekdays & inputs ======= */
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0,1fr));
  gap: .8rem;
  margin-top: .8rem;
}
.day {
  text-align: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: .8rem;
  padding: 1rem .8rem;
  font-weight: 600;
}
.day.is-holiday { color: #b91c1c; background: #fff1f2; border-color: #fecdd3; }

/* ======= Results / Numbers ======= */
.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
}
.kpi-item {
  background: #0ea5e9; color: #001018;
  border-radius: 1rem;
  padding: 1.2rem 1.6rem;
}
.kpi-item .label { opacity: .9; font-weight: 600; font-size: 1.3rem; }
.kpi-item .value { font-size: clamp(2.2rem, 1.2rem + 2vw, 3.2rem); font-weight: 800; line-height: 1.1; }

/* ======= Footer / アクセス情報など ======= */
.footer {
  margin: 2.4rem 0 4rem;
  color: #334155;
  font-size: 1.4rem;
}
.footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ======= Responsive ======= */
@media (max-width: 860px) {
  .header { grid-template-columns: 1fr; justify-items: start; }
  .days-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 520px) {
  .days-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ======= Dark mode (自動) ======= */
@media (prefers-color-scheme: dark) {
  body { color: #e5e7eb; background: #0b1220; }
  .card { background: #0f172a; border-color: #1f2937; box-shadow: none; }
  .section-title { color: #e5e7eb; }
  input[type="number"], select { background:#0b1220; color:#e5e7eb; border-color:#334155; }
  input[type="number"]:hover, select:hover { border-color:#475569; }
  .choice { background:#0b1220; border-color:#334155; color:#e5e7eb; }
  .choice:has(input:checked) { background:#082f49; border-color:#0369a1; color:#e0f2fe; }
  .day { background:#0f172a; border-color:#1f2937; }
  .day.is-holiday { color:#fecaca; background:#450a0a; border-color:#7f1d1d; }
  .kpi-item { background:#0369a1; color:#e0f2fe; }
  .footer { color:#cbd5e1; }
}
