:root {
  --bg: #0b0f19;
  --bg-card: #141a2a;
  --bg-elevated: #1c2438;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --success: #22c55e;
  --danger: #ef4444;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --radius: 20px;
  --radius-sm: 14px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(ellipse at top, #1a1035 0%, var(--bg) 60%);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 25, 0.75);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
}

.user-badge {
  background: var(--bg-elevated);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Content */
.content {
  flex: 1;
  padding: 20px 16px 100px;
  overflow-y: auto;
}

.tab {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.hero h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 15px;
}

/* Upload Zone */
.upload-zone {
  background: var(--bg-card);
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 20px;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  transform: scale(1.01);
}

.upload-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.upload-text {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}

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

/* Preview */
.preview-box {
  position: relative;
  margin-bottom: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.preview-box img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.preview-box .btn-secondary {
  position: absolute;
  top: 12px;
  right: 12px;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  padding: 16px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary:not(:disabled):active {
  transform: scale(0.98);
}

.btn-secondary {
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
}

.btn-small {
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  color: white;
}

.btn-small.success { background: var(--success); }
.btn-small.danger { background: var(--danger); }

/* Results */
.results {
  margin-top: 28px;
}

.results h3 {
  font-size: 18px;
  margin-bottom: 14px;
}

.result-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.result-card:active {
  transform: scale(0.98);
}

.result-card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
}

.result-card.yandex .card-icon { background: linear-gradient(135deg, #fc3f1d, #ff6b4a); }
.result-card.google .card-icon { background: linear-gradient(135deg, #4285f4, #34a853); }
.result-card.bing .card-icon { background: linear-gradient(135deg, #008373, #00bcf2); }

.card-info { flex: 1; }
.card-title { font-weight: 600; margin-bottom: 2px; }
.card-desc { font-size: 13px; color: var(--text-muted); }
.card-arrow { font-size: 20px; color: var(--text-muted); }

/* History */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  gap: 14px;
  border: 1px solid var(--border);
}

.history-item img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
}

.history-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.history-date {
  font-size: 12px;
  color: var(--text-muted);
}

.history-links {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.history-links a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* Profile */
.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: white;
}

.profile-info .name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.profile-info .username {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 6px;
}

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

.status-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-card.allowed .status-dot { background: var(--success); }
.status-card.denied .status-dot { background: var(--danger); }

/* Admin */
.admin-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.admin-panel h3 {
  margin-bottom: 16px;
  font-size: 17px;
}

.admin-section {
  margin-bottom: 20px;
}

.admin-section label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.admin-row {
  display: flex;
  gap: 8px;
}

.admin-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.admin-row input:focus {
  border-color: var(--accent);
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 13px;
}

.user-row .badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.user-row .badge.denied {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(20, 26, 42, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 24px;
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 14px;
  transition: all 0.2s;
}

.nav-item.active {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
}

.nav-icon {
  font-size: 22px;
}

/* Loader */
.loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Telegram specific */
body.tg-viewport {
  /* handled by TG */
}
