:root {
  font-family: "Inter", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: #201b36;
  background: #f7f7fc;
  font-synthesis: none;
  line-height: 1.55;
  --ink: #201b36;
  --muted: #625d76;
  --purple: #5838c6;
  --line: #e9e6f2;
  --positive: #007b62;
  --negative: #a63b59;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: default; opacity: .56; }
:focus-visible { outline: 3px solid #8265ef; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.28; }
.shell { width: min(1220px, calc(100% - 80px)); margin-inline: auto; }
.skip { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 8px 14px; background: #fff; transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }

.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1440px; padding: 0 42px; min-height: 72px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 900; letter-spacing: -.06em; white-space: nowrap; }
.brand-accent { color: var(--purple); }
.brand-icon { display: inline-flex; align-items: flex-end; justify-content: center; gap: 3px; width: 34px; height: 34px; padding-bottom: 9px; border-radius: 10px; background: #623ee0; box-shadow: 0 3px 7px #623ee038; }
.brand-icon i { width: 3px; height: 7px; border-radius: 2px; background: #fff; }
.brand-icon i:nth-child(2) { height: 11px; }
.brand-icon i:nth-child(3) { height: 16px; }
nav { display: flex; align-self: stretch; gap: clamp(9px, 2vw, 29px); }
nav a { display: flex; align-items: center; position: relative; color: var(--muted); padding-inline: 5px; font-size: .91rem; font-weight: 700; white-space: nowrap; }
nav a:hover, nav a[aria-current] { color: var(--purple); }
nav a[aria-current]::after { content: ""; position: absolute; inset: auto 4px -1px; height: 3px; border-radius: 6px 6px 0 0; background: #714ae3; }
.data-label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border: 1px solid #e6dfef; background: #faf8ff; color: #51456b; border-radius: 50px; padding: 6px 10px; font-size: .81rem; font-weight: 700; }
.data-label span { width: 7px; height: 7px; background: #9b78dd; border-radius: 50%; }

main { min-height: calc(100vh - 180px); padding: 28px 0 56px; }
.hero { min-height: 387px; position: relative; overflow: hidden; display: flex; align-items: center; isolation: isolate; border-radius: 25px; background: radial-gradient(ellipse at 80% 24%, #47317d 0, #292049 45%, #18142e 77%); color: white; box-shadow: 0 14px 28px #2b205721; }
.hero-copy { z-index: 1; padding: 42px clamp(24px, 4.5vw, 64px); }
.overline { display: flex; align-items: center; gap: 9px; color: #d9c9ff; font-size: .84rem; font-weight: 800; letter-spacing: .13em; }
.overline span { width: 17px; height: 2px; background: #a582ff; border-radius: 20px; }
.overline.light { color: #6346a6; font-size: .78rem; }
.hero h1 { margin-top: 13px; font-size: clamp(2.7rem, 5.5vw, 4.8rem); letter-spacing: -.083em; line-height: 1.12; font-weight: 900; }
.hero h1 em { font-style: normal; color: #c8abff; }
.hero-description { margin-top: 17px; font-size: 1.015rem; font-weight: 600; color: #e0d9ef; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 24px; }
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 9px 16px; font-size: .91rem; font-weight: 800; border: 1px solid transparent; text-align: center; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.btn-primary { background: #633cdb; color: #fff; box-shadow: 0 5px 15px #6f4adf31; }
.btn-primary:hover { background: #5130bd; }
.hero .btn-primary { background: #a884ff; color: #20103f; }
.hero .btn-primary:hover { background: #c4a7ff; }
.btn-hero { border-color: #ffffff50; color: #fff; background: #ffffff09; }
.btn-hero:hover { background: #ffffff21; }
.btn-secondary { background: #f0ebfe; color: #5034ad; border-color: #e6dcfb; }
.btn-secondary:hover { background: #e6dafa; }
.spark { font-size: 1.15em; line-height: 1; }
.hero-art { position: absolute; width: 54%; inset: 0 0 0 auto; pointer-events: none; }
.hero-grid { position: absolute; inset: 12% 5% 10% 3%; background: linear-gradient(#b894ff28 1px, transparent 1px), linear-gradient(90deg, #b894ff28 1px, transparent 1px); background-size: 50px 47px; mask-image: radial-gradient(ellipse at 60% 50%, black 23%, transparent 78%); }
#hero-chart { position: absolute; width: 100%; height: 100%; inset: 0; }
.hero-float { position: absolute; left: 45%; top: 25%; display: flex; gap: 12px; align-items: center; border: 1px solid #d6b5ff52; background: #2b214bd9; border-radius: 14px; padding: 12px 15px; box-shadow: 0 8px 25px #130c2e70; }
.hero-float div > span { display: block; color: #ece4ff; font-size: .79rem; }
.hero-float strong { display: block; color: #fff; font-size: 1.55rem; line-height: 1.15; }
.hero-float strong span { font-size: .76em; }
.hero-mini-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: #efddff; background: #6b46ba80; font-weight: 900; font-size: 1.28rem; }
.hero-point { position: absolute; z-index: 1; left: 84%; top: 27%; width: 11px; height: 11px; border: 2px solid #fff; background: #bd90ff; box-shadow: 0 0 17px 4px #a672ff; border-radius: 50%; transform: translate(-50%, -50%); }

.home-section { margin-top: 30px; }
.section-head, .panel-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 13px; }
.section-head h2, .panel h2 { margin-top: 4px; font-size: clamp(1.2rem, 2.2vw, 1.65rem); letter-spacing: -.04em; }
.text-link { color: var(--purple); font-size: .88rem; font-weight: 800; white-space: nowrap; padding-bottom: 2px; }
.text-link:hover, .footer a:hover, .learn-sources a:hover { text-decoration: underline; text-underline-offset: 4px; }
.stock-cards, .result-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stock-card, .sector-card, .panel, .metric-card { border: 1px solid var(--line); background: #fff; border-radius: 17px; box-shadow: 0 3px 9px #201b3605; }
.stock-card { display: block; padding: 16px; min-width: 0; }
a.stock-card:hover, a.sector-card:hover, button.sector-card:hover { border-color: #bfaaf1; box-shadow: 0 7px 20px #29145210; }
.stock-top { display: flex; gap: 11px; align-items: center; }
.stock-mark, .sector-mark { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #5634b0; background: #efebff; font-size: .95rem; font-weight: 900; letter-spacing: -.06em; }
.mark-auto { color: #6240ab; background: #eee6ff; }
.mark-bank { color: #1e7766; background: #e0f7ee; }
.mark-comms { color: #294eb2; background: #e8eeff; }
.mark-electric { color: #a14819; background: #ffeddf; }
.stock-top h3 { font-size: 1rem; }
.meta { color: var(--muted); font-size: .83rem; }
.quote-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 12px; min-width: 0; gap: 6px; }
.quote { font-size: clamp(1.1rem, 2.3vw, 1.58rem); font-weight: 900; line-height: 1.2; letter-spacing: -.04em; white-space: nowrap; }
.quote small { font-size: .76rem; margin-left: 3px; }
.quote-change { font-size: .81rem; font-weight: 800; white-space: nowrap; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.sparkline { display: block; width: 38%; max-width: 139px; height: 38px; }
.sector-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sector-card { display: flex; align-items: center; text-align: left; gap: 10px; padding: 11px 12px; width: 100%; }
.sector-card[aria-pressed="true"] { border-color: #8864e6; background: #f9f5ff; }
.sector-card strong { font-size: .91rem; display: block; }
.sector-card .meta { display: block; }
.footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); }
.footer-inner { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding-block: 19px; font-size: .83rem; }
.footer-brand { display: inline-block; color: var(--ink); font-size: 1.08rem; }
.footer-inner > a:last-child { white-space: nowrap; color: var(--purple); font-weight: 700; }

.page-heading { padding: 14px 0 22px; }
.page-heading h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); letter-spacing: -.077em; margin-block: 5px 8px; }
.page-heading p:last-child, .muted, .panel-heading p { color: var(--muted); }
.page-heading.compact { display: grid; grid-template-columns: 1fr minmax(210px, 340px); align-items: end; }
.page-heading.compact .overline { grid-column: 1; }
.page-heading.compact h1 { grid-column: 1; margin-bottom: 0; }
.analysis-field { grid-column: 2; grid-row: 1 / 3; }
.panel { padding: clamp(15px, 2.5vw, 27px); }
.finder { display: grid; gap: 16px; }
.finder h2 .spark { color: #6f46df; }
.finder h2 { margin-bottom: 5px; }
fieldset { margin: 0; padding: 0; border: 0; }
legend, .field { display: block; font-weight: 800; font-size: .9rem; }
legend { margin-bottom: 8px; }
.profile-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.profile-option { display: block; position: relative; min-width: 0; }
.profile-option input { position: absolute; inset: 0 auto auto 0; width: 1px; height: 1px; opacity: 0; }
.profile-option > span { display: block; height: 100%; background: #faf9fc; border: 1px solid var(--line); border-radius: 12px; padding: 11px; cursor: pointer; }
.profile-option:hover > span, .profile-option input:checked + span { border-color: #9777eb; background: #f1ebff; }
.profile-option input:focus-visible + span { outline: 3px solid #8265ef; outline-offset: 3px; }
.profile-option strong, .profile-option small { display: block; }
.profile-option small { color: var(--muted); margin-top: 3px; font-size: .84rem; }
.finder-controls { display: flex; gap: 12px; align-items: flex-end; margin-top: 14px; }
.finder-controls .field { flex: 0 1 280px; }
.field select { display: block; width: 100%; margin-top: 5px; appearance: none; border: 1px solid #ded9ee; border-radius: 10px; color: var(--ink); background: linear-gradient(45deg, transparent 50%, #6b5389 50%) calc(100% - 17px) 50% / 5px 5px no-repeat, linear-gradient(135deg, #6b5389 50%, transparent 50%) calc(100% - 12px) 50% / 5px 5px no-repeat, #fff; min-height: 44px; padding: 7px 26px 7px 10px; text-overflow: ellipsis; }
.results-head { margin-top: 22px; }
.result-card { min-width: 0; }
.result-score { margin-top: 15px; display: flex; align-items: baseline; justify-content: space-between; gap: 7px; color: var(--purple); font-size: .86rem; font-weight: 800; }
.result-score strong { font-size: 1.22rem; }
.score-track { height: 7px; background: #ebe4fa; border-radius: 20px; margin: 5px 0 11px; }
.score-track span { height: 100%; display: block; background: #7e56e4; border-radius: inherit; }
.result-reason { font-size: .9rem; min-height: 3em; }
.result-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.result-actions .btn { font-size: .84rem; padding-inline: 9px; }
.method { margin-top: 16px; }
.method summary { cursor: pointer; color: var(--purple); font-weight: 800; }
.method p { padding-top: 10px; color: var(--muted); }

.compare-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
#compare-selects { flex: 1 1 500px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#compare-status { flex: 1 0 100%; font-size: .84rem; }
#compare-status:empty { display: none; }
.chart-panel, .table-panel, .sector-profile { margin-top: 16px; }
.panel-heading { align-items: center; flex-wrap: wrap; margin-bottom: 13px; }
.panel-heading p { font-size: .91rem; margin-top: 4px; }
.periods { display: inline-flex; gap: 3px; background: #f4f1fa; border: 1px solid #ede8f6; border-radius: 10px; padding: 4px; }
.periods button { font-weight: 700; background: transparent; border: 0; padding: 4px 9px; border-radius: 7px; min-height: 32px; font-size: .87rem; color: var(--muted); }
.periods button[aria-pressed="true"] { background: #fff; color: var(--purple); box-shadow: 0 1px 5px #201b3618; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 7px 17px; margin: 12px 0 2px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .87rem; font-weight: 700; }
.chart-legend i { width: 15px; height: 4px; border-radius: 9px; background: var(--series); }
.chart-box { height: clamp(190px, 30vw, 315px); position: relative; }
.chart-box canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.chart-readout { font-size: .85rem; color: var(--muted); min-height: 1.55em; padding: 3px 0 0 5px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; min-width: 520px; line-height: 1.45; font-size: .92rem; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead { background: #f8f5fe; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
table a { color: var(--purple); font-weight: 800; }
table a:hover { text-decoration: underline; }
.stock-profile { display: flex; align-items: center; gap: 15px; }
.stock-profile .stock-mark { width: 54px; height: 54px; font-size: 1.17rem; }
.stock-profile-main { flex: 1; }
.stock-profile-main h2 { margin-bottom: 3px; }
.stock-profile-quote { text-align: right; }
.analysis-metrics { margin-block: 14px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.metric-card { padding: 11px 13px; }
.metric-card a { color: var(--purple); display: block; font-weight: 700; font-size: .86rem; }
.metric-card strong { font-size: clamp(1.1rem, 2.2vw, 1.5rem); }
.sector-profile h2 { margin-bottom: 6px; }
.sector-profile span { color: var(--muted); font-size: .85rem; }
.sector-bars { display: grid; gap: 6px; }
.sector-bar { display: grid; grid-template-columns: minmax(80px, 1fr) 4fr 73px; align-items: center; gap: 10px; padding: 6px 0; background: transparent; border: 0; text-align: left; width: 100%; font-size: .9rem; }
.sector-bar:hover .bar-track { background: #f0e8fe; }
.sector-bar strong { text-align: right; }
.bar-track { position: relative; width: 100%; background: #f6f3fa; border-radius: 20px; height: 15px; }
.bar-track::before { position: absolute; inset: 0 auto 0 50%; content: ""; border-left: 1px solid #bbb0cd; }
.bar-fill { position: absolute; inset: 2px auto 2px var(--bar-left); width: var(--bar-width); background: var(--bar-color, #a085e8); border-radius: 20px; }
.learn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.learn-card h2 { color: var(--purple); margin: 0 0 7px; font-size: 1.15rem; }
.learn-card p + p { margin-top: 9px; color: var(--muted); }
.learn-card:target, .learn-card.term-focus { border-color: #a381f2; background: #fbf8ff; }
.learn-sources { margin-top: 16px; }
.learn-sources ul { padding-left: 22px; margin-bottom: 0; }
.learn-sources a { color: var(--purple); font-weight: 700; }

@media (max-width: 850px) {
  .shell { width: calc(100% - 42px); }
  .top-inner { padding-inline: 21px; }
  .hero-art { width: 52%; }
  .hero-float { left: 34%; }
  .profile-grid, .learn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { flex-wrap: wrap; gap: 6px 14px; }
  .footer-inner p { order: 3; flex-basis: 100%; }
}
@media (max-width: 730px) {
  .shell { width: calc(100% - 28px); }
  .top-inner { padding: 9px 14px 0; min-height: 0; flex-wrap: wrap; gap: 5px; }
  .top-inner nav { order: 3; flex-basis: 100%; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
  .top-inner nav a { justify-content: center; min-height: 36px; padding-inline: 1px; font-size: .85rem; }
  .brand { font-size: 19px; }
  .brand-icon { width: 30px; height: 30px; padding-bottom: 7px; }
  main { padding-top: 14px; }
  .hero { min-height: 350px; border-radius: 17px; }
  .hero-copy { padding-block: 24px; }
  .hero-art { width: 68%; opacity: .53; top: 19%; right: -16%; }
  .hero-float, .hero-point { display: none; }
  .hero-description { font-size: .95rem; }
  .hero-actions .btn { padding-inline: 10px; font-size: .84rem; }
  .section-head h2 { font-size: 1.3rem; }
  .overline.light { font-size: .72rem; }
  .stock-cards, .result-cards { grid-template-columns: 1fr; gap: 9px; }
  .sector-cards { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .stock-card { padding: 12px; }
  .quote { font-size: 1.36rem; }
  .quote-row { margin-top: 8px; }
  .page-heading { padding: 8px 0 15px; }
  .page-heading.compact { display: block; }
  .analysis-field { margin-top: 10px; }
  .finder-controls .field { flex: 1 1 0; }
  .analysis-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stock-profile { flex-wrap: wrap; gap: 9px; }
  .stock-profile-main { flex: 1 1 70%; }
  .stock-profile-quote { text-align: left; padding-left: 63px; }
  #compare-selects { grid-template-columns: 1fr; }
  .results-head { margin-top: 17px; }
  .result-reason { min-height: 0; }
}
@media (max-width: 490px) {
  .top-inner nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .learn-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; }
  .text-link { font-size: .8rem; }
  .sector-card { padding-inline: 7px; gap: 6px; }
  .sector-mark { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
