*, *::before, *::after { box-sizing: border-box; }

:root {
  --blue-deep:  #0b3a66;
  --blue-mid:   #1565C0;
  --blue-light: #dce8f8;
  --red:        #B71C1C;
  --green:      #1B5E20;
  --orange:     #E65100;
  --teal:       #00695C;
  --purple:     #4A148C;
  --text:       #1f2937;
  --muted:      #6b7280;
  --line:       #d8e1ea;
  --bg:         #f6f8fb;
  --card:       #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', Meiryo, sans-serif;
  margin: 0;
  background:
    radial-gradient(circle at top right,   rgba(11,58,102,0.06), transparent 28%),
    radial-gradient(circle at bottom left, rgba(183,28,28,0.04), transparent 22%),
    var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}

/* ── Navigation bar ── */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: .84rem;
  color: var(--muted);
}

.breadcrumb a            { color: #0b5394; text-decoration: none; }
.breadcrumb a:hover      { text-decoration: underline; }
.breadcrumb .sep         { color: #c4cdd8; }
.breadcrumb .current     { color: var(--text); font-weight: 600; }

/* ── Language toggle ── */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 13px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.lang-btn.active {
  background: var(--blue-deep);
  color: #fff;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #0b3a66 0%, #1565C0 62%, #1976D2 100%);
  color: #fff;
  border-radius: 12px;
  padding: 24px 24px 20px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
}

.hero h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
}

.hero p {
  margin: .65rem 0 0;
  line-height: 1.6;
  color: #dbe8f6;
  font-size: .96rem;
}

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

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 12px;
}

.card h2 {
  font-size: 1rem;
  margin: 0 0 8px;
  color: var(--blue-deep);
}

.card p  { line-height: 1.65; margin: 6px 0; }

.card ul {
  margin: 6px 0;
  padding-left: 20px;
  line-height: 1.7;
}

.card li + li { margin-top: 3px; }

/* nav card link list */
.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-list a {
  display: inline-block;
  text-decoration: none;
  color: #0b5394;
  background: #f0f5fc;
  border: 1px solid #d0dcea;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: .9rem;
  transition: background .15s;
}

.nav-list a:hover { background: var(--blue-light); }

/* ── Note / Warning ── */
.note {
  color: #6b4e00;
  background: #fff7e6;
  border-left: 4px solid #f0a500;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin-top: 12px;
  font-size: .9rem;
  line-height: 1.65;
}

/* ── Code ── */
code {
  background: #eef3f8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .88em;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-confirmed  { background: #e6f4ea; color: #1B5E20;  border: 1px solid #a8d5b0; }
.badge-inferred   { background: #fff3e0; color: #bf5000;  border: 1px solid #ffcc80; }
.badge-unresolved { background: #fce4ec; color: #880E4F;  border: 1px solid #f48fb1; }
.badge-limited    { background: #f3e5f5; color: #4A148C;  border: 1px solid #ce93d8; }
.badge-phase      { background: #e8eaf6; color: #1A237E;  border: 1px solid #9fa8da; }
.badge-env        { background: #e0f2f1; color: #00695C;  border: 1px solid #80cbc4; }

/* ── Callout boxes ── */
.callout {
  border-left: 4px solid;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 8px 0;
  font-size: .9rem;
  line-height: 1.65;
}
.callout-confirmed  { border-color: #388e3c; background: #f1f8e9; color: #1B5E20; }
.callout-inferred   { border-color: #f57c00; background: #fff8e1; color: #bf5000; }
.callout-unresolved { border-color: #e91e63; background: #fce4ec; color: #880E4F; }
.callout-limited    { border-color: #9c27b0; background: #f3e5f5; color: #4A148C; }

/* ── Phase grid ── */
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.phase-item {
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.phase-item.done    { border-left: 3px solid #388e3c; }
.phase-item.partial { border-left: 3px solid #f57c00; }
.phase-item.pending { border-left: 3px solid #9e9e9e; }

.phase-label  { font-weight: 700; color: var(--blue-deep); font-size: .85rem; margin-bottom: 3px; }
.phase-status { font-size: .78rem; color: var(--muted); }
.phase-item.done .phase-status    { color: #388e3c; }
.phase-item.partial .phase-status { color: #f57c00; }

/* ── Call-chain block ── */
.call-chain {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: .82rem;
  line-height: 1.9;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 8px 0;
}

.call-chain .arrow  { color: #0b5394; }
.call-chain .branch { color: var(--muted); font-style: italic; }
.call-chain .target { color: var(--green); font-weight: 700; }
.call-chain .alt    { color: #bf5000; }

/* ── Data tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  margin: 8px 0;
}

.data-table th {
  background: #f0f5fc;
  color: var(--blue-deep);
  text-align: left;
  padding: 7px 10px;
  border-bottom: 2px solid #d0dcea;
  font-size: .83rem;
}

.data-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e8ecf0;
  vertical-align: top;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: #f8fafd; }
.data-table code             { background: #eef3f8; padding: 1px 5px; border-radius: 3px; font-size: .84em; }

/* ── Timeline (worklog) ── */
.timeline      { list-style: none; padding: 0; margin: 6px 0; }
.timeline li   {
  display: grid;
  grid-template-columns: 6.5rem auto;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #e8ecf0;
  font-size: .9rem;
  line-height: 1.65;
}
.timeline li:first-child { border-top: none; }
.tl-date   { color: #0b5394; font-weight: 600; font-size: .81rem; padding-top: 2px; white-space: nowrap; }
.tl-body   { }
.tl-phase  { font-weight: 700; color: var(--blue-deep); margin-bottom: 2px; }
.tl-text   { color: var(--text); }

/* ── Language visibility ── */
html[data-lang="en"] .ja { display: none !important; }
html[data-lang="ja"] .en { display: none !important; }

/* ── Graph images (Python-generated) ── */
.graph-img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  margin: 12px auto 4px;
}
.graph-zoom {
  display: block;
  text-decoration: none;
}
.graph-zoom:hover .graph-img {
  opacity: 0.92;
  outline: 2px solid #4A90D9;
  outline-offset: 2px;
}
.graph-caption {
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 10px;
}
