:root {
  --bg0: #d9e4ea;
  --ink: #13212b;
  --muted: #5a6d78;
  --line: rgba(19, 33, 43, 0.12);
  --panel: rgba(247, 251, 252, 0.88);
  --accent: #0f7a6c;
  --accent-2: #1c4d6e;
  --sand: #e7eef3;
  --bad: #9b2c2c;
  --good: #0f7a6c;
  --warn: #9a5b16;
  --shadow: 0 22px 60px rgba(19, 33, 43, 0.1);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Sora", system-ui, sans-serif;
  --display: "Sora", system-ui, sans-serif;
  --radius: 20px;
  --ring: 327;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg0);
  line-height: 1.45;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(15, 122, 108, 0.26), transparent 58%),
    radial-gradient(820px 480px at 92% 4%, rgba(28, 77, 110, 0.18), transparent 55%),
    radial-gradient(700px 500px at 70% 90%, rgba(28, 77, 110, 0.1), transparent 60%),
    linear-gradient(165deg, #cfdce4 0%, #e4eef2 42%, #eef4f6 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: multiply;
}

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 0.5rem;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1.25rem;
  align-items: stretch;
}

.kicker {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.1rem, 4.5vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 11ch;
}

.lede {
  margin: 0.9rem 0 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.25rem;
}

.status {
  min-height: 1.35rem;
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.score-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: fade-up 500ms ease both;
}

.ring-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
}

.ring {
  width: 132px;
  height: 132px;
  transform: rotate(-90deg);
}

.ring-bg,
.ring-fg {
  fill: none;
  stroke-width: 10;
}

.ring-bg {
  stroke: rgba(20, 35, 28, 0.08);
}

.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: var(--ring);
  stroke-dashoffset: var(--ring);
  transition: stroke-dashoffset 700ms cubic-bezier(0.22, 1, 0.36, 1), stroke 300ms ease;
}

.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.ring-label strong {
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.ring-label span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.headline {
  margin: 0.85rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.55);
}

.metrics dt {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.metrics dd {
  margin: 0.1rem 0 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.15rem;
}

.editor {
  display: flex;
  flex-direction: column;
  min-height: 72vh;
  position: sticky;
  top: 1rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.field.grow {
  flex: 1;
  min-height: 0;
}

.field span {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  padding: 0.7rem 0.8rem;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(11, 110, 86, 0.28);
  border-color: rgba(11, 110, 86, 0.4);
}

textarea {
  flex: 1;
  min-height: 320px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
}

.live-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.58rem 1rem;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary {
  background: var(--ink);
  color: #f4fbf7;
}

.secondary {
  background: rgba(11, 110, 86, 0.12);
  color: var(--accent);
  border-color: rgba(11, 110, 86, 0.22);
}

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.55);
}

.swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
}

.graph-wrap {
  border: 1px dashed rgba(20, 35, 28, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(243, 234, 215, 0.25)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 10px,
      rgba(20, 35, 28, 0.02) 10px,
      rgba(20, 35, 28, 0.02) 11px
    );
  overflow: auto;
  min-height: 220px;
}

.graph-wrap svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: auto;
}

.graph-node {
  cursor: pointer;
}

.graph-node .node-hit {
  transition: transform 160ms ease, filter 160ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.graph-node:hover .node-hit {
  transform: scale(1.05);
  filter: drop-shadow(0 6px 10px rgba(19, 33, 43, 0.12));
}

.graph-node:hover rect,
.graph-node:hover ellipse {
  stroke-width: 2.25;
}

.graph-node rect,
.graph-node ellipse {
  stroke-width: 1.5;
  transition: stroke-width 160ms ease;
}

.graph-node text {
  font-family: var(--sans);
  fill: var(--ink);
  pointer-events: none;
}

.graph-node .sub {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.lanes {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.55rem;
}

.edge-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.edge-list li {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.checklist,
.suggestions,
.saved {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.checklist li,
.suggestions li,
.saved li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.62);
  animation: fade-up 420ms ease both;
}

.checklist li.ok {
  border-color: rgba(11, 110, 86, 0.28);
}

.checklist li.bad {
  border-color: rgba(155, 44, 44, 0.22);
}

.check-title {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-weight: 600;
  font-size: 0.92rem;
}

.check-title .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--bad);
  flex: 0 0 auto;
}

.checklist li.ok .dot {
  background: var(--good);
}

.check-detail {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.suggestions li[data-level="good"] {
  border-color: rgba(11, 110, 86, 0.28);
}

.suggestions li[data-level="warn"] {
  border-color: rgba(154, 91, 22, 0.28);
  background: linear-gradient(180deg, #fff, #fbf4ea);
}

.suggestions li[data-level="info"] {
  border-color: rgba(31, 77, 99, 0.22);
}

.saved a {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
}

.saved a:hover {
  text-decoration: underline;
}

.detail-panel {
  border-color: rgba(11, 110, 86, 0.28);
}

.detail-grid {
  display: grid;
  gap: 0.45rem;
}

.detail-grid div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  font-size: 0.88rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.detail-grid dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-grid dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-word;
}

.muted,
.empty {
  color: var(--muted);
}

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .hero,
  .shell,
  .split {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
  }

  .editor {
    position: static;
    min-height: auto;
  }
}
