.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--line-strong);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.9rem;
}

.svg-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}
.svg-icon.sm { width: 14px; height: 14px; }
.svg-icon.lg { width: 22px; height: 22px; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--surface-3);
  color: var(--dim);
  flex-shrink: 0;
}
.rank-badge.rank-1 {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(214, 179, 112, 0.4);
  box-shadow: 0 0 12px rgba(214, 179, 112, 0.25);
}
.rank-badge.rank-2 {
  background: var(--silver-soft);
  color: var(--silver);
  border: 1px solid rgba(180, 191, 207, 0.3);
}
.rank-badge.rank-3 {
  background: var(--bronze-soft);
  color: var(--bronze);
  border: 1px solid rgba(199, 143, 102, 0.4);
}

.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--txt);
  font-weight: 600;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
  text-decoration: none;
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn-secondary {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--txt);
}
.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}
.btn-danger {
  background: var(--bad-soft);
  border-color: var(--bad);
  color: var(--bad);
}
.btn-danger:hover {
  background: rgba(240, 112, 122, 0.2);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  flex-shrink: 0;
}
.led.green {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(82, 201, 154, 0.2);
}
.led.amber {
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.led.red {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

.slice-pre {
  background: #080c14;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.25rem 1.4rem;
  font-family: "JetBrains Mono", "SF Mono", "Consolas", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--txt);
  margin-bottom: 1.25rem;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
  letter-spacing: -0.01em;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.metric-badge {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: var(--transition);
}
.metric-badge:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}
.metric-badge .m-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.metric-badge .m-val {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--txt);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.achievement-pill {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}
.achievement-pill:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
}
.achievement-pill .ach-title {
  font-weight: 700;
  color: var(--gold);
}
.achievement-pill .ach-winner {
  font-weight: 600;
  color: var(--txt);
}
.achievement-pill .ach-score {
  color: var(--dim);
  font-size: 0.8rem;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  gap: 1rem;
}
.toggle-item:last-child {
  border-bottom: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: .2s; border-radius: 24px;
}
.slider:before {
  position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background-color: white; transition: .2s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent); border-color: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 0.55rem;
  gap: 1rem;
  transition: var(--transition);
}
.file-item:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--txt);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: slideIn 0.2s var(--ease);
}
.toast-success {
  border-color: rgba(82, 201, 154, 0.4);
  color: var(--ok);
}
.toast-error {
  border-color: rgba(240, 112, 122, 0.4);
  color: var(--bad);
}
.toast-info {
  border-color: rgba(111, 155, 255, 0.4);
  color: var(--accent);
}
@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Login screen styles */
.login-wrap {
  min-height: 80vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 38px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: linear-gradient(160deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line-strong);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.login-card h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--txt);
}
.login-sub {
  margin: 6px 0 24px;
  font-size: 13px;
  color: var(--dim);
}
.field {
  display: block;
  text-align: left;
  margin-bottom: 16px;
}
.field span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  outline: none;
  font-size: 14.5px;
  color: var(--txt);
  transition: border-color .2s, background .2s;
  box-sizing: border-box;
}
.field input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.login-btn {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  transition: filter .2s, transform .2s var(--ease);
}
.login-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* Browser autofill override (prevents bright white/blue inputs) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #151e30 inset !important;
  -webkit-text-fill-color: #e9edf5 !important;
  caret-color: #e9edf5 !important;
  transition: background-color 5000s ease-in-out 0s;
}
