/* SPPS — full-width dark fintech theme, one-screen dashboard */
:root {
  --bg-0: #090d16;
  --bg-1: #0f1420;
  --card: rgba(24, 32, 50, 0.72);
  --card-solid: #182032;
  --card-border: rgba(120, 150, 210, 0.14);
  --card-border-strong: rgba(120, 150, 210, 0.28);
  --text: #e8ecf4;
  --text-dim: #8d9ab5;
  --text-faint: #5c6a88;
  --up: #ff5d52;
  /* Japanese market convention: red = up */
  --up-soft: rgba(255, 93, 82, 0.14);
  --down: #4d9bff;
  /* blue = down */
  --down-soft: rgba(77, 155, 255, 0.14);
  --accent: #f0b429;
  --accent-soft: rgba(240, 180, 41, 0.12);
  --sigma: #4ecdc4;
  --echo: #c792ea;
  --nexus: #f0b429;
  --mono: "JetBrains Mono", Consolas, monospace;
  --radius: 14px;
  --pad-x: clamp(14px, 3vw, 48px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  line-height: 1.55;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(77, 155, 255, 0.10), transparent 60%),
    radial-gradient(900px 420px at 0% 0%, rgba(240, 180, 41, 0.07), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 40%);
  background-attachment: fixed;
}

/* faint grid overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(120, 150, 210, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 210, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 70%);
}

/* ---------- top bar ---------- */
.topbar {
  flex: none;
  /* fixed 3-column grid so the nav never moves across pages */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 10px var(--pad-x);
  border-bottom: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(9, 13, 22, 0.85), rgba(9, 13, 22, 0.4));
  backdrop-filter: blur(8px);
}

.topbar .brand {
  justify-self: start;
}

.topbar .nav {
  justify-self: center;
}

.topbar .meta {
  justify-self: end;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 30px;
  height: 30px;
}

.brand-mark {
  /* fixed casing "Synova" — white light fading into deep blue */
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.42rem;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #ffffff 25%, #7fd0ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(0, 240, 255, 0.28));
}

.brand-sub {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
}

/* catchphrase: 三つの視点、一つの未来。 */
.brand-tagline {
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 500;
  padding-left: 10px;
  border-left: 1px solid var(--card-border-strong);
}

@media (max-width: 1100px) {
  .brand-tagline {
    display: none;
  }
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  border-color: var(--card-border-strong);
}

.nav a.active {
  color: var(--accent);
  border-color: rgba(240, 180, 41, 0.45);
  background: var(--accent-soft);
}

.meta {
  color: var(--text-faint);
  font-size: 0.72rem;
  font-feature-settings: "tnum";
  text-align: right;
}

/* ---------- layout ---------- */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px var(--pad-x) 4px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  min-height: 0;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

h2 {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  font-family: var(--mono);
}

.card-head-note {
  font-size: 0.7rem;
  color: var(--text-faint);
}

/* ---------- dashboard one-screen grid ---------- */
.dashboard-grid {
  grid-template-columns: minmax(360px, 5fr) 8fr;
  grid-template-rows: minmax(0, 13fr) minmax(0, 10fr);
  grid-template-areas: "verdict chart" "brains brains";
}

.verdict-panel {
  grid-area: verdict;
}

.chart-panel {
  grid-area: chart;
}

.brains {
  grid-area: brains;
}

/* ---------- verdict ---------- */
.verdict-panel {
  padding: 18px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.verdict-panel::after {
  /* directional glow */
  content: "";
  position: absolute;
  inset: auto -30% -55% -30%;
  height: 90%;
  background: radial-gradient(closest-side, var(--glow, transparent), transparent 70%);
  opacity: 0.55;
  pointer-events: none;
}

.verdict-panel.up {
  --glow: rgba(255, 93, 82, 0.35);
}

.verdict-panel.down {
  --glow: rgba(77, 155, 255, 0.35);
}

.headline {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* brand word keeps its fixed "Synova" casing inside uppercased contexts */
.headline .brand-word {
  text-transform: none;
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: 0.06em;
}

.headline .jp {
  font-family: inherit;
  letter-spacing: 0.06em;
  margin-left: 8px;
  color: var(--text-dim);
}

.verdict {
  font-family: "Inter", var(--mono), sans-serif;
  font-size: clamp(2.4rem, 4.2vw, 3.8rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.verdict.up {
  color: var(--up);
  text-shadow: 0 0 42px rgba(255, 93, 82, 0.45);
}

.verdict.down {
  color: var(--down);
  text-shadow: 0 0 42px rgba(77, 155, 255, 0.45);
}

.verdict .arrow {
  font-size: 0.5em;
  transform: translateY(3px);
}

.verdict-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
}

.vote-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.vote-chip {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--card-border-strong);
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
}

.vote-chip.up {
  color: var(--up);
  border-color: rgba(255, 93, 82, 0.4);
  background: var(--up-soft);
}

.vote-chip.down {
  color: var(--down);
  border-color: rgba(77, 155, 255, 0.4);
  background: var(--down-soft);
}

.vote-detail {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.vote-detail strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
}

.agreement {
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid;
}

.badge.unanimous {
  color: #4cd97b;
  border-color: rgba(76, 217, 123, 0.45);
  background: rgba(76, 217, 123, 0.1);
}

.badge.split {
  color: var(--accent);
  border-color: rgba(240, 180, 41, 0.5);
  background: var(--accent-soft);
}

/* ---------- chart ---------- */
.chart-panel {
  padding: 16px 22px 10px;
  display: flex;
  flex-direction: column;
}

#price-chart {
  width: 100%;
  max-width: 100%;
  display: block;
  flex: 1 1 auto;
  min-height: 0;
}

/* ---------- brain cards ---------- */
.brains {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.brain-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 14px 20px 12px;
  position: relative;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.brain-card:hover {
  transform: translateY(-3px);
  border-color: var(--card-border-strong);
}

.brain-card::before {
  /* per-brain accent line */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brain-accent), transparent 75%);
}

.brain-card[data-brain="brain_a"] {
  --brain-accent: var(--sigma);
}

.brain-card[data-brain="brain_b"] {
  --brain-accent: var(--echo);
}

.brain-card[data-brain="brain_c"] {
  --brain-accent: var(--nexus);
}

.brain-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* faint brain logo behind each prediction card */
.brain-watermark {
  position: absolute;
  right: -14px;
  bottom: -18px;
  width: 118px;
  height: 118px;
  opacity: 0.09;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.brain-watermark svg {
  width: 100%;
  height: 100%;
}

.brain-card:hover .brain-watermark {
  opacity: 0.16;
  transform: rotate(-6deg) scale(1.05);
}

/* Synova mark behind the verdict panel */
.synova-watermark {
  right: 18px;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 150px;
  height: 150px;
  opacity: 0.08;
}

.brain-icon {
  flex: none;
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.4));
}

.brain-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brain-name {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--brain-accent);
}

.brain-type {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.brain-desc {
  font-size: 0.68rem;
  color: var(--text-faint);
}

.brain-verdict {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 8px;
}

.direction {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.direction .jp {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.6em;
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 6px;
  letter-spacing: 0;
}

.direction.up {
  color: var(--up);
}

.direction.down {
  color: var(--down);
}

.prob-big {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.prob-big small {
  font-size: 0.62em;
  color: var(--text-dim);
  font-weight: 500;
  margin-left: 2px;
}

.prob-bar {
  height: 8px;
  border-radius: 6px;
  margin: 8px 0 5px;
  background: var(--down-soft);
  border: 1px solid rgba(77, 155, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.prob-bar .fill {
  height: 100%;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, rgba(255, 93, 82, 0.55), var(--up));
  box-shadow: 0 0 14px rgba(255, 93, 82, 0.4);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.prob-bar .midline {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 1px;
  background: rgba(232, 236, 244, 0.5);
}

.prob-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-feature-settings: "tnum";
}

.prob-labels .lab-up {
  color: var(--up);
}

.prob-labels .lab-down {
  color: var(--down);
}

.record {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--card-border);
  font-size: 0.7rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-feature-settings: "tnum";
}

.record .acc {
  font-family: var(--mono);
  color: var(--text);
}

/* ---------- footer ---------- */
footer {
  flex: none;
  padding: 6px var(--pad-x) 12px;
}

.disclaimer {
  font-size: 0.68rem;
  color: var(--text-faint);
}

.loading {
  color: var(--text-dim);
}

.error {
  color: #ff7b72;
}

/* ============================================================
   HISTORY page
   ============================================================ */
.history-grid {
  grid-template-rows: auto minmax(0, 1fr);
}

.summary-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.summary-chip {
  flex: 1 1 160px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.summary-chip .k {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--chip-accent, var(--text-faint));
  /* no uppercase transform: "Synova" keeps its fixed casing */
}

.summary-chip .v {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.summary-chip .s {
  font-size: 0.68rem;
  color: var(--text-faint);
}

.table-panel {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-scroll {
  overflow-y: auto;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th,
td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

th {
  color: var(--text-faint);
  font-weight: 700;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  /* no uppercase transform: "Synova" keeps its fixed casing */
  font-family: var(--mono);
  position: sticky;
  top: 0;
  background: var(--card-solid);
  z-index: 1;
}

td {
  font-feature-settings: "tnum";
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.cell-dir {
  font-family: var(--mono);
  font-weight: 700;
}

.cell-dir.up {
  color: var(--up);
}

.cell-dir.down {
  color: var(--down);
}

.cell-dir .p {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 0.86em;
  margin-left: 5px;
}

.cell-ret.up {
  color: var(--up);
}

.cell-ret.down {
  color: var(--down);
}

.hit-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid;
}

.hit-badge.hit {
  color: #4cd97b;
  border-color: rgba(76, 217, 123, 0.4);
  background: rgba(76, 217, 123, 0.08);
}

.hit-badge.miss {
  color: #ff7b72;
  border-color: rgba(255, 123, 114, 0.4);
  background: rgba(255, 123, 114, 0.08);
}

.hit-badge.pending {
  color: var(--text-faint);
  border-color: var(--card-border-strong);
}

.note {
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-top: 8px;
}

/* ============================================================
   SYSTEM (about) page
   ============================================================ */
body.page-about {
  overflow-y: auto;
}

.about-layout {
  display: block;
  padding: 22px var(--pad-x) 10px;
  overflow-y: auto;
}

.about-section {
  margin-bottom: 22px;
  padding: 22px 28px;
}

.about-section h2 {
  margin-bottom: 4px;
  font-size: 0.84rem;
  color: var(--accent);
}

.about-lead {
  color: var(--text-dim);
  font-size: 0.84rem;
  max-width: 1000px;
  margin-bottom: 14px;
}

.about-lead strong {
  color: var(--text);
}

.diagram {
  width: 100%;
  height: auto;
  display: block;
  margin: 6px auto;
}

.diagram text {
  font-family: "Inter", "Noto Sans JP", sans-serif;
}

.diagram .flow {
  stroke-dasharray: 5 9;
  animation: spps-dash 1.4s linear infinite;
}

@keyframes spps-dash {
  to {
    stroke-dashoffset: -28;
  }
}

.diagram .ring {
  animation: spps-pulse 3.2s ease-in-out infinite;
}

.diagram .ring.r2 {
  animation-delay: 0.8s;
}

.diagram .ring.r3 {
  animation-delay: 1.6s;
}

@keyframes spps-pulse {

  0%,
  100% {
    opacity: 0.08;
  }

  50% {
    opacity: 0.3;
  }
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.spec-card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 18px;
  background: rgba(9, 13, 22, 0.35);
  border-top: 2px solid var(--spec-accent, var(--card-border-strong));
}

.spec-card h3 {
  font-family: var(--mono);
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  color: var(--spec-accent);
}

.spec-card .jp {
  font-size: 0.76rem;
  color: var(--text);
  font-weight: 700;
}

.spec-card p {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 6px;
}

#dev-details {
  font-size: 0.8rem;
  color: var(--text-dim);
}

#dev-details h3 {
  font-size: 0.78rem;
  color: var(--text);
  margin: 12px 0 4px;
  letter-spacing: 0.04em;
}

#dev-details ul {
  padding-left: 18px;
}

#dev-details li {
  margin: 2px 0;
}

#dev-details code {
  background: rgba(9, 13, 22, 0.8);
  padding: 1px 7px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #9ecbff;
  border: 1px solid var(--card-border);
}

/* ---------- responsive ---------- */
@media (max-width: 1100px),
(max-height: 620px) {
  body {
    height: auto;
    min-height: 100%;
  }

  .dashboard-grid,
  .history-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas: "verdict" "chart" "brains";
  }

  .verdict-panel {
    padding: 22px;
    min-height: 220px;
  }

  #price-chart {
    flex: none;
  }

  .table-scroll {
    max-height: 70vh;
  }
}

@media (max-width: 800px) {

  .brains,
  .spec-grid {
    grid-template-columns: 1fr;
  }

  .meta {
    display: none;
  }

  .topbar {
    grid-template-columns: auto auto;
    justify-content: space-between;
  }

  .verdict {
    font-size: 2.6rem;
  }
}