/* ==========================================================================
   Basil Cheats — design tokens and shared primitives.
   Hand written; no build step, no CSS framework.

   The look leans on three things rather than decoration:
   1. Real elevation — every raised surface carries a 1px inner top highlight,
      which is what stops dark UI reading as flat grey boxes.
   2. A tight neutral ramp, so hierarchy comes from value not from borders.
   3. Green used sparingly. It marks the one thing that matters per screen.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;450;500;600;700&display=swap');

:root {
  /* --- ground and elevated surfaces ------------------------------------ */
  --bg:          #07080b;
  --bg-alt:      #0a0c10;
  --surface:     #0f1116;
  --surface-2:   #14171e;
  --surface-3:   #1c2029;
  --surface-4:   #242935;

  --line:        #20242e;
  --line-soft:   #171a22;
  --line-strong: #2c323f;

  /* the highlight that sells elevation on dark backgrounds */
  --sheen:       rgba(255, 255, 255, .055);
  --sheen-soft:  rgba(255, 255, 255, .025);

  /* --- type ramp -------------------------------------------------------- */
  --text:        #f6f8fa;
  --text-2:      #a5aeba;
  --text-3:      #6b7481;
  --text-4:      #474f5c;

  /* --- accents ---------------------------------------------------------- */
  --accent:      #2fbf71;
  --accent-hi:   #46d98a;
  --accent-lo:   #1c8f52;
  --accent-dim:  #0c2c1c;
  --accent-glow: rgba(47, 191, 113, .32);
  --accent-grad: linear-gradient(140deg, #3ed283 0%, #1f9d5d 100%);

  --green:       #35d18a;
  --green-dim:   #0d2b1e;
  --lime:        #a8dc4f;
  --lime-dim:    #1e2b12;
  --teal:        #3ac2b6;
  --teal-dim:    #0c2827;
  --gold:        #e5ab3c;
  --gold-dim:    #2c2010;
  --red:         #f0616d;
  --red-dim:     #2c1418;
  --blue:        #5aa9ff;

  /* --- shape ------------------------------------------------------------ */
  --radius-sm: 8px;
  --radius:    11px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  /* --- depth ------------------------------------------------------------ */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow:    0 10px 30px -14px rgba(0,0,0,.75);
  --shadow-lg: 0 32px 70px -28px rgba(0,0,0,.85);
  --ring:      0 0 0 3px var(--accent-glow);

  /* raised card material, reused everywhere */
  --card-bg: linear-gradient(180deg, var(--sheen-soft), transparent 46%), var(--surface);
  --card-shadow: inset 0 1px 0 var(--sheen), var(--shadow);

  --font-display: 'Sora', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Menlo, monospace;

  --ease: cubic-bezier(.22, .68, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* A single soft bloom behind everything, so the ground is not dead flat. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(47,191,113,.07), transparent 70%),
    radial-gradient(760px 460px at 92% 4%, rgba(58,110,194,.045), transparent 72%);
}
body > * { position: relative; z-index: 1; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -.03em;
  margin: 0;
  font-weight: 700;
}

/* Money and counters must not jitter as digits change. */
.tabular, .stat-value, .total-amount, .dur-price, .tier-pct,
.side-balance-amount, .legend-total, .ladder-held, .hero-stat b, .official-row .price {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: #04140c; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* scrollbars ------------------------------------------------------------ */
* { scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--surface-4);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #333a49; background-clip: content-box; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-border: var(--line-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.008em;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: inset 0 1px 0 var(--sheen), var(--shadow-sm);
  transition: background .16s var(--ease), border-color .16s var(--ease),
              transform .12s var(--ease), box-shadow .16s var(--ease), opacity .16s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: #39414f; text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 var(--sheen); }
.btn:disabled, .btn[aria-disabled='true'] {
  opacity: .4; cursor: not-allowed; transform: none; box-shadow: none;
}

.btn-primary {
  --btn-bg: var(--accent-grad);
  --btn-border: transparent;
  --btn-fg: #04150c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 8px 22px -10px var(--accent-glow);
}
.btn-primary:hover {
  --btn-bg: linear-gradient(140deg, #4bdd90 0%, #23a866 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34), 0 10px 26px -10px var(--accent-glow);
}

.btn-ghost { --btn-bg: transparent; --btn-border: var(--line); box-shadow: none; }
.btn-ghost:hover { --btn-bg: var(--surface-2); }

/* A custom logo replaces the built-in mark's SVG. The gradient and glow the
   mark normally carries would fight an arbitrary image, so drop them and let
   the image fill the tile. */
.brand-mark.has-logo,
.side-brand-mark.has-logo {
  background: none;
  box-shadow: none;
  overflow: hidden;
}
.brand-mark.has-logo::after,
.side-brand-mark.has-logo::after { display: none; }
.brand-mark.has-logo img,
.side-brand-mark.has-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.btn-danger { --btn-bg: var(--red-dim); --btn-border: #4a2026; --btn-fg: #ff909a; }
.btn-danger:hover { --btn-bg: #3a1a1f; --btn-border: #5c272f; }

.btn-block { width: 100%; }
.btn-lg { height: 45px; font-size: 14.5px; border-radius: 13px; }
.btn-sm { height: 31px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { width: 34px; padding: 0; }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: 16px; }

.label {
  display: flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 7px;
  letter-spacing: -.005em;
}

.input, .select, .textarea {
  width: 100%;
  height: 41px;
  padding: 0 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.28);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7481' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.28), var(--ring);
}
.input:disabled, .textarea:disabled { opacity: .5; cursor: not-allowed; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 62px; }
.input-affix {
  position: absolute;
  right: 6px; top: 50%; transform: translateY(-50%);
  height: 26px; padding: 0 9px;
  border-radius: 7px;
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  background: var(--surface-3); border: 1px solid var(--line);
  cursor: pointer;
  transition: color .14s var(--ease), background .14s var(--ease);
}
.input-affix:hover { color: var(--text); background: var(--surface-4); }

.hint { font-size: 12px; color: var(--text-3); margin-top: 7px; line-height: 1.5; }
.hint-error { color: #ff909a; }

/* ==========================================================================
   Small shared pieces
   ========================================================================== */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 23px; padding: 0 10px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .012em;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--sheen-soft);
  white-space: nowrap;
}
.pill-green { background: var(--green-dim); color: var(--green); border-color: #17452f; }
.pill-gold  { background: var(--gold-dim); color: var(--gold); border-color: #40311a; }
.pill-red   { background: var(--red-dim); color: #ff909a; border-color: #432026; }
.pill-lime  { background: var(--lime-dim); color: var(--lime); border-color: #32431d; }
.pill-teal  { background: var(--teal-dim); color: var(--teal); border-color: #17403d; }
.pill-accent,
.pill-violet { background: var(--accent-dim); color: var(--accent-hi); border-color: #17452f; }

.dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex: none; }
.dot-pulse { position: relative; }
.dot-pulse::after {
  content: ''; position: absolute; inset: -3px; border-radius: 99px;
  background: currentColor; opacity: .3; animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0% { transform: scale(.7); opacity: .45 } 70%,100% { transform: scale(2.3); opacity: 0 } }

.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: -.02em; }
.muted { color: var(--text-2); }
.dim   { color: var(--text-3); }

/* toast ----------------------------------------------------------------- */
#toasts {
  position: fixed; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 300; pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 11px;
  min-width: 268px; max-width: 390px;
  padding: 13px 15px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  box-shadow: inset 0 1px 0 var(--sheen), var(--shadow-lg);
  font-size: 13px;
  animation: toast-in .34s var(--ease-out);
}
.toast strong { display: block; font-weight: 600; margin-bottom: 2px; }
.toast span { color: var(--text-2); line-height: 1.5; }
.toast.ok  { border-color: #1d5236; }
.toast.ok .toast-mark { color: var(--accent-hi); }
.toast.err { border-color: #4a2026; }
.toast.err .toast-mark { color: #ff909a; }
.toast-mark { flex: none; margin-top: 1px; }
.toast.hide { animation: toast-out .22s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(14px) scale(.96) } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(24px) scale(.98) } }

/* skeleton -------------------------------------------------------------- */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -300% 0 } }

/* spinner --------------------------------------------------------------- */
.spinner {
  width: 15px; height: 15px; flex: none;
  border: 2px solid rgba(255,255,255,.22);
  border-top-color: currentColor;
  border-radius: 99px;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
