/* NEBULA'S EDGE ARCADE — shared design system for the hub + all tables.
   Self-contained tokens (palette mirrors the Spades styles.css). */

:root {
  --ui-scale: 1;
  --card-w: calc(76px * var(--ui-scale));
  --card-h: calc(106px * var(--ui-scale));
  --bg0: #0a0712; --bg1: #120a22;
  --panel: rgba(20, 14, 36, 0.92);
  --line: rgba(150, 110, 230, 0.35);
  --cyan: #46e6ff; --violet: #b06bff; --pink: #ff4fa3; --amber: #ffb44d; --gold: #ffd36b;
  --ink: #e9e6ff; --dim: #9b93c4; --good: #6ee7a0; --bad: #ff6b6b;
  --dm: #b06bff; --bt: #ff4fa3; --pl: #46e6ff; --me: #ffb44d;
  font-family: "Rajdhani", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg0); color: var(--ink); }
body { user-select: none; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }

#bg, #fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#fx { pointer-events: none; z-index: 5; }

/* ---------------- buttons ---------------- */
.btn { font: 600 14px/1 "Rajdhani", system-ui, sans-serif; letter-spacing: 1px; color: var(--ink);
  background: linear-gradient(180deg, rgba(70,50,120,0.5), rgba(30,20,55,0.6));
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 18px; cursor: pointer;
  text-transform: uppercase; transition: transform .12s, box-shadow .12s, border-color .12s; display: inline-block; }
.btn:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(70,230,255,0.3); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, rgba(70,230,255,0.25), rgba(40,30,90,0.6)); border-color: var(--cyan); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------------- HUB ---------------- */
.hub { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.hub-head { text-align: center; margin-bottom: 8px; }
.hub-title { font-size: clamp(34px, 8vw, 68px); letter-spacing: 6px; font-weight: 700; margin: 0;
  background: linear-gradient(180deg, #fff, var(--violet) 55%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(176,107,255,0.4); }
.hub-sub { color: var(--cyan); letter-spacing: 4px; font-size: clamp(10px, 2.6vw, 13px); margin-top: 4px; }
.hub-profile { display: flex; gap: 14px; justify-content: center; margin: 16px 0 6px; color: var(--dim); font-size: 13px; letter-spacing: 1px; }
.hub-profile b { color: var(--gold); }
.hub-filters { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 18px 0 22px; }
.chip { border: 1px solid var(--line); background: rgba(30,20,55,0.5); color: var(--dim); padding: 7px 14px;
  border-radius: 20px; cursor: pointer; font: 600 12px "Rajdhani", sans-serif; letter-spacing: 1px; text-transform: uppercase; }
.chip.on { background: rgba(70,230,255,0.18); color: var(--ink); border-color: var(--cyan); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.tile { position: relative; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  background: linear-gradient(160deg, rgba(28,18,48,0.92), rgba(14,9,26,0.92)); padding: 16px; min-height: 168px;
  display: flex; flex-direction: column; cursor: pointer; transition: transform .14s, box-shadow .14s, border-color .14s; }
.tile:hover { transform: translateY(-3px); border-color: var(--cyan); box-shadow: 0 10px 30px rgba(70,230,255,0.18); }
.tile.flagship { border-color: var(--violet); box-shadow: 0 0 0 1px rgba(176,107,255,0.3) inset; }
.tile-art { position: absolute; inset: 0; opacity: .5; pointer-events: none; }
.tile-glyph { position: absolute; right: 12px; top: 8px; font-size: 56px; opacity: .14; }
.tile-brand { font-size: 21px; font-weight: 700; letter-spacing: 1px; position: relative; z-index: 1; }
.tile-classic { color: var(--dim); font-size: 12px; letter-spacing: 1px; margin-top: 1px; position: relative; z-index: 1; }
.tile-blurb { color: var(--ink); opacity: .8; font-size: 12.5px; line-height: 1.4; margin: 10px 0; flex: 1; position: relative; z-index: 1; }
.tile-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--dim); position: relative; z-index: 1; }
.tile-meta span { border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; letter-spacing: .5px; }
.tile-flag { position: absolute; top: 10px; right: 12px; font-size: 9px; letter-spacing: 1px; color: var(--violet);
  border: 1px solid var(--violet); border-radius: 5px; padding: 1px 5px; z-index: 2; }
.diff { color: var(--amber); }
.hub-foot { text-align: center; color: var(--dim); font-size: 11px; letter-spacing: 1px; margin-top: 30px; }

/* ---------------- TABLE SHELL ---------------- */
.table-page { overflow: hidden; }
#game { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; z-index: 4;
  background: linear-gradient(180deg, rgba(10,7,18,0.9), transparent); }
.tb-back { font-weight: 700; letter-spacing: 1px; color: var(--cyan); border: 1px solid var(--line); padding: 7px 12px; border-radius: 9px; font-size: 13px; }
.tb-back:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(70,230,255,0.25); }
.tb-title { flex: 1; text-align: center; }
.tb-title b { font-size: 18px; letter-spacing: 2px; }
.tb-title span { color: var(--dim); font-size: 12px; letter-spacing: 1px; margin-left: 8px; }
.tb-status { min-width: 90px; text-align: right; color: var(--dim); font-size: 13px; letter-spacing: 1px; }
.tb-status b { color: var(--ink); }
.stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------------- CARDS ---------------- */
.card { width: var(--card-w); height: var(--card-h); border-radius: 9px; position: relative; flex: 0 0 auto;
  background: linear-gradient(160deg, #fbf7ff, #d9d2ee); color: #1a1030; border: 1px solid rgba(0,0,0,0.25);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4); transition: transform .12s, box-shadow .12s; }
.card.small { --card-w: calc(50px * var(--ui-scale)); --card-h: calc(70px * var(--ui-scale)); }
.card .cc { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .92; font-weight: 700; }
.card .cc.tl { top: 5px; left: 6px; } .card .cc.br { bottom: 5px; right: 6px; transform: rotate(180deg); }
.card .cc .r { font-size: calc(15px * var(--ui-scale)); } .card .cc .s { font-size: calc(13px * var(--ui-scale)); }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(34px * var(--ui-scale)); opacity: .9; }
.card.s-dm { color: var(--dm); } .card.s-bt { color: var(--bt); } .card.s-pl { color: var(--pl); } .card.s-me { color: var(--me); }
.card.s-dm .pip, .card.s-bt .pip, .card.s-pl .pip, .card.s-me .pip { filter: drop-shadow(0 0 5px currentColor); }
.card.s-joker { color: #7a5cff; }
/* real Nebula's Edge card art (assets/cards/*.png) with legible rank corners painted on top */
.card.has-art { background-size: cover; background-position: center; background-repeat: no-repeat; border-color: rgba(0,0,0,0.45); }
.card.has-art .pip { display: none; }
.card.has-art .cc { color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.card.has-art .cc .s { filter: drop-shadow(0 0 2px #000); }
.card.back { background: linear-gradient(160deg, #2a1c52, #150d2c); border: 1px solid rgba(120,90,200,0.5); }
.card-back-glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(30px * var(--ui-scale)); color: rgba(150,110,230,0.6); }
.card.sel { transform: translateY(-14px); box-shadow: 0 0 20px var(--cyan); }
.card.playable { cursor: pointer; outline: 1px solid rgba(70,230,255,0.0); }
.card.playable:hover { transform: translateY(-10px); box-shadow: 0 0 18px rgba(70,230,255,0.45); }
.card.dim { opacity: .42; filter: grayscale(.4); }

/* number-deck cards (Flux / Protocol / Cascade) + joker — reuse the real Nebula's Edge faction art */
.card.art-num { background-color: #05030c; background-size: cover; background-position: center;
  background-repeat: no-repeat; color: #fff; overflow: hidden; border-color: rgba(0,0,0,0.5); }
.card.art-num.art-quad { background-size: 50% 50%;
  background-position: top left, top right, bottom left, bottom right; background-repeat: no-repeat; }
.card.art-num .cc { top: 5px; left: 6px; font-size: calc(14px * var(--ui-scale)); font-weight: 800;
  color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; z-index: 2; }
.card.art-num .cc.tl { flex-direction: row; }
.card.art-num .cc.br { top: auto; bottom: 5px; right: 6px; left: auto; }
.card.art-num .nc-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 2; }
.card.art-num .bignum { font-size: calc(40px * var(--ui-scale)); font-weight: 800; color: #fff; line-height: 1;
  padding: 6px 12px; border-radius: 50%; text-shadow: 0 2px 6px #000, 0 0 10px #000;
  background: radial-gradient(closest-side, rgba(5,3,12,0.82), rgba(5,3,12,0.0) 80%); }
.card.art-num.wild .bignum { font-size: calc(26px * var(--ui-scale)); }
.card.small.art-num .bignum { font-size: calc(24px * var(--ui-scale)); padding: 3px 7px; }

/* ---------------- generic table bits ---------------- */
.hand { display: flex; justify-content: center; align-items: flex-end; gap: 6px; padding: 10px; flex-wrap: wrap; }
.hand.fan .card { margin-left: -18px; } .hand.fan .card:first-child { margin-left: 0; }
.np { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(16,11,30,0.8); font-weight: 700; letter-spacing: 1px; font-size: 13px; }
.np.active { border-color: var(--cyan); box-shadow: 0 0 18px rgba(70,230,255,0.4); }
.np.you { border-left: 3px solid var(--cyan); }
.np-badge { font-size: 9px; padding: 1px 5px; border-radius: 5px; background: rgba(120,90,200,0.25); color: var(--violet); letter-spacing: 1px; }
.center-pile { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pile-label { color: var(--dim); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; text-align: center; }
.actions { display: flex; gap: 10px; justify-content: center; padding: 10px; flex-wrap: wrap; }
.banner { text-align: center; color: var(--cyan); letter-spacing: 2px; font-weight: 700; padding: 6px; min-height: 22px; font-size: 14px; }

/* ---------------- overlay + toast ---------------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(6,4,14,0.6); opacity: 0; transition: opacity .2s; padding: 20px; }
.overlay.in { opacity: 1; } .overlay.dim { background: rgba(6,4,14,0.85); }
.ov-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; max-width: 460px;
  width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.6); transform: translateY(8px); transition: transform .2s; }
.overlay.in .ov-card { transform: translateY(0); }
.ov-card h2 { margin: 0 0 6px; letter-spacing: 2px; }
.ov-card .ov-sub { color: var(--dim); margin-bottom: 16px; font-size: 14px; }
.ov-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.score-line { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(150,110,230,0.15); }
.score-line .pos { color: var(--good); } .score-line .neg { color: var(--bad); }

#toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(10px); z-index: 30;
  background: rgba(20,14,36,0.96); border: 1px solid var(--cyan); color: var(--ink); padding: 10px 18px; border-radius: 10px;
  letter-spacing: 1px; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; box-shadow: 0 0 20px rgba(70,230,255,0.25); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.host-error { padding: 40px; text-align: center; color: var(--dim); }
.host-error pre { text-align: left; font-size: 11px; color: var(--bad); white-space: pre-wrap; max-height: 240px; overflow: auto; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { min-height: 150px; padding: 12px; }
  .tile-blurb { display: none; }
}

/* ===================== BRAND LOGO ===================== */
.ne-logo { display: inline-flex; align-items: center; gap: 14px; }
.ne-logo.stacked { flex-direction: column; gap: 16px; }
.ne-logo-mark { display: inline-flex; filter: drop-shadow(0 0 18px rgba(176,107,255,0.45)); }
.ne-logo-mark .ne-mark { display: block; }
.ne-word { text-align: left; }
.ne-logo.stacked .ne-word { text-align: center; }
.ne-word-main { font-size: 30px; font-weight: 800; letter-spacing: 5px; line-height: 1;
  background: linear-gradient(180deg, #fff, var(--violet) 58%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.ne-word-sub { color: var(--cyan); letter-spacing: 4px; font-size: 11px; margin-top: 6px; }
.ne-logo.stacked .ne-word-main { font-size: clamp(36px, 9vw, 66px); letter-spacing: 8px; text-shadow: 0 0 40px rgba(176,107,255,0.4); }
.ne-logo.stacked .ne-word-sub { font-size: 12px; letter-spacing: 6px; margin-top: 8px; }

/* ===================== HUB HEADER additions ===================== */
.hub-back { position: absolute; top: 18px; left: 16px; z-index: 3; cursor: pointer;
  background: rgba(16,11,30,0.8); border: 1px solid var(--line); color: var(--cyan);
  font: 700 11px "Rajdhani", system-ui, sans-serif; letter-spacing: 1px; text-transform: uppercase;
  padding: 7px 12px; border-radius: 8px; transition: border-color .12s, box-shadow .12s; }
.hub-back:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(70,230,255,0.25); }
.hub-loc { color: var(--dim); letter-spacing: 3px; font-size: 12px; margin-top: 12px; text-transform: uppercase; }
.hub-intro { color: var(--ink); opacity: .82; font-size: 13px; max-width: 560px; margin: 8px auto 0; line-height: 1.5; }

/* ===================== FLAGSHIP HERO ===================== */
.hero { position: relative; display: flex; align-items: stretch; margin: 22px 0 6px; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--violet); background: linear-gradient(110deg, rgba(28,18,48,0.95), rgba(14,9,26,0.9));
  box-shadow: 0 0 0 1px rgba(176,107,255,0.22) inset, 0 14px 40px rgba(0,0,0,0.5); min-height: 172px;
  transition: transform .14s, box-shadow .14s; }
.hero:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(70,230,255,0.4) inset, 0 18px 50px rgba(70,230,255,0.18); }
.hero-art { width: 36%; min-width: 170px;
  background: linear-gradient(90deg, transparent, rgba(11,7,24,0.92)), url("./assets/bg.png") center/cover no-repeat; }
.hero-body { flex: 1; padding: 20px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; z-index: 1; }
.hero-tag { color: var(--violet); letter-spacing: 3px; font-size: 11px; font-weight: 700; }
.hero-brand { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: 2px; line-height: 1.05;
  background: linear-gradient(180deg, #fff, var(--violet) 60%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-classic { color: var(--dim); letter-spacing: 1px; font-size: 12px; }
.hero-blurb { color: var(--ink); opacity: .85; font-size: 13.5px; line-height: 1.5; margin: 9px 0 13px; max-width: 540px; }
.hero-cta { margin-top: auto; }
.hero-glyph { position: absolute; right: 20px; top: 8px; font-size: 92px; opacity: .12; pointer-events: none; z-index: 0; }

/* ===================== FLOOR section heading ===================== */
.floor-head { display: flex; align-items: center; gap: 14px; margin: 24px 0 6px; }
.floor-head span { color: var(--ink); letter-spacing: 4px; font-size: 13px; font-weight: 700; }
.floor-head i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* ===================== ENTRY SPLASH ===================== */
#splash { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background-color: #06040e; background-position: center; background-size: cover; background-repeat: no-repeat;
  background-image: linear-gradient(180deg, rgba(6,4,14,0.74), rgba(6,4,14,0.9)), url("./assets/splash.png");
  transition: opacity .6s ease; }
#splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 28px; animation: splashIn .8s ease; }
@keyframes splashIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.splash-kicker { color: var(--dim); letter-spacing: 4px; font-size: 11px; text-transform: uppercase; }
.splash-tagline { color: var(--ink); opacity: .88; letter-spacing: 1px; font-size: 14px; }
.splash-flagship { color: var(--dim); letter-spacing: 2px; font-size: 12px; text-transform: uppercase; }
.splash-flagship b { color: var(--violet); }
.splash-enter { margin-top: 12px; padding: 14px 32px; font-size: 16px; letter-spacing: 2px; }
.splash-hint { color: var(--dim); font-size: 11px; letter-spacing: 2px; animation: splashBlink 1.6s ease-in-out infinite; }
@keyframes splashBlink { 0%,100% { opacity: .35; } 50% { opacity: .85; } }

@media (max-width: 560px) {
  .hero { flex-direction: column; }
  .hero-art { width: 100%; min-height: 96px; }
  .ne-logo { gap: 10px; } .ne-word-main { font-size: 23px; letter-spacing: 3px; }
}
