:root {
  --ink: #111827;
  --muted: #596274;
  --paper: #f7f8f3;
  --line: rgba(17, 24, 39, 0.14);
  --line-strong: rgba(17, 24, 39, 0.24);
  --green: #2d6a4f;
  --amber: #9a5b13;
  --red: #8f2d32;
  --blue: #294c7a;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  overflow-x: hidden;
  min-height: 100%;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(45, 106, 79, 0.08), transparent 34%),
    var(--paper);
  letter-spacing: 0;
}

.field-canvas,
.page-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.field-canvas {
  z-index: 0;
  width: 100%;
  height: 100%;
}

.page-texture {
  z-index: 1;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 86%, transparent);
}

.utility-link {
  position: fixed;
  z-index: 3;
  top: clamp(18px, 3vw, 34px);
  right: clamp(18px, 4vw, 48px);
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  background: rgba(255, 255, 250, 0.58);
  font-size: 0.84rem;
  font-weight: 760;
  text-decoration: none;
  backdrop-filter: blur(10px);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.utility-link:hover {
  border-color: rgba(41, 76, 122, 0.28);
  background: rgba(255, 255, 250, 0.84);
  transform: translateY(-1px);
}

.home-shell {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 100svh;
  align-items: center;
  padding: clamp(28px, 6vw, 80px);
}

.tool-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 560px);
  gap: clamp(34px, 7vw, 96px);
  align-items: center;
  width: min(1180px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(72px, 8vw, 112px) clamp(24px, 6vw, 72px);
}

.decision-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: clamp(34px, 8vw, 112px);
  align-items: center;
  width: min(1220px, 100%);
}

.copy-block {
  max-width: 920px;
}

.tool-header {
  max-width: 620px;
}

.tool-home-link {
  display: inline-flex;
  margin-bottom: clamp(28px, 5vw, 56px);
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 780;
  text-decoration: none;
}

.tool-home-link:hover {
  color: var(--green);
}

.kicker {
  max-width: 42rem;
  margin: 0 0 18px;
  color: var(--green);
  font-size: clamp(0.78rem, 1.3vw, 0.95rem);
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(4.3rem, 16vw, 11.5rem);
  font-weight: 820;
  line-height: 0.88;
  letter-spacing: 0;
  text-wrap: balance;
}

.tool-header h1 {
  max-width: 12ch;
  font-size: clamp(3.15rem, 8vw, 7rem);
  line-height: 0.9;
}

.statement {
  max-width: 42rem;
  margin: clamp(24px, 4vw, 42px) 0 0;
  color: var(--muted);
  font-size: clamp(1.15rem, 2.4vw, 1.58rem);
  line-height: 1.75;
}

.principles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(18px, 4vw, 34px);
  padding: clamp(22px, 4vw, 38px) 0 0;
  margin: clamp(28px, 5vw, 48px) 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.principles li {
  color: var(--ink);
  font-size: clamp(0.92rem, 1.7vw, 1.05rem);
  font-weight: 760;
}

.principles li:nth-child(1) {
  color: var(--green);
}

.principles li:nth-child(2) {
  color: var(--amber);
}

.principles li:nth-child(3) {
  color: var(--red);
}

.transcript-panel {
  display: grid;
  grid-template-rows: none;
  gap: 12px;
  align-self: stretch;
  min-height: 520px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 250, 0.88), rgba(255, 255, 250, 0.62)),
    rgba(255, 255, 250, 0.76);
  box-shadow:
    0 32px 90px rgba(17, 24, 39, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(12px);
  animation: boardReveal 900ms ease both;
}

.tool-panel {
  align-self: center;
  min-height: 620px;
}

.transcript-heading {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker {
  margin: 0;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.transcript-heading h2 {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 3.2rem);
  font-weight: 820;
  line-height: 1;
  letter-spacing: 0;
}

.field-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.transcript-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
select,
textarea,
button {
  font: inherit;
  letter-spacing: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 260px;
  padding: 12px;
  resize: vertical;
  line-height: 1.65;
}

.transcript-output {
  display: block;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(41, 76, 122, 0.42);
  outline-offset: 2px;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 780;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.primary-button {
  min-width: 86px;
  padding: 0 18px;
  color: #fff;
  background: var(--green);
}

.secondary-button {
  width: 100%;
  padding: 0 14px;
  color: var(--blue);
  background: rgba(41, 76, 122, 0.08);
  border-color: rgba(41, 76, 122, 0.22);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.transcript-status {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  font-size: 0.88rem;
  line-height: 1.35;
}

.transcript-status[data-state="loading"] {
  color: var(--amber);
  border-color: rgba(154, 91, 19, 0.28);
  background: rgba(154, 91, 19, 0.08);
}

.transcript-status[data-state="success"] {
  color: var(--green);
  border-color: rgba(45, 106, 79, 0.24);
  background: rgba(45, 106, 79, 0.08);
}

.transcript-status[data-state="error"] {
  color: var(--red);
  border-color: rgba(143, 45, 50, 0.28);
  background: rgba(143, 45, 50, 0.08);
}

.signal-board {
  position: relative;
  aspect-ratio: 0.82;
  min-height: 420px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 49%, rgba(17, 24, 39, 0.1) 49% 51%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(17, 24, 39, 0.1) 49% 51%, transparent 51%),
    repeating-linear-gradient(0deg, transparent 0 37px, rgba(17, 24, 39, 0.055) 37px 38px),
    repeating-linear-gradient(90deg, transparent 0 37px, rgba(17, 24, 39, 0.055) 37px 38px),
    rgba(255, 255, 250, 0.46);
  box-shadow:
    0 32px 90px rgba(17, 24, 39, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.54);
  overflow: hidden;
  animation: boardReveal 900ms ease both;
}

.signal-board::before,
.signal-board::after {
  position: absolute;
  content: "";
  background: var(--line-strong);
}

.signal-board::before {
  top: 18%;
  right: 0;
  left: 0;
  height: 1px;
}

.signal-board::after {
  top: 0;
  bottom: 0;
  left: 64%;
  width: 1px;
}

.board-grid {
  position: absolute;
  inset: 13% 14%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.board-grid span {
  position: relative;
}

.board-grid span::before {
  position: absolute;
  width: 9px;
  height: 9px;
  content: "";
  background: var(--ink);
  border-radius: 50%;
  box-shadow: 0 0 0 9px rgba(17, 24, 39, 0.045);
  transform: translate(-50%, -50%);
  animation: pulsePoint 4.8s ease-in-out infinite;
}

.board-grid span:nth-child(3n + 1)::before {
  background: var(--green);
}

.board-grid span:nth-child(3n + 2)::before {
  background: var(--amber);
  animation-delay: -1.4s;
}

.board-grid span:nth-child(3n + 3)::before {
  background: var(--red);
  animation-delay: -2.6s;
}

.board-grid span:nth-child(1)::before { top: 18%; left: 18%; }
.board-grid span:nth-child(2)::before { top: 38%; left: 72%; }
.board-grid span:nth-child(3)::before { top: 66%; left: 44%; }
.board-grid span:nth-child(4)::before { top: 22%; left: 58%; }
.board-grid span:nth-child(5)::before { top: 76%; left: 28%; }
.board-grid span:nth-child(6)::before { top: 46%; left: 62%; }
.board-grid span:nth-child(7)::before { top: 20%; left: 36%; }
.board-grid span:nth-child(8)::before { top: 62%; left: 84%; }
.board-grid span:nth-child(9)::before { top: 44%; left: 26%; }
.board-grid span:nth-child(10)::before { top: 72%; left: 54%; }
.board-grid span:nth-child(11)::before { top: 34%; left: 76%; }
.board-grid span:nth-child(12)::before { top: 82%; left: 38%; }

.signal-line,
.signal-axis {
  position: absolute;
  transform-origin: left center;
}

.signal-line {
  height: 2px;
  background: currentColor;
  opacity: 0.72;
  animation: scanLine 5.6s ease-in-out infinite;
}

.line-a {
  top: 32%;
  left: 16%;
  width: 54%;
  color: var(--green);
  transform: rotate(17deg);
}

.line-b {
  top: 58%;
  left: 19%;
  width: 63%;
  color: var(--amber);
  transform: rotate(-10deg);
  animation-delay: -1.8s;
}

.line-c {
  top: 75%;
  left: 28%;
  width: 46%;
  color: var(--red);
  transform: rotate(-31deg);
  animation-delay: -3.2s;
}

.signal-axis {
  background: rgba(17, 24, 39, 0.2);
}

.axis-x {
  right: 12%;
  bottom: 14%;
  left: 12%;
  height: 1px;
}

.axis-y {
  top: 12%;
  bottom: 14%;
  left: 14%;
  width: 1px;
}

@keyframes pulsePoint {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.82);
    opacity: 0.58;
  }

  48% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
}

@keyframes scanLine {
  0%,
  100% {
    clip-path: inset(0 100% 0 0);
    opacity: 0.22;
  }

  45%,
  62% {
    clip-path: inset(0 0 0 0);
    opacity: 0.78;
  }
}

@keyframes boardReveal {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .tool-shell {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 34px;
  }

  .tool-header {
    max-width: 760px;
  }

  .tool-panel {
    width: 100%;
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .home-shell {
    align-items: end;
    padding: 76px 20px 42px;
  }

  .utility-link {
    top: 16px;
    right: 16px;
    min-height: 34px;
    font-size: 0.78rem;
  }

  .tool-shell {
    min-height: 100svh;
    padding: 72px 20px 42px;
  }

  .decision-home {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  h1 {
    font-size: clamp(4rem, 22vw, 6.8rem);
  }

  .tool-header h1 {
    font-size: clamp(3.25rem, 16vw, 5.8rem);
  }

  .tool-home-link {
    margin-bottom: 28px;
  }

  .tool-header .statement {
    font-size: 1.02rem;
    line-height: 1.65;
  }

  .principles {
    display: grid;
    gap: 12px;
  }

  .transcript-panel {
    min-height: 460px;
  }

  .transcript-input-row {
    grid-template-columns: 1fr;
  }

  .signal-board {
    min-height: 250px;
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
