/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green-1: #22c55e; --green-2: #16a34a;
  --purple-1: #a855f7; --purple-2: #7c3aed;
  --yellow-1: #eab308; --yellow-2: #ca8a04;
  --orange-1: #f97316; --orange-2: #ea580c;
  --blue-1: #3b82f6; --blue-2: #2563eb;
  --red-1: #ef4444; --red-2: #dc2626;
  --gray-1: #6b7280; --gray-2: #4b5563;
  --bg: #0a0a0a;
  --card-radius: 28px;
  --safe-top: env(safe-area-inset-top, 20px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  touch-action: manipulation;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-top) + 24px) calc(env(safe-area-inset-right, 0px) + 20px) calc(var(--safe-bottom) + 24px) calc(env(safe-area-inset-left, 0px) + 20px);
  gap: 20px;
}

/* === Status Card === */
.card {
  width: 100%;
  max-width: 338px;
  height: 354px;
  border-radius: var(--card-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: background 0.6s ease, transform 0.3s ease;
  will-change: transform;
}

.card { cursor: pointer; }
.card:active { transform: scale(0.97); }

.card-bg-circle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.card-bg-circle.top {
  width: 160px; height: 160px;
  top: -40px; right: -40px;
  background: rgba(255,255,255,0.1);
}
.card-bg-circle.bottom {
  width: 200px; height: 200px;
  bottom: -60px; left: -30px;
  background: rgba(0,0,0,0.08);
}

.icon {
  font-size: 72px;
  margin-bottom: 12px;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
  animation: iconPop 0.4s ease-out;
}
.title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  z-index: 1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
  margin-bottom: 6px;
}
.subtitle {
  font-size: 15px;
  font-weight: 500;
  opacity: 0.85;
  z-index: 1;
  max-width: 280px;
}

/* Card status colors */
.status-ok       { background: linear-gradient(145deg, var(--green-1), var(--green-2)); }
.status-vpn      { background: linear-gradient(145deg, var(--purple-1), var(--purple-2)); }
.status-whitelist{ background: linear-gradient(145deg, var(--yellow-1), var(--yellow-2)); }
.status-slow     { background: linear-gradient(145deg, var(--orange-1), var(--orange-2)); }
.status-abroad   { background: linear-gradient(145deg, var(--blue-1), var(--blue-2)); }
.status-offline  { background: linear-gradient(145deg, var(--red-1), var(--red-2)); }
.status-checking { background: linear-gradient(145deg, var(--gray-1), var(--gray-2)); }

/* === Progress Bar === */
.progress-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(0,0,0,0.2);
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s;
}
.progress-bar.active { opacity: 1; }
.progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(255,255,255,0.7);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* === Details Panel === */
.details {
  width: 100%;
  max-width: 338px;
  background: #1a1a1a;
  border-radius: 20px;
  padding: 20px;
  transition: all 0.3s ease;
}
.details.hidden { display: none; }
.details-header {
  font-size: 14px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}
.checks-list { display: flex; flex-direction: column; gap: 10px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}
.check-group-header {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
  margin-bottom: 4px;
}
.check-group-header:first-child { margin-top: 0; }
.check-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.check-dot.ok { background: var(--green-1); }
.check-dot.fail { background: var(--red-1); }
.check-dot.slow { background: var(--orange-1); }
.check-dot.pending { background: #555; animation: pulse 1s infinite; }
.check-name { color: #ccc; flex: 1; }
.check-time { color: #666; font-size: 13px; font-variant-numeric: tabular-nums; }
.last-check {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
  font-size: 13px;
  color: #555;
  text-align: center;
}

/* === Actions === */
.actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 338px;
}
.btn {
  flex: 1;
  padding: 14px 12px;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.95); }
.btn-refresh {
  background: #fff;
  color: #000;
}
.btn-secondary {
  background: #1a1a1a;
  color: #aaa;
}
.btn-icon { font-size: 18px; }
.btn.loading .btn-icon { animation: spin 1s linear infinite; }

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease;
}
.modal.hidden { display: none; }
.modal-content {
  background: #1a1a1a;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  padding-bottom: calc(var(--safe-bottom) + 24px);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: #333;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Export Cards Grid === */
.export-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.export-card-wrapper { text-align: center; }
.export-mini-card {
  width: 100%;
  aspect-ratio: 338/354;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}
.export-mini-card:active { transform: scale(0.95); }
.export-mini-card .icon { font-size: 36px; margin-bottom: 6px; }
.export-mini-card .title { font-size: 13px; font-weight: 700; }
.export-mini-card .subtitle { font-size: 10px; display: none; }
.export-card-label { font-size: 11px; color: #666; margin-top: 6px; }

/* === Shortcut Guide === */
.shortcut-guide { font-size: 15px; line-height: 1.6; }
.guide-step {
  background: #222;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.guide-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 13px;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}
.guide-step-title {
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}
.guide-step-desc { color: #999; font-size: 14px; }
.guide-code {
  background: #333;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', monospace;
  font-size: 13px;
  color: #eee;
}

/* === Animations === */
@keyframes iconPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Responsive === */
@media (min-width: 500px) {
  .card { max-width: 380px; height: 380px; }
  .details, .actions { max-width: 380px; }
}
