:root {
  --bg: #07030f;
  --bg2: #120a24;
  --card: #170d2e;
  --card2: #1f1240;
  --line: #3a2168;
  --text: #f4ecff;
  --muted: #a78bd6;
  --pink: #ff2d95;
  --cyan: #00e5ff;
  --green: #39ff14;
  --purple: #c026ff;
  --yellow: #ffe600;
  --radius: 20px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 8% -5%, rgba(255,45,149,.28), transparent 60%),
    radial-gradient(900px 500px at 95% 8%, rgba(0,229,255,.25), transparent 55%),
    radial-gradient(800px 600px at 50% 110%, rgba(57,255,20,.18), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.screen { max-width: 580px; margin: 0 auto; padding: 0 16px env(safe-area-inset-bottom); }

/* ---------- Onboarding ---------- */
.hero { text-align: center; padding: 44px 0 18px; }
.hero-emoji { font-size: 70px; filter: drop-shadow(0 0 22px rgba(0,229,255,.7)); animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.neon-title {
  font-size: 40px; line-height: .98; margin: 10px 0 6px; letter-spacing: 1px; font-weight: 900;
  background: linear-gradient(90deg, var(--pink), var(--cyan), var(--green));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(255,45,149,.5));
}
.subtitle { color: var(--cyan); margin: 0; font-size: 15px; font-weight: 600; text-shadow: 0 0 12px rgba(0,229,255,.6); }
.card {
  background: linear-gradient(var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 14px;
  box-shadow: 0 0 0 1px rgba(255,45,149,.15), 0 24px 60px rgba(0,0,0,.5), inset 0 0 30px rgba(192,38,255,.08);
}
.join-h { text-align: center; font-size: 24px; margin: 0 0 6px; }
.join-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 18px; line-height: 1.4; }
.form label, label { display: block; font-size: 13px; color: var(--cyan); margin: 12px 0 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
input[type=text], input[type=number], input[type=time], select {
  width: 100%; padding: 15px; border-radius: 13px; border: 2px solid var(--line);
  background: rgba(7,3,15,.7); color: var(--text); font-size: 16px; outline: none; transition: .15s;
}
input:focus, select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255,45,149,.25), 0 0 18px rgba(255,45,149,.3); }
.btn {
  width: 100%; padding: 16px; border: 0; border-radius: 14px; font-size: 17px; font-weight: 800; cursor: pointer; margin-top: 16px;
  transition: .15s; letter-spacing: .3px;
}
.btn.primary { background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff; box-shadow: 0 0 24px rgba(255,45,149,.55); }
.btn.primary:disabled { opacity: .4; box-shadow: none; }
.btn.primary:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--cyan); border: 2px solid var(--cyan); box-shadow: 0 0 16px rgba(0,229,255,.2); }
.btn.danger { background: linear-gradient(135deg, #ff1744, #ff2d95); color: #fff; box-shadow: 0 0 22px rgba(255,23,68,.5); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 13px; margin: 0; border-radius: 10px; }
.error { color: #ff5b8a; font-size: 14px; text-align: center; min-height: 18px; margin: 10px 0 0; font-weight: 600; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 30px; }

/* ---------- App ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 14px 0; background: linear-gradient(var(--bg) 60%, transparent); backdrop-filter: blur(6px); }
.team-badge { display: flex; align-items: center; gap: 12px; }
.t-emoji { font-size: 36px; filter: drop-shadow(0 0 12px rgba(0,229,255,.6)); }
.t-name { font-weight: 900; font-size: 19px; }
.t-stats { font-size: 13px; color: var(--green); font-weight: 700; text-shadow: 0 0 10px rgba(57,255,20,.5); }
.icon-btn { background: var(--card2); border: 2px solid var(--line); color: var(--cyan); width: 46px; height: 46px; border-radius: 13px; font-size: 18px; cursor: pointer; }
main { padding-bottom: 92px; }
.view-title { font-size: 22px; margin: 14px 2px; display: flex; align-items: center; gap: 10px; font-weight: 900; }
.live { font-size: 11px; color: var(--green); font-weight: 800; animation: pulse 1.6s infinite; text-shadow: 0 0 10px var(--green); }
@keyframes pulse { 50% { opacity: .35; } }

.lock-banner { background: linear-gradient(135deg, rgba(255,230,0,.15), rgba(255,45,149,.12)); border: 2px solid var(--yellow); color: var(--yellow); border-radius: 14px; padding: 14px; text-align: center; font-weight: 800; margin: 14px 0 4px; box-shadow: 0 0 18px rgba(255,230,0,.25); }

.progress { height: 10px; background: var(--card2); border-radius: 20px; overflow: hidden; margin: 14px 0 6px; border: 1px solid var(--line); }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--cyan), var(--pink)); transition: width .5s; box-shadow: 0 0 14px rgba(0,229,255,.6); }
.progress-text { font-size: 13px; margin: 0 2px 12px; font-weight: 600; }

.cat-filter { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 4px; scrollbar-width: none; }
.cat-filter::-webkit-scrollbar { display: none; }
.cat-chip { white-space: nowrap; padding: 9px 15px; border-radius: 30px; background: var(--card2); border: 2px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.cat-chip.active { background: linear-gradient(135deg, var(--cyan), var(--green)); color: #04121a; border-color: transparent; box-shadow: 0 0 16px rgba(0,229,255,.5); }

.mission { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; cursor: pointer; transition: .15s; }
.mission:active { transform: scale(.99); }
.mission.done { opacity: .55; border-color: var(--green); box-shadow: inset 0 0 18px rgba(57,255,20,.12); }
.mission.locked { opacity: .5; }
.m-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 13px; display: grid; place-items: center; font-size: 25px; }
.m-body { flex: 1; min-width: 0; }
.m-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.m-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.m-right { text-align: right; flex-shrink: 0; }
.m-pts { font-weight: 900; color: var(--yellow); font-size: 16px; text-shadow: 0 0 10px rgba(255,230,0,.5); }
.m-pts small { font-weight: 700; font-size: 10px; color: var(--muted); display: block; text-shadow: none; }
.m-check { color: var(--green); font-size: 24px; text-shadow: 0 0 12px var(--green); }
.m-lock { font-size: 11px; color: var(--yellow); font-weight: 700; }
.cat-head { font-size: 13px; font-weight: 900; margin: 20px 4px 8px; text-transform: uppercase; letter-spacing: 1px; }

.lb-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.lb-row.me { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 20px rgba(0,229,255,.35); }
.lb-row.top1 { border-color: var(--yellow); box-shadow: 0 0 22px rgba(255,230,0,.3); }
.lb-rank { font-size: 22px; font-weight: 900; width: 36px; text-align: center; color: var(--muted); }
.lb-row.top1 .lb-rank { color: var(--yellow); text-shadow: 0 0 14px var(--yellow); }
.lb-emoji { font-size: 32px; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 900; font-size: 16px; }
.lb-players { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-pts { font-weight: 900; font-size: 20px; color: var(--yellow); text-shadow: 0 0 12px rgba(255,230,0,.5); text-align: right; }
.lb-pts small { display: block; font-size: 10px; color: var(--muted); font-weight: 700; text-shadow: none; }

.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gphoto { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 1; background: var(--card); border: 1px solid var(--line); }
.gphoto img { width: 100%; height: 100%; object-fit: cover; }
.gphoto .cap { position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 8px 6px; font-size: 11px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.gphoto .cap b { display: block; color: var(--cyan); }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; max-width: 580px; margin: 0 auto; background: rgba(18,10,36,.96); backdrop-filter: blur(12px); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-btn { flex: 1; background: transparent; border: 0; color: var(--muted); padding: 12px 0 14px; font-size: 11px; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.nav-btn span { font-size: 23px; }
.nav-btn.active { color: var(--pink); text-shadow: 0 0 10px var(--pink); }

.modal { position: fixed; inset: 0; background: rgba(7,3,15,.75); backdrop-filter: blur(5px); display: grid; place-items: end center; z-index: 100; }
.modal-card { background: linear-gradient(var(--card), var(--bg2)); width: 100%; max-width: 580px; border-radius: 26px 26px 0 0; padding: 28px 20px calc(26px + env(safe-area-inset-bottom)); position: relative; animation: slideup .25s ease; border-top: 2px solid var(--pink); box-shadow: 0 0 40px rgba(255,45,149,.3); }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
.modal-close { position: absolute; top: 16px; right: 16px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.modal-emoji { font-size: 48px; text-align: center; }
.modal-card h3 { text-align: center; margin: 8px 0 4px; font-size: 23px; }
.modal-card #modal-desc { text-align: center; margin: 0 0 14px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.modal-points { text-align: center; color: var(--yellow); font-weight: 900; font-size: 19px; margin-bottom: 16px; text-shadow: 0 0 12px rgba(255,230,0,.5); }
.photo-zone { margin-bottom: 12px; }
.photo-label { display: block; text-align: center; padding: 24px; border: 2px dashed var(--cyan); border-radius: 14px; color: var(--cyan); cursor: pointer; font-size: 14px; font-weight: 700; }
.photo-preview { width: 100%; border-radius: 14px; margin-top: 10px; max-height: 240px; object-fit: cover; }

.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--green), var(--cyan)); color: #04121a; padding: 14px 24px; border-radius: 30px; font-weight: 800; z-index: 200; box-shadow: 0 0 30px rgba(57,255,20,.5); animation: drop .3s; max-width: 90%; text-align: center; }
.toast.err { background: linear-gradient(135deg, #ff1744, var(--pink)); color: #fff; }
@keyframes drop { from { transform: translate(-50%,-20px); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; }

/* ---------- Arbitrage ---------- */
.arb-alert { position: sticky; top: 64px; z-index: 9; background: linear-gradient(135deg, rgba(255,45,149,.2), rgba(0,229,255,.16)); border: 2px solid var(--pink); border-radius: 16px; padding: 14px; margin: 0 16px 4px; box-shadow: 0 0 26px rgba(255,45,149,.45); animation: arbpulse 1.4s infinite; }
@keyframes arbpulse { 50% { box-shadow: 0 0 10px rgba(255,45,149,.2); } }
.arb-head { font-weight: 900; font-size: 14px; color: var(--pink); display: flex; justify-content: space-between; align-items: center; }
.arb-count { font-size: 11px; color: var(--muted); font-weight: 700; }
.arb-body { font-size: 14px; margin: 8px 0 10px; line-height: 1.4; }
.arb-mission { color: var(--cyan); font-weight: 800; }
.arb-pts { color: var(--yellow); font-weight: 800; }
.arb-note { color: var(--muted); font-style: italic; margin-top: 4px; font-size: 12px; }
.arb-actions { display: flex; gap: 8px; }
.arb-actions .btn { margin-top: 0; flex: 1; }
.m-pending { color: var(--cyan); font-size: 20px; text-align: center; text-shadow: 0 0 10px rgba(0,229,255,.5); }
.m-pending small { display: block; font-size: 9px; color: var(--muted); font-weight: 700; text-shadow: none; }
.mission.pending { border-color: var(--cyan); box-shadow: inset 0 0 14px rgba(0,229,255,.1); }
.modal-hint { text-align: center; font-size: 12.5px; color: var(--cyan); background: rgba(0,229,255,.08); border: 1px solid rgba(0,229,255,.3); border-radius: 10px; padding: 9px; margin-bottom: 12px; font-weight: 600; }
.modal-hint.pending { color: var(--yellow); background: rgba(255,230,0,.08); border-color: rgba(255,230,0,.3); }

/* ---------- Admin ---------- */
.admin-body { max-width: 760px; margin: 0 auto; padding: 18px 16px 60px; }
.admin-head { text-align: center; margin-bottom: 8px; }
.admin-head h1 { font-size: 26px; margin: 0; background: linear-gradient(90deg, var(--pink), var(--cyan)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.admin-head p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.admin-tabs { display: flex; gap: 8px; margin: 18px 0; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 5; }
.admin-tabs button { flex: 1; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card2); color: var(--muted); font-weight: 800; font-size: 13px; cursor: pointer; }
.admin-tabs button.active { background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff; border-color: transparent; box-shadow: 0 0 16px rgba(255,45,149,.5); }
.panel { display: none; }
.panel.active { display: block; }
.block { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.block h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ateam { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; background: var(--bg2); }
.ateam-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ateam-top .em { font-size: 26px; }
.ateam-top .nm { font-weight: 900; font-size: 16px; flex: 1; }
.ateam-top .sc { color: var(--yellow); font-weight: 900; text-shadow: 0 0 10px rgba(255,230,0,.4); }
.aplayer { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--card2); border-radius: 10px; margin-bottom: 6px; }
.aplayer .pn { flex: 1; font-weight: 700; }
.aplayer select { width: auto; padding: 7px 10px; font-size: 12px; border-radius: 8px; flex-shrink: 1; max-width: 42%; }
.aplayer .x { background: transparent; border: 0; color: #ff5b8a; font-size: 18px; cursor: pointer; padding: 0 4px; }
.ateam-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row > * { margin-top: 0; }
.grow { flex: 1; }
.amission { border: 1px solid var(--line); border-radius: 13px; padding: 12px; margin-bottom: 10px; background: var(--bg2); }
.amission.off { opacity: .55; }
.amission-top { display: flex; align-items: center; gap: 10px; }
.amission-top .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.amission-top .ti { flex: 1; font-weight: 800; font-size: 14px; }
.amission-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: 10px; align-items: end; }
.amission-grid label { margin: 0 0 4px; font-size: 10px; }
.amission-grid input { padding: 10px; font-size: 14px; }
.dft { font-size: 10px; color: var(--muted); margin-top: 4px; }
/* toggle switch */
.sw-toggle { position: relative; width: 50px; height: 28px; flex-shrink: 0; }
.sw-toggle input { display: none; }
.sw-toggle .track { position: absolute; inset: 0; background: var(--line); border-radius: 20px; transition: .2s; cursor: pointer; }
.sw-toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: .2s; }
.sw-toggle input:checked + .track { background: linear-gradient(135deg, var(--green), var(--cyan)); box-shadow: 0 0 12px rgba(57,255,20,.5); }
.sw-toggle input:checked + .track::after { transform: translateX(22px); }
.saved { color: var(--green); font-size: 12px; font-weight: 800; }
.danger-zone { border-color: #ff1744; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
