:root {
  color-scheme: dark;
  --bg: #050716;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-alt: rgba(255, 255, 255, 0.08);
  --text: #f2f4ff;
  --muted: #a6b1d4;
  --primary: #6ad3ff;
  --primary-dark: #3aa5ff;
  --radius: 16px;
  --border: 1px solid rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --retro-left-fr: 1.2fr;
  --retro-right-fr: 1fr;
  --layout-max: 2000px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.25), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(45, 212, 191, 0.18), transparent 30%),
    radial-gradient(circle at 40% 60%, rgba(52, 211, 255, 0.2), transparent 32%),
    var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1rem 90px;
}

.layout {
  width: min(var(--layout-max), 100vw);
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
  flex: 1;
}

.hero {
  text-align: center;
  padding: 0 1rem;
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 2.9rem);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.card,
.card-muted {
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.card-muted {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.05);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.field label,
.field legend {
  font-weight: 600;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-two {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

input,
select,
textarea,
button {
  font: inherit;
  border-radius: calc(var(--radius) / 1.4);
  border: var(--border);
  background: var(--surface-alt);
  color: var(--text);
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

button.primary {
  margin-top: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(58, 165, 255, 0.3);
}

button.link-button {
  background: rgba(15, 23, 42, 0.45);
  border: var(--border);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

button.link-button:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.7);
  transform: translateY(-1px);
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(58, 165, 255, 0.4);
}

button.primary:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--retro-left-fr)) minmax(0, var(--retro-right-fr));
  gap: 2rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -120px;
  padding: 0.85rem 1.2rem;
  color: var(--text);
  font-size: 0.95rem;
  background: rgba(5, 7, 22, 0.9);
  backdrop-filter: blur(12px);
  border-top: var(--border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  z-index: 20;
  transition: transform 0.35s ease, bottom 0.35s ease, opacity 0.35s ease;
  transform: translateY(100%);
  opacity: 0;
  display: grid;
  place-items: center;
  justify-items: center;
  text-align: center;
}

.footer.visible {
  bottom: 0;
  transform: translateY(0);
  opacity: 1;
}

.footer p {
  margin: 0.2rem 0;
}

.status h2 {
  margin-top: 0;
}

#status-message {
  font-size: 0.95rem;
  color: var(--muted);
}

#download-container a,
#download-container button.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.6rem 1rem;
  border-radius: calc(var(--radius) / 1.6);
  border: var(--border);
  color: var(--text);
  text-decoration: none;
  background: rgba(15, 23, 42, 0.55);
  transition: border-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

#download-container a:hover,
#download-container button.link-button:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.7);
  transform: translateY(-1px);
}

#download-container button.link-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#console-panel {
  padding-bottom: 1rem;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.console-header h2 {
  margin: 0;
}

.console-header .link-button {
  margin-top: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

#console-output {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.6);
  border: var(--border);
  border-radius: calc(var(--radius) / 1.5);
  max-height: 320px;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

.console-entry {
  border-left: 3px solid rgba(56, 189, 248, 0.4);
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
}

.console-entry:last-child {
  margin-bottom: 0;
}

.console-entry .console-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

.console-entry .console-message {
  font-weight: 600;
}

.console-entry pre {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(15, 23, 42, 0.4);
  border-radius: calc(var(--radius) / 2);
  padding: 0.5rem;
}

#error {
  color: #fca5a5;
  margin-top: 0.75rem;
}

#status-message[data-variant='success'] {
  color: #86efac;
}

#status-message[data-variant='error'] {
  color: #fca5a5;
}

#status-message[data-variant='warning'] {
  color: #fbbf24;
}

.retro {
  position: relative;
  height: 100%;
}

.retro-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  text-align: center;
}

.retro-select {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  max-width: 360px;
  align-items: center;
}

.retro-select select {
  width: 100%;
}

.retro-frame {
  margin-top: 1rem;
  border: var(--border);
  border-radius: calc(var(--radius) / 1.1);
  background: rgba(0, 0, 0, 0.6);
  overflow: hidden;
  min-height: 600px;
  display: grid;
  margin-inline: auto;
}

@media (max-width: 768px) {
  .retro-frame {
    min-height: 420px;
  }
}

.retro-frame iframe {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: none;
  background: #0b1220;
}

.retro-fallback {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  color: var(--muted);
}

.downloads {
  margin-top: 1.25rem;
}

.downloads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.download-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border: var(--border);
  border-radius: calc(var(--radius) / 1.5);
  background: rgba(15, 23, 42, 0.55);
}

.download-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.download-meta .name {
  font-weight: 600;
}

.download-meta .detail {
  color: var(--muted);
  font-size: 0.85rem;
}

.footer {
  display: flex;
  justify-content: flex-end;
}
