* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-elevated: #0a0f0a;
  --panel: rgba(10, 15, 10, 0.92);
  --panel-border: #1a2e1a;
  --cyan: #efecc0;
  --cyan-dim: rgba(239, 236, 192, 0.08);
  --sand: #efecc0;
  --sand-dim: rgba(239, 236, 192, 0.08);
  --red: #fc3a3a;
  --red-bg: rgba(252, 58, 58, 0.10);
  --green: #6cffb3;
  --green-bg: rgba(108, 255, 179, 0.10);
  --text: #e9e9e9;
  --muted: #6b8a6b;
  --hazard: repeating-linear-gradient(
    45deg,
    #efecc0 0px,
    #efecc0 6px,
    #111 6px,
    #111 12px
  );
  --glow-cyan: 0 0 8px rgba(0, 234, 219, 0.35), 0 0 20px rgba(0, 234, 219, 0.10);
  --glow-red: 0 0 8px rgba(252, 58, 58, 0.35), 0 0 20px rgba(252, 58, 58, 0.10);
  --glow-green: 0 0 8px rgba(108, 255, 179, 0.35), 0 0 20px rgba(108, 255, 179, 0.10);
}

html, body {
  min-height: 100%;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(0, 234, 219, 0.05), transparent 35%),
    radial-gradient(circle at 20% 100%, rgba(252, 58, 58, 0.04), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: "Courier New", Courier, "Lucida Console", monospace;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.02em;
}

/* CRT scanlines overlay */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  mix-blend-mode: multiply;
}

button, input {
  font: inherit;
  letter-spacing: inherit;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.track-card {
  position: relative;
  width: min(100%, 580px);
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  overflow: hidden;
}

.hazard-stripe {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--hazard);
  opacity: 0.7;
}

.hazard-stripe.top { top: 0; }
.hazard-stripe.bottom { bottom: 0; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 0 0 6px rgba(0, 234, 219, 0.4);
}

h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0.04em;
  color: var(--sand);
}

.topbar p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.icon-button {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid #1f3320;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 120ms ease;
}

.icon-button:hover {
  background: var(--cyan-dim);
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

#track-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #1f3320;
  border-radius: 2px;
  outline: none;
  background: #070c07;
  color: var(--text);
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder {
  color: #2a402a;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 234, 219, 0.15), var(--glow-cyan);
}

.button {
  position: relative;
  width: 100%;
  height: 42px;
  border: 1px solid var(--cyan);
  border-radius: 2px;
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 150ms ease;
}

.button:hover {
  background: var(--cyan-dim);
  color: #b0fff8;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid var(--cyan);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.button.loading .button-label {
  display: none;
}

.button.loading .spinner {
  display: block;
}

.alert {
  padding: 10px 12px;
  border: 1px solid rgba(252, 58, 58, 0.35);
  border-radius: 2px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--glow-red);
  text-shadow: 0 0 4px rgba(252, 58, 58, 0.3);
}

.result {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #1a2e1a;
}

.result-preview {
  width: 112px;
  height: 112px;
  overflow: hidden;
  border: 1px solid #1f3320;
  border-radius: 2px;
  background: #070c07;
  box-shadow: var(--glow-green);
}

.result-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.result-info {
  min-width: 0;
  align-self: center;
}

.success-label {
  margin-bottom: 6px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: 0 0 6px rgba(108, 255, 179, 0.4);
}

.result h2 {
  margin: 0 0 4px;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--sand);
}

.result p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.duration {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid #1f3320;
  border-radius: 2px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 234, 219, 0.06);
  box-shadow: inset 0 0 6px rgba(0, 234, 219, 0.08);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .page-shell { padding: 16px; }
  .track-card { padding: 24px; }
  .result { grid-template-columns: 88px 1fr; }
  .result-preview { width: 88px; height: 88px; }
}