* { box-sizing: border-box; }
:root {
  --bg: #14161f; --panel: #171a25; --panel2: #1a1d29; --line: #2a2f40; --text: #dde2f0; --dim: #8d95ad;
  --gold: #ffd479; --btn: #2a3044; --btn-h: #343c56; --btn-line: #3a4260; --red: #ff9a9a; --green: #8fe0a0;
}
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, sans-serif; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, textarea { font-family: ui-monospace, Menlo, monospace; }

/* nav */
#nav { display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
#nav a { color: var(--text); padding: 6px 10px; border-radius: 6px; }
#nav a:hover { background: var(--btn); text-decoration: none; }
#nav a.on { background: var(--btn); }
#nav .brand { color: var(--gold); font-weight: 700; margin-right: 8px; }
#nav .brand span { color: var(--dim); font-weight: 400; font-size: 12px; }
#nav .grow { flex: 1; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--btn); }
.menu > div { position: absolute; right: 0; top: 36px; z-index: 10; min-width: 190px; display: flex; flex-direction: column; padding: 6px;
              background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.menu > div a, .menu > div button { text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 7px 10px; border-radius: 5px; cursor: pointer; }
.menu > div a:hover, .menu > div button:hover { background: var(--btn); text-decoration: none; }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 9px; vertical-align: 1px; }
.badge.admin { background: #6b3fd1; color: #fff; }
.badge.mod { background: #2f7d4f; color: #fff; }

/* buttons */
.btn, button.btn { background: var(--btn); color: var(--text); border: 1px solid var(--btn-line); border-radius: 6px; padding: 5px 12px; font: inherit; cursor: pointer; }
.btn:hover { background: var(--btn-h); text-decoration: none; }
.btn.primary { background: #c9932a; border-color: #e0ab45; color: #1a1300; font-weight: 600; }
.btn.primary:hover { background: #dba53a; }
.btn.danger { background: #5a2430; border-color: #7a3442; }
.btn.danger:hover { background: #6e2c3a; }
.btn.on { background: #6b2340; border-color: #a33a64; }
.btn:disabled { opacity: .5; cursor: default; }
input.field { background: var(--panel2); color: var(--text); border: 1px solid var(--btn-line); border-radius: 6px; padding: 5px 9px; font: inherit; }

/* page body */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { font-size: 28px; margin: 6px 0 16px; }
h2 { font-size: 19px; margin: 28px 0 12px; }
.dim { color: var(--dim); }
.msg { padding: 30px; text-align: center; color: var(--dim); }
.err { color: var(--red); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

/* project cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--text); }
.card:hover { border-color: var(--gold); text-decoration: none; transform: translateY(-2px); transition: transform .1s; }
.card img, .card .noimg { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #1e2230; }
.card .noimg { display: flex; align-items: center; justify-content: center; color: #3c4560; font-size: 22px; letter-spacing: 6px; }
.card .ct { padding: 8px 10px 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cm { padding: 2px 10px 9px; color: var(--dim); font-size: 12px; }
.hid { color: var(--red); }

/* engine view */
.vx-view { position: relative; outline: 0; overflow: hidden; background: #1e2230; }
.vx-view canvas { display: block; }
.vx-hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: 6px;
           background: rgba(0,0,0,.6); font-size: 13px; pointer-events: none; white-space: nowrap; }
.vx-view:focus .vx-hint { background: rgba(30,120,60,.7); }
.vx-hud { position: absolute; top: 10px; left: 10px; padding: 6px 10px; border-radius: 6px; background: rgba(0,0,0,.55);
          font: 13px/1.5 ui-monospace, Menlo, monospace; white-space: pre; pointer-events: none; }
.vx-hud:empty { display: none; }
.vx-ui { position: absolute; inset: 0; pointer-events: none; }
.vx-btn { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; min-width: 64px; padding: 10px 18px;
          border: 2px solid rgba(255,255,255,.25); border-radius: 10px; background: rgba(20,24,36,.75); color: #fff;
          font: 600 16px system-ui, sans-serif; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.vx-btn:hover { background: rgba(50,58,86,.85); }
.vx-btn:active { transform: translate(-50%, -50%) scale(.94); background: rgba(201,147,42,.85); color: #1a1300; }

dialog { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 20px; max-width: 460px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 10px; }
dialog .row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
dialog input.field { flex: 1; min-width: 0; }

@media (max-width: 700px) {
  #nav { overflow-x: auto; }
  h1 { font-size: 23px; }
}
