:root {
  --bg-main: radial-gradient(120% 120% at 50% 15%, #1f2742, #0a0d18 55%, #04060f 100%);
  --panel-start: #171c2e;
  --panel-end: #101423;
  --text: #e8edf7;
  --muted: #9aa3b8;
  --accent-cyan: #7ee0ff;
  --accent-green: #6efacc;
  --accent-red: #ff7b7b;
  --line-soft: #ffffff12;
  --line-faint: #ffffff0f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 28px 18px 48px;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg-main);
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.proj-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-cyan), var(--accent-green));
  box-shadow: 0 0 12px #7ee0ffcc;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.panel {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid #ffffff0d;
  background: linear-gradient(145deg, var(--panel-start), var(--panel-end));
  box-shadow: 0 18px 32px #00000073;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.panel-margin {
  margin-top: 16px;
}

textarea {
  width: 100%;
  min-height: 260px;
  padding: 14px;
  resize: vertical;
  outline: none;
  border-radius: 14px;
  border: 1px solid #ffffff14;
  background: #ffffff08;
  color: var(--text);
  font-size: 14px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
  border-color: #7ee0ffb3;
  box-shadow: 0 0 0 1px #7ee0ff66;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 14px;
}

.word-counter {
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.word-counter.over-limit {
  color: var(--accent-red);
}

.btn {
  border: none;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #0c121f;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
  box-shadow: 0 12px 24px #6efacc40;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 26px #6efacc59;
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.82;
}

.btn-secondary {
  color: var(--text);
  background: linear-gradient(135deg, #2a3556, #1b233e);
  box-shadow: 0 10px 20px #00000059;
}

.btn-secondary:hover {
  box-shadow: 0 14px 22px #00000066;
}

.btn-compact {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 10px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #ffffff0f;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: #ffffff17;
}

.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.gauge-wrap {
  display: grid;
  place-items: center;
  padding: 12px;
}

.gauge {
  position: relative;
  display: grid;
  place-items: center;
  width: 240px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent-cyan) 0deg,
    var(--accent-cyan) var(--fill, 0deg),
    #1b2034 var(--fill, 0deg),
    #1b2034 360deg
  );
  box-shadow: inset 0 0 30px #00000080, 0 12px 28px #00000066;
}

.gauge::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #1d2338, #0f1223 70%);
  box-shadow: inset 0 0 24px #00000099;
}

.gauge-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.prob {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 1px;
}

.label-chip {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-faint);
  background: #ffffff0d;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px #6efacccc;
}

.exp-raw {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line-faint);
  background: #ffffff05;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 14px;
}

.exp-raw:empty {
  display: none;
}

.exp-more {
  margin-top: 10px;
}

.exp-more summary {
  cursor: pointer;
  user-select: none;
  color: var(--muted);
}

.exp-items {
  margin-top: 10px;
  display: grid;
  gap: 12px;
}

.exp-items:empty {
  display: none;
}

.exp-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}

.exp-group {
  display: grid;
  gap: 10px;
  align-content: start;
}

.exp-group-title {
  font-size: 13px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.exp-group-title.ai {
  color: #ff9ea1;
}

.exp-group-title.human {
  color: #8ad9ff;
}

.feature-card {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: radial-gradient(140% 140% at 20% 20%, #ffffff08, #0e1322 65%);
  box-shadow: 0 12px 20px #0000004f;
}

.feature-card.positive {
  border-color: #ff7b7b55;
}

.feature-card.negative {
  border-color: #6efacc55;
}

.feature-name {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.feature-metrics {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.feature-chip {
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid #ffffff14;
  background: #ffffff12;
}

.feature-exp {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
}

.panel-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ablation-label {
  font-size: 13px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.feature-menu-wrap {
  position: relative;
}

.feature-menu-dropdown {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 20;
  width: min(360px, calc(100vw - 44px));
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(145deg, var(--panel-start), var(--panel-end));
  box-shadow: 0 18px 30px #0000007a;
  display: grid;
  gap: 10px;
}

.feature-menu-dropdown.open-up {
  top: auto;
  bottom: 40px;
}

.feature-menu-dropdown[hidden] {
  display: none;
}

.ablation-checklist {
  width: 100%;
  min-height: 150px;
  max-height: 250px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: #ffffff08;
  color: var(--text);
  font-size: 13px;
  display: grid;
  gap: 8px;
  overflow: auto;
}

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

.ablation-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #ffffff05;
}

.ablation-option:hover {
  border-color: var(--line-soft);
  background: #ffffff0d;
}

.ablation-tick {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.ablation-option-text {
  line-height: 1.3;
}

.feature-menu-actions {
  display: flex;
  justify-content: flex-end;
}

.ablation-output {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line-faint);
  background: #ffffff05;
  font-size: 14px;
  color: var(--text);
  display: grid;
  gap: 10px;
}

.ablation-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.ablation-metric {
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: #ffffff08;
}

.ablation-metric-name {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ablation-metric-value {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
}

.ablation-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ablation-feature-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.ablation-note {
  color: var(--muted);
  font-style: italic;
}

.ablation-caveat {
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #000000bf;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 560px) {
  body {
    padding: 20px 12px 36px;
  }

  .proj-name {
    font-size: 20px;
  }

  .gauge {
    width: 210px;
  }

  .prob {
    font-size: 36px;
  }
}
