:root {
  color-scheme: dark;
  --bg: #06080a;
  --panel: rgba(12, 17, 20, 0.78);
  --panel-strong: rgba(15, 22, 25, 0.94);
  --line: rgba(185, 255, 220, 0.12);
  --line-strong: rgba(185, 255, 220, 0.24);
  --text: #eef7f1;
  --muted: #93a39b;
  --soft: #c9d8d0;
  --green: #9fffc3;
  --cyan: #8de8ff;
  --yellow: #ffd166;
  --red: #ff6b6b;
  --shadow: rgba(0, 0, 0, 0.42);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  background:
    radial-gradient(circle at 16% 12%, rgba(159, 255, 195, 0.16), transparent 26vw),
    radial-gradient(circle at 76% 18%, rgba(141, 232, 255, 0.11), transparent 28vw),
    linear-gradient(145deg, #050607 0%, #08100d 48%, #0b1514 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.ambient,
.grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient {
  z-index: -3;
  background:
    linear-gradient(120deg, transparent 0 30%, rgba(159, 255, 195, 0.05) 31%, transparent 42%),
    radial-gradient(ellipse at 50% 100%, rgba(159, 255, 195, 0.08), transparent 42%);
}

.grid {
  z-index: -2;
  background-image:
    linear-gradient(rgba(185, 255, 220, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185, 255, 220, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 84%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(185, 255, 220, 0.1);
  background: rgba(5, 8, 8, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(185, 255, 220, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.brand-mark img {
  width: 24px;
  height: 24px;
}

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

.nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.nav a:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(185, 255, 220, 0.06);
}

.shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 60px 0 72px;
}

.hero {
  max-width: 880px;
  margin-bottom: 42px;
}

.kicker,
.panel-head p {
  margin: 0 0 16px;
  color: var(--green);
  font-family: "SFMono-Regular", "Cascadia Code", "Menlo", monospace;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 88px);
  line-height: 0.98;
  font-weight: 790;
  letter-spacing: 0;
}

.summary {
  max-width: 720px;
  margin: 26px 0 0;
  color: var(--soft);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.75;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
  gap: 20px;
  align-items: start;
}

.input-panel,
.result-panel,
.rules-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 34px 100px rgba(0, 0, 0, 0.3);
}

.input-panel,
.result-panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.sample-button,
.ghost,
.rewrite-card button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.sample-button:hover,
.ghost:hover,
.rewrite-card button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(159, 255, 195, 0.06);
}

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid rgba(185, 255, 220, 0.1);
  border-radius: 20px;
  padding: 18px;
  background: rgba(2, 6, 6, 0.42);
  color: var(--text);
  outline: none;
  font-size: 16px;
  line-height: 1.65;
}

textarea:focus {
  border-color: var(--line-strong);
}

textarea::placeholder {
  color: rgba(147, 163, 155, 0.7);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.primary {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--green);
  color: #07110d;
  font-weight: 800;
}

.risk-card {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.risk-card span,
.result-block span,
.rewrite-card span,
.rule-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.risk-card strong {
  font-size: 42px;
  line-height: 1;
}

.risk-card em {
  color: var(--soft);
  font-style: normal;
}

.risk-card.low strong {
  color: var(--green);
}

.risk-card.mid strong {
  color: var(--yellow);
}

.risk-card.high strong {
  color: var(--red);
}

.result-grid,
.rewrite-panel,
.rule-grid {
  display: grid;
  gap: 12px;
}

.result-grid {
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
}

.result-block,
.rewrite-card,
.rule-grid article {
  border: 1px solid rgba(185, 255, 220, 0.1);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.result-block p,
.rewrite-card p,
.rule-grid p {
  margin: 10px 0 0;
  color: var(--soft);
  line-height: 1.7;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips b,
.chips em {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--soft);
  font-size: 13px;
  font-style: normal;
  font-weight: 650;
}

.chips b {
  color: #ffd6d6;
  border-color: rgba(255, 107, 107, 0.28);
  background: rgba(255, 107, 107, 0.08);
}

.rewrite-panel {
  margin-top: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rewrite-card {
  display: grid;
  gap: 12px;
}

.rewrite-card p {
  min-height: 112px;
}

.rewrite-card button {
  justify-self: start;
}

.json-panel {
  margin-top: 12px;
  border: 1px solid rgba(185, 255, 220, 0.1);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.json-panel summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--muted);
  font-weight: 760;
}

pre {
  margin: 0;
  overflow: auto;
  padding: 16px;
  color: #d8ffe6;
  font-family: "SFMono-Regular", "Cascadia Code", "Menlo", monospace;
  font-size: 12px;
  line-height: 1.7;
}

.rules-panel {
  margin-top: 20px;
  padding: 24px;
}

.rule-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .rewrite-panel,
  .rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 64px;
    padding: 0 14px;
  }

  .brand span:last-child {
    display: none;
  }

  .nav a {
    padding: 0 10px;
    font-size: 12px;
  }

  .shell {
    width: calc(100% - 24px);
    padding-top: 38px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .input-panel,
  .result-panel,
  .rules-panel {
    border-radius: 22px;
    padding: 18px;
  }

  .result-grid,
  .rewrite-panel,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }
}
