/* CGS ID account portal — dark theme, studio-site visual language.
   Phone-first (Kenneth drives from a phone), safe-area aware. */

:root {
  --bg: #0b0f14;
  --surface: #131a22;
  --surface-2: #1a2330;
  --border: #243040;
  --text: #f4f6f8;
  --muted: #8b98a9;
  --brand: #ff4d3d;
  --brand-hover: #ff6a5c;
  --red: #ff6b61;
  --green: #46c98a;
  --radius: 14px;
  --max-width: 680px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; font-weight: 600; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}

/* --------------------------------- top nav -------------------------------- */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 18px;
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
}
.topnav .brand:hover { text-decoration: none; }

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: #201503;
  font-weight: 900;
}

.topnav .links { display: flex; align-items: center; gap: 14px; }
.topnav .links[hidden] { display: none; } /* beat display:flex when signed out */
.topnav .links a { color: var(--muted); font-weight: 600; font-size: 14px; }
.topnav .links a:hover { color: var(--brand); text-decoration: none; }
.topnav .links a.active { color: var(--brand); }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.linklike:hover { color: var(--red); }

/* --------------------------------- layout --------------------------------- */

h1 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.02em;
  margin: 8px 0 4px;
}
h1 .accent { color: var(--brand); }

.sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}

.card h2 {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* ---------------------------------- forms --------------------------------- */

.tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 2px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
}

.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

label.f-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 5px;
}

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* no iOS zoom on focus */
  padding: 12px;
}
input:focus { outline: none; border-color: var(--brand); }

input.code {
  text-align: center;
  letter-spacing: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 600;
  margin: 14px 0 4px;
}
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 13px;
  margin-top: 14px;
  cursor: pointer;
  background: var(--brand);
  color: #201503;
}
.btn:hover { background: var(--brand-hover); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:active { transform: scale(0.99); }

.btn.ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover { border-color: var(--brand); }

.btn.danger {
  background: none;
  border-color: var(--red);
  color: var(--red);
}
.btn.danger:hover { background: rgba(255, 107, 97, 0.12); }

.btn.small { width: auto; padding: 7px 12px; margin-top: 0; font-size: 12px; }

.error {
  color: var(--red);
  font-size: 12.5px;
  font-weight: 700;
  min-height: 18px;
  margin-top: 10px;
  text-align: center;
}

.note-ok { color: var(--green); font-weight: 700; }

.link-row { margin-top: 12px; text-align: center; font-size: 13px; }
.link-row button {
  background: none; border: 0; padding: 4px;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--brand); cursor: pointer;
}
.link-row button:hover { color: var(--brand-hover); text-decoration: underline; }

/* ------------------------------ profile header ---------------------------- */

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--brand);
  flex-shrink: 0;
}

.profile .p-name { font-size: 19px; font-weight: 900; }
.profile .p-meta { color: var(--muted); font-size: 12.5px; }

.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge.ok { background: rgba(70, 201, 138, 0.14); color: var(--green); border: 1px solid rgba(70, 201, 138, 0.4); }
.badge.warn { background: rgba(240, 165, 0, 0.14); color: var(--brand); border: 1px solid rgba(240, 165, 0, 0.4); }
.badge.off { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* -------------------------------- game cards ------------------------------ */

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.game-card { .game-card.clickable { cursor: pointer; }
  display: flex;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.game-card:hover { border-color: var(--brand); transform: translateY(-2px); }

.game-card img.gc-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  flex-shrink: 0;
}

.game-card .gc-title { font-size: 15.5px; font-weight: 800; color: var(--text); }
.game-card .gc-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.game-card .gc-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(240, 165, 0, 0.14);
  color: var(--brand);
  border: 1px solid rgba(240, 165, 0, 0.35);
}
.game-card.soon { opacity: 0.6; }
.game-card.soon:hover { border-color: var(--border); transform: none; }
.game-card .gc-links { font-size: 12.5px; margin-top: 8px; }
.game-card .gc-live {
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
}
.game-card .gc-live .team { font-size: 14px; font-weight: 900; color: var(--text); }
.game-card .gc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  color: var(--muted);
}
.game-card .gc-stats b { color: var(--text); }
.game-card .clan {
  display: inline-block;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(240, 165, 0, 0.14);
  border: 1px solid rgba(240, 165, 0, 0.35);
  color: var(--brand);
  font-weight: 800;
  font-size: 11px;
}

.game-card.clickable { cursor: pointer; }

/* ------------------------------- SC hub (#/sc) ---------------------------- */

.hub-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.hub-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}

.hub-tile-val { font-size: 17px; font-weight: 900; }

.hub-tile-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 4px;
}

/* -------------------------------- security -------------------------------- */

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.session-row:last-child { border-bottom: 0; }
.session-row .s-label { font-size: 13px; font-weight: 700; word-break: break-word; }
.session-row .s-meta { font-size: 11.5px; color: var(--muted); }

.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  width: fit-content;
  margin: 12px auto;
}
.qr-box svg { display: block; }

.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 1px;
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
  word-break: break-all;
}

.codes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
  margin: 10px 0;
}
.codes code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 1px;
}

/* --------------------------------- footer --------------------------------- */

footer {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
footer .row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.spinner { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }

@media (max-width: 460px) {
  .topnav .links { gap: 10px; }
  .topnav .links a, .linklike { font-size: 13px; }
  h1 { font-size: 22px; }
  .games-grid { grid-template-columns: 1fr; }
}
