:root {
  --bg: #0b0d12;
  --bg-2: #12151c;
  --card: #171b24;
  --card-2: #1c2230;
  --line: #2a3142;
  --text: #eef2f7;
  --muted: #97a0b5;
  --accent: #66c0f4;
  --accent-2: #4b9fd6;
  --ok: #2f9e62;
  --warn: #d8892f;
  --danger: #d45252;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: Inter, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(102,192,244,.12), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(47,158,98,.08), transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

/* Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #2d6f96);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #071018;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: .2px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(47,158,98,.12);
  border: 1px solid rgba(47,158,98,.35);
  color: #9fe0bc;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 4px rgba(61,220,132,.15);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: .15s ease;
}

.tab:hover { border-color: #3b455c; }

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071018;
  border-color: transparent;
}

/* Layout */
.grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 12px;
  font-size: .92rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

/* Forms */
.form-group { margin-bottom: 12px; }

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}

input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e1219;
  color: var(--text);
  outline: none;
  transition: .15s ease;
}

input:focus {
  border-color: rgba(102,192,244,.7);
  box-shadow: 0 0 0 3px rgba(102,192,244,.12);
}

/* Buttons */
button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: .15s ease;
}

.btn {
  width: 100%;
  padding: 11px 12px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071018;
}

.btn-primary:hover { filter: brightness(1.05); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

.btn-sm {
  width: auto;
  padding: 7px 10px;
  font-size: .78rem;
}

.btn:active { transform: translateY(1px); }

#message {
  min-height: 18px;
  margin-top: 10px;
  text-align: center;
  font-size: .85rem;
}

/* Table */
.table-wrap {
  overflow: auto;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: .86rem;
}

th {
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .4px;
}

tr:hover td { background: rgba(255,255,255,.015); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .3px;
}

.b-online { background: rgba(47,158,98,.2); color: #8fe0b2; }
.b-offline { background: rgba(151,160,181,.15); color: #c0c7d6; }
.b-erro { background: rgba(212,82,82,.2); color: #ffb0b0; }
.b-guard { background: rgba(102,192,244,.18); color: #9fd8f8; }
.b-conectando { background: rgba(155,89,182,.2); color: #e0b8f5; }

/* Profiles */
.profiles-list {
  display: grid;
  gap: 14px;
}

.profile {
  background: linear-gradient(180deg, #171b24, #12161e);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.02);
  flex-wrap: wrap;
}

.profile-user {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-user h3 {
  margin: 0;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.stat-box {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}

.stat-value {
  color: var(--text);
  font-size: .92rem;
  font-weight: 700;
}

.stat-value a {
  color: var(--accent);
  text-decoration: none;
}

.stat-value a:hover {
  text-decoration: underline;
}

.profile-section {
  padding: 0 16px 14px;
}

.section-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}

.games {
  display: grid;
  gap: 10px;
}

.game {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0f131a;
  border: 1px solid var(--line);
}

.game-main {
  min-width: 0;
}

.game .title {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game .sub {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.game .time {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #9fe0bc;
  font-size: .95rem;
  font-weight: 700;
}

.game-actions {
  display: flex;
  align-items: center;
}

.profile-footer {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,.15);
}

.add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty,
.empty-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 14px;
  color: var(--muted);
  font-size: .88rem;
  text-align: center;
  background: rgba(255,255,255,.015);
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .wrap {
    width: min(100% - 16px, 1120px);
    padding-top: 12px;
  }

  .brand h1 { font-size: 1rem; }
  .card { padding: 14px; }

  .profile-stats {
    grid-template-columns: 1fr;
  }

  .game {
    grid-template-columns: 1fr;
  }

  .game-actions {
    justify-content: flex-start;
  }

  .add-row {
    grid-template-columns: 1fr;
  }
}