:root {
  --bg: #1e1e1e;
  --text: #f5f5f5;
  --muted: #aab3c5;
  --accent: #6aa0ff;
  --accent-2: #7ae7c7;
  --fail: #ff6b6b;
  --pass: #38d996;
  --neutral: #ffd166;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Inter,
    "Helvetica Neue", Arial;
  padding: 20px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

canvas#background-stars {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

h1 {
  margin: 0 0 6px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.site-header {
  padding: 24px 20px 10px;
  text-align: center;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.container {
  max-width: 1100px;
  margin: 20px auto 32px;
  padding: 0 16px;
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1.2fr;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 18px 10px 28px;
}

.input-panel,
.results-panel {
  background: linear-gradient(
    145deg,
    rgba(20, 20, 20, 0.7) 0%,
    rgba(30, 30, 30, 0.6) 40%,
    rgba(40, 40, 40, 0.5) 70%,
    rgba(60, 60, 60, 0.4) 100%
  );
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-head h2 {
  margin: 6px 0 12px;
}

.output-box {
  min-height: 220px;
  max-height: 60vh;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.15); 
  border-radius: 14px;
  padding: 12px;
  background: rgba(42, 42, 44, 0.5); 
}

.output-box .empty {
  color: #9aa4bf;
}

.controls textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.15); 
  border-radius: 14px;
  background: rgba(42, 42, 44, 0.5); 
  color: var(--text);
  padding: 12px 12px;
  line-height: 1.4;
  outline: none;
}

.controls textarea::placeholder {
  color: #7c87a6;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.export-row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.15); 
  background: rgba(51, 52, 54, 0.7);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.02s ease, background 0.2s ease, border-color 0.2s ease;
  transform: translateZ(0);
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover {
  background: rgba(18, 32, 90, 0.8);
  border-color: #2a3f78;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.export-row .btn {
  position: relative;
}
.export-row .btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, rgba(34, 35, 36, 0.8), rgba(19, 42, 92, 0.9));
  border-color: #2a3f78;
}

.split {
  position: relative;
}

.menu {
  position: absolute;
  top: 110%;
  left: 0;
  min-width: 240px;
  background: #29292c;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 2;
}

.menu button {
  text-align: left;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 8px 12px;
  width: 100%;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.menu button:hover {
  background: rgba(80, 80, 85, 0.7);
}

.validation {
  margin: 8px 2px 0;
  color: #ffd166;
  min-height: 1.2em;
}

.hint {
  margin-top: 8px;
  color: var(--muted);
}

.kv {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 0;
}

.kv li {
  padding: 4px 0;
  border-bottom: 1px dashed rgba(31, 44, 85, 0.5);
}

.kv li:last-child {
  border-bottom: 0;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 10px 0 0;
}

.auth-card {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px;
  background: rgba(11, 20, 53, 0.5);
}

.legend {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0 2px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge.pass {
  background: #0e2f22;
  color: #8af3c5;
  border-color: #215c49;
}

.badge.fail {
  background: #3a1414;
  color: #ff9a9a;
  border-color: #6b2626;
}

.badge.neutral {
  background: #3a3014;
  color: #ffe28a;
  border-color: #6b5a26;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 27, 67, 0.7);
  color: #cfe0ff;
}

.timeline {
  list-style: none;
  padding-left: 0;
  margin: 10px 0 0;
  counter-reset: hop;
}

.timeline li {
  counter-increment: hop;
  position: relative;
  padding-left: 32px;
  margin: 10px 0;
  border-left: 2px solid #20315e;
}

.timeline li::before {
  content: counter(hop);
  position: absolute;
  left: -13px;
  top: -2px;
  background: #152655;
  border: 2px solid #2a3f78;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  color: #cfe0ff;
  font-weight: 700;
}

.timeline .item {
  display: grid;
  gap: 4px;
}

.timeline .meta {
  color: var(--muted);
  font-size: 12px;
}

.delays {
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed #2a3f78;
  border-radius: 10px;
  background: rgba(11, 20, 53, 0.5);
}

.delays .delay {
  margin: 2px 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .container {
    grid-template-columns: 1fr;
  }
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }
}
