* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #090a0f;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1a1f36 0%, #090a0f 65%);
  --surface: rgba(21, 25, 36, 0.7);
  --surface-hover: rgba(28, 33, 48, 0.8);
  --surface-2: #141824;
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --ok: #10b981;
  --err: #f43f5e;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.1);
}

body {
  margin: 0;
  min-height: 100dvh;
  font: 14px/1.6 var(--sans);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: min(840px, 100%);
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.top {
  margin-bottom: 32px;
  text-align: center;
}

.top__header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.top__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top__download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: all 0.2s ease;
}

.top__download-btn:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
  transform: translateY(-1px);
}


.top__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.top__title {
  margin: 0 0 10px;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.top__desc {
  margin: 0 auto;
  max-width: 580px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card--glass {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.stack {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.resolve__field {
  display: block;
  min-width: 0;
}

.resolve__field--grow {
  flex: 1;
}

.resolve__label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #94a3b8;
  text-transform: uppercase;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  pointer-events: none;
}

.resolve__form-grid {
  display: grid;
  grid-template-columns: 1fr 1.8fr auto;
  gap: 14px;
  align-items: flex-end;
}

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

.resolve__hint {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

input[type="search"],
input[type="text"],
select,
.export__row input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

button#resolve-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent-gradient);
  color: #ffffff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
}

button#resolve-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
}

button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.export__row input {
  padding-left: 14px;
  font: 0.83rem/1.4 var(--mono);
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.05);
}

.export__row button {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.export__row button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

button.ok {
  color: var(--ok);
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.msg--err {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  font-size: 0.88rem;
  color: var(--err);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stream-title {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
}

.stream-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.section-title {
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.player {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000000;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.exports {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.export__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.export__name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
}

.export__hint {
  font-size: 0.78rem;
  color: #64748b;
}

.export__row {
  display: flex;
  gap: 10px;
}

@media (max-width: 540px) {
  .app {
    padding: 24px 16px 40px;
  }

  .export__row {
    flex-direction: column;
  }

  .export__row button {
    width: 100%;
  }
}

.servers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.badge:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.1);
  color: #f1f5f9;
}

.badge--active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.badge--fail {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: rgba(244, 63, 94, 0.2);
}

.badge--pending {
  opacity: 0.4;
  cursor: default;
}

.badge--running {
  opacity: 1;
  border-color: var(--accent);
  animation: pulse 1.5s infinite;
}

.badge__name {
  font-weight: 600;
}

.badge__tag {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--err);
}

.badge__ms {
  font: 0.72rem/1.4 var(--mono);
  color: #64748b;
}
