:root {
  --bg: #12141a;
  --surface: #1a1d26;
  --surface-2: #222633;
  --border: #2e3342;
  --text: #e8eaf0;
  --muted: #939bb0;
  --accent: #f5a623;
  --accent-ink: #1a1206;
  --ok: #4ec26f;
  --warn: #e8b13a;
  --danger: #e35d5d;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* Regras com display próprio (.modal, .login-wrap) venceriam o atributo
   hidden, deixando modais visíveis na carga. Isto restabelece a precedência. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: .95rem; color: var(--muted); margin-top: 1.25rem; }

.muted { color: var(--muted); font-size: .875rem; }
.error { color: var(--danger); font-size: .875rem; }
.warn {
  background: rgba(232, 177, 58, .1);
  border-left: 3px solid var(--warn);
  padding: .6rem .75rem;
  border-radius: 4px;
  font-size: .85rem;
  color: #e4d3ab;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.login-card { width: min(380px, 100%); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.topbar-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.empty { text-align: center; padding: 3rem 1rem; }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* Server card */
.server-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}
.server-name { font-size: 1.05rem; font-weight: 600; }

.badge {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .18rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.badge.running { color: var(--ok); border-color: rgba(78,194,111,.4); }
.badge.paused  { color: var(--warn); border-color: rgba(232,177,58,.4); }
.badge.exited, .badge.ausente { color: var(--danger); border-color: rgba(227,93,93,.4); }

.address {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .5rem .65rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .85rem;
  margin: .75rem 0;
  overflow-x: auto;
}
.address button {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: .15rem .45rem;
  font-size: .72rem;
  cursor: pointer;
}
.address button:hover { color: var(--text); border-color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin: .75rem 0;
}
.stat { background: var(--surface-2); border-radius: 6px; padding: .5rem; text-align: center; }
.stat b { display: block; font-size: 1rem; }
.stat span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.players { font-size: .85rem; margin: .5rem 0; min-height: 1.3em; }

/* Buttons */
.btn {
  font: inherit;
  font-size: .875rem;
  padding: .45rem .8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(227,93,93,.35); }
.btn.danger:hover:not(:disabled) { background: rgba(227,93,93,.12); }
.btn.sm { font-size: .8rem; padding: .3rem .6rem; }

.actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.card-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .75rem; }

/* Forms */
label { display: block; margin-bottom: .85rem; font-size: .875rem; }
input, select {
  width: 100%;
  margin-top: .3rem;
  padding: .5rem .6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label small { display: block; margin-top: .25rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.search-row { grid-template-columns: 1fr auto; align-items: start; }
.search-row .btn { margin-top: .3rem; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 12, .7);
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
  z-index: 10;
}
.modal-card { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; }

/* Mods */
.mod-list { list-style: none; padding: 0; margin: .5rem 0; }
.mod-list li {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .65rem;
  background: var(--surface-2);
  border-radius: 6px;
  margin-bottom: .4rem;
  font-size: .875rem;
}
.mod-list .mod-info { flex: 1; min-width: 0; }
.mod-list .mod-title { font-weight: 500; }
.mod-list .mod-meta { font-size: .75rem; color: var(--muted); }

@media (max-width: 520px) {
  .row { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}

/* Modpack */
.pack {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  margin: .75rem 0 .25rem;
}
.pack .btn { display: inline-block; text-decoration: none; }
.pack-help { margin-top: .6rem; font-size: .82rem; line-height: 1.5; }
.pack-help ul { margin: .4rem 0; padding-left: 1.1rem; }
.pack-help li { margin: .15rem 0; }
.pack-help code {
  background: var(--surface);
  padding: .1rem .3rem;
  border-radius: 3px;
  font-size: .95em;
}
