/* CGware site - one stylesheet for every page.
   Plain dark surfaces, hairlines, square-ish corners, one blue; type does the work (IBM Plex Sans / Mono). */
:root {
  --bg: #0e0e10;
  --surface: #141416;
  --surface-2: #1a1a1d;
  --line: #242428;
  --line-2: #2f2f34;
  --text: #e4e4e8;
  --muted: #8d8d94;
  --dim: #606067;
  --accent: #c8c8ce;          /* silver: buttons, logo, highlights */
  --accent-ink: #111113;
  --green: #3ccf8e;
  --yellow: #f2c14e;
  --red: #ff5f6d;
  --radius: 3px;
  --wrap: 1080px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
}
a { color: inherit; }
img { max-width: 100%; }
::selection { background: rgba(200, 200, 206, .28); }


.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- header ---- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(14, 14, 16, .94);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; height: 58px; gap: 28px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; text-decoration: none; color: var(--muted); }
.brand b { color: var(--accent); font-weight: 700; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a:hover, .nav a.on { color: var(--text); }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

/* ---- buttons / fields ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
  font: 600 14px var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #3c3c42; background: #202024; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #dcdce1; border-color: #dcdce1; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }

label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  font: 400 14px var(--sans); outline: none;
}
textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input.key { font-family: var(--mono); letter-spacing: .5px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0 0; }
.ok { color: var(--green); font-size: 13px; }

/* ---- sections ---- */
section { padding: 84px 0; border-top: 1px solid var(--line); }
.label { font: 500 12px var(--mono); color: var(--dim); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 14px; }
.label b { color: var(--accent); font-weight: 500; }
h1 { font-size: 52px; line-height: 1.08; letter-spacing: -1.2px; margin: 0 0 20px; font-weight: 700; }
h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.6px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 16px; margin: 0 0 6px; font-weight: 600; }
.lead { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 0 30px; }
.intro { color: var(--muted); max-width: 640px; margin: 0 0 40px; }

/* hero: a black flag with the logo waving behind the text (home.js) */
.hero {
  position: relative; overflow: hidden; border-top: 0;
  min-height: calc(100vh - 58px); display: flex; flex-direction: column; justify-content: center;
  padding: 72px 0 48px;
}
.hero > .wrap { position: relative; z-index: 2; width: 100%; }
.hero-bg {   /* the light behind the flag: only seen through its tears */
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(45% 55% at 85% 35%, rgba(205, 208, 216, .17), transparent 70%),
              radial-gradient(35% 40% at 70% 95%, rgba(205, 208, 216, .09), transparent 70%);
}
#flag { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-bg::after {    /* the text side stays readable, the bottom melts into the page */
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 14, 16, .78) 0%, rgba(14, 14, 16, .45) 40%, transparent 65%),
    linear-gradient(180deg, transparent 75%, var(--bg) 100%);
}
@media (max-width: 900px) {
  .hero-bg::after { background: linear-gradient(180deg, rgba(14, 14, 16, .3) 0%, rgba(14, 14, 16, .75) 45%, var(--bg) 100%); }
}

/* sections fade in when they scroll into view (smoke.js adds .reveal / .in) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.facts {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 64px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.facts div { padding: 18px 20px 18px 0; }
.facts div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.facts strong { display: block; font: 600 22px var(--mono); }
.facts div { color: var(--muted); font-size: 13.5px; }
.facts strong { color: var(--text); }

/* features: a 3 x 2 sheet of plain lists */
.sheet { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.sheet > div { padding: 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sheet > div:nth-child(3n) { border-right: 0; }
.sheet > div:nth-last-child(-n+3) { border-bottom: 0; }
.sheet p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.sheet ul { list-style: none; margin: 0; padding: 0; }
.sheet li { font-size: 14px; padding: 5px 0; border-top: 1px solid var(--line); }
.sheet li:first-child { border-top: 0; }
.new { font: 600 10px var(--mono); color: var(--accent); margin-left: 6px; vertical-align: 1px; }
.extras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 28px; }
.extras div { padding: 16px 20px 0 0; }
.extras div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.extras p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* pricing: one row of plans */
.plans { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.plan { padding: 24px 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.plan:last-child { border-right: 0; }
.plan.pick { box-shadow: inset 0 2px 0 var(--accent); background: var(--surface); }
.plan .tag { font: 500 11px var(--mono); color: var(--accent); min-height: 18px; text-transform: uppercase; letter-spacing: .5px; }
.plan .price { font: 600 34px var(--mono); margin: 6px 0 2px; }
.plan .per { color: var(--muted); font-size: 13px; min-height: 21px; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 22px; font-size: 13.5px; color: var(--muted); flex: 1; }
.plan li { padding: 3px 0; }
.plan .btn { width: 100%; }
.note { color: var(--muted); font-size: 13.5px; margin-top: 18px; }

/* steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.steps li { padding: 22px 22px 0 0; }
.steps li + li { padding-left: 22px; border-left: 1px solid var(--line); }
.steps .n { font: 600 13px var(--mono); color: var(--accent); display: block; margin-bottom: 10px; }
.steps p { color: var(--muted); font-size: 14px; margin: 0; }
code, kbd { font: 500 12.5px var(--mono); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1px 6px; }
.rules { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 36px; border: 1px solid var(--line); }
.rules div { padding: 16px 20px; }
.rules div + div { border-left: 1px solid var(--line); }
.rules p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* faq */
.faq { border-top: 1px solid var(--line); max-width: 800px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 18px 30px 18px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 16px; font: 400 20px var(--mono); color: var(--muted); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { color: var(--muted); margin: -6px 0 18px; max-width: 700px; }

/* news */
.news-list { border-top: 1px solid var(--line); }
.news-item { display: grid; grid-template-columns: 140px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.news-item time { font: 500 13px var(--mono); color: var(--dim); }
.news-item p { color: var(--muted); margin: 4px 0 0; white-space: pre-line; }

/* closing band */
.band { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

/* footer */
footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--dim); font-size: 13px; }
footer .wrap { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
footer p { max-width: 560px; margin: 0; }
footer nav { display: flex; gap: 18px; }
footer nav a { color: var(--muted); text-decoration: none; }
footer nav a:hover { color: var(--text); }

/* ---- account / admin pages ---- */
.page { padding: 56px 0 80px; min-height: calc(100vh - 58px - 120px); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 14.5px; }
.panel-body { padding: 20px; }
.auth { max-width: 400px; margin: 40px auto 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tabs button { background: none; border: 0; color: var(--muted); font: 600 14px var(--sans); padding: 12px 0; margin-right: 22px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--dim); }
.dot.green { background: var(--green); } .dot.yellow { background: var(--yellow); } .dot.red { background: var(--red); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--surface); }
.stats div { padding: 18px 20px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats div:nth-child(5) { border-left: 0; }
.stats div:nth-child(n+5) { border-top: 1px solid var(--line); }
.stats strong { display: block; font: 600 26px var(--mono); }
.stats span { color: var(--muted); font-size: 13px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font: 500 11.5px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.actions { white-space: nowrap; text-align: right; }
.warn { color: var(--yellow); }
.bad { color: var(--red); }
.badge { font: 600 11px var(--mono); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--muted); }
.badge.blue { color: var(--accent); border-color: rgba(200,200,206,.4); }
.badge.red { color: var(--red); border-color: rgba(255,95,109,.4); }
.msg { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg.unread { box-shadow: inset 2px 0 0 var(--accent); }
.msg .meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.msg p { margin: 8px 0 10px; white-space: pre-line; }
.scroll { overflow-x: auto; }

/* ---- small screens ---- */
@media (max-width: 900px) {
  h1 { font-size: 38px; }
  h2 { font-size: 28px; }
  .nav { display: none; }
  .facts, .extras, .steps, .rules, .stats { grid-template-columns: 1fr 1fr; }
  .facts div + div, .extras div + div, .steps li + li, .rules div + div, .stats div + div { border-left: 0; padding-left: 0; }
  .sheet { grid-template-columns: 1fr; }
  .sheet > div { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .sheet > div:last-child { border-bottom: 0 !important; }
  .plans { grid-template-columns: 1fr; }
  .plan { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid2 { grid-template-columns: 1fr; }
  .news-item { grid-template-columns: 1fr; gap: 4px; }
  .stats div { border-left: 0 !important; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .facts, .extras, .steps, .rules, .stats { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}

/* ---- inner pages: the naval battle scene behind the content (scene.js) ---- */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: 0; transition: opacity 1.4s ease; pointer-events: none; }
#scene.on { opacity: 1; }
body.scene > header, body.scene > main, body.scene > footer { position: relative; z-index: 1; }
body.scene .doc, body.scene .auth, body.scene #dash {
  background: rgba(14, 14, 16, .84); border: 1px solid var(--line); border-radius: 8px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
body.scene .doc { margin-top: 48px; margin-bottom: 56px; padding: 44px 48px; }
body.scene .auth { padding: 30px 32px 22px; }
body.scene #dash { padding: 30px 32px; }
body.scene footer { background: rgba(14, 14, 16, .9); }
@media (max-width: 640px) { body.scene .doc { padding: 28px 20px; margin-top: 20px; } }
#scene.still { background-size: cover; background-position: 62% center; filter: brightness(.72); }
/* easter egg: a white flash behind the flag (home.js) */
.flag-flash { position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(40% 55% at 72% 42%, rgba(235, 238, 245, .55), transparent 70%);
  animation: flag-flash 1.5s ease-out forwards; }
@keyframes flag-flash { 0% { opacity: 0; } 6% { opacity: 1; } 100% { opacity: 0; } }

/* home: the flag stays behind the whole page while it tears apart (home.js); the sections pass over it */
body:not(.scene) .hero .hero-bg { position: fixed; transition: opacity .2s linear; }
body:not(.scene) main > section:not(.hero), body:not(.scene) > footer { position: relative; z-index: 1; }

/* admin: traffic */
.tchart { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 10px; }
.tcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; min-width: 0; }
.tcol span { font: 10px var(--mono); color: var(--muted); text-align: center; margin-top: 6px; height: 12px; overflow: hidden; }
.tbar.v { background: color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 2px 2px 0 0; position: relative; display: flex; align-items: flex-end; min-height: 1px; }
.tbar.u { width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; }
.tcol:hover .tbar.v { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.tbar-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; }
.tbar-key.v { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.tbar-key.u { background: var(--accent); }
.tlists { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.trow { position: relative; display: flex; justify-content: space-between; padding: 8px 14px; font-size: 13px; border-top: 1px solid var(--line); }
.trow-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.trow span, .trow b { position: relative; }
.trow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 10px; }
.trow b { font: 600 13px var(--mono); }
@media (max-width: 760px) { .tlists { grid-template-columns: 1fr; } .tcol span { display: none; } }
