:root {
  --bg: #070A12;
  --card: #151B2B;
  --ink: #E2E8F0;
  --muted: #64748B;
  --cyan: #00F0FF;
  --green: #00FF88;
  --red: #FF4757;
  --line: rgba(255, 255, 255, 0.06);
  --grad: linear-gradient(135deg, #00F0FF, #00FF88);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--cyan); }
.hidden { display: none !important; }

.app-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #070A12;
}
.app-shell.wide { max-width: none; }

.preview-frame {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
.preview-frame::-webkit-scrollbar { width: 3px; }
.preview-frame::-webkit-scrollbar-thumb { background: #1E293B; border-radius: 2px; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 8px;
}
.app-header h2 {
  font-size: 16px;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bell, .pts-chip {
  min-height: 36px;
  border-radius: 12px;
  background: #151B2B;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
}
.pts-chip { border-radius: 20px; background: rgba(0, 255, 136, 0.1); border-color: rgba(0, 255, 136, 0.2); gap: 6px; }

.u-view { display: none; animation: fadeIn 0.3s ease; min-height: 100%; padding: 0 16px 88px; }
.u-view.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.card h3 {
  font-size: 12px;
  color: var(--cyan);
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-steps { text-align: center; padding: 8px 0 16px; }
.hero-steps .hi { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.hero-steps .label { font-size: 22px; font-weight: 800; }
.hero-steps .big {
  font-size: 42px;
  font-weight: 900;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 4px 0;
}
.hero-steps .sub { font-size: 12px; color: var(--muted); }

.rings-row { display: flex; justify-content: space-around; align-items: center; padding: 10px 0 28px; }
.ring-wrap { text-align: center; position: relative; width: 80px; height: 80px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #1E293B; stroke-width: 8; }
.ring-fill { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 22px; }
.ring-label { font-size: 9px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.ring-val { font-size: 11px; color: var(--ink); font-weight: 700; margin-top: 2px; }

.challenge-card {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.08), #151B2B);
  border: 1px solid rgba(0, 240, 255, 0.12);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.challenge-card::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.15), transparent 70%);
}
.ch-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; padding-right: 72px; }
.ch-sub { font-size: 10px; color: var(--muted); margin-bottom: 10px; }
.ch-bar { height: 8px; background: #1E293B; border-radius: 4px; overflow: hidden; }
.ch-fill { height: 100%; border-radius: 4px; background: var(--grad); }
.ch-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; }
.ch-meta .cur { color: var(--cyan); font-weight: 700; }
.ch-meta .goal { color: var(--muted); }
.ch-reward {
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(0, 255, 136, 0.12);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.r-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.r-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.r-img {
  width: 100%;
  height: 110px;
  background: linear-gradient(135deg, #1E293B, #0F172A);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.r-info { padding: 10px; }
.r-info h4 { font-size: 11px; margin-bottom: 4px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-price { display: flex; align-items: center; gap: 3px; color: var(--green); font-size: 11px; font-weight: 800; }

.lb-row, .rk-area-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.lb-row:last-child, .rk-area-row:last-child { border-bottom: none; }
.lb-rank { width: 28px; text-align: center; font-size: 14px; font-weight: 800; }
.lb-rank.gold { color: #FFD700; }
.lb-rank.silver { color: #C0C0C0; }
.lb-rank.bronze { color: #CD7F32; }
.lb-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.lb-name { flex: 1; font-size: 12px; font-weight: 600; }
.lb-pts { font-size: 12px; font-weight: 800; color: var(--green); }
.lb-you { background: rgba(0, 240, 255, 0.06); border-radius: 12px; padding: 0 10px; margin: 0 -10px; }
.rk-tab {
  flex: 1; padding: 8px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer;
}
.rk-tab.active { background: var(--grad); color: #070A12; border-color: transparent; font-weight: 800; }
.rk-area-name { flex: 1; font-size: 12px; font-weight: 700; }
.rk-area-sub { font-size: 9px; color: var(--muted); margin-top: 1px; }
.rk-subtitle { font-size: 10px; color: var(--muted); margin: -8px 0 12px; }

.banner-img { width: 100%; display: block; border-radius: 16px; margin-bottom: 14px; }

.post-card {
  background: var(--card);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-av {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.post-user { font-size: 12px; font-weight: 700; }
.post-meta { font-size: 10px; color: var(--muted); margin-top: 1px; }
.post-text { font-size: 12px; color: #CBD5E1; line-height: 1.5; margin-bottom: 10px; }
.post-actions { display: flex; gap: 16px; font-size: 11px; color: var(--muted); }
.post-actions button { border: 0; background: none; color: inherit; cursor: pointer; font-weight: 700; }
.post-actions button.on { color: var(--red); }
.composer textarea {
  width: 100%; min-height: 72px; border-radius: 12px; border: 1px solid var(--line);
  background: #0B0F19; color: var(--ink); padding: 12px; resize: vertical;
}

.b-nav {
  height: 64px;
  background: rgba(11, 15, 25, 0.98);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
}
.b-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 12px; cursor: pointer;
  color: var(--muted); font-size: 8.5px; font-weight: 700;
  border: none; background: transparent;
}
.b-nav-item .ni { font-size: 20px; }
.b-nav-item.active { color: var(--cyan); }

.auth {
  padding: 48px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth h1 {
  font-size: 28px;
  font-weight: 900;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth p { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
.field, .auth input, .auth textarea, .form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0B0F19;
  color: var(--ink);
  margin: 6px 0;
  outline: none;
}
.field:focus, .auth input:focus { border-color: var(--cyan); }
.btn, .btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: var(--grad);
  color: #070A12;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
}
.btn.ghost, .btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn.danger { background: linear-gradient(135deg, #FF4757, #FF6B81); color: #fff; }
.error { color: #f87171; min-height: 1.2em; font-size: 13px; }
.muted { color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.ach-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.ach-item {
  min-width: 80px; text-align: center; padding: 12px 8px;
  background: #0B0F19; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.04);
}
.ach-item .ic { font-size: 28px; margin-bottom: 4px; }
.ach-item .tx { font-size: 9px; font-weight: 700; }
.hist-row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 12px;
}
.hist-row:last-child { border-bottom: none; }
.hist-row .plus { color: var(--green); font-weight: 700; }
.hist-row .minus { color: var(--red); font-weight: 700; }

.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #151B2B; color: #fff; padding: 12px 20px; border-radius: 30px;
  font-size: 13px; font-weight: 700; z-index: 9999;
  border: 1px solid rgba(0, 240, 255, 0.2); opacity: 0; transition: opacity 0.3s;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

.admin-page { max-width: 1400px; margin: 0 auto; min-height: 100vh; display: flex; background: #0B0F19; }
.ad-sidebar {
  width: 260px; background: #070A12; border-right: 1px solid var(--line);
  padding: 24px 16px; display: flex; flex-direction: column;
}
.ad-logo {
  font-size: 18px; font-weight: 800; background: var(--grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 32px; padding: 0 8px;
}
.ad-nav {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600;
  margin-bottom: 4px; border: none; background: transparent; width: 100%; text-align: left;
}
.ad-nav:hover { background: #151B2B; color: var(--ink); }
.ad-nav.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(0, 255, 136, 0.08));
  color: var(--cyan); border: 1px solid rgba(0, 240, 255, 0.15);
}
.ad-main { flex: 1; padding: 28px 32px; overflow-y: auto; }
.ad-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.ad-header h1 { font-size: 22px; font-weight: 800; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: var(--card); border-radius: 18px; padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.04); position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad);
}
.kpi-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 800; }
.ad-view { display: none; }
.ad-view.active { display: block; animation: fadeIn 0.3s ease; }
.ad-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.ad-table th {
  text-align: left; padding: 12px 14px; color: var(--muted); font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--line);
}
.ad-table td { padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
.ad-table tr:hover td { background: rgba(0, 240, 255, 0.03); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.pts-badge { background: rgba(0, 255, 136, 0.1); color: var(--green); padding: 3px 10px; border-radius: 20px; font-weight: 700; font-size: 11px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.active { background: var(--green); }
.status-dot.inactive { background: var(--red); }
.chart-card { background: var(--card); border-radius: 18px; padding: 20px; border: 1px solid rgba(255, 255, 255, 0.04); margin-bottom: 16px; }
.chart-card h3 { font-size: 13px; color: var(--cyan); margin-bottom: 16px; font-weight: 700; }
.btn-sm { width: auto; padding: 8px 14px; font-size: 11px; margin: 0 4px 0 0; }

@media (max-width: 900px) {
  .admin-page { flex-direction: column; }
  .ad-sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 12px; gap: 8px; }
  .ad-nav { white-space: nowrap; margin-bottom: 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
