﻿@import url('https://fonts.googleapis.com/css2?family=Clash+Display:wght@600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #060b16;
  --bg-2: #0a1224;
  --surface: rgba(16, 24, 48, 0.82);
  --surface-solid: #101830;
  --surface-2: #162040;
  --primary: #7B2CBF;
  --primary-2: #9D4EDD;
  --accent: #C77DFF;
  --gold: #FFC857;
  --gold-2: #E8A317;
  --success: #2ee59d;
  --danger: #ff5d7a;
  --text: #f4f7ff;
  --muted: #9aa8c7;
  --line: rgba(255, 255, 255, 0.08);
  --radius: 22px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --glow: 0 0 40px rgba(79, 124, 255, 0.35);
  --font: "Manrope", system-ui, sans-serif;
  --display: "Sora", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(123, 44, 191, 0.32), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(255, 200, 87, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(157, 78, 221, 0.1), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

/* Brand */
.brand {
  font: 800 1.15rem/1 var(--display);
  letter-spacing: -0.04em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.brand span {
  background: linear-gradient(120deg, var(--gold), #ffe6a3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-lg { font-size: clamp(2rem, 7vw, 3.4rem); }
.brand-center { justify-content: center; width: 100%; margin-bottom: 1.25rem; }
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.brand-logo img {
  height: 42px;
  width: auto;
  display: block;
}
.brand-logo-lg img {
  height: clamp(56px, 14vw, 88px);
}
.brand-logo-auth img {
  height: 72px;
  margin: 0 auto 8px;
}
.brand-icon img {
  height: 36px;
  width: 36px;
  object-fit: cover;
  border-radius: 10px;
}

/* Shells */
.app-shell { max-width: 760px; margin: auto; min-height: 100vh; padding-bottom: 96px; }
.app-header, .public-header, .admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(6, 11, 22, 0.72);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.stars-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 200, 87, 0.12);
  border: 1px solid rgba(255, 200, 87, 0.28);
  color: var(--gold);
  font-weight: 800;
  font-size: 0.9rem;
}
.page { padding: 20px; }

/* Typography */
.eyebrow {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}
.title {
  font: 800 clamp(1.7rem, 5.5vw, 2.5rem)/1.12 var(--display);
  letter-spacing: -0.03em;
  margin: 6px 0 10px;
}
.muted { color: var(--muted); }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 36rem; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.card + .card { margin-top: 14px; }
.hero-card {
  background:
    linear-gradient(135deg, rgba(123, 44, 191, 0.95), rgba(45, 18, 72, 0.95) 55%, rgba(8, 10, 24, 0.98)),
    var(--surface-solid);
  border-color: rgba(255, 255, 255, 0.12);
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 200, 87, 0.35), transparent 70%);
  pointer-events: none;
}
.balance {
  font: 800 clamp(1.8rem, 6vw, 2.5rem)/1 var(--display);
  color: var(--gold);
  margin: 10px 0;
  text-shadow: 0 0 24px rgba(255, 200, 87, 0.35);
}

/* Grid */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: 1fr; }
.stat { text-align: center; }
.stat strong { display: block; font: 800 1.35rem var(--display); }

/* Buttons */
.btn {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 13px 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled, .btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 12px 30px rgba(123, 44, 191, 0.38);
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1a1200;
  box-shadow: 0 12px 30px rgba(255, 200, 87, 0.28);
}
.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-block { width: 100%; }
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  margin: auto;
  max-width: 760px;
  display: flex;
  justify-content: space-around;
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  background: rgba(8, 14, 28, 0.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  min-width: 58px;
  transition: color 0.2s ease;
}
.bottom-nav i { display: block; font-size: 1.28rem; margin-bottom: 2px; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--gold); }

/* Progress / checkin */
.progress {
  height: 9px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: inherit;
}
.checkin-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  margin-top: 16px;
}
.day {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.day.done {
  background: rgba(46, 229, 157, 0.18);
  color: var(--success);
  border-color: rgba(46, 229, 157, 0.35);
}
.day.today {
  outline: 2px solid var(--gold);
  box-shadow: 0 0 16px rgba(255, 200, 87, 0.25);
}
.task { display: flex; align-items: center; gap: 12px; }
.task-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(79, 124, 255, 0.16);
  color: #b8cbff;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.task-main { flex: 1; min-width: 0; }
.badge, .vip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 99px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 800;
}
.badge {
  background: rgba(79, 124, 255, 0.16);
  color: #b8cbff;
}
.vip-badge {
  background: linear-gradient(120deg, #ffb020, #ffe6a3, #ffb020);
  color: #3a2500;
}

/* Forms */
.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  margin: 14px 0 7px;
  color: #d7def0;
}
.form-control, .form-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(6, 12, 26, 0.85);
  color: var(--text);
  padding: 13px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: rgba(79, 124, 255, 0.7);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.18);
}
.form-control::placeholder { color: #6d7b9c; }
.input-with-action {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.input-with-action .form-control { flex: 1; }
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap .form-control {
  padding-right: 52px;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.password-toggle:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.terms-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0 8px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.terms-check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.terms-check span { font-size: 0.92rem; color: var(--muted); line-height: 1.45; }
.terms-check a {
  color: var(--gold);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Auth */
.auth-body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
.auth-body::before,
.auth-body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}
.auth-body::before {
  width: 320px; height: 320px;
  top: -80px; right: -60px;
  background: rgba(123, 44, 191, 0.28);
  animation: floatOrb 8s ease-in-out infinite;
}
.auth-body::after {
  width: 260px; height: 260px;
  bottom: -40px; left: -40px;
  background: rgba(255, 200, 87, 0.18);
  animation: floatOrb 10s ease-in-out infinite reverse;
}
@keyframes floatOrb {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(18px); }
}
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  position: relative;
  z-index: 1;
}
.auth-card {
  width: min(100%, 440px);
  animation: riseIn 0.45s ease;
}
.auth-card .title { text-align: center; }
.auth-card > .muted:first-of-type { text-align: center; margin-bottom: 8px; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.auth-footer-link {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
}
.auth-footer-link a { color: var(--gold); font-weight: 700; }

/* Public landing */
.public-body { overflow-x: hidden; }
.public-main { max-width: 1120px; margin: auto; padding: 0 20px 80px; }
.public-nav { display: none; gap: 22px; color: var(--muted); font-weight: 600; font-size: 0.92rem; }
.public-nav a:hover { color: var(--text); }
.public-actions { display: flex; gap: 8px; align-items: center; }

.hero-landing {
  min-height: min(92vh, 820px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 48px 0 40px;
  position: relative;
}
.hero-landing .brand-hero {
  font: 800 clamp(2.4rem, 10vw, 4.8rem)/0.95 var(--display);
  letter-spacing: -0.05em;
  margin: 0 0 18px;
}
.hero-landing .brand-hero span {
  display: block;
  background: linear-gradient(115deg, var(--gold) 10%, #fff3c4 45%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 10px 30px rgba(255, 200, 87, 0.2));
}
.hero-landing h1 {
  font: 700 clamp(1.15rem, 3.8vw, 1.65rem)/1.35 var(--font);
  color: #dbe4ff;
  max-width: 28rem;
  margin: 0 0 12px;
  font-weight: 600;
}
.hero-landing .hero-sub {
  color: var(--muted);
  max-width: 26rem;
  margin: 0 0 28px;
  font-size: 1.02rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.hero-visual {
  margin-top: 42px;
  width: min(100%, 520px);
  aspect-ratio: 16/10;
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(79,124,255,0.25), rgba(0,229,192,0.08)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 40 40'%3E%3Cg fill='%23ffc857' fill-opacity='0.08'%3E%3Cpath d='M20 2l2.5 7.5L30 12l-7.5 2.5L20 22l-2.5-7.5L10 12l7.5-2.5z'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, #15224a, #0a1228);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: var(--glow), var(--shadow);
  position: relative;
  overflow: hidden;
  animation: heroPulse 5s ease-in-out infinite;
}
.hero-visual::after {
  content: "★";
  position: absolute;
  right: 12%;
  top: 18%;
  font-size: 4rem;
  color: var(--gold);
  opacity: 0.85;
  animation: starTwinkle 2.4s ease-in-out infinite;
}
.hero-visual::before {
  content: "★";
  position: absolute;
  left: 16%;
  bottom: 22%;
  font-size: 2.2rem;
  color: var(--accent);
  opacity: 0.7;
  animation: starTwinkle 3s ease-in-out infinite 0.4s;
}
@keyframes heroPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes starTwinkle {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
}

.section-block {
  padding: 28px 0 10px;
  text-align: center;
}
.section-block h2 {
  font: 800 clamp(1.4rem, 4vw, 2rem)/1.15 var(--display);
  margin: 8px 0 10px;
}
.feature-card {
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 124, 255, 0.35);
}
.feature-icon {
  font-size: 1.7rem;
  color: var(--gold);
  margin-bottom: 10px;
  display: inline-block;
}

.public-footer {
  max-width: 1120px;
  margin: 40px auto 0;
  padding: 28px 20px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 16px;
  color: var(--muted);
}
.public-footer a { margin-right: 14px; }
.public-footer .copy { margin: 0; font-size: 0.85rem; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 6, 16, 0.72);
  backdrop-filter: blur(8px);
  display: none;
  place-items: center;
  padding: 16px;
}
.modal-overlay.open { display: grid; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  width: min(100%, 560px);
  max-height: min(82vh, 720px);
  background: #0e1730;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: riseIn 0.25s ease;
}
.modal-sheet header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-sheet header h3 {
  margin: 0;
  font: 800 1.1rem var(--display);
}
.modal-sheet .modal-body {
  padding: 16px 18px 22px;
  overflow: auto;
  color: var(--muted);
  font-size: 0.94rem;
}
.modal-sheet .modal-body h4 {
  color: var(--text);
  margin: 16px 0 8px;
  font-size: 0.98rem;
}
.modal-sheet .modal-body p { margin: 0 0 10px; }
.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
}

/* Toasts / misc */
.toast-container, #toast-root {
  position: fixed;
  right: 15px;
  top: 75px;
  z-index: 300;
  width: min(92vw, 340px);
}
.toast-msg {
  background: #152040;
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.roulette {
  width: min(78vw, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 20px auto;
  background: conic-gradient(#4f7cff 0 45deg, #ffc857 45deg 90deg, #2ee59d 90deg 135deg, #6b8cff 135deg 180deg, #ffb020 180deg 225deg, #4f7cff 225deg 270deg, #00e5c0 270deg 315deg, #6b8cff 315deg);
  border: 10px solid rgba(255,255,255,0.85);
  box-shadow: 0 0 0 8px #243048, 0 16px 40px rgba(0,0,0,0.4);
  transition: transform 4s cubic-bezier(.12,.65,.1,1);
}
.roulette-wrap { text-align: center; }
.roulette-pointer {
  color: var(--gold);
  font-size: 2rem;
  line-height: 1;
  margin-bottom: -12px;
  position: relative;
  z-index: 2;
}
.scratch-canvas {
  width: 100%;
  border-radius: 18px;
  background: #94a3b8;
  touch-action: none;
  display: block;
}
.skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, #152040 25%, #243458 38%, #152040 60%);
  background-size: 400% 100%;
  animation: shine 1.3s infinite;
}
@keyframes shine { to { background-position: -100% 0; } }
.skeleton.hide { display: none; }

.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 250px;
  padding: 22px 14px;
  background: #070d1c;
  border-right: 1px solid var(--line);
  position: fixed;
  inset: 0 auto 0 0;
}
.admin-sidebar a {
  display: block;
  padding: 11px 13px;
  border-radius: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  color: #fff;
  background: rgba(79, 124, 255, 0.16);
}
.admin-main { margin-left: 250px; flex: 1; }
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}
.empty { text-align: center; padding: 32px; color: var(--muted); }
.list { padding-left: 20px; color: var(--muted); }
.footer {
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (min-width: 768px) {
  .app-shell { max-width: 1120px; padding-bottom: 28px; }
  .bottom-nav {
    position: static;
    border-radius: 18px;
    margin: 0 20px 20px;
    max-width: none;
  }
  .public-nav { display: flex; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .admin-topbar { padding: 18px 30px; }
  .page { padding: 30px; }
}
@media (max-width: 767px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .admin-main .page { padding-bottom: 86px; }
  .public-actions .btn-ghost { display: none; }
}
