/* ============================================================
   HUB OS — BASE CAMP  ·  shared design system
   Self-contained. No external fonts or assets.
   ============================================================ */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; overflow-x: hidden; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }

/* ---------- tokens ---------- */
:root {
  --bg:        #05070f;
  --bg-2:      #080b18;
  --surface:   rgba(20, 27, 48, 0.55);
  --surface-2: rgba(28, 37, 64, 0.65);
  --border:    rgba(120, 150, 230, 0.16);
  --border-hi: rgba(120, 150, 230, 0.42);
  --text:      #e9edff;
  --muted:     #93a0c7;
  --dim:       #5f6d94;

  --cyan:   #35e6ff;
  --violet: #a780ff;
  --lime:   #67ffa3;
  --pink:   #ff6fb3;
  --amber:  #ffc24d;
  --red:    #ff6b6b;

  /* crew colours (generic roles) */
  --c-p1: #ff6fb3;  /* Player One */
  --c-p2: #ffd23d;  /* Player Two */
  --c-gm1: #4d9bff;  /* Game Master 1 */
  --c-gm2: #67ffa3;  /* Game Master 2 */

  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 16px;
  --radius-sm: 10px;
  --ring: 0 0 0 1px var(--border), 0 20px 60px -20px rgba(0,0,0,.7);
  --glow-cyan: 0 0 24px rgba(53,230,255,.35);
  --glow-violet: 0 0 24px rgba(167,128,255,.35);
  --maxw: 1120px;
}

/* ---------- base ---------- */
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: .1px;
  -webkit-font-smoothing: antialiased;
}

/* animated backdrop layers */
.bg-layer { position: fixed; inset: 0; z-index: -3; pointer-events: none; }
.bg-grid {
  background-image:
    linear-gradient(rgba(90,120,220,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90,120,220,.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  animation: gridDrift 40s linear infinite;
}
@keyframes gridDrift { to { background-position: 46px 46px; } }
.bg-glow {
  z-index: -2;
  background:
    radial-gradient(60vw 60vw at 12% 8%,  rgba(53,230,255,.16), transparent 60%),
    radial-gradient(55vw 55vw at 88% 12%, rgba(167,128,255,.16), transparent 60%),
    radial-gradient(70vw 70vw at 50% 108%, rgba(103,255,163,.10), transparent 60%);
  filter: saturate(1.1);
}
#particles { z-index: -1; opacity: .55; }
body::before { /* subtle vignette + scanline tint */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120vw 90vh at 50% -10%, transparent 60%, rgba(0,0,0,.55));
}

/* scanline overlay (very subtle CRT feel) */
.scanlines { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.015) 0 1px, transparent 1px 3px); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(18px, 4vw, 40px); }
section { padding-block: clamp(48px, 8vw, 96px); position: relative; }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- typography ---------- */
.kicker {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--cyan); display: inline-flex; align-items: center; gap: .6em;
}
.kicker::before { content: ""; width: 26px; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan)); }
h1, h2, h3 { line-height: 1.08; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: clamp(1.7rem, 4.4vw, 2.9rem); margin-bottom: .5em; }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.4rem); }
.lead { font-size: clamp(1.02rem, 2.2vw, 1.22rem); color: var(--muted); max-width: 62ch; }
.mono { font-family: var(--mono); }
.grad {
  background: linear-gradient(100deg, var(--cyan), var(--violet) 55%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px clamp(18px, 4vw, 40px);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(5,7,15,.82), rgba(5,7,15,.35));
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-weight: 700; letter-spacing: .04em; }
.brand .logo {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  color: var(--cyan); filter: drop-shadow(var(--glow-cyan)); cursor: pointer;
  transition: transform .3s ease;
}
.brand .logo:hover { transform: rotate(90deg) scale(1.06); }
.brand small { color: var(--dim); font-weight: 400; letter-spacing: .18em; font-size: .64rem; text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a { font-family: var(--mono); font-size: .82rem; color: var(--muted); padding: 8px 12px; border-radius: 8px; transition: .2s; }
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-status { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .72rem; color: var(--lime); }
.nav-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@media (max-width: 720px) { .nav-links a[data-collapse] { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: .92rem; letter-spacing: .02em;
  padding: 13px 22px; border-radius: 12px; position: relative; overflow: hidden;
  transition: transform .15s ease, box-shadow .25s ease, background .25s ease;
}
.btn-primary {
  color: #04121a; background: linear-gradient(100deg, var(--cyan), var(--violet));
  box-shadow: 0 10px 30px -8px rgba(53,230,255,.5);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -8px rgba(167,128,255,.6); }
.btn-ghost { color: var(--text); background: var(--surface); border: 1px solid var(--border-hi); }
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.btn:active { transform: translateY(0) scale(.98); }

/* ---------- glass card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: clamp(20px, 3vw, 28px); position: relative; overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card::after { /* corner sheen */
  content: ""; position: absolute; top: -40%; right: -30%; width: 60%; height: 80%;
  background: radial-gradient(circle, rgba(53,230,255,.10), transparent 70%); pointer-events: none;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-hi); box-shadow: var(--ring); }
.card .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(53,230,255,.10); color: var(--cyan); margin-bottom: 14px; }
.card h3 { margin-bottom: .4em; }
.card p { color: var(--muted); font-size: .96rem; }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ---------- pain / fix rows ---------- */
.painfix { display: grid; gap: 14px; }
.pf-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.pf-row .arrow { color: var(--cyan); font-family: var(--mono); font-size: 1.3rem; }
.pf-pain { color: var(--muted); }
.pf-pain b { color: var(--red); font-weight: 700; }
.pf-fix { color: var(--text); }
.pf-fix b { color: var(--lime); }
@media (max-width: 680px) {
  .pf-row { grid-template-columns: 1fr; text-align: left; gap: 8px; }
  .pf-row .arrow { transform: rotate(90deg); justify-self: start; }
}

/* ---------- chips / tags ---------- */
.chip { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: .74rem;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-hi); color: var(--muted); }
.chip .swatch { width: 10px; height: 10px; border-radius: 3px; }

.size-tag { font-family: var(--mono); font-weight: 800; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; font-size: .82rem; }
.size-s { background: rgba(103,255,163,.14); color: var(--lime); border: 1px solid rgba(103,255,163,.4); }
.size-m { background: rgba(255,194,77,.14); color: var(--amber); border: 1px solid rgba(255,194,77,.4); }
.size-l { background: rgba(255,111,179,.14); color: var(--pink); border: 1px solid rgba(255,111,179,.4); }

/* ---------- currency ---------- */
.hex { font-family: var(--mono); color: var(--amber); font-weight: 700; white-space: nowrap; }
.hex::before { content: "⬢ "; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); background: rgba(53,230,255,.04); }
tbody tr { transition: background .2s; }
tbody tr:hover { background: rgba(120,150,230,.06); }
tbody tr:last-child td { border-bottom: none; }
td .loot-name { font-weight: 700; }
td .loot-desc { color: var(--muted); font-size: .88rem; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--border); padding: 40px 0; color: var(--dim); font-family: var(--mono); font-size: .8rem; text-align: center; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--cyan); }

/* ---------- toast / achievements ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px;
  background: linear-gradient(100deg, rgba(20,27,48,.96), rgba(28,37,64,.96));
  border: 1px solid var(--border-hi); box-shadow: var(--ring); max-width: 320px;
  transform: translateX(120%); opacity: 0; transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .5s;
}
.toast.show { transform: none; opacity: 1; }
.toast .tico { font-size: 1.4rem; filter: drop-shadow(0 0 8px currentColor); }
.toast .tt { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.toast .td { font-size: .86rem; color: var(--text); }

/* ---------- cheat / rainbow mode (konami) ---------- */
body.cheat { animation: hueSpin 8s linear infinite; }
@keyframes hueSpin { to { filter: hue-rotate(360deg); } }
body.cheat .bg-glow { opacity: 1; }

/* ---------- accessibility ---------- */
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iterations: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
