:root {
  --cream: #faf9f6;
  --ink: #2a2233;
  --plum-50: #f7f2fc;
  --plum-100: #ece2f6;
  --plum-200: #d9c5ec;
  --plum-300: #b492d6;
  --plum-500: #7c4dab;
  --plum-600: #5b2d8e;
  --plum-700: #46226e;
  --plum-800: #351a54;
  --gold-100: #f4ead0;
  --gold-300: #e0c98a;
  --gold-400: #d5b568;
  --gold-500: #c9a24b;
  --gold-600: #b08a36;
  --gold-700: #8e6e2a;
  --sans: "Noto Sans JP", system-ui, sans-serif;
  --display: "Shippori Mincho", "Noto Sans JP", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.8; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
a { color: var(--plum-600); }

/* ヘッダー */
.site-header { background: linear-gradient(120deg, var(--plum-800), var(--plum-600)); color: #fff; border-bottom: 3px solid var(--gold-500); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.logo { display: flex; flex-direction: column; align-items: center; padding: 6px 12px; border: 1px solid rgba(224, 201, 138, .55); border-radius: 10px; }
.logo-main { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .12em; color: var(--gold-300); line-height: 1.1; }
.logo-rule { width: 100%; height: 1px; background: var(--gold-500); margin: 3px 0; }
.logo-sub { font-size: 9px; letter-spacing: .3em; color: var(--gold-100); line-height: 1.2; }
.brand-kicker { margin: 0; font-size: 12px; letter-spacing: .15em; color: var(--gold-300); }
.brand-title { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(18px, 3.4vw, 26px); letter-spacing: .06em; line-height: 1.35; }
.site-header .btn-ghost { color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); white-space: nowrap; }
.site-header .btn-ghost:hover { background: rgba(255, 255, 255, .12); }

/* タブ */
.tabs-bar { background: #fff; border-bottom: 1px solid var(--plum-100); position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(70, 34, 110, .05); }
.tabs { display: flex; align-items: stretch; gap: 6px; padding-top: 10px; padding-bottom: 10px; }
.tab { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--plum-100); background: #fff; border-radius: 14px; cursor: pointer; font-family: inherit; color: var(--ink); text-align: left; transition: .2s; min-width: 0; }
.tab:hover { background: var(--plum-50); }
.tab-num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; background: var(--plum-50); color: var(--plum-600); border: 1px solid var(--plum-200); }
.tab-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.tab-text b { font-family: var(--display); font-size: 15px; font-weight: 700; }
.tab-text small { font-size: 11px; color: rgba(42, 34, 51, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-done { margin-left: auto; color: var(--gold-600); font-weight: 800; }
.tab.active { background: linear-gradient(120deg, var(--plum-700), var(--plum-500)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(70, 34, 110, .25); }
.tab.active .tab-num { background: linear-gradient(135deg, var(--gold-600), var(--gold-300)); color: #fff; border-color: transparent; }
.tab.active .tab-text small { color: rgba(255, 255, 255, .75); }
.tab.active .tab-done { color: var(--gold-300); }
.tab-arrow { align-self: center; color: var(--gold-500); font-size: 20px; }

/* 本文 */
.main { padding-top: 28px; padding-bottom: 60px; }
.panel-head { margin-bottom: 18px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .3em; color: var(--gold-600); }
.panel-head h2 { margin: 2px 0 8px; font-family: var(--display); font-weight: 800; font-size: clamp(22px, 4vw, 30px); color: var(--plum-700); line-height: 1.4; }
.panel-head h2::after { content: ""; display: block; width: 64px; height: 2px; margin-top: 10px; background: linear-gradient(90deg, var(--gold-600), var(--gold-300)); }
.lead { margin: 0; color: rgba(42, 34, 51, .78); max-width: 52em; }
.card { background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(70, 34, 110, .06), 0 0 0 1px var(--plum-100); padding: 22px; margin-bottom: 20px; }
.card h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--plum-700); }
.hint { font-size: 12px; font-weight: 400; color: rgba(42, 34, 51, .6); font-family: var(--sans); }
p.hint { margin: 6px 0 0; }
.label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--plum-700); }
.inline-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--plum-700); white-space: nowrap; }
.input { width: 100%; border: 1px solid var(--plum-200); background: #fff; border-radius: 12px; padding: 10px 14px; font: inherit; font-size: 14px; color: var(--ink); outline: none; transition: .2s; }
.input:focus { border-color: var(--plum-500); box-shadow: 0 0 0 3px var(--plum-100); }
.input::placeholder { color: rgba(42, 34, 51, .32); }
.textarea { resize: vertical; line-height: 1.9; }
.textarea.result { background: #fdfcfa; margin-top: 12px; font-size: 15px; }
.select { width: auto; padding-right: 30px; }
.grow { flex: 1; width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; margin-top: 10px; }
.row.end { justify-content: flex-end; margin-top: 10px; }
.mt { margin-top: 16px; }
.mt2 { margin-top: 30px !important; }
.count { font-size: 12px; color: rgba(42, 34, 51, .6); }

/* ボタン */
button { font-family: inherit; }
.btn-primary, .btn-gold, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 10px 24px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .2s; line-height: 1.5; }
.btn-primary { background: linear-gradient(90deg, var(--plum-700), var(--plum-500)); color: #fff; box-shadow: 0 2px 6px rgba(70, 34, 110, .25); }
.btn-gold { background: linear-gradient(90deg, var(--gold-600), var(--gold-400)); color: #fff; box-shadow: 0 2px 6px rgba(142, 110, 42, .25); }
.btn-ghost { background: transparent; color: var(--plum-700); box-shadow: inset 0 0 0 1px var(--plum-200); font-weight: 500; padding: 9px 16px; }
.btn-ghost:hover { background: var(--plum-50); }
.btn-primary:hover, .btn-gold:hover { opacity: .9; }
button:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.danger { color: #a33a3a; box-shadow: inset 0 0 0 1px #e6c3c3; }

/* お知らせ・進行状況 */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--gold-100); border: 1px solid var(--gold-300); color: #5c4718; border-radius: 14px; padding: 12px 18px; margin-bottom: 20px; font-size: 14px; }
.empty { padding: 18px; text-align: center; color: rgba(42, 34, 51, .6); background: var(--plum-50); border-radius: 12px; }
.src-info { margin: 0 0 12px; font-size: 13px; color: rgba(42, 34, 51, .7); }
.progress { margin-top: 16px; padding: 14px 16px; background: var(--plum-50); border-radius: 12px; }
.progress-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.progress-msg { color: var(--plum-700); font-weight: 500; }
.progress.error .progress-msg { color: #a33a3a; }
.bar { height: 8px; background: #fff; border-radius: 99px; overflow: hidden; margin-top: 10px; box-shadow: inset 0 0 0 1px var(--plum-100); }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--plum-500), var(--gold-400)); border-radius: 99px; transition: width .4s; }
.progress.running .bar > i { background-size: 200% 100%; animation: shine 1.6s linear infinite; background-image: linear-gradient(90deg, var(--plum-500), var(--gold-400), var(--plum-500)); }
@keyframes shine { to { background-position: -200% 0; } }

/* 章立て */
.chapter { border-top: 4px solid var(--plum-600); }
.chapter.edge { border-top-color: var(--gold-500); }
.ch-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ch-no { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--plum-700); }
.ch-stage { font-size: 11px; font-weight: 700; color: var(--gold-700); background: var(--gold-100); border-radius: 99px; padding: 2px 12px; }
.ch-sum { margin: 6px 0 12px; font-size: 13px; color: rgba(42, 34, 51, .7); }
.titles { display: grid; gap: 6px; margin: 8px 0; }
.title-opt { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--plum-100); border-radius: 10px; cursor: pointer; transition: .15s; }
.title-opt:hover { background: var(--plum-50); }
.title-opt:has(input:checked) { border-color: var(--plum-500); background: var(--plum-50); box-shadow: 0 0 0 2px var(--plum-100); }
.title-opt input[type=radio] { accent-color: var(--plum-600); flex: none; }
.title-opt span.t { font-family: var(--display); font-weight: 700; font-size: 15px; flex: 1; }
.title-opt .n { font-size: 11px; color: rgba(42, 34, 51, .45); flex: none; }
.title-opt input[type=text] { flex: 1; border: 0; border-bottom: 1px dashed var(--plum-200); background: transparent; font: inherit; font-size: 14px; outline: none; padding: 2px 0; min-width: 0; }
.section { margin-top: 16px; padding: 14px 16px; background: #fdfcfa; border-radius: 12px; border-left: 3px solid var(--gold-400); }
.sec-no { font-weight: 700; color: var(--gold-700); font-size: 13px; }
details.body { margin-top: 8px; }
details.body summary { cursor: pointer; font-size: 12px; color: var(--plum-600); }
details.body pre { white-space: pre-wrap; font: inherit; font-size: 13px; line-height: 1.9; margin: 8px 0 0; padding: 12px; background: #fff; border-radius: 8px; border: 1px solid var(--plum-100); max-height: 360px; overflow: auto; }

/* 表 */
.table-wrap { overflow-x: auto; margin-top: 10px; border: 1px solid var(--plum-100); border-radius: 12px; max-height: 560px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: var(--plum-700); color: #fff; font-weight: 700; padding: 8px 10px; text-align: left; white-space: nowrap; }
.tbl td { padding: 8px 10px; border-top: 1px solid var(--plum-100); vertical-align: top; }
.tbl tr:nth-child(even) td { background: #fdfcfa; }
.tbl td.c { text-align: center; white-space: nowrap; }
.tbl .before { color: #a33a3a; }
.tbl .after { color: #1f6b45; font-weight: 500; }
.tbl tr.off td { opacity: .45; }
.tbl input[type=checkbox] { accent-color: var(--plum-600); width: 16px; height: 16px; }

/* 設定 */
.modal { position: fixed; inset: 0; background: rgba(42, 26, 60, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: #fff; border-radius: 20px; padding: 26px; width: min(560px, 100%); max-height: 92vh; overflow: auto; border-top: 4px solid var(--gold-500); }
.modal-box h3 { margin: 0 0 16px; font-family: var(--display); font-size: 20px; color: var(--plum-700); }
.test-msg { min-height: 1.6em; margin: 10px 0 0; font-size: 13px; }
.test-msg.ok { color: #1f6b45; }
.test-msg.ng { color: #a33a3a; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--plum-800); color: #fff; padding: 10px 22px; border-radius: 99px; font-size: 13px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: 90vw; }
.site-footer { text-align: center; font-size: 11px; color: rgba(42, 34, 51, .45); padding: 24px 0 36px; }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .tab-text small, .tab-arrow { display: none; }
  .tab { padding: 8px 10px; gap: 6px; }
  .tab-text b { font-size: 13px; }
  .card { padding: 16px; }
  .logo { display: none; }
}
