:root {
  --ink: #070707;
  --muted: #6d7178;
  --line: #d9dde3;
  --blue: #1467d9;
  --red: #e21b1b;
  --green: #18834b;
  --paper: #ffffff;
  --soft: #f7f8fa;
  --shadow: 0 18px 45px rgba(7, 7, 7, 0.08);
  --signal-left: #4c55e9;
  --signal-right: #d64279;
  --signal-glow: rgba(116, 79, 226, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
}

a {
  color: inherit;
}

.site-header,
main,
footer {
  width: min(1420px, calc(100vw - 48px));
  margin: 0 auto;
}

.site-header {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-grid;
  gap: 2px;
  text-decoration: none;
  line-height: 1;
}

.brand-name {
  display: inline-flex;
  align-items: baseline;
  justify-self: start;
  width: max-content;
}

.brand-japan,
.brand-real,
.brand-39 {
  font-size: clamp(31px, 3.2vw, 52px);
  letter-spacing: 0;
}

.brand-japan {
  font-weight: 300;
}

.brand-real {
  font-weight: 760;
}

.brand-39 {
  color: var(--red);
  font-weight: 780;
}

.hero {
  padding: 34px 0 22px;
}

h1 {
  max-width: 960px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 6vw, 88px);
  font-weight: 650;
  line-height: 0.98;
  letter-spacing: 0;
}

#today-count {
  color: var(--red);
}

.phrase-line {
  margin: 22px 0 8px;
  font-size: clamp(18px, 1.8vw, 28px);
  line-height: 1.35;
}

.signal-stage {
  position: relative;
  min-height: clamp(245px, 31vw, 430px);
  display: grid;
  place-items: center;
  margin: clamp(12px, 2.2vw, 30px) 0 4px;
  overflow: hidden;
  perspective: 1200px;
}

.signal-canvas {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.signal-canvas:active {
  cursor: grabbing;
}

.signal-stage.has-webgl .signal-fallback {
  opacity: 0;
}

.signal-stage::after {
  content: "";
  position: absolute;
  width: min(56vw, 640px);
  height: 28px;
  bottom: clamp(18px, 4vw, 54px);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(50, 36, 110, 0.22), rgba(50, 36, 110, 0));
  filter: blur(8px);
}

.signal-39 {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1vw, 18px);
  transform: rotateX(var(--signal-rotate-x, 8deg)) rotateY(var(--signal-rotate-y, -13deg));
  animation: signal-drift 8s ease-in-out infinite;
  filter: drop-shadow(0 26px 32px rgba(74, 50, 150, 0.26));
  cursor: grab;
  touch-action: none;
  user-select: none;
  will-change: transform;
}

.signal-39:active,
.signal-39.is-dragging {
  animation: none;
  cursor: grabbing;
}

.signal-39 span {
  position: relative;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(160px, 23vw, 330px);
  font-weight: 760;
  line-height: 0.78;
  letter-spacing: 0;
  color: transparent;
  background:
    radial-gradient(circle at 36% 18%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.22) 20%, transparent 34%),
    linear-gradient(120deg, var(--signal-left), rgba(125, 80, 229, 0.9) 45%, var(--signal-right));
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow:
    1px 1px 0 rgba(255, 255, 255, 0.8),
    10px 8px 0 rgba(87, 74, 212, 0.2),
    18px 15px 0 rgba(218, 44, 98, 0.16);
}

.signal-39 span::before,
.signal-39 span::after {
  content: attr(data-echo);
  position: absolute;
  inset: 0;
  color: transparent;
  pointer-events: none;
  -webkit-background-clip: text;
  background-clip: text;
}

.signal-39 span::before {
  background-image: linear-gradient(130deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0));
  transform: translate(-5px, -8px);
}

.signal-39 span::after {
  background-image: linear-gradient(130deg, rgba(50, 59, 188, 0.25), rgba(225, 38, 89, 0.22));
  transform: translate(14px, 16px);
  z-index: -1;
}

.particle-field {
  position: absolute;
  z-index: 1;
  width: 36%;
  height: 62%;
  top: 25%;
  opacity: 0.7;
  background-image:
    radial-gradient(circle, currentColor 0 1.2px, transparent 1.6px),
    radial-gradient(circle, currentColor 0 1px, transparent 1.4px);
  background-size: 34px 24px, 51px 37px;
  mask-image: linear-gradient(90deg, transparent, #000 24%, #000 74%, transparent);
}

.particle-field::before {
  content: "39  39  39  39  39  39  39  39  39";
  position: absolute;
  inset: 0;
  font-size: clamp(10px, 1.1vw, 17px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 2.25;
  word-spacing: 17px;
}

.particle-field-left {
  left: 0;
  color: rgba(68, 80, 232, 0.62);
  transform: rotate(-7deg);
}

.particle-field-right {
  right: 0;
  color: rgba(226, 27, 72, 0.6);
  transform: rotate(7deg);
}

@keyframes signal-drift {
  0%, 100% {
    transform: rotateX(var(--signal-rotate-x, 8deg)) rotateY(var(--signal-rotate-y, -13deg)) translateY(0);
  }
  50% {
    transform: rotateX(calc(var(--signal-rotate-x, 8deg) - 2deg)) rotateY(calc(var(--signal-rotate-y, -13deg) + 23deg)) translateY(-10px);
  }
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  max-width: 920px;
  margin: 4px auto 0;
}

.metric-panel {
  min-width: 0;
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 0 clamp(14px, 3vw, 44px);
  text-align: center;
}

.metric-panel + .metric-panel {
  border-left: 1px solid var(--line);
}

.metric-label {
  font-size: 12px;
  font-weight: 740;
  line-height: 1;
  text-transform: uppercase;
}

.metric-panel strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 5vw, 66px);
  font-weight: 430;
  line-height: 0.96;
}

.metric-panel span:last-child {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.split-line {
  margin: 0;
  font-size: clamp(17px, 1.45vw, 24px);
}

.share-line {
  margin-top: 0;
}

.definition {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.definition-stack {
  display: grid;
  gap: 4px;
  justify-items: center;
  margin-top: 28px;
  text-align: center;
}

.highlight-phrase {
  color: var(--red);
  font-weight: 700;
  background: rgba(226, 27, 27, 0.08);
  border-radius: 4px;
  padding: 0 2px;
}

.blue {
  color: var(--blue);
}

.red {
  color: var(--red);
}

.green {
  color: var(--green);
}

.dot {
  color: var(--muted);
  padding: 0 8px;
}

.wave-section {
  padding: 20px 0 44px;
}

.legend {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.key {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.key-blue {
  background: var(--blue);
}

.key-red {
  background: var(--red);
}

.chart-shell {
  position: relative;
  border-bottom: 1px solid var(--line);
  min-height: 340px;
}

#wave-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 300px;
  overflow: visible;
}

.wave-dot {
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  dominant-baseline: middle;
  text-anchor: middle;
  user-select: none;
}

.wave-dot:hover,
.wave-dot.is-selected {
  filter: drop-shadow(0 0 5px currentColor);
}

.marker {
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-dasharray: 4 6;
}

.marker-tip {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2;
}

.tooltip {
  position: absolute;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.35;
  pointer-events: none;
}

.tooltip strong {
  display: block;
  font-size: 18px;
}

.axis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: #2b2f35;
  font-size: 15px;
  padding-top: 10px;
}

.axis span:nth-child(2),
.axis span:nth-child(3),
.axis span:nth-child(4) {
  text-align: center;
}

.axis span:last-child {
  text-align: right;
}

.evidence {
  padding: 24px 0 58px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(27px, 2.4vw, 38px);
  line-height: 1.1;
}

.section-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

.ghost-button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  padding: 9px 15px;
}

.ghost-button:hover {
  border-color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--ink);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  text-transform: lowercase;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.type-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.source-link {
  color: #0a397f;
  text-decoration: none;
  white-space: nowrap;
}

.source-link:hover {
  text-decoration: underline;
}

.method {
  border-top: 1px solid var(--line);
  padding: 44px 0 62px;
}

.method p {
  max-width: 860px;
  color: #32363d;
  font-size: 18px;
  line-height: 1.65;
}

.header-credit {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.header-credit a,
footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.header-credit a:hover,
footer a:hover {
  border-color: var(--ink);
}

footer {
  border-top: 1px solid var(--line);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 860px) {
  .site-header,
  main,
  footer {
    width: min(100vw - 28px, 680px);
  }

  .site-header {
    min-height: 92px;
    align-items: flex-start;
    padding: 20px 0 14px;
  }

  .header-credit {
    padding-top: 4px;
    font-size: 12px;
  }

  .hero {
    padding-top: 24px;
  }

  h1 {
    font-size: clamp(40px, 12vw, 58px);
  }

  .signal-stage {
    min-height: 300px;
  }

  .particle-field {
    width: 44%;
    opacity: 0.48;
  }

  .metric-strip {
    max-width: 100%;
  }

  .legend {
    justify-content: flex-start;
  }

  .chart-shell {
    min-height: 260px;
  }

  #wave-chart {
    min-height: 230px;
  }

  .wave-dot {
    font-size: 9px;
  }

  .section-heading {
    align-items: flex-start;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px 0;
  }
}

@media (max-width: 560px) {
  .brand-japan,
  .brand-real,
  .brand-39 {
    font-size: 31px;
  }

  .tagline {
    max-width: 230px;
    font-size: 12px;
  }

  .site-header {
    gap: 10px;
    flex-direction: column;
  }

  .header-credit {
    align-self: flex-start;
  }

  .phrase-line {
    font-size: 17px;
  }

  .signal-stage {
    min-height: 235px;
    margin-top: 18px;
  }

  .signal-39 span {
    font-size: clamp(128px, 42vw, 190px);
  }

  .particle-field {
    top: 31%;
    height: 50%;
    opacity: 0.34;
  }

  .metric-strip {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 8px;
  }

  .metric-panel {
    border-left: 0;
    padding: 0;
  }

  .metric-panel + .metric-panel {
    border-left: 0;
  }

  .metric-panel strong {
    font-size: 42px;
  }

  .split-line {
    font-size: 16px;
  }

  .chart-shell {
    min-height: 220px;
  }

  .axis {
    font-size: 12px;
  }

  .tooltip {
    min-width: 150px;
    font-size: 12px;
  }

  .tooltip strong {
    font-size: 16px;
  }
}
