:root {
  color-scheme: light;
  font-family: "Helvetica Neue", Arial, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--page);
  --ink: #182820;
  --page: #f5f7f5;
  --muted: #52645b;
  --green: #206345;
  --border: #dce5de;
  --focus: #277852;
  --surface: #fff;
  --surface-soft: #fcfdfc;
  --table-header: #f8faf8;
  --hover: #ecf2ee;
  --rule: #e8eee9;
  --selected-border: #d9e5dc;
  --quote-start: #f5faf6;
  --quote-border: #e4ebe5;
  --positive-bg: #eaf5ec;
  --negative-bg: #fcf0ee;
  --negative: #9c3c37;
  --pill: #edf3ee;
  --body-ink: #304138;
  --body-heavy: #30453a;
  --deep-green: #174b35;
  --active: #184b35;
  --tooltip-bg: #183b2c;
  --tooltip-text: #fff;
  --driver: #165e5b;
  --driver-rule: #83b7b0;
  --entity-bg: #eaf0f3;
  --entity-ink: #334d5c;
  --caveat: #56665e;
  --citation-bg: #f3f8f4;
  --citation-hover: #e4f1e8;
  --citation-border: #d8e8dd;
  --citation-ink: #20593e;
  --skeleton: #e7eee8;
  --shimmer: #f7fbf8;
  --chart-skeleton: #f5f8f5;
  --skeleton-grid: #edf2ee;
  --card-shadow: #18382308;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6f0e9;
  --page: #101813;
  --muted: #adbbb1;
  --green: #87d8ad;
  --border: #304239;
  --focus: #8ad6ac;
  --surface: #18231c;
  --surface-soft: #151f19;
  --table-header: #1d2a22;
  --hover: #253b2d;
  --rule: #2d3d32;
  --selected-border: #4a6654;
  --quote-start: #1c3023;
  --quote-border: #2e4135;
  --positive-bg: #203a2b;
  --negative-bg: #412725;
  --negative: #ffaba2;
  --pill: #26392d;
  --body-ink: #cfddd2;
  --body-heavy: #d9e6dc;
  --deep-green: #a0dfb9;
  --active: #a6e5bf;
  --tooltip-bg: #294735;
  --tooltip-text: #f0faf3;
  --driver: #a1ddd6;
  --driver-rule: #4f9389;
  --entity-bg: #2a3c42;
  --entity-ink: #c4dce5;
  --caveat: #aabdaf;
  --citation-bg: #203226;
  --citation-hover: #2b4333;
  --citation-border: #405e49;
  --citation-ink: #a1dfba;
  --skeleton: #283a2d;
  --shimmer: #3a5140;
  --chart-skeleton: #1d2b21;
  --skeleton-grid: #293c30;
  --card-shadow: #00000036;
  --plot-up: #80d8ad;
  --plot-down: #ffa099;
  --plot-up-fill: #367957;
  --plot-down-fill: #824842;
  --plot-grid: #2d3d32;
  --plot-label: #adbbb1;
  --plot-guide: #78b392;
  --plot-dot-border: #18231c;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
body { min-width: 290px; }
a { color: inherit; text-underline-offset: .25em; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.container { width: min(1040px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: var(--surface-soft); border-bottom: 1px solid var(--border); }
.header-inner { height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 700; font-size: .95rem; text-decoration: none; }
.brand-mark { display: flex; align-items: flex-end; gap: 3px; padding: 7px; border-radius: 8px; background: #215640; width: 30px; height: 30px; }
.brand-mark i { background: #eef8ef; border-radius: 1px; width: 4px; height: 5px; }
.brand-mark i:nth-child(2) { height: 10px; }
.brand-mark i:nth-child(3) { height: 15px; }
.provider { font-size: .875rem; color: var(--muted); text-decoration-color: var(--border); }
.intro { padding: 46px 0 32px; }
.category { color: var(--green); font-weight: 700; font-size: .875rem; margin-bottom: 13px; }
h1 { font-size: clamp(1.76rem, 4.7vw, 2.75rem); line-height: 1.35; letter-spacing: -.035em; }
h1 span { display: inline-block; }
.benchmark { color: var(--muted); line-height: 1.75; margin-top: 11px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 6px 24px var(--card-shadow); overflow: hidden; }
.quote { padding: 26px 30px 22px; display: flex; align-items: end; justify-content: space-between; gap: 1rem; background: linear-gradient(108deg, var(--quote-start) 0%, var(--surface) 76%); border-bottom: 1px solid var(--quote-border); }
.quote h2, .quote-meta { color: var(--muted); font-size: .9rem; font-weight: 600; }
.headline { display: flex; align-items: baseline; gap: .65rem; font-size: clamp(2.8rem, 7vw, 4.3rem); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: .045em; margin-top: 7px; }
.yen { font-size: .44em; letter-spacing: 0; color: var(--muted); }
.quote-meta { text-align: right; line-height: 1.6; padding-bottom: 2px; }
.change { display: flex; justify-content: flex-end; align-items: baseline; gap: .6rem; margin-top: 5px; }
.change strong { white-space: nowrap; border-radius: 6px; padding: 3px 8px; background: var(--pill); color: var(--body-heavy); font-variant-numeric: tabular-nums; }
.change strong[data-tone="down"] { background: var(--negative-bg); color: var(--negative); }
.change strong[data-tone="up"] { background: var(--positive-bg); color: var(--green); }
.chart-section { padding: 22px 27px 17px; }
.chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.chart-heading h3, .fund-details h2 { font-size: 1.06rem; }
.ranges { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--page); }
.ranges button { border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); min-height: 34px; padding: 4px 13px; cursor: pointer; white-space: nowrap; font-size: .875rem; }
.ranges button:hover { color: var(--deep-green); background: var(--hover); }
.ranges button[aria-pressed="true"] { color: var(--active); border-color: var(--selected-border); background: var(--surface); font-weight: 700; }
.chart-help { margin-top: 9px; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.plot { height: clamp(228px, 32vw, 323px); position: relative; margin-top: 7px; }
canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: crosshair; }
.plot-message { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
[hidden] { display: none !important; }
.tooltip { position: absolute; pointer-events: none; z-index: 1; padding: 10px 12px; background: var(--tooltip-bg); color: var(--tooltip-text); border-radius: 8px; font-size: .875rem; white-space: nowrap; box-shadow: 0 6px 18px #142f2526; }
.chart-caption { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; min-height: 38px; gap: .5rem; font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
#performance { font-weight: 700; color: var(--green); }
#performance[data-tone="down"] { color: var(--negative); }
.fund-details { margin-top: 28px; }
.fund-details dl { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1rem; margin-top: 12px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; }
.fund-details dt { color: var(--muted); font-size: .875rem; margin-bottom: 5px; }
.fund-details dd { font-size: .95rem; font-weight: 600; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; margin-top: 18px; padding-bottom: 24px; color: var(--muted); font-size: .8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 600px) {
  .container { width: calc(100% - 32px); }
  .header-inner { height: 56px; }
  .intro { padding: 30px 0 22px; }
  .quote { padding: 19px 16px; align-items: start; flex-direction: column; gap: 12px; }
  .quote-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; text-align: left; }
  .change { margin: 0; justify-content: flex-start; gap: .35rem; }
  .chart-section { padding: 16px 12px 14px; }
  .chart-heading { align-items: flex-start; flex-direction: column; }
  .ranges { width: 100%; }
  .ranges button { flex: 1; padding-inline: 4px; }
  .plot { margin-top: 8px; }
  .fund-details dl { grid-template-columns: repeat(2, 1fr); }
  .fund-details dl div:first-child { grid-column: 1 / -1; }
}

.chart-result { display: flex; align-items: center; }
.comparison { display: inline-flex; align-items: center; gap: .55rem; }
#delta { color: var(--green); }
#delta[data-tone="down"] { color: var(--negative); }
#delta[data-tone="flat"] { color: var(--muted); }
#clear-comparison {
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 8px;
}
#clear-comparison:hover { color: var(--green); background: var(--hover); }
@media (prefers-reduced-motion: no-preference) {
  .comparison { animation: comparison-in 180ms ease-out; }
  @keyframes comparison-in {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.holdings { margin-top: 30px; }
.holdings h2 { font-size: 1.06rem; }
.holdings-note { color: var(--muted); font-size: .875rem; line-height: 1.5; margin: 6px 0 12px; }
.holdings-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.holdings table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.holdings th, .holdings td { text-align: right; padding: 11px 20px; }
.holdings th:first-child { text-align: left; }
.holdings thead { color: var(--muted); background: var(--table-header); }
.holdings tbody tr { border-top: 1px solid var(--rule); }
.holdings tbody td { white-space: nowrap; }
.holdings tbody td[data-tone="up"] { color: var(--green); }
.holdings tbody td[data-tone="down"] { color: var(--negative); }
.holding-secondary { display: block; margin-top: 3px; color: var(--muted); font-size: .8125rem; font-weight: 400; }
.holding-secondary.mobile-weight { display: none; }
.holdings-status { color: var(--muted); font-size: .875rem; padding: 12px 20px; }
.holdings-status:empty { display: none; }
.holdings-sources { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--muted); font-size: .8125rem; }
@media (max-width: 600px) {
  .holdings th, .holdings td { padding: 10px 8px; }
  .holdings th:first-child { padding-left: 12px; }
  .holdings th:last-child, .holdings td:last-child { padding-right: 12px; }
  .holdings th:nth-child(2), .holdings .desktop-weight { display: none; }
  .holding-secondary.mobile-weight { display: block; }
}

.analysis-panel {
  min-width: 0;
  margin-top: 24px;
  padding: 20px 27px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 6px 24px var(--card-shadow);
}
.analysis-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 18px; }
.analysis-header h2 { font-size: 1.06rem; }
.analysis-date, .analysis-status { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.analysis-status { margin-top: 7px; }
.analysis-report {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 13px;
  min-width: 0;
  margin-top: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.analysis-heading { color: var(--deep-green); font-size: 1.05rem; line-height: 1.35; }
.analysis-paragraph { color: var(--body-ink); }
.analysis-paragraph strong { color: var(--ink); font-weight: 750; }
.analysis-report strong[data-move="up"] { color: var(--green); }
.analysis-report strong[data-move="down"] { color: var(--negative); }
.analysis-paragraph .analysis-driver {
  color: var(--driver);
  text-decoration: underline;
  text-decoration-color: var(--driver-rule);
  text-decoration-thickness: .12em;
  text-underline-offset: .22em;
}
.analysis-entity {
  padding: .05em .3em;
  border-radius: .28em;
  background: var(--entity-bg);
  color: var(--entity-ink);
  font-weight: 650;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.analysis-caveat { color: var(--caveat); }
.analysis-paragraph + .analysis-heading { margin-top: 6px; }
.analysis-citation {
  display: inline-block;
  max-width: 100%;
  margin: 2px 0;
  padding: 1px 7px;
  border: 1px solid var(--citation-border);
  border-radius: 5px;
  background: var(--citation-bg);
  color: var(--citation-ink);
  font-size: .8125rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.analysis-citation:hover { background: var(--citation-hover); }
.analysis-skeleton { display: grid; gap: 10px; margin-top: 14px; }
.analysis-skeleton span { height: .76rem; border-radius: 4px; background: var(--skeleton); }
.analysis-skeleton span:nth-child(2) { width: 95%; }
.analysis-skeleton span:nth-child(3) { width: 87%; }
.analysis-skeleton span:nth-child(4) { width: 62%; }
.placeholder { display: block; width: min(100%, 4.8rem); height: .7rem; margin-inline-start: auto; border-radius: 4px; background-color: var(--skeleton); }
.placeholder + .placeholder { width: min(100%, 3.6rem); margin-top: .4rem; }
#holdings-placeholder th .placeholder { width: min(100%, 8rem); margin-inline-start: 0; }
#holdings-placeholder th .placeholder + .placeholder { width: min(100%, 3.3rem); }
#holdings-placeholder tr { height: 3.55rem; }

.chart-skeleton {
  position: absolute;
  inset: 18px 60px 34px 5px;
  border-block: 1px solid var(--skeleton-grid);
  border-radius: 6px;
  background: repeating-linear-gradient(to bottom, var(--skeleton-grid) 0 1px, transparent 1px 25%), var(--table-header);
  pointer-events: none;
}
.plot[aria-busy="true"] .plot-message {
  inset: 18px 60px 34px 5px;
  font-size: .875rem;
  font-weight: 600;
}
.quote[aria-busy="true"] #nav,
.quote[aria-busy="true"] #daily,
#assets[aria-busy="true"] {
  color: transparent;
  background-color: var(--skeleton);
  border-radius: .2em;
}
.quote[aria-busy="true"] #nav { min-width: 3.3ch; }
.quote[aria-busy="true"] #daily { min-width: min(9rem, 32vw); }
#assets[aria-busy="true"] { width: min(100%, 8ch); }
@media (prefers-reduced-motion: no-preference) {
  .shimmer, .analysis-skeleton span,
  .quote[aria-busy="true"] #nav, .quote[aria-busy="true"] #daily, #assets[aria-busy="true"] {
    background-image: linear-gradient(90deg, var(--skeleton) 38%, var(--shimmer) 50%, var(--skeleton) 62%);
    background-size: 240% 100%;
    animation: analysis-shimmer 1.55s linear infinite;
  }
  .chart-skeleton.shimmer {
    background-image: repeating-linear-gradient(to bottom, var(--skeleton) 0 1px, transparent 1px 25%),
      linear-gradient(90deg, var(--chart-skeleton) 38%, var(--surface) 50%, var(--chart-skeleton) 62%);
    background-size: 100% 100%, 240% 100%;
  }
  @keyframes analysis-shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0% 0; }
  }
}
@media (max-width: 600px) { .analysis-panel { padding: 16px; } }

.header-actions { display: flex; align-items: center; gap: clamp(8px, 2vw, 18px); }
.theme-control { display: inline-flex; position: relative; align-items: center; }
.theme-control select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: .875rem;
  min-height: 32px;
  padding: 3px 25px 3px 9px;
}
.theme-control::after {
  content: "";
  position: absolute;
  inset-inline-end: 10px;
  inline-size: 6px;
  block-size: 6px;
  border-inline-end: 1.5px solid var(--muted);
  border-block-end: 1.5px solid var(--muted);
  rotate: 45deg;
  margin-block-start: -3px;
  pointer-events: none;
}
@media (max-width: 405px) {
  .header-inner { height: auto; min-height: 66px; padding-block: 7px; }
  .header-actions { flex-direction: column; align-items: flex-end; gap: 4px; }
}
