/* ---------- Reset & tokens ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #060a16;
  --bg-1: #0b1120;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e9edf9;
  --muted: #93a0bd;
  --violet: #8b7bff;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --amber: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --grad: linear-gradient(135deg, #a18cff 0%, #30e8ff 50%, #f472b6 100%);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 800px at 82% -10%, rgba(139, 123, 255, 0.14), transparent 60%),
    radial-gradient(1000px 700px at 8% 110%, rgba(34, 211, 238, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 55%, #070b17);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

::selection { background: rgba(139, 123, 255, 0.45); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139, 123, 255, 0.28);
  border-radius: 999px;
  border: 2px solid var(--bg-0);
}
::-webkit-scrollbar-thumb:hover { background: rgba(139, 123, 255, 0.48); }
* { scrollbar-width: thin; scrollbar-color: rgba(139, 123, 255, 0.35) transparent; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 4px; }

/* ---------- Scroll progress ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 80;
  height: 3px; width: 0;
  background: var(--grad);
  border-radius: 0 999px 999px 0;
  box-shadow: 0 0 12px rgba(139, 123, 255, 0.6);
  transition: width .12s linear;
}

/* ---------- Background glow ---------- */
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
}
.bg-glow::before,
.bg-glow::after {
  content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  filter: blur(120px); opacity: .5;
}
.bg-glow::before {
  background: rgba(139, 123, 255, 0.35); top: -140px; left: -100px;
  animation: float-a 16s ease-in-out infinite alternate;
}
.bg-glow::after {
  background: rgba(34, 211, 238, 0.28); bottom: -160px; right: -120px;
  animation: float-b 20s ease-in-out infinite alternate;
}
@keyframes float-a { to { transform: translate(90px, 60px) scale(1.15); } }
@keyframes float-b { to { transform: translate(-80px, -50px) scale(1.2); } }

/* ---------- Nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 28px;
  background: rgba(7, 11, 22, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none;
}
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 0 14px rgba(139, 123, 255, 0.8);
}
.brand-accent {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  padding: 8px 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: all .18s ease;
}
.nav-link:hover { color: var(--text); background: var(--panel); }
.nav-link.active {
  color: #fff;
  background: rgba(139, 123, 255, 0.18);
  border-color: rgba(139, 123, 255, 0.38);
}
.nav-toggle {
  display: none;
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-family: var(--font);
  place-items: center;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: ""; display: block; width: 18px; height: 2px;
  background: currentColor; border-radius: 2px;
  position: relative; transition: all .25s ease;
}
.nav-toggle span::before { position: absolute; top: -5px; }
.nav-toggle span::after { position: absolute; top: 5px; }
.topnav.nav-open .nav-toggle span { background: transparent; }
.topnav.nav-open .nav-toggle span::before { top: 0; transform: rotate(45deg); }
.topnav.nav-open .nav-toggle span::after { top: 0; transform: rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-family: var(--font); font-size: 15px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  color: var(--text); text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #0a0f1f; box-shadow: 0 8px 24px rgba(139, 123, 255, 0.35); position: relative; overflow: hidden; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(139, 123, 255, 0.5); }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-20deg); pointer-events: none;
  transition: left .55s ease;
}
.btn-primary:not(:disabled):hover::after { left: 130%; }
.btn-ghost { background: var(--panel); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--panel-strong); transform: translateY(-2px); }
.btn-danger { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.4); color: var(--red); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); transform: translateY(-2px); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none; }

/* Loading spinner inside buttons */
.btn.loading { pointer-events: none; opacity: .85; }
.btn.loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout & typography ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 56px 24px 80px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 28px;
}
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 10px;
}
h1 { font-size: clamp(38px, 6vw, 72px); font-weight: 900; letter-spacing: -0.04em; line-height: 1.05; text-wrap: balance; margin-bottom: 12px; }
h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.muted { color: var(--muted); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.shimmer {
  background-size: 200% auto;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity .8s cubic-bezier(.22, 1, .36, 1), transform .8s cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- Home ---------- */
.hero { position: relative; text-align: center; padding: 30px 0 54px; }
.hero-grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 123, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 123, 255, 0.08) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(620px 340px at 50% 36%, #000 30%, transparent 78%);
  mask-image: radial-gradient(620px 340px at 50% 36%, #000 30%, transparent 78%);
}
.hero > :not(.hero-grid) { position: relative; z-index: 1; }
.hero-blob {
  position: absolute; font-size: 38px; opacity: .7; pointer-events: none;
  filter: drop-shadow(0 0 24px currentColor) brightness(1.2);
  animation: blob-float 8s ease-in-out infinite alternate;
}
.hero-blob:nth-of-type(1) { top: 12px; left: 12%; color: var(--violet); }
.hero-blob:nth-of-type(2) { top: 32px; right: 14%; font-size: 32px; animation-delay: 1.6s; color: var(--cyan); }
.hero-blob:nth-of-type(3) { bottom: 32px; left: 22%; font-size: 28px; animation-delay: 3.2s; color: var(--pink); }
.hero-blob:nth-of-type(4) { bottom: 18px; right: 24%; font-size: 34px; animation-delay: 4.6s; color: var(--amber); }
@keyframes blob-float { to { transform: translateY(-18px) rotate(10deg); } }
@media (max-width: 700px) { .hero-blob { display: none; } }

.hero-sub { color: var(--muted); max-width: 560px; margin: 16px auto 28px; font-size: 17px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.stats {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 14px;
  margin: 8px auto 0; max-width: 820px;
}
.stat {
  flex: 1; min-width: 150px; text-align: center; padding: 20px 14px 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  backdrop-filter: blur(10px); position: relative; overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.stat::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(200px 100px at 50% -30%, rgba(139, 123, 255, 0.22), transparent 70%);
}
.stat:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat b {
  display: block; position: relative; font-size: 26px; font-weight: 900; letter-spacing: -0.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span {
  position: relative; display: inline-block; margin-top: 4px;
  font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-weight: 700;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; text-decoration: none; color: var(--text);
  backdrop-filter: blur(10px); position: relative; overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 50% -10%, rgba(161, 140, 255, 0.18), transparent 60%);
  opacity: 0; transition: opacity .4s ease; z-index: 0; pointer-events: none;
}
.card:hover {
  transform: translateY(-8px); 
  border-color: rgba(255, 255, 255, 0.3); 
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(161, 140, 255, 0.15); 
}
.card:hover::before { opacity: 1; }
.card:hover .card-icon { transform: translateY(-4px) scale(1.05) rotate(-6deg); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 1.5px;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,0.4), transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .4s ease;
}
.card:hover::after { opacity: 1; }
.card-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; font-size: 26px;
  position: relative; z-index: 1;
  transition: transform .25s ease;
}
.card-icon-violet { background: rgba(139, 123, 255, 0.16); border: 1px solid rgba(139, 123, 255, 0.35); }
.card-icon-cyan { background: rgba(34, 211, 238, 0.14); border: 1px solid rgba(34, 211, 238, 0.35); }
.card-icon-pink { background: rgba(244, 114, 182, 0.14); border: 1px solid rgba(244, 114, 182, 0.35); }
.card h3 { position: relative; z-index: 1; font-size: 20px; }
.card p { position: relative; z-index: 1; color: var(--muted); font-size: 14.5px; flex: 1; }
.card-feats { position: relative; z-index: 1; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.card-feats li::before { content: "✦ "; color: var(--violet); }
.card-cta {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 14px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card-cta::after { content: "→"; transition: transform .2s ease; }
.card:hover .card-cta::after { transform: translateX(4px); }

/* ---------- Guessing game ---------- */
.game-wrap { display: grid; place-items: center; padding-top: 20px; }
.game-panel { max-width: 480px; width: 100%; text-align: center; padding: 36px; }
.chips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 20px; }
.chip {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  background: var(--panel-strong); border: 1px solid var(--border); color: var(--text);
  transition: all .25s ease;
  cursor: default;
}
.chip:not(.elim):not(.correct):hover {
  transform: translateY(-3px);
  border-color: var(--violet);
  box-shadow: 0 6px 18px rgba(139, 123, 255, 0.25);
}
.chip.elim { opacity: .2; transform: scale(.85); }
.chip.correct {
  background: var(--grad); color: #0a0f1f; border-color: transparent;
  transform: scale(1.18); box-shadow: 0 0 22px rgba(139, 123, 255, 0.6);
  animation: pop .45s ease;
}
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1.18); }
}

.guess-status {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 15px; min-height: 56px;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  margin-bottom: 18px; transition: all .25s ease;
}
.guess-status.low { color: var(--cyan); border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); }
.guess-status.high { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }
.guess-status.win { color: var(--green); border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.1); animation: pop .5s ease; }
.guess-status.error { color: var(--red); border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }

.guess-form { display: flex; gap: 10px; }
.guess-form input {
  flex: 1; padding: 13px 18px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.3); color: var(--text);
  font-family: var(--mono); font-size: 16px; font-weight: 600; text-align: center;
  outline: none; transition: border-color .2s ease, box-shadow .2s ease;
}
.guess-form input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.22); }
.guess-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; color: var(--muted); font-size: 14px; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
input, textarea {
  padding: 12px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.3); color: var(--text);
  font-family: var(--font); font-size: 15px; width: 100%;
  outline: none; transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.2); }
input:hover, textarea:hover { border-color: var(--border-strong); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .65; }
textarea { resize: vertical; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; min-height: 120px; }

/* ---------- Shake ---------- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shake { animation: shake .4s ease; }

/* ---------- Bank ---------- */
.bank-wrap { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  margin: 14px 0 20px;
}
.tab {
  border: none; background: transparent; color: var(--muted);
  padding: 9px 20px; border-radius: 999px;
  font-family: var(--font); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: all .2s ease;
}
.tab.active { background: var(--grad); color: #0a0f1f; }
.auth-form { display: flex; flex-direction: column; gap: 16px; max-width: 420px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.note { margin-top: 16px; font-size: 13px; }

.balance-card { text-align: center; padding: 40px 28px; position: relative; overflow: hidden; }
.balance-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(500px 220px at 50% -20%, rgba(139, 123, 255, 0.25), transparent 70%);
}
.balance {
  font-size: 48px; font-weight: 900; letter-spacing: -0.03em; margin: 6px 0;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block;
}
.balance.bump { animation: bump .5s ease; }
@keyframes bump { 50% { transform: scale(1.06); } }
#logout { position: absolute; top: 18px; right: 18px; z-index: 1; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.dash-grid .panel { display: flex; flex-direction: column; gap: 14px; }
.dash-grid form { display: flex; flex-direction: column; gap: 12px; }
.danger-panel { border-color: rgba(248, 113, 113, 0.28); }

/* Activity feed */
.activity-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.activity-head h3 { margin: 0; }
.activity {
  list-style: none; display: flex; flex-direction: column; gap: 10px;
  max-height: 264px; overflow-y: auto; padding-right: 4px;
}
.activity li {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 13.5px; color: var(--muted);
  padding: 11px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border);
  animation: fade-up .3s ease;
}
.activity li:first-child { border-color: var(--border-strong); }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
.activity .dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
}
.dot.deposit { background: var(--green); box-shadow: 0 0 10px rgba(52, 211, 153, 0.6); }
.dot.withdraw { background: var(--red); box-shadow: 0 0 10px rgba(248, 113, 113, 0.6); }
.dot.update { background: var(--cyan); box-shadow: 0 0 10px rgba(34, 211, 238, 0.6); }
.dot.welcome { background: var(--violet); box-shadow: 0 0 10px rgba(139, 123, 255, 0.6); }
.activity .a-body { flex: 1; min-width: 0; }
.activity .a-text { color: var(--text); font-weight: 500; word-break: break-word; }
.activity time { font-size: 11px; color: var(--muted); opacity: .75; }
.activity-empty { text-align: center; padding: 18px; }

/* ---------- File manager ---------- */
.files-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: stretch; }
.file-sidebar { padding: 0; display: flex; flex-direction: column; overflow: hidden; max-height: 72vh; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.sidebar-head h3 { display: flex; align-items: center; margin: 0; }
.file-count {
  font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 8px;
  background: var(--panel-strong); border: 1px solid var(--border);
  padding: 1px 8px; border-radius: 999px;
}
.file-list { list-style: none; overflow-y: auto; flex: 1; padding: 8px; }
.file-item { padding: 11px 13px; border-radius: var(--radius-sm); cursor: pointer; position: relative; transition: background .15s ease, transform .15s ease; }
.file-item:hover { background: var(--panel-strong); transform: translateX(3px); }
.file-item.active { background: rgba(139, 123, 255, 0.16); transform: none; }
.file-item.active::before {
  content: ""; position: absolute; left: -8px; top: 16%; bottom: 16%; width: 3px;
  border-radius: 999px; background: var(--grad);
}
.file-item-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-item-body { flex: 1; min-width: 0; }
.file-item-name { font-family: var(--mono); font-size: 13.5px; font-weight: 500; word-break: break-all; }
.file-item-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.file-badge {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
}
.badge-violet { background: rgba(139, 123, 255, 0.15); color: #a99dff; border: 1px solid rgba(139, 123, 255, 0.35); }
.badge-amber { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.35); }
.badge-cyan { background: rgba(34, 211, 238, 0.12); color: #67e8f9; border: 1px solid rgba(34, 211, 238, 0.35); }
.badge-pink { background: rgba(244, 114, 182, 0.12); color: #f9a8d4; border: 1px solid rgba(244, 114, 182, 0.35); }
.badge-green { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.35); }
.badge-muted { background: var(--panel-strong); color: var(--muted); border: 1px solid var(--border); }
.file-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; padding: 42px 18px; color: var(--muted);
}
.file-empty-icon {
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center;
  font-size: 26px; margin-bottom: 4px;
  background: rgba(139, 123, 255, 0.14); border: 1px solid rgba(139, 123, 255, 0.35);
  box-shadow: 0 8px 24px rgba(139, 123, 255, 0.18);
  animation: float-a 5s ease-in-out infinite alternate;
}
.file-empty-title { font-weight: 700; color: var(--text); font-size: 15px; }
.file-empty-sub { font-size: 12.5px; line-height: 1.6; }
.file-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 28px;
  border: 1.5px dashed rgba(255, 255, 255, 0.16); border-radius: var(--radius-sm);
  min-height: 400px; background: rgba(0, 0, 0, 0.15);
}
.file-placeholder-icon {
  width: 74px; height: 74px; border-radius: 22px; display: grid; place-items: center;
  font-size: 32px; margin-bottom: 8px;
  background: var(--panel-strong); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  animation: float-b 6s ease-in-out infinite alternate;
}
.file-placeholder h3 { margin: 0; }
.file-main { display: flex; flex-direction: column; gap: 16px; min-height: 72vh; }
.file-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.file-name { font-family: var(--mono); font-weight: 600; font-size: 15px; word-break: break-all; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-content {
  flex: 1; margin: 0;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 20px; font-family: var(--mono); font-size: 13.5px; line-height: 1.7;
  overflow: auto; white-space: pre-wrap; word-break: break-word;
  color: #c6d0ea; min-height: 400px;
  transition: opacity .2s ease;
}
.file-content.loading { opacity: .55; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); font-size: 16px; cursor: pointer;
  font-family: var(--font); line-height: 1;
  transition: all .2s ease;
}
.icon-btn:hover { color: var(--text); transform: rotate(180deg); border-color: var(--border-strong); }
.icon-btn.loading { color: var(--violet); border-color: rgba(139, 123, 255, 0.5); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(4, 7, 15, 0.7); backdrop-filter: blur(6px);
  animation: fade .18s ease;
}
.modal-box { width: min(560px, 92vw); display: flex; flex-direction: column; gap: 16px; animation: slideup .28s cubic-bezier(.22, 1, .36, 1); }
.modal-box label { margin-top: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-box.danger { border-color: rgba(248, 113, 113, 0.45); }
.modal-box.danger h3 { color: var(--red); }
#modal-message { font-size: 14px; line-height: 1.6; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(18px) scale(.96); opacity: 0; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 20px; border-radius: 14px;
  font-size: 14px; font-weight: 600; overflow: hidden;
  background: #131a2e; border: 1px solid var(--border-strong); color: var(--text);
  box-shadow: var(--shadow); max-width: 340px;
  transform: translateY(16px); opacity: 0; transition: all .3s ease;
}
.toast::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px;
  background: currentColor; opacity: .4; border-radius: 999px;
  animation: toast-bar 3.4s linear forwards;
}
@keyframes toast-bar { from { width: 100%; } to { width: 0; } }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { font-size: 16px; line-height: 1.4; }
.toast-success { border-color: rgba(52, 211, 153, 0.5); color: var(--green); }
.toast-error { border-color: rgba(248, 113, 113, 0.5); color: var(--red); }

/* ---------- Confetti ---------- */
.confetti {
  position: fixed; top: -14px; z-index: 150;
  width: 10px; height: 16px; border-radius: 2px;
  pointer-events: none; animation: fall 2.4s ease-in forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg) translateX(var(--drift)); opacity: .2; }
}

/* ---------- Back to top & grain ---------- */
.back-top {
  position: fixed; left: 24px; bottom: 24px; z-index: 90;
  width: 46px; height: 46px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: rgba(19, 26, 46, 0.85);
  color: var(--text); font-size: 18px; cursor: pointer; line-height: 1;
  font-family: var(--font); backdrop-filter: blur(10px); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, border-color .2s ease;
}
.back-top.show { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { border-color: rgba(139, 123, 255, 0.6); color: #fff; transform: translateY(-2px); }
.back-top:active { transform: scale(.94); }
.grain {
  position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Footer ---------- */
.footer {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 30px 20px 40px; border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .files-wrap { grid-template-columns: 1fr; }
  .page { padding: 36px 16px 60px; }
  .row-2 { grid-template-columns: 1fr; }
  .game-panel { padding: 26px 20px; }
}
@media (max-width: 720px) {
  .topnav { flex-wrap: wrap; padding: 12px 18px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none; width: 100%;
    flex-direction: column; gap: 4px; padding-top: 4px;
  }
  .topnav.nav-open .nav-links { display: flex; }
  .nav-link { width: 100%; text-align: center; }
  .hero-actions .btn { flex: 1; min-width: 140px; }
  .toast { left: 16px; right: 16px; max-width: none; }
  .back-top { left: 16px; bottom: 16px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
