:root {
  --bg: #eef6f4;
  --ink: #111827;
  --muted: #49566a;
  --line: #c9d6e6;
  --page-background:
    radial-gradient(circle at 12% -2%, rgba(43, 214, 146, 0.48) 0%, rgba(43, 214, 146, 0) 42%),
    radial-gradient(circle at 87% 14%, rgba(17, 177, 129, 0.36) 0%, rgba(17, 177, 129, 0) 36%),
    linear-gradient(165deg, #e8f8ef 0%, #e5f7ef 50%, #dcf2e8 100%);
  --panel: linear-gradient(140deg, rgba(255, 255, 255, 0.9) 0%, rgba(236, 255, 244, 0.86) 56%, rgba(222, 248, 235, 0.84) 100%);
  --btn-bg: linear-gradient(145deg, #ffffff 0%, #f1fff6 56%, #e8faef 100%);
  --btn-bg-hover: linear-gradient(145deg, #f8fffb 0%, #ecfff4 56%, #e1f7ea 100%);
  --delete-panel-bg: linear-gradient(145deg, rgba(251, 255, 253, 0.94) 0%, rgba(235, 255, 245, 0.88) 58%, rgba(223, 249, 236, 0.86) 100%);
  --delete-list-bg: linear-gradient(155deg, #ffffff 0%, #f3fff7 56%, #e7f9ee 100%);
  --modal-bg: linear-gradient(145deg, #ffffff 0%, #effff6 56%, #e4f8eb 100%);
  --modal-body-bg: linear-gradient(145deg, #f8fffb 0%, #ecfff4 54%, #e2f8ea 100%);
  --brand: #0f766e;
  --brand-soft: #d6f5f1;
  --accent-strong: #0f766e;
  --accent-strong-hover: #0e665f;
  --accent-strong-press: #14988d;
  --accent-soft-bg: #d6f5f1;
  --accent-soft-border: #9fdbd3;
  --accent-soft-text: #115a53;
  --accent-pill-bg: #e6f8f5;
  --accent-pill-border: #bee5df;
  --accent-pill-text: #0e534c;
  --accent-focus-ring: rgba(15, 118, 110, 0.28);
  --accent-focus-shadow: rgba(15, 118, 110, 0.18);
  --accent-active-ring: rgba(15, 118, 110, 0.22);
  --accent-active-shadow: rgba(15, 118, 110, 0.2);
  --accent-press-ring: rgba(20, 152, 141, 0.35);
  --accent-press-shadow: rgba(20, 152, 141, 0.28);
  --accent-busy-ring: rgba(15, 118, 110, 0.25);
  --accent-busy-glow: rgba(15, 118, 110, 0.35);
  --ambient-a-color: #2bd692;
  --ambient-b-color: #11b181;
  --warn: #9a3412;
}

body.scope-year {
  --page-background:
    radial-gradient(circle at 14% 2%, rgba(255, 109, 173, 0.5) 0%, rgba(255, 109, 173, 0) 44%),
    radial-gradient(circle at 86% 16%, rgba(227, 63, 136, 0.38) 0%, rgba(227, 63, 136, 0) 36%),
    linear-gradient(165deg, #fff0f8 0%, #ffe7f2 56%, #f9dce9 100%);
  --panel: linear-gradient(140deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 238, 247, 0.86) 56%, rgba(251, 220, 236, 0.84) 100%);
  --btn-bg: linear-gradient(145deg, #ffffff 0%, #fff1f8 56%, #ffe5f1 100%);
  --btn-bg-hover: linear-gradient(145deg, #fff8fc 0%, #ffedf6 56%, #ffe1ef 100%);
  --delete-panel-bg: linear-gradient(145deg, rgba(255, 251, 254, 0.94) 0%, rgba(255, 237, 247, 0.88) 58%, rgba(252, 221, 237, 0.86) 100%);
  --delete-list-bg: linear-gradient(155deg, #ffffff 0%, #fff3f9 56%, #ffe7f2 100%);
  --modal-bg: linear-gradient(145deg, #ffffff 0%, #fff0f8 56%, #ffe4f1 100%);
  --modal-body-bg: linear-gradient(145deg, #fff8fc 0%, #ffedf6 54%, #ffe3f0 100%);
  --brand: #c2185b;
  --brand-soft: #ffe4ef;
  --accent-strong: #c2185b;
  --accent-strong-hover: #ac1750;
  --accent-strong-press: #d94f8a;
  --accent-soft-bg: #ffe4ef;
  --accent-soft-border: #f3b6cf;
  --accent-soft-text: #85224f;
  --accent-pill-bg: #ffedf5;
  --accent-pill-border: #f8c7dc;
  --accent-pill-text: #8a1d4f;
  --accent-focus-ring: rgba(194, 24, 91, 0.28);
  --accent-focus-shadow: rgba(194, 24, 91, 0.18);
  --accent-active-ring: rgba(194, 24, 91, 0.22);
  --accent-active-shadow: rgba(194, 24, 91, 0.2);
  --accent-press-ring: rgba(217, 79, 138, 0.35);
  --accent-press-shadow: rgba(217, 79, 138, 0.28);
  --accent-busy-ring: rgba(194, 24, 91, 0.25);
  --accent-busy-glow: rgba(194, 24, 91, 0.35);
  --ambient-a-color: #ff57a0;
  --ambient-b-color: #e33f88;
}

body.page-schedule {
  --page-background:
    radial-gradient(circle at 12% -2%, rgba(245, 194, 61, 0.5) 0%, rgba(245, 194, 61, 0) 42%),
    radial-gradient(circle at 87% 14%, rgba(245, 158, 11, 0.38) 0%, rgba(245, 158, 11, 0) 36%),
    linear-gradient(165deg, #fff8da 0%, #fff2c2 54%, #ffe8a3 100%);
  --panel: linear-gradient(140deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 249, 223, 0.88) 56%, rgba(255, 239, 191, 0.86) 100%);
  --btn-bg: linear-gradient(145deg, #ffffff 0%, #fff7da 56%, #ffefbf 100%);
  --btn-bg-hover: linear-gradient(145deg, #fffdf2 0%, #fff4cf 56%, #ffe9ad 100%);
  --delete-panel-bg: linear-gradient(145deg, rgba(255, 254, 247, 0.95) 0%, rgba(255, 248, 218, 0.9) 58%, rgba(255, 238, 184, 0.88) 100%);
  --delete-list-bg: linear-gradient(155deg, #ffffff 0%, #fff8de 56%, #ffefc2 100%);
  --modal-bg: linear-gradient(145deg, #ffffff 0%, #fff7db 56%, #ffeebe 100%);
  --modal-body-bg: linear-gradient(145deg, #fffdf2 0%, #fff4d2 54%, #ffebaf 100%);
  --brand: #b45309;
  --brand-soft: #ffefc2;
  --accent-strong: #b45309;
  --accent-strong-hover: #92400e;
  --accent-strong-press: #d97706;
  --accent-soft-bg: #ffefc2;
  --accent-soft-border: #f2cf7b;
  --accent-soft-text: #7c3e0a;
  --accent-pill-bg: #fff5d6;
  --accent-pill-border: #f5d591;
  --accent-pill-text: #8a4b0f;
  --accent-focus-ring: rgba(180, 83, 9, 0.28);
  --accent-focus-shadow: rgba(180, 83, 9, 0.18);
  --accent-active-ring: rgba(180, 83, 9, 0.22);
  --accent-active-shadow: rgba(180, 83, 9, 0.2);
  --accent-press-ring: rgba(217, 119, 6, 0.35);
  --accent-press-shadow: rgba(217, 119, 6, 0.28);
  --accent-busy-ring: rgba(180, 83, 9, 0.25);
  --accent-busy-glow: rgba(180, 83, 9, 0.35);
  --ambient-a-color: #f5c23d;
  --ambient-b-color: #f59e0b;
}

body.page-schedule.scope-year {
  --page-background:
    radial-gradient(circle at 14% 2%, rgba(96, 165, 250, 0.48) 0%, rgba(96, 165, 250, 0) 44%),
    radial-gradient(circle at 86% 16%, rgba(37, 99, 235, 0.4) 0%, rgba(37, 99, 235, 0) 36%),
    linear-gradient(165deg, #eff6ff 0%, #dbeafe 54%, #c7dcff 100%);
  --panel: linear-gradient(140deg, rgba(255, 255, 255, 0.9) 0%, rgba(237, 245, 255, 0.88) 56%, rgba(219, 234, 254, 0.86) 100%);
  --btn-bg: linear-gradient(145deg, #ffffff 0%, #ecf4ff 56%, #dbeafe 100%);
  --btn-bg-hover: linear-gradient(145deg, #f7faff 0%, #e6f0ff 56%, #cfe2ff 100%);
  --delete-panel-bg: linear-gradient(145deg, rgba(252, 254, 255, 0.95) 0%, rgba(236, 245, 255, 0.9) 58%, rgba(214, 229, 255, 0.88) 100%);
  --delete-list-bg: linear-gradient(155deg, #ffffff 0%, #eef5ff 56%, #dce9ff 100%);
  --modal-bg: linear-gradient(145deg, #ffffff 0%, #ecf4ff 56%, #d9e8ff 100%);
  --modal-body-bg: linear-gradient(145deg, #f7faff 0%, #e6f0ff 54%, #d2e3ff 100%);
  --brand: #1d4ed8;
  --brand-soft: #dbeafe;
  --accent-strong: #1d4ed8;
  --accent-strong-hover: #1e40af;
  --accent-strong-press: #2563eb;
  --accent-soft-bg: #dbeafe;
  --accent-soft-border: #a8c7ff;
  --accent-soft-text: #1e3a8a;
  --accent-pill-bg: #e9f2ff;
  --accent-pill-border: #bdd7ff;
  --accent-pill-text: #1e3a8a;
  --accent-focus-ring: rgba(29, 78, 216, 0.28);
  --accent-focus-shadow: rgba(29, 78, 216, 0.18);
  --accent-active-ring: rgba(29, 78, 216, 0.22);
  --accent-active-shadow: rgba(29, 78, 216, 0.2);
  --accent-press-ring: rgba(37, 99, 235, 0.35);
  --accent-press-shadow: rgba(37, 99, 235, 0.28);
  --accent-busy-ring: rgba(29, 78, 216, 0.25);
  --accent-busy-glow: rgba(29, 78, 216, 0.35);
  --ambient-a-color: #60a5fa;
  --ambient-b-color: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--page-background);
  padding: clamp(20px, 3vw, 36px);
}

.ambient {
  position: fixed;
  pointer-events: none;
  filter: blur(32px);
  opacity: 0.8;
}

.ambient-a {
  width: 300px;
  height: 300px;
  background: var(--ambient-a-color);
  top: -80px;
  right: 4%;
  border-radius: 52% 48% 61% 39%;
}

.ambient-b {
  width: 320px;
  height: 220px;
  background: var(--ambient-b-color);
  left: 4%;
  bottom: 1%;
  border-radius: 45% 55% 60% 40%;
}

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 30px rgba(12, 22, 41, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.hero {
  padding: clamp(18px, 2.2vw, 24px);
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(26px, 4.1vw, 40px);
  line-height: 1.1;
}

h2 {
  font-size: clamp(18px, 2.4vw, 22px);
}

.lead {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.badges {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  border-radius: 999px;
  border: 1px solid var(--accent-soft-border);
  background: var(--accent-soft-bg);
  color: var(--accent-soft-text);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
}

.panel {
  padding: clamp(16px, 2vw, 22px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.spec-link {
  color: var(--accent-strong);
  font-weight: 700;
}

.pill-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-list li {
  border: 1px solid var(--accent-pill-border);
  background: var(--accent-pill-bg);
  color: var(--accent-pill-text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #c9d3e2;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 170px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.btn {
  border: 1px solid #b8c8de;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--ink);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.08s ease;
}

.btn:hover {
  background: var(--btn-bg-hover);
  border-color: #a7bedb;
  box-shadow: 0 6px 16px rgba(45, 73, 120, 0.12);
}

.btn.primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-strong-hover);
  box-shadow: 0 6px 18px var(--accent-focus-shadow);
}

.btn.is-current {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-focus-shadow);
}

.btn.is-current:hover {
  background: var(--accent-strong-hover);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-focus-ring), 0 6px 16px var(--accent-focus-shadow);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 0 0 3px var(--accent-active-ring), 0 8px 18px var(--accent-active-shadow);
}

.btn.is-pressed {
  transform: translateY(1px) scale(0.99);
  border-color: #5b88c9;
  background: #e6f0ff;
  color: #10233f;
  box-shadow: 0 0 0 3px rgba(91, 136, 201, 0.22), 0 8px 18px rgba(91, 136, 201, 0.22);
}

.btn.primary.is-pressed {
  border-color: var(--accent-strong-hover);
  background: var(--accent-strong-press);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-press-ring), 0 8px 18px var(--accent-press-shadow);
}

.btn.is-current.is-pressed {
  border-color: var(--accent-strong-hover);
  background: var(--accent-strong-press);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-press-ring), 0 8px 18px var(--accent-press-shadow);
}

.btn.is-busy {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-busy-ring), 0 0 18px var(--accent-busy-glow);
}

.btn.is-busy::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 999px;
  background: currentColor;
  animation: btnPulse 0.9s ease-in-out infinite;
}

.btn:disabled {
  cursor: progress;
  opacity: 0.75;
}

@keyframes btnPulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.75);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.csv-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.page-switches {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.page-btn.is-page-selected {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.scope-controls {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.scope-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.scope-btn.is-scope-selected {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.scope-label {
  border-radius: 999px;
  border: 1px solid var(--accent-soft-border);
  background: var(--accent-soft-bg);
  color: var(--accent-soft-text);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
}

.note {
  margin-top: 10px;
  color: var(--warn);
  font-size: 13px;
}

.log {
  margin: 8px 0 0;
  border: 1px solid #d4dbea;
  border-radius: 10px;
  background: #0f172a;
  color: #dce4f5;
  padding: 12px;
  min-height: 130px;
  max-height: 280px;
  overflow: auto;
  line-height: 1.6;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.delete-panel {
  margin-top: 14px;
  border: 1px solid #d6dbe6;
  border-radius: 12px;
  background: var(--delete-panel-bg);
  padding: 12px;
}

.delete-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.delete-head h3 {
  margin: 0;
  font-size: 15px;
}

.check-inline {
  margin: 0;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.delete-list {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #d4dbea;
  border-radius: 10px;
  background: var(--delete-list-bg);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.delete-item {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  padding: 6px 8px;
  border-radius: 8px;
}

.delete-item:hover {
  background: #f6f8fc;
}

.delete-item code {
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid #d6dbe6;
  border-radius: 12px;
  padding: 14px;
  background: var(--modal-bg);
  color: var(--ink);
  box-shadow: 0 18px 34px rgba(12, 22, 41, 0.25);
}

.result-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.result-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.result-modal-body {
  margin: 10px 0 0;
  border: 1px solid #d4dbea;
  border-radius: 10px;
  background: var(--modal-body-bg);
  color: #0f172a;
  padding: 12px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 760px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .delete-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-modal {
    width: calc(100vw - 20px);
    padding: 10px;
  }

  .result-modal-body {
    max-height: calc(100vh - 140px);
  }
}
