:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #eef2f6;
  --text: #101418;
  --muted: #5f6973;
  --line: #dce2e8;
  --accent: #0b7fa3;
  --accent-soft: #dff4fb;
  --accent-strong: #075e7a;
  --shadow: 0 18px 50px rgba(20, 31, 43, 0.08);
  --max: 1120px;
  --radius: 22px;
}

[data-theme="dark"] {
  --bg: #0d1115;
  --surface: #151b21;
  --surface-soft: #11171c;
  --text: #edf2f6;
  --muted: #9da8b3;
  --line: #27313a;
  --accent: #4fc3e7;
  --accent-soft: #102d37;
  --accent-strong: #8cdef4;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.container {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
}

.section { padding: 96px 0; }
.section-tight { padding: 72px 0; }
.section-soft {
  background: var(--surface-soft);
  border-block: 1px solid var(--line);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}

.nav-wrap {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  margin-right: auto;
}
.brand-dot { color: var(--accent); }
.nav { display: flex; gap: 24px; }
.nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: color .2s ease;
}
.nav a:hover { color: var(--text); }
.theme-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.hero { padding-top: 116px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr);
  align-items: end;
  gap: 72px;
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 16px;
  font-size: clamp(56px, 9vw, 108px);
  line-height: .92;
  letter-spacing: -.07em;
}
h2 {
  margin-bottom: 18px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.06;
  letter-spacing: -.045em;
}
h3 { line-height: 1.3; }
.hero-copy {
  max-width: 720px;
  margin-bottom: 10px;
  font-size: clamp(20px, 3vw, 32px);
  line-height: 1.35;
  letter-spacing: -.02em;
}
.hero-sub { color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-2px); border-color: var(--accent); }
.button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }

.status-card,
.highlight-card,
.atcoder-panel,
.skill-card,
.goal-card,
.link-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.status-card { padding: 28px; box-shadow: var(--shadow); }
.status-label, .card-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}
.status-main { margin: 18px 0 4px; font-size: 30px; font-weight: 800; letter-spacing: -.04em; }
.status-sub { color: var(--muted); }
.status-line { height: 1px; background: var(--line); margin: 24px 0; }
.status-note { margin-bottom: 0; font-size: 13px; color: var(--muted); }

.section-heading { max-width: 800px; margin-bottom: 42px; }
.section-heading.compact { margin-bottom: 28px; }
.split-heading { max-width: none; display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.split-heading h2 { margin-bottom: 0; }
.about-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 64px; }
.lead { font-size: clamp(20px, 2.5vw, 27px); line-height: 1.65; letter-spacing: -.015em; }
.narrow { max-width: 650px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-link { color: var(--accent-strong); font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.highlight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.highlight-card { min-height: 220px; padding: 26px; }
.highlight-card h3 { margin-bottom: 8px; }
.highlight-card > p:last-child { color: var(--muted); margin-bottom: 0; }
.card-value { margin: 28px 0 8px; font-size: clamp(34px, 4vw, 52px); font-weight: 850; line-height: 1; letter-spacing: -.05em; }
.accent-card { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.atcoder-panel { padding: 30px; box-shadow: var(--shadow); overflow: hidden; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.metric { padding: 2px 24px 28px 0; }
.metric + .metric { padding-left: 24px; border-left: 1px solid var(--line); }
.metric-label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.metric strong { font-size: clamp(32px, 4.5vw, 48px); letter-spacing: -.05em; }
.chart-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 30px 0 12px; }
.chart-toolbar h3 { margin-bottom: 2px; font-size: 20px; }
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--line); }
.segmented-button {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.segmented-button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.chart { position: relative; width: 100%; min-height: 360px; overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 720px; height: auto; overflow: visible; }
.chart-loading { padding: 100px 0; text-align: center; color: var(--muted); }
.chart-tooltip {
  position: fixed;
  z-index: 80;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
  pointer-events: none;
}
.chart-tooltip strong { display: block; margin-bottom: 3px; }
.data-source { margin: 10px 0 0; color: var(--muted); font-size: 11px; text-align: right; }

.skill-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.skill-card { position: relative; padding: 28px; min-height: 180px; }
.skill-card h3 { margin-top: 28px; font-size: 23px; }
.skill-card p { margin-bottom: 0; color: var(--muted); }
.skill-index { position: absolute; top: 24px; right: 26px; color: var(--muted); font-size: 11px; font-weight: 800; }
.security-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 80px; align-items: center; }
.goal-card { padding: 34px; }
.goal-card h3 { margin: 20px 0 0; font-size: 24px; }
.goal-code { margin: 4px 0 20px; color: var(--accent-strong); font-size: 78px; font-weight: 900; line-height: 1; letter-spacing: -.06em; }

.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 100px 1fr; gap: 28px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline strong, .timeline span { display: block; }
.timeline span { margin-top: 3px; color: var(--muted); font-size: 13px; }

.link-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.link-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 96px; padding: 22px; text-decoration: none; transition: transform .18s ease, border-color .18s ease; }
.link-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.link-card span { color: var(--muted); font-size: 12px; }
.site-footer { padding: 30px 0; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; font-size: 12px; }
.footer-inner p { margin: 0; }
.is-hidden { display: none !important; }

/* SVG chart */
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis-text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart-point { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; cursor: pointer; transition: r .15s ease; }
.chart-point:hover, .chart-point:focus { r: 6.5; outline: none; }
.chart-threshold { stroke: color-mix(in srgb, var(--muted) 35%, transparent); stroke-width: 1; stroke-dasharray: 5 7; }
.chart-threshold-label { fill: var(--muted); font-size: 10px; font-family: inherit; }

@media (max-width: 820px) {
  .nav { display: none; }
  .hero-grid, .about-grid, .security-grid { grid-template-columns: 1fr; gap: 38px; }
  .hero { padding-top: 80px; }
  .highlight-grid, .link-grid { grid-template-columns: 1fr; }
  .highlight-card { min-height: 0; }
  .skill-grid { grid-template-columns: 1fr; }
  .split-heading { align-items: start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .metric, .metric + .metric { padding: 18px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .chart-toolbar { align-items: start; flex-direction: column; }
  .footer-inner { flex-direction: column; }
}

@media (max-width: 520px) {
  .container { width: min(calc(100% - 28px), var(--max)); }
  .section { padding: 70px 0; }
  .section-tight { padding: 54px 0; }
  .hero { padding-top: 66px; }
  .atcoder-panel { padding: 20px 16px; border-radius: 18px; }
  .timeline li { grid-template-columns: 64px 1fr; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .goal-grid {
    grid-template-columns: 1fr;
  }
}