:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #121722;
  --bg-tertiary: #192131;
  --bg-card: rgba(25, 33, 49, 0.7);

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #586069;

  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.4);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.4);
  --accent-amber: #f59e0b;
  --accent-danger: #ef4444;
  --accent-danger-glow: rgba(239, 68, 68, 0.35);

  --border-subtle: rgba(255, 255, 255, 0.08);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Apple SF Pro & Modern System Font Stack */
  --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Plus Jakarta Sans", system-ui, -system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: -webkit-fill-available;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-touch-callout: none;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 10%, #151e30 0%, #0a0d14 70%);
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  /* Safe Area Inset Handling for Apple Notches, Dynamic Island & Home Bars */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(10px, 1.8vh, 16px) clamp(12px, 3.5vw, 20px);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 8px #f59e0b);
}

.brand-name {
  font-weight: 800;
  font-size: 17px;
  background: linear-gradient(135deg, #ffffff 40%, #8b949e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 9px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-qr-nav {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-qr-nav:hover {
  background: rgba(59, 130, 246, 0.3);
}

/* Main Body */
.main-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: clamp(6px, 1.2vh, 12px) clamp(10px, 3vw, 16px);
  gap: clamp(6px, 1.2vh, 10px);
  width: 100%;
}

/* Onion Multi-Hop Invisible Tunnel Card */
.onion-card {
  width: 100%;
  background: linear-gradient(135deg, rgba(30, 20, 50, 0.7) 0%, rgba(18, 23, 34, 0.85) 100%);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-md);
  padding: clamp(6px, 1vh, 10px) clamp(10px, 2.5vw, 14px);
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.8vh, 8px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.onion-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.onion-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.onion-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #c084fc;
}

.onion-status {
  font-size: 10px;
  font-weight: 700;
  color: #34d399;
}

.btn-rotate {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #e9d5ff;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.btn-rotate:hover {
  background: rgba(168, 85, 247, 0.35);
  transform: translateY(-1px);
}

.btn-rotate.rotating .rotate-icon {
  animation: spinRing 0.8s linear infinite;
}

.circuit-path {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
}

.circuit-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.circuit-icon {
  font-size: 15px;
}

.circuit-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
}

.circuit-arrow {
  color: #a855f7;
  font-size: 11px;
  opacity: 0.7;
}

.onion-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.onion-ip-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.onion-ip-label {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.onion-ip-val {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #38bdf8;
}

.btn-setup-proxy {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-setup-proxy:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.setup-tabs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setup-intro {
  font-size: 12px;
  color: var(--text-secondary);
}

.setup-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setup-card h4 {
  color: #c084fc;
  font-size: 13px;
  margin-bottom: 4px;
}

.setup-code {
  background: #000;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #34d399;
  word-break: break-all;
  margin-top: 4px;
}

/* Status Pill */
.status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  transition: all 0.3s ease;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-pill.disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.status-pill.disconnected .status-dot { background: #ef4444; }

.status-pill.connecting {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.status-pill.connecting .status-dot {
  background: #3b82f6;
  box-shadow: 0 0 8px #3b82f6;
  animation: pulseDot 1s infinite alternate;
}

.status-pill.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
}
.status-pill.connected .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.ip-indicator {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* Power Connect Button */
.power-button-wrapper {
  position: relative;
  width: clamp(105px, 24vw, 130px);
  height: clamp(105px, 24vw, 130px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: clamp(2px, 0.6vh, 6px) 0;
  flex-shrink: 0;
}

.glow-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-danger-glow) 0%, transparent 70%);
  transition: all 0.5s ease;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  transition: all 0.5s ease;
}

.power-btn {
  position: relative;
  z-index: 3;
  width: clamp(76px, 18vw, 100px);
  height: clamp(76px, 18vw, 100px);
  border-radius: 50%;
  background: linear-gradient(145deg, #1b2434, #121824);
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: all 0.25s ease;
}

.power-btn:hover {
  transform: scale(1.04);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.power-icon {
  width: clamp(30px, 7vw, 40px);
  height: clamp(30px, 7vw, 40px);
}

.power-button-wrapper.connecting .pulse-ring {
  border-color: var(--accent-blue);
  animation: spinRing 2s linear infinite;
}
.power-button-wrapper.connecting .power-btn {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.power-button-wrapper.connected .glow-ring {
  background: radial-gradient(circle, var(--accent-emerald-glow) 0%, transparent 70%);
  transform: scale(1.15);
}
.power-button-wrapper.connected .pulse-ring {
  border: 2px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}
.power-button-wrapper.connected .power-btn {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.35);
}

/* Server Card */
.server-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: clamp(6px, 1.2vh, 10px) clamp(10px, 2.5vw, 14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.2s ease;
}

.server-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(25, 33, 49, 0.85);
}

.server-card-main {
  display: flex;
  align-items: center;
  gap: clamp(6px, 2vw, 10px);
}

.server-flag {
  font-size: clamp(20px, 5vw, 24px);
}

.server-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.server-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.server-name {
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 700;
}

.server-meta {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.badge {
  font-size: 9.5px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-ping {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-speed {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.btn-change-server {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: clamp(10px, 2.6vw, 11px);
  font-weight: 600;
  padding: clamp(6px, 1vh, 8px) clamp(8px, 2vw, 12px);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

/* Stats Section */
.stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: rgba(18, 23, 34, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 15px;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Action Buttons Row */
.actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-action {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-action:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-action.apk-action {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-action.apk-action:hover {
  background: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

.btn-action.primary-action {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-action.primary-action:hover {
  background: rgba(16, 185, 129, 0.25);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2.5vw, 18px);
  padding-top: max(clamp(8px, 2.5vw, 18px), env(safe-area-inset-top, 0px));
  padding-bottom: max(clamp(8px, 2.5vw, 18px), env(safe-area-inset-bottom, 0px));
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 20px);
  background: #121722;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: clamp(12px, 2.5vh, 20px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 14px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.form-input {
  width: 100%;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.modal-server-picker {
  height: clamp(380px, 80dvh, 650px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

/* QR Code Section */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.qr-instructions {
  font-size: 13px;
  color: var(--text-secondary);
}

.qr-image-wrapper {
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.qr-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  width: 100%;
}

.qr-url-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #60a5fa;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.qr-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Server List */
.modal-search-box input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: #fff;
  font-size: 12px;
  outline: none;
}

.filter-tabs {
  display: flex;
  gap: 6px;
}

.filter-tab {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.filter-tab.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
}

.server-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.server-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.server-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.server-item.selected {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
}

.server-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.server-item-flag {
  font-size: 22px;
  flex-shrink: 0;
}

.server-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.server-item-country {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-item-ip {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.server-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 8px;
  white-space: nowrap;
}

.server-item-ping {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #34d399;
  white-space: nowrap;
}

.server-item-speed {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.hidden { display: none !important; }

/* VIP Mode & Quota Styling */
.vip-nav-btn {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fcd34d !important;
}

.vip-nav-btn.active-vip {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.25)) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.quota-card {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: clamp(6px, 1vh, 9px) clamp(10px, 2.5vw, 13px);
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.7vh, 6px);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.quota-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.quota-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.quota-badge {
  font-size: clamp(9.5px, 2.4vw, 10.5px);
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: 0.5px;
}

.quota-reset {
  font-size: 9.5px;
  color: #64748b;
}

.quota-remaining {
  font-size: clamp(10px, 2.5vw, 11px);
  font-weight: 800;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.quota-bar-wrapper {
  width: 100%;
  height: clamp(6px, 1vh, 8px);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.quota-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.quota-progress-fill.danger {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.quota-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: clamp(9.5px, 2.4vw, 10.5px);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.vip-locked-tag {
  font-size: 9px;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-left: 6px;
}

.server-item.vip-node-card {
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.04);
}

.server-item.vip-node-card:hover {
  background: rgba(245, 158, 11, 0.08);
}

@keyframes spinRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseDot {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* ==========================================================================
   DYNAMIC MOBILE & APPLE iOS RESPONSIVE RULES
   ========================================================================== */

/* 1. Prevent iOS Safari auto-zoom on inputs (Safari zooms if font-size < 16px) */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* 2. Compact Mobile Screens (iPhone SE 4.7", Small Android 360x640, Height <= 700px) */
@media screen and (max-height: 700px) {
  .navbar {
    padding: 8px 12px;
  }
  .brand-name {
    font-size: 15px;
  }
  .btn-qr-nav {
    padding: 5px 9px;
    font-size: 10px;
  }
  .main-body {
    padding: 4px 10px;
    gap: 5px;
    justify-content: space-around;
  }
  .status-container {
    gap: 2px;
  }
  .status-pill {
    padding: 3px 10px;
    font-size: 9px;
  }
  .ip-indicator {
    font-size: 9px;
  }
  .power-button-wrapper {
    width: 95px;
    height: 95px;
    margin: 2px 0;
  }
  .power-btn {
    width: 70px;
    height: 70px;
  }
  .power-icon {
    width: 26px;
    height: 26px;
  }
  .server-card {
    padding: 5px 10px;
  }
  .server-flag {
    font-size: 20px;
  }
  .server-name {
    font-size: 12.5px;
  }
  .onion-card {
    padding: 5px 10px;
    gap: 4px;
  }
  .circuit-path {
    padding: 4px 2px;
  }
  .circuit-icon {
    font-size: 13px;
  }
  .quota-card {
    padding: 5px 10px;
    gap: 3px;
  }
}

/* 3. Ultra-compact or Landscape Mobile displays (Height <= 580px) */
@media screen and (max-height: 580px) {
  .app-container {
    overflow-y: auto;
  }
  .main-body {
    justify-content: flex-start;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  }
  .power-button-wrapper {
    width: 80px;
    height: 80px;
  }
  .power-btn {
    width: 60px;
    height: 60px;
  }
  .power-icon {
    width: 22px;
    height: 22px;
  }
}

/* 4. Large Tablets, iPad Mini / Pro, and Foldables (Width >= 768px) */
@media screen and (min-width: 768px) {
  .app-container {
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    margin: 24px auto;
    min-height: calc(100dvh - 48px);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  }
}
