:root {
  color-scheme: dark;
  --bg: #080a09;
  --panel: #171b18;
  --panel-2: #20241f;
  --line: #313831;
  --text: #f1f5f0;
  --muted: #a1aa9f;
  --soft: #c6d1c3;
  --green: #7ae582;
  --green-2: #2fbf71;
  --amber: #ffca5f;
  --red: #ff7b72;
  --cyan: #5cc8ff;
  --ink: #0d100e;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(122, 229, 130, 0.12), transparent 30rem),
    linear-gradient(180deg, #101311 0%, var(--bg) 42%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(34px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 9vw, 48px);
  line-height: 0.96;
}

h2 {
  font-size: 19px;
  line-height: 1.15;
}

.cloud-pill,
.sample-count {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--soft);
  background: rgba(23, 27, 24, 0.78);
  font-size: 12px;
  white-space: nowrap;
}

.cloud-pill.ok {
  color: var(--green);
  border-color: rgba(122, 229, 130, 0.35);
}

.cloud-pill.warn {
  color: var(--amber);
  border-color: rgba(255, 202, 95, 0.35);
}

.panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 24, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 720;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #3a423a;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--text);
  background: #0e110f;
  outline: none;
}

input:focus {
  border-color: rgba(122, 229, 130, 0.8);
  box-shadow: 0 0 0 3px rgba(122, 229, 130, 0.14);
}

.field-hint {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.with-unit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.with-unit span {
  min-width: 24px;
  color: var(--muted);
  font-weight: 800;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 2px;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: var(--ink);
  background: linear-gradient(135deg, var(--green), #bafc7c);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.secondary-button,
.icon-button {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.secondary-button.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  font-size: 24px;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-message.error {
  color: var(--red);
}

.form-message.ok {
  color: var(--green);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.metric-card {
  min-height: 122px;
  padding: 14px;
  display: grid;
  align-content: space-between;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card:nth-child(4) strong {
  font-size: 24px;
  line-height: 1.04;
}

.verdict-panel {
  display: grid;
  gap: 10px;
  background:
    linear-gradient(135deg, rgba(122, 229, 130, 0.14), rgba(92, 200, 255, 0.08)),
    rgba(23, 27, 24, 0.96);
}

.verdict-panel p:last-child {
  margin: 0;
  color: var(--soft);
  line-height: 1.55;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 12 / 7;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0e0c;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.dot.current {
  background: var(--green);
}

.dot.public {
  background: var(--cyan);
}

.line {
  width: 20px;
  height: 2px;
  display: inline-block;
  background: var(--amber);
}

.records-list {
  display: grid;
  gap: 8px;
}

.record-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101310;
}

.record-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.record-row small {
  color: var(--muted);
  line-height: 1.35;
}

.record-score {
  text-align: right;
}

.record-score b {
  display: block;
  font-size: 18px;
}

.record-score span {
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (min-width: 760px) {
  .app-shell {
    padding-inline: 22px;
  }

  .input-panel {
    padding: 20px;
  }

  .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
  }

  .form-grid label:first-child {
    grid-column: span 2;
  }

  .field-hint {
    grid-column: span 2;
    align-self: center;
    margin: 0;
  }

  .form-actions {
    grid-column: span 2;
  }

  .form-message {
    grid-column: span 2;
    align-self: center;
  }

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