/* The Twisted Isle — premium jungle/dino theme.
   CSS-only visual upgrade: same class names, same layout hooks, zero JS risk. */
:root {
  --bg: #070d12;
  --bg-2: #0b141b;
  --panel: #0f1c24;
  --panel-2: #14242f;
  --line: #1e3a47;
  --line-soft: #17303c;
  --text: #eef6f1;
  --muted: #8fb0a5;
  --brand: #34d399;
  --brand-2: #fbbf24;
  --money: #fbbf24;
  --bones: #e8f0ec;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --radius: 14px;
  --shadow: 0 14px 40px rgba(0,0,0,.45);
  --sidebar-w: 264px;
}
html[data-dim="1"] { --bg:#05090c; --bg-2:#070e13; --panel:#0a151c; --panel-2:#0e1b24; --text:#b7c8c0; --muted:#5b7269; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 480px at 85% -10%, rgba(52,211,153,.14) 0%, transparent 60%),
    radial-gradient(900px 520px at -10% 10%, rgba(251,191,36,.08) 0%, transparent 55%),
    radial-gradient(700px 700px at 50% 120%, rgba(20,60,50,.35) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(52,211,153,.07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 45%);
}
.app, .gate { position: relative; z-index: 1; }
a { color: var(--brand); text-decoration: none; }
h1,h2,h3 { margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: 30px; font-weight: 800; background: linear-gradient(90deg, #fff, var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h3 { font-size: 17px; color: var(--brand-2); text-transform: uppercase; letter-spacing: .09em; font-size: 13px; margin-top: 22px; }
.muted { color: var(--muted); }
.error { color: var(--err); }
.hidden { display: none !important; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5em; justify-content: center;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); color: var(--text); border: 1px solid var(--line);
  padding: .6em 1.1em; border-radius: 12px; cursor: pointer; font-weight: 700;
  transition: transform .06s ease, box-shadow .15s ease, border-color .15s, filter .15s;
}
.btn:hover { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 8px 22px rgba(52,211,153,.18); filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand), #a7f3d0 55%, var(--brand-2)); color: #052018; border: none; box-shadow: 0 8px 26px rgba(52,211,153,.35); }
.btn-danger { background: #3a1620; border-color: #5b2130; color: #ffb4c2; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .35em .7em; font-size: 13px; }
.btn-lg { padding: .85em 1.5em; font-size: 17px; }
.btn-discord { background: linear-gradient(135deg, #5865F2, #7c8bff); color: #fff; border: none; box-shadow: 0 10px 28px rgba(88,101,242,.4); }
.btn-block { width: 100%; }

/* gate */
.gate { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; padding: 20px; }
.gate-card {
  background: linear-gradient(180deg, rgba(20,36,47,.96), rgba(11,20,27,.96));
  border: 1px solid var(--line); border-radius: 22px;
  padding: 44px 40px; text-align: center; box-shadow: var(--shadow); max-width: 400px; width: 100%;
}
.gate-card h1 { -webkit-text-fill-color: unset; color: #fff; background: none; }
.logo { margin-bottom: 8px; filter: drop-shadow(0 6px 18px rgba(52,211,153,.45)); }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: linear-gradient(180deg, #0d1820, #080f15);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: .6em; padding: 18px 18px 10px; font-weight: 800; font-size: 18px; }
.nav-close { display: none; margin-left: auto; background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; }
.nav { padding: 6px 10px 20px; display: flex; flex-direction: column; gap: 4px; }
.nav-group { margin-top: 12px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 6px 10px; }
.nav-link { display: block; padding: 8px 12px; border-radius: 10px; color: var(--text); font-weight: 500; border: 1px solid transparent; }
.nav-link:hover { background: var(--panel); border-color: var(--line-soft); }
.nav-link.active { background: linear-gradient(135deg, rgba(52,211,153,.22), rgba(251,191,36,.14)); color: #fff; border-color: var(--brand); box-shadow: inset 0 0 18px rgba(52,211,153,.12); }
.wallet-chips { display: flex; gap: 8px; padding: 6px 10px; flex-wrap: wrap; }
.chip { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 14px; }
.chip-money { color: var(--money); }
.chip-bones { color: var(--bones); }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.me-card { font-size: 13px; color: var(--muted); margin-bottom: 8px; word-break: break-word; }
.me-card b { color: var(--text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  border-bottom: 1px solid var(--line); background: rgba(11,18,32,.6);
  backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 30;
}
.nav-open { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }
.topbar h2 { margin: 0; font-size: 20px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* cards & grids */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: linear-gradient(180deg, rgba(20,36,47,.92), rgba(12,22,31,.92)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.stat { font-size: 30px; font-weight: 800; }
.stat.small { font-size: 22px; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv b { font-weight: 700; }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; background: #0a141b; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: .6em .8em; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 120px; }
.inline { display: flex; gap: 8px; align-items: center; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: rgba(255,255,255,.02); }
.tbl-wrap { overflow-x: auto; }

/* badges & pills */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); }
.badge.err { color: var(--err); }
.badge.warn { color: var(--warn); }

/* shop tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.tile {
  background: linear-gradient(180deg, rgba(20,36,47,.92), rgba(12,22,31,.92)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.tile .emoji { font-size: 38px; }
.tile .name { font-weight: 700; }
.tile .price { color: var(--money); font-weight: 700; }
.tile.owned { opacity: .55; }

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); min-width: 220px; max-width: 340px;
  animation: slidein .18s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(2,6,15,.7); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.modal-x { background: none; border: none; color: var(--muted); font-size: 24px; cursor: pointer; }

/* console */
.console {
  background: #06090f; border: 1px solid var(--line); border-radius: 10px;
  font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; color: #cbd5e1;
  padding: 14px; height: 46vh; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.console .line-in { color: var(--brand); }

/* map canvas */
.map-wrap { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
canvas { width: 100%; height: auto; display: block; border-radius: 8px; background: #0a1a12; }

/* casino */
.slots { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }
.reel { width: 78px; height: 96px; display: grid; place-items: center; font-size: 46px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.reel.spin { animation: reelspin .12s linear infinite; }
@keyframes reelspin { 50% { transform: translateY(-6px); } }
.cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.card-poker { width: 62px; height: 90px; border-radius: 8px; background: #f8fafc; color: #0b1220; display: grid; place-items: center; font-weight: 800; font-size: 20px; box-shadow: var(--shadow); }
.card-poker.red { color: #dc2626; }
.wheel { width: 200px; height: 200px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; font-size: 40px; background: conic-gradient(#dc2626 0 48%, #0b1220 48% 52%, #111827 52% 100%); border: 4px solid var(--brand-2); box-shadow: 0 0 40px rgba(251,191,36,.25); }
.reel { width: 78px; height: 96px; display: grid; place-items: center; font-size: 46px; background: linear-gradient(180deg, #14242f, #0a141b); border: 1px solid var(--brand); border-radius: 12px; box-shadow: inset 0 0 20px rgba(52,211,153,.12); }

/* skin editor rows */
.skin-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.swatch { width: 100%; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }

/* responsive */
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .nav-open { display: block; }
  .nav-close { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .skin-row { grid-template-columns: repeat(2, 1fr); }
}

.status-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 8px currentColor; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.status-dot.online { background: var(--ok); }
.status-dot.offline { background: var(--err); }
.view { padding: 22px; max-width: 1180px; width: 100%; margin: 0 auto; }
.loading { color: var(--muted); padding: 40px; text-align: center; }
