/* Marble Engine website: the game's machine-room HUD palette (scripts/ui/style.gd). */
:root {
  --bg: #070c16;
  --panel: #0b1422;
  --panel-2: #0f1b2d;
  --line: #23415f;
  --line-dim: #16283c;
  --cyan: #4fd1ff;
  --amber: #ffb347;
  --green: #7ee787;
  --red: #ff5f56;
  --violet: #b388ff;
  --text: #d6e4f0;
  --dim: #7f93a8;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% -10%, #10233a 0%, transparent 55%),
    radial-gradient(ellipse at 100% 0%, #1a1630 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--mono); line-height: 1.25; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 4.5vw, 46px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.amber { color: var(--amber); }
.green { color: var(--green); }
.red { color: var(--red); }
.cyan { color: var(--cyan); }
.wrap { width: min(1180px, 100% - 32px); margin: 0 auto; }
.section { padding: 56px 0; }
.center { text-align: center; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ------------------------------------------------------------- header ---- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(7, 12, 22, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-dim);
}
.nav { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 17px var(--mono); color: var(--text); letter-spacing: .06em; }
.brand:hover { text-decoration: none; color: var(--cyan); }
.brand img { border-radius: 8px; }
.links { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.links a { color: var(--dim); padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.links a:hover, .links a.on { color: var(--text); background: var(--panel-2); text-decoration: none; }
.links a.user { color: var(--green); font-family: var(--mono); font-size: 14px; }
.links a.btn { color: var(--bg); }
.menu-toggle, .menu-btn { display: none; }
@media (max-width: 720px) {
  .menu-btn { display: block; margin-left: auto; font-size: 24px; cursor: pointer; padding: 4px 10px; }
  .links {
    display: none; position: absolute; top: 62px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; padding: 12px 16px 18px;
    background: var(--bg); border-bottom: 1px solid var(--line-dim);
  }
  .menu-toggle:checked ~ .links { display: flex; }
}

/* ------------------------------------------------------------ buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid var(--cyan);
  background: var(--cyan); color: var(--bg); font: 700 15px var(--mono);
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(79, 209, 255, .25); }
.btn.ghost { background: transparent; color: var(--cyan); }
.btn.green { background: var(--green); border-color: var(--green); }
.btn.amber { background: var(--amber); border-color: var(--amber); }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.big { padding: 15px 26px; font-size: 17px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* -------------------------------------------------------------- cards ---- */
.card {
  background: linear-gradient(180deg, rgba(15, 27, 45, .85), rgba(11, 20, 34, .85));
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  padding: 22px;
}
.card.hl { border-color: var(--line); }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 99px; font: 700 12px var(--mono);
  border: 1px solid var(--line); color: var(--dim);
}
.tag.green { color: var(--green); border-color: rgba(126, 231, 135, .4); }
.tag.amber { color: var(--amber); border-color: rgba(255, 179, 71, .4); }
.tag.red { color: var(--red); border-color: rgba(255, 95, 86, .4); }
.tag.cyan { color: var(--cyan); border-color: rgba(79, 209, 255, .4); }

/* --------------------------------------------------------------- hero ---- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line-dim); }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: url(/img/hero.jpg) center / cover no-repeat;
  opacity: .35; mask-image: linear-gradient(180deg, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent);
}
.hero .wrap { position: relative; padding: 72px 0 64px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 32px; align-items: center; }
.hero .logo { width: min(520px, 100%); margin-bottom: 8px; }
.hero .tagline { font: 700 20px var(--mono); color: var(--amber); }
.hero .lead { font-size: 18px; max-width: 560px; }
.hero .ram { justify-self: center; width: min(320px, 70%); filter: drop-shadow(0 20px 40px rgba(79, 209, 255, .25)); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px); } }
@media (max-width: 820px) { .hero .wrap { grid-template-columns: 1fr; } .hero .ram { display: none; } }

.feature h3 { color: var(--cyan); }
.feature img { width: 44px; height: 44px; margin-bottom: 10px; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.shots figure { margin: 0; }
.shots img { border-radius: 12px; border: 1px solid var(--line-dim); display: block; }
.shots figcaption { color: var(--dim); font-size: 14px; margin-top: 6px; }
.machines { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.machines img { width: 54px; height: 54px; padding: 6px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-dim); }

/* ----------------------------------------------------------- download ---- */
.dl { display: flex; flex-direction: column; gap: 10px; }
.dl .os { font: 700 22px var(--mono); }
.dl .meta { font-size: 13px; color: var(--dim); font-family: var(--mono); word-break: break-all; }
.dl.mine { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }

/* ------------------------------------------------------------ listing ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0 22px; }
.toolbar input[type=search] { flex: 1 1 240px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line-dim); border-radius: 12px; padding: 4px; }
.tabs a { padding: 6px 12px; border-radius: 9px; color: var(--dim); font-size: 14px; }
.tabs a.on, .tabs a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.item { display: flex; flex-direction: column; gap: 10px; color: var(--text); transition: border-color .15s, transform .15s; }
.item:hover { text-decoration: none; border-color: var(--line); transform: translateY(-2px); }
.item h3 { margin: 0; color: var(--text); }
.item .desc { color: var(--dim); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; margin: 0; }
.item canvas { width: 100%; aspect-ratio: 16 / 9; background: #060a12; border-radius: 10px; }
.stats { display: flex; gap: 14px; font: 500 13px var(--mono); color: var(--dim); flex-wrap: wrap; }
.stats b { color: var(--text); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 28px; }
.empty { text-align: center; padding: 48px 16px; color: var(--dim); }
.empty img { width: 140px; display: block; margin: 0 auto 12px; }

/* ------------------------------------------------------------- detail ---- */
.detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.board { width: 100%; max-height: 72vh; background: #060a12; border-radius: 12px; border: 1px solid var(--line-dim); display: block; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }
.big-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.big-stats div { background: var(--panel); border: 1px solid var(--line-dim); border-radius: 12px; padding: 12px 6px; }
.big-stats b { display: block; font: 700 24px var(--mono); color: var(--cyan); }
.big-stats span { font-size: 12px; color: var(--dim); }
.code-box { display: flex; gap: 8px; }
.code-box input { flex: 1; font-family: var(--mono); font-size: 12px; }
table.lb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lb th { text-align: left; color: var(--dim); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.lb td { padding: 9px 10px; border-bottom: 1px solid var(--line-dim); }
table.lb td.n { font-family: var(--mono); text-align: right; }
table.lb tr.me td { background: rgba(126, 231, 135, .07); }
table.lb .rank { font: 700 14px var(--mono); width: 44px; }
table.lb tr:nth-child(1) .rank { color: #ffd166; }
table.lb tr:nth-child(2) .rank { color: #c9d6e2; }
table.lb tr:nth-child(3) .rank { color: #e8a87c; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; padding-left: 36px; position: relative; margin-bottom: 10px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--cyan); font: 700 12px/22px var(--mono); text-align: center;
}

/* -------------------------------------------------------------- forms ---- */
input, select, textarea {
  width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: 15px var(--sans);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(79, 209, 255, .15); }
input[type=checkbox] { width: auto; accent-color: var(--cyan); }
label { display: block; font-size: 14px; color: var(--dim); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field small { color: var(--dim); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); }
.form { max-width: 440px; margin: 0 auto; }
.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid; margin-bottom: 16px; font-size: 14px; }
.alert.err { border-color: rgba(255, 95, 86, .5); background: rgba(255, 95, 86, .08); color: #ffb3ae; }
.alert.ok { border-color: rgba(126, 231, 135, .5); background: rgba(126, 231, 135, .08); color: var(--green); }
.alert.info { border-color: var(--line); background: var(--panel); color: var(--text); }
table.mine { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mine td, table.mine th { padding: 10px; border-bottom: 1px solid var(--line-dim); text-align: left; }
table.mine th { color: var(--dim); font-weight: 500; }
.scroll-x { overflow-x: auto; }

/* ------------------------------------------------------------- footer ---- */
.foot { border-top: 1px solid var(--line-dim); padding: 28px 0; margin-top: 40px; font-size: 14px; }
.foot-row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--dim); }
