:root {
  --bg-color: #0f1115;
  --card-bg: rgba(22, 24, 29, 0.7);
  --text-main: #ffffff;
  --text-muted: #9ca3af;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-bg: #1f2937;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --animation-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--bg-color);
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
}

#app {
  width: 100%;
  padding: 24px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: var(--glass-border);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: relative;
}

.header {
  margin-bottom: 40px;
}

.top-nav-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
  z-index: 100;
}

.nav-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0;
}

.nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  color: #3b82f6;
}

.nav-icon-btn svg {
  display: block;
}

.header {
  margin-bottom: 40px;
  position: relative;
}

.app-logo {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  margin: 0 auto 24px;
  display: block;
  object-fit: cover;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.download-section {
  min-height: 200px;
  /* Prevent layout shift */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.state-container {
  animation: fadeIn 0.6s var(--animation-ease);
}

.hidden {
  display: none !important;
}

.os-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  color: var(--text-main);
  background: var(--secondary-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--glass-border);
}

h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.download-section p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  width: 100%;
  font-size: 16px;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text-main);
  border: var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
  transform: translateY(0);
}

.helper-text {
  font-size: 12px !important;
  margin-top: 16px;
  opacity: 0.6;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

.desktop-options {
  display: flex;
  gap: 16px;
}

.option-card {
  flex: 1;
  background: var(--secondary-bg);
  padding: 16px;
  border-radius: 16px;
  border: var(--glass-border);
}

.option-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.small {
  font-size: 12px !important;
}

footer {
  margin-top: 40px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.5;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 32px 20px;
  }
}

/* Environment Tabs */
.env-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 12px;
  border: var(--glass-border);
  flex-grow: 1;
}

.controls-wrapper {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  height: 48px;
  /* Fixed height for alignment */
}

.controls-wrapper.hidden {
  display: none;
}

.os-icon-slot {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.mini-os-icon {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.mini-os-icon svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.android-mini-glow {
  background: rgba(61, 220, 132, 0.1);
  border-color: rgba(61, 220, 132, 0.2);
  color: #3ddc84;
  box-shadow: 0 4px 12px rgba(61, 220, 132, 0.1);
}

.ios-mini-glow {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
}

.env-tabs.hidden {
  display: none;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Version List Styles */
#dynamic-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
  /* Space for scrollbar */
}

/* Custom Scrollbar */
#dynamic-content::-webkit-scrollbar {
  width: 6px;
}

#dynamic-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

#dynamic-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.version-card {
  background: var(--secondary-bg);
  border: var(--glass-border);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.version-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.version-info {
  text-align: left;
}

.version-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.version-changelog {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 2px solid var(--primary-color);
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  white-space: pre-wrap;
  line-height: 1.5;
}

.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-latest {
  background: rgba(59, 130, 246, 0.2);
  color: var(--primary-color);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
}

.state-header {
  margin-bottom: 24px;
}

.state-header h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

.state-header p {
  font-size: 14px;
  margin: 0;
  color: var(--text-muted);
}

/* OS Icon Styling */
.os-icon-display {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 24px;
  margin: 0 auto 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.android-glow {
  color: #3ddc84;
  box-shadow: 0 8px 32px rgba(61, 220, 132, 0.15);
  border-color: rgba(61, 220, 132, 0.2);
  background: linear-gradient(135deg, rgba(61, 220, 132, 0.1) 0%, rgba(61, 220, 132, 0.05) 100%);
}

.ios-glow {
  color: #ffffff;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.os-icon-display svg {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* LOGIN OVERLAY */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(20px);
}

.login-card {
  background: var(--card-bg);
  padding: 40px;
  border-radius: 24px;
  border: var(--glass-border);
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.6s var(--animation-ease);
}

.app-logo-large {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  margin-bottom: 24px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 32px;
  line-height: 1.5;
}

#google-signin-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  min-height: 44px;
}

.login-error {
  color: #ff4d4d;
  font-size: 13px;
  margin-top: 16px;
  background: rgba(255, 77, 77, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* Pagination controls */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-pagination {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pagination:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.btn-pagination:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-indicator {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}