:root {
  --ink: #1b2233;
  --muted: #5b6475;
  --paper: #f7f5ef;
  --card: #ffffff;
  --navy: #14213d;
  --gold: #c8962e;
  --line: #e3dfd3;
  --before: #2f6f9f;
  --during: #b03a2e;
  --after: #2e8b57;
  --plus: #2e8b57;
  --minus: #b03a2e;
  --mixed: #b07d1e;
  --radius: 12px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.7;
}

a { color: var(--before); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, td:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1.2rem;
  background: var(--navy);
  color: #fff;
  overflow-x: auto;
  white-space: nowrap;
}
.topbar a { color: #e9e4d4; text-decoration: none; font-size: .92rem; padding: .35rem .5rem; border-radius: 6px; }
.topbar a:hover { background: rgba(255,255,255,.1); }
.topbar .home-link { color: var(--gold); font-weight: 600; }
.topbar nav { display: flex; gap: .2rem; }

main { max-width: 1180px; margin: 0 auto; padding: 0 1.2rem 3rem; }

.hero { padding: 3.2rem 0 2rem; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--gold); font-weight: 700; letter-spacing: .12em; margin: 0; font-size: .85rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: .3rem 0 .6rem; color: var(--navy); letter-spacing: .04em; }
.lede { font-size: 1.12rem; max-width: 820px; color: #2c3446; }
.lede em { font-style: normal; background: linear-gradient(transparent 60%, #f3dfae 60%); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin: 1.6rem 0 1rem; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stats dt { color: var(--muted); font-size: .82rem; }
.stats dd { margin: 0; font-size: 1.7rem; font-weight: 700; color: var(--navy); }
.disclaimer-inline { color: var(--muted); font-size: .88rem; }

.section { padding: 2.6rem 0 1rem; scroll-margin-top: 3.4rem; }
.section h2 { font-size: 1.6rem; color: var(--navy); margin: 0 0 .6rem; padding-left: .7rem; border-left: 5px solid var(--gold); }
.section h2.sub { margin-top: 2rem; }
.section-note { color: var(--muted); font-size: .92rem; }

.findings { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.finding { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.finding h3 { margin: 0 0 .3rem; font-size: 1.05rem; color: var(--navy); }
.finding p { margin: 0; color: #333b4d; font-size: .95rem; }
.finding .num { color: var(--gold); font-weight: 800; margin-right: .4rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.tab {
  min-height: 44px; padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab.before[aria-selected="true"] { background: var(--before); border-color: var(--before); }
.tab.during[aria-selected="true"] { background: var(--during); border-color: var(--during); }
.tab.after[aria-selected="true"] { background: var(--after); border-color: var(--after); }

.playbook-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.pb-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.pb-card h3 { margin: 0 0 .4rem; font-size: 1rem; color: var(--navy); }
.pb-card ul { margin: 0; padding-left: 1.2rem; }
.pb-card li { margin: .2rem 0; font-size: .94rem; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.matrix { border-collapse: collapse; width: 100%; min-width: 760px; font-size: .9rem; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); padding: .55rem .5rem; text-align: center; }
.matrix th { background: #f1eee4; color: var(--navy); font-weight: 600; }
.matrix th[scope="row"] { text-align: left; white-space: nowrap; }
.matrix td { cursor: pointer; font-weight: 800; font-size: 1.1rem; }
.matrix td.v-plus { color: var(--plus); background: #eaf5ee; }
.matrix td.v-minus { color: var(--minus); background: #f9e9e7; }
.matrix td.v-mixed { color: var(--mixed); background: #fbf3e2; }
.matrix td.active { box-shadow: inset 0 0 0 3px var(--navy); }
.matrix-why { background: #fff8e6; border: 1px solid #f0dfb4; border-radius: 8px; padding: .7rem 1rem; min-height: 3rem; }
.pill { display: inline-block; min-width: 1.6rem; text-align: center; border-radius: 6px; font-weight: 800; margin: 0 .2rem 0 .6rem; }
.pill.plus { background: #eaf5ee; color: var(--plus); }
.pill.minus { background: #f9e9e7; color: var(--minus); }
.pill.mixed { background: #fbf3e2; color: var(--mixed); }

.types-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-top: 1.4rem; }
.type-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.type-card h3 { margin: 0; color: var(--navy); }
.type-card .meta { color: var(--muted); font-size: .86rem; margin: .2rem 0 .6rem; }
.type-card details { border-top: 1px dashed var(--line); padding: .4rem 0; }
.type-card summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.type-card p, .type-card li { font-size: .92rem; }

.filters { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: .7rem; margin: 1rem 0; }
.filters label { display: flex; flex-direction: column; font-size: .82rem; color: var(--muted); gap: .2rem; }
.filters input, .filters select {
  font: inherit; color: var(--ink); min-height: 44px; padding: .4rem .6rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}

.timeline { position: relative; height: 46px; margin: 1.2rem 0 2.2rem; border-bottom: 2px solid var(--navy); }
.timeline .tick { position: absolute; bottom: -1.5rem; font-size: .72rem; color: var(--muted); transform: translateX(-50%); }
.timeline .dot { position: absolute; bottom: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--during); transform: translateX(-50%); opacity: .75; }
.timeline .dot.dim { background: #c9c4b6; opacity: .5; }

.crisis-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-top: 2rem; }
.crisis-card {
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .35rem; transition: transform .15s, box-shadow .15s;
}
.crisis-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,33,61,.08); }
.crisis-card .yr { color: var(--gold); font-weight: 700; font-size: .85rem; }
.crisis-card h3 { margin: 0; font-size: 1.08rem; color: var(--navy); }
.crisis-card .where { color: var(--muted); font-size: .84rem; }
.crisis-card .sum { font-size: .9rem; color: #394154; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag { font-size: .74rem; background: #eef1f7; color: var(--navy); border-radius: 999px; padding: .05rem .55rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.info-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.info-card h3 { margin: 0 0 .3rem; font-size: 1.02rem; color: var(--navy); }
.info-card p { margin: .3rem 0; font-size: .92rem; }
.info-card .small { color: var(--muted); font-size: .84rem; }
.info-card.warn-card { border-left: 4px solid var(--during); }

.method { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.4rem; }
.method .warn { background: #fdf0ee; border-radius: 8px; padding: .7rem 1rem; }
.sources-all { margin-top: 1rem; }
.sources-all summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.sources-all li, .d-sources li { word-break: break-all; font-size: .88rem; }

dialog {
  width: min(980px, 96vw); max-height: 92vh; padding: 0; border: none; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink); background: var(--paper);
}
dialog::backdrop { background: rgba(20,33,61,.55); }
.dialog-inner { padding: 1.4rem 1.6rem 2rem; position: relative; }
.close {
  position: sticky; top: 0; float: right; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); font-size: 1.5rem; cursor: pointer; z-index: 2;
}
.d-head .yr { color: var(--gold); font-weight: 700; }
.d-head h2 { margin: .2rem 0; color: var(--navy); font-size: 1.6rem; }
.d-head .en { color: var(--muted); font-size: .9rem; }
.d-summary { font-size: 1rem; }
.d-section { margin-top: 1.4rem; }
.d-section h3 { margin: 0 0 .5rem; color: var(--navy); font-size: 1.12rem; }
.keydata { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
.keydata div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.keydata .k { color: var(--muted); font-size: .8rem; }
.keydata .v { font-weight: 700; color: var(--navy); }
.phase { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; border-top: 5px solid var(--navy); }
.phase.before { border-top-color: var(--before); }
.phase.during { border-top-color: var(--during); }
.phase.after { border-top-color: var(--after); }
.phase .tf { color: var(--muted); font-size: .88rem; }
.phase h4 { margin: 1rem 0 .4rem; font-size: .98rem; }
.ind { border-left: 3px solid var(--line); padding: .2rem 0 .2rem .8rem; margin: .5rem 0; }
.ind b { color: var(--navy); }
.ind .conf { font-size: .72rem; border-radius: 4px; padding: 0 .35rem; margin-left: .4rem; vertical-align: 1px; }
.conf.documented { background: #eaf5ee; color: var(--plus); }
.conf.pattern { background: #eef1f7; color: var(--navy); }
.ind p { margin: .15rem 0; font-size: .92rem; }
.ind .ex { color: var(--muted); }
.invest { background: #f6f8fb; border-radius: 10px; padding: .7rem 1rem; }
.invest .strategy { font-weight: 700; color: var(--navy); }
.invest .row { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .3rem 0; font-size: .88rem; }
.chip-good { background: #eaf5ee; color: var(--plus); border-radius: 999px; padding: 0 .55rem; }
.chip-bad { background: #f9e9e7; color: var(--minus); border-radius: 999px; padding: 0 .55rem; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; }
.people div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; font-size: .92rem; }
.people .w { border-left: 4px solid var(--plus); }
.people .l { border-left: 4px solid var(--minus); }
sup a { text-decoration: none; font-size: .75rem; }

.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: 1.4rem; background: var(--navy); color: #c9cfdb; font-size: .88rem;
}
.footer a { color: var(--gold); }

@media (max-width: 720px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:first-child { grid-column: 1 / -1; }
  .dialog-inner { padding: 1rem; }
  .hero { padding-top: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .filters, .timeline, .footer { display: none; }
}
