/* Gem Bot Universe — shared styles for every room/page of the app (mandem.os/workspace/app/) */
:root {
  --bg: #070d1c;
  --bg2: #0d1730;
  --panel: #111d3a;
  --panel2: #172648;
  --line: #2a3b66;
  --text: #e8edf9;
  --muted: #a9b6d6;
  --accent: #8f78ff;
  --accent2: #38d4e8;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text);
  background: radial-gradient(1200px 600px at 70% -10%, #1b2457 0%, transparent 60%), var(--bg);
  min-height: 100vh; overflow-x: hidden;
}
a { color: var(--accent2); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent2); outline-offset: 2px;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.4rem, 4.5vw, 2.1rem); }
h2 { font-size: clamp(1.15rem, 3.4vw, 1.4rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── top nav ─────────────────────────────────────────── */
.gbu-top {
  position: sticky; top: 0; z-index: 50; background: rgba(7, 13, 28, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.gbu-bar { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 6px 12px; min-height: 56px; }
.gbu-brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; min-height: 44px; margin-right: auto; }
.gbu-brand .gem { width: 26px; height: 26px; flex: none; }
.gbu-brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.1; }
.gbu-menu-btn { display: inline-flex; }
#gbu-wallet-link { white-space: nowrap; }
.gbu-links { display: none; width: 100%; padding: 4px 12px 12px; max-width: 1280px; margin: 0 auto; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.gbu-links.open { display: grid; }
.gbu-links a {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; background: var(--panel); border: 1px solid var(--line); font-size: 15px;
}
.gbu-links a[aria-current="page"] { border-color: var(--accent); background: #22205a; }
.gbu-links a:hover { border-color: var(--accent2); }
@media (min-width: 1100px) {
  .gbu-top .gbu-menu-btn { display: none; }
  .gbu-brand { white-space: nowrap; }
  .gbu-bar { flex-wrap: nowrap; }
  .gbu-links, .gbu-links.open { display: flex; flex-wrap: wrap; width: auto; padding: 0; margin: 0; gap: 4px; }
  .gbu-links a { background: transparent; border-color: transparent; padding: 6px 7px; font-size: 14px; gap: 4px; }
  .gbu-links, .gbu-links.open { gap: 0; }
  .gbu-top .gbu-bar { max-width: none; }
}

/* ── buttons / forms ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.btn:hover { border-color: var(--accent2); }
.btn.primary { background: linear-gradient(135deg, #6d55f0, #3a8de0); border-color: transparent; font-weight: 600; }
.btn.danger { border-color: #7f2a2a; color: #ffd0d0; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 4px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #0a1328; color: var(--text); font: inherit; font-size: 16px;
}
input[type="color"] { padding: 4px; }
textarea { min-height: 88px; resize: vertical; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

/* ── layout ──────────────────────────────────────────── */
.page { max-width: 1280px; margin: 0 auto; padding: 14px 12px 40px; }
.page-head { margin: 6px 0 12px; }
.page-head p { color: var(--muted); max-width: 70ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.card h2 { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.room-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 120px; }
.room-card:hover { border-color: var(--accent); }
.room-card .ico { font-size: 28px; }
.room-card span.muted { font-size: 14px; }
.layout { display: grid; gap: 14px; }
@media (min-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } }
.note { border-left: 4px solid var(--warn); background: #2a2310; padding: 10px 12px; border-radius: 8px; color: #fde9b0; font-size: 15px; margin: 0 0 12px; }
.note.info { border-color: var(--accent2); background: #0d2a33; color: #c9f3fa; }
.note.ok { border-color: var(--ok); background: #0f2a1a; color: #c9f7d9; }
details.howto { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; margin: 14px 0; }
details.howto summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; font-weight: 600; }
details.howto[open] { padding-bottom: 12px; }
details.howto li { margin-bottom: 4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { color: var(--muted); font-weight: 600; font-size: 14px; }
.table-wrap { width: 100%; overflow-x: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.result { font-size: 1.6rem; font-weight: 700; color: var(--accent2); }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: middle; border: 1px solid #fff4; }
.empty { color: var(--muted); padding: 10px 0; }
code { background: #0a1328; padding: 1px 5px; border-radius: 5px; font-size: .92em; word-break: break-all; }
footer.gbu-foot a { display: inline-block; padding: 12px 0; }
footer.gbu-foot { max-width: 1280px; margin: 0 auto; padding: 16px 12px 30px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

/* ── 3D stage ────────────────────────────────────────── */
.stage { position: relative; width: 100%; height: min(62vh, 560px); min-height: 320px; border-radius: var(--radius); overflow: hidden; background: #050913; border: 1px solid var(--line); touch-action: none; }
@media (min-width: 1000px) { .stage { height: min(72vh, 680px); } }
.stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.stage .hud { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; pointer-events: none; }
.stage .hud .btn { pointer-events: auto; background: rgba(13, 23, 48, .85); min-width: 46px; padding: 6px 10px; }
.stage .hint { position: absolute; top: 8px; left: 8px; right: 8px; font-size: 14px; color: #dfe6ff; background: rgba(5, 9, 19, .7); padding: 6px 10px; border-radius: 8px; pointer-events: none; text-align: center; }
.stage .fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); }
.stage .infocard { position: absolute; top: 48px; left: 8px; max-width: min(320px, calc(100% - 16px)); background: rgba(13, 23, 48, .94); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.stage .infocard h3 { margin: 0 0 4px; }
.stage .infocard[hidden] { display: none; }
.poi { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.realm-banner { margin: 0 0 12px; }

/* ── toast ───────────────────────────────────────────── */
#gbu-toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100% - 24px); background: #1b2a52; border: 1px solid var(--accent); color: var(--text); padding: 10px 14px; border-radius: 10px; z-index: 100; font-size: 15px; box-shadow: 0 6px 24px #0008; }
#gbu-toast[hidden] { display: none; }

/* ── map pages ───────────────────────────────────────── */
.map { width: 100%; height: min(60vh, 560px); min-height: 320px; border-radius: var(--radius); border: 1px solid var(--line); background: #0a1328; }
.leaflet-container { font: 14px/1.4 var(--font); }
.map.leaflet-container .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
.map .leaflet-control-attribution a { display: inline-block; padding: 8px 0; }
.leaflet-control-attribution { font-size: 12px; }
