:root {
  --bg: #0b1210;
  --bg-elevated: rgba(18, 32, 28, 0.82);
  --ink: #e8f2ec;
  --muted: #8aa396;
  --line: rgba(126, 184, 156, 0.22);
  --accent: #7dffb3;
  --accent-deep: #2f9e6a;
  --danger: #ff7a7a;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Outfit", system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 55% at 12% -10%, rgba(47, 158, 106, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 10%, rgba(125, 255, 179, 0.08), transparent 50%),
    linear-gradient(165deg, #0b1210 0%, #101a16 45%, #0a100e 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(125, 255, 179, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 255, 179, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 20%, transparent 75%);
  pointer-events: none;
}

.shell {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

.brand {
  margin-bottom: 2.25rem;
  animation: rise 0.7s ease both;
}

.brand__mark {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.brand__tag {
  margin: 0.85rem 0 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.2rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: rise 0.75s ease both;
  animation-delay: 0.08s;
}

.panel + .panel {
  margin-top: 1.1rem;
  animation-delay: 0.16s;
}

.panel--history {
  animation-delay: 0.24s;
}

.fetch-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem 0.75rem;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  grid-column: 1 / -1;
}

.field--narrow {
  grid-column: 1 / 2;
}

.field__label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__label em {
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(6, 12, 10, 0.75);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  font: 500 0.98rem/1.3 var(--mono);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder {
  color: rgba(138, 163, 150, 0.55);
}

input:focus {
  border-color: rgba(125, 255, 179, 0.55);
  box-shadow: 0 0 0 3px rgba(125, 255, 179, 0.12);
}

.btn {
  justify-self: end;
  border: 0;
  border-radius: 10px;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(135deg, var(--accent) 0%, #4fd98f 100%);
  color: #062016;
  font: 600 0.95rem/1 var(--sans);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.hint {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.result-head h2 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  font-family: var(--mono);
  font-weight: 500;
}

.meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.text-link:hover {
  text-decoration: underline;
}

.progress {
  margin-top: 1rem;
}

.progress__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.progress__meta #progress-label {
  color: var(--ink);
}

.progress__track {
  height: 6px;
  border-radius: 999px;
  background: rgba(125, 255, 179, 0.12);
  overflow: hidden;
}

.progress__bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width 0.35s ease;
}

.progress__bar.is-indeterminate {
  width: 35%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: slide 1.2s ease-in-out infinite;
  transition: none;
}

.files-wrap {
  margin-top: 1.15rem;
}

.files-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.file-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list {
  max-height: 22rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 12, 10, 0.55);
}

.file-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(126, 184, 156, 0.12);
}

.file-list li:last-child {
  border-bottom: 0;
}

.file-path {
  font-family: var(--mono);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--mono);
}

.file-dl {
  color: #062016;
  background: var(--accent);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 7px;
}

.file-dl:hover {
  filter: brightness(1.08);
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.history-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font: 500 0.82rem/1 var(--sans);
  cursor: pointer;
}

.ghost-btn:hover {
  color: var(--ink);
  border-color: rgba(125, 255, 179, 0.4);
}

.ghost-btn--danger {
  color: var(--danger);
  border-color: rgba(255, 122, 122, 0.35);
}

.ghost-btn--danger:hover {
  color: #ff9b9b;
  border-color: rgba(255, 122, 122, 0.65);
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.history-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(126, 184, 156, 0.14);
}

.history-list li.history-empty {
  display: block;
  border-top: 0;
  color: var(--muted);
  padding: 0.25rem 0;
}

.history-repo {
  font-family: var(--mono);
  font-size: 0.88rem;
}

.history-meta {
  color: var(--muted);
  font-size: 0.8rem;
  grid-column: 1;
}

.history-actions {
  grid-row: 1 / span 2;
  align-self: center;
  display: flex;
  gap: 0.45rem;
}

.chip {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chip.is-ready {
  color: var(--accent);
  border-color: rgba(125, 255, 179, 0.45);
}

.chip.is-cancelled {
  color: #c4b59a;
  border-color: rgba(196, 181, 154, 0.45);
}

.chip.is-downloading,
.chip.is-queued {
  color: #f0d48a;
  border-color: rgba(240, 212, 138, 0.4);
}

.footer {
  margin-top: 1.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  animation: rise 0.8s ease both;
  animation-delay: 0.3s;
}

.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;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 1.25rem, 920px);
    padding-top: 2rem;
  }

  .fetch-form {
    grid-template-columns: 1fr;
  }

  .field--narrow,
  .btn {
    grid-column: 1;
    justify-self: stretch;
    width: 100%;
  }

  .file-list li {
    grid-template-columns: 1fr auto;
  }

  .file-path {
    grid-column: 1 / -1;
    white-space: normal;
    word-break: break-all;
  }
}
