* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --s1: #4A7FC1;
  --s1-bg: #EBF2FF;
  --s1-light: #C8DEFF;
  --s2: #B54A8A;
  --s2-bg: #FFEBF5;
  --s2-light: #F5C0DF;
  --s3: #3A9E6E;
  --s3-bg: #EBFFF4;
  --s3-light: #AFECD0;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --bg: #f8f9fc;
  --white: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

.site-header {
  background: linear-gradient(135deg, #7B2D8B 0%, #4A7FC1 35%, #3A9E6E 65%, #D4A017 100%);
  padding: 32px 24px 28px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.18);
}
.site-header > * { position: relative; }
.header-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 11px;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.site-header h1 {
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.site-header h1 span {
  display: block;
  font-size: clamp(13px, 2.5vw, 16px);
  font-weight: 400;
  opacity: 0.9;
  margin-top: 4px;
}
.header-sub {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 8px;
}

.progress-bar-wrapper {
  position: sticky;
  top: 100px;
  z-index: 100;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 10px 20px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.progress-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.progress-count { font-size: 15px; font-weight: 700; color: var(--text); }
.progress-count em { color: #7B2D8B; font-style: normal; font-size: 20px; }
.progress-title-mini { font-size: 12px; font-weight: 600; color: #7B2D8B; margin-left: auto; padding-left: 12px; white-space: nowrap; }
.progress-track { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7B2D8B, #4A7FC1, #3A9E6E);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

.title-banner {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid transparent;
  transition: border-color 0.4s, background 0.4s;
}
.title-icon { font-size: 36px; line-height: 1; flex-shrink: 0; }
.title-body { flex: 1; }
.title-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.title-name { font-size: 20px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.2; transition: color 0.4s; }
.title-next { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.title-next strong { color: var(--text); }

.tier-0  { border-color: #e5e7eb; }
.tier-0  .title-name { color: #9ca3af; }
.tier-1  { border-color: #fde68a; background: #fffbeb; }
.tier-1  .title-name { color: #b45309; }
.tier-2  { border-color: #bfdbfe; background: #eff6ff; }
.tier-2  .title-name { color: #1d4ed8; }
.tier-3  { border-color: #a7f3d0; background: #ecfdf5; }
.tier-3  .title-name { color: #065f46; }
.tier-4  { border-color: #c4b5fd; background: #f5f3ff; }
.tier-4  .title-name { color: #5b21b6; }
.tier-5  { border-color: #f9a8d4; background: #fdf2f8; }
.tier-5  .title-name { color: #9d174d; }
.tier-6  { border-color: #fdba74; background: #fff7ed; }
.tier-6  .title-name { color: #9a3412; }
.tier-7  {
  border-color: transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #7B2D8B, #4A7FC1, #3A9E6E, #D4A017) border-box;
}
.tier-7  .title-name {
  background: linear-gradient(90deg, #7B2D8B, #4A7FC1, #3A9E6E);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main { max-width: 1320px; margin: 0 auto; padding: 24px 16px 100px; }

.intro-box {
  background: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border-left: 4px solid #7B2D8B;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

.section-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
.section-header { padding: 18px 22px; color: white; display: flex; align-items: center; gap: 14px; }
.section-number {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.section-title-wrap { flex: 1; }
.section-title { font-size: 15px; font-weight: 700; line-height: 1.4; }
.section-progress-mini { font-size: 12px; opacity: 0.9; margin-top: 3px; }
.s1 .section-header { background: var(--s1); }
.s2 .section-header { background: var(--s2); }
.s3 .section-header { background: var(--s3); }

.subsection { padding: 0 22px 16px; }
.subsection:first-of-type { padding-top: 16px; }
.subsection-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  display: inline-block;
}
.s1 .subsection-title { background: var(--s1-light); color: var(--s1); }
.s2 .subsection-title { background: var(--s2-light); color: var(--s2); }
.s3 .subsection-title { background: var(--s3-light); color: var(--s3); }

.divider { border: none; border-top: 1px solid #f0f0f5; margin: 16px 22px; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
  user-select: none;
}
.item:hover { background: #f5f6fa; }
.item.checked { background: #f0fdf4; }
.item-number { font-size: 11px; color: var(--text-muted); min-width: 22px; padding-top: 2px; font-weight: 600; }
.check-box {
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 2px solid #d1d5db;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  margin-top: 1px;
}
.item.checked .check-box { background: #22c55e; border-color: #22c55e; }
.check-box svg { display: none; }
.item.checked .check-box svg { display: block; }
.item-text { font-size: 13.5px; line-height: 1.65; color: var(--text); flex: 1; }
.item.checked .item-text { color: #16a34a; }

.action-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  z-index: 99;
}
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-share-x { background: #000; color: white; }
.btn-share-x:hover { background: #333; }
.btn-copy { background: #7B2D8B; color: white; }
.btn-copy:hover { background: #6a1f7a; }
.btn-print { background: #4A7FC1; color: white; }
.btn-print:hover { background: #3a6aaa; }
.btn-reset { background: #f3f4f6; color: #6b7280; }
.btn-reset:hover { background: #e5e7eb; }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a1a2e;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer { text-align: center; font-size: 11px; color: var(--text-muted); padding: 8px 16px 0; }
.footer a { color: #7B2D8B; text-decoration: none; }

@media print {
  /* ページ全体を非表示にしてからツール部分だけ表示 */
  body * { visibility: hidden; }

  .main, .main *,
  .title-banner, .title-banner * { visibility: visible; }

  .main {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: 0;
    max-width: 100%;
    font-size: 12px;
  }

  .progress-bar-wrapper, .action-bar, .toast, .intro-box { display: none !important; }

  .section-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; margin-bottom: 16px; }
  .s1 .section-header { background: #4A7FC1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .s2 .section-header { background: #B54A8A !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .s3 .section-header { background: #3A9E6E !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .item { padding: 6px 8px; break-inside: avoid; }
  .item.checked { background: #f0fdf4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .item.checked .check-box { background: #22c55e !important; border-color: #22c55e !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .item.checked .item-text { color: #16a34a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 480px) {
  .section-header { padding: 14px 16px; }
  .subsection { padding: 0 14px 12px; }
  .divider { margin: 12px 14px; }
  .item-text { font-size: 13px; }
}
