:root {
  --bg: #0e0e0e;
  --surface: #1a1a1a;
  --border: #2d2d2d;
  --text: #f5f5f5;
  --muted: #a0a0a0;
  --green: #44a033;
  --green-hover: #5cb85c;
  --amber: #e8a635;
  --red: #c0392b;
  --grey: #555;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100vh;
  background-image:
    radial-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.3) 1px, transparent 1px);
  background-size: 24px 24px, 32px 32px;
  background-position: 0 0, 12px 12px;
}

@font-face {
  font-family: "Minecraftia";
  src: url("../fonts/Minecraftia.ttf") format("truetype");
  font-display: swap;
}

.hero {
  padding: 2.5rem 2rem 2rem;
  border-bottom: 4px solid #2d2d2d;
  background: linear-gradient(180deg, #1a1a1a 0%, #0e0e0e 100%);
  display: flex; align-items: center; justify-content: space-between;
}
.hero h1 {
  font-family: "Minecraftia", monospace;
  font-size: 2.5rem;
  letter-spacing: 0.08em;
  margin: 0;
}
.hero .user { color: var(--muted); display: flex; gap: 1rem; align-items: center; }

button, .btn {
  font-family: inherit;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border: 2px solid #000;
  border-radius: 2px;
  cursor: pointer;
  background: var(--grey);
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.15), inset 0 -2px 0 rgba(0,0,0,0.35);
  transition: background 0.1s;
}
button:hover, .btn:hover { filter: brightness(1.1); }
button.primary { background: var(--green); }
button.primary:hover { background: var(--green-hover); }
button.danger { background: var(--red); }

#create-btn {
  margin: 1.5rem 2rem;
  background: var(--green);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.card h2 { margin: 0; font-size: 1.4rem; }
.card .status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  width: fit-content;
}
.card.status-active .status { background: var(--green); color: #fff; }
.card.status-activating .status { background: var(--amber); color: #000; }
.card.status-failed .status { background: var(--red); color: #fff; }
.card.status-inactive .status { background: var(--grey); color: #fff; }

.card .players { font-size: 1.1rem; color: var(--green-hover); margin: 0; }
.card .motd { color: var(--muted); margin: 0; font-size: 0.9rem; }

.card dl.meta {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.8rem;
  row-gap: 0.2rem;
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
}
.card dl.meta dt { color: var(--muted); }
.card dl.meta dd { color: var(--text); margin: 0; }

.actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 0.6rem;
}
.actions form { margin: 0; }

.log {
  background: #000;
  color: #bfffbf;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  padding: 1rem;
  height: 60vh;
  overflow-y: scroll;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: 2px;
}
.log .log-error { color: #ff6b6b; }
.log .log-warn { color: #ffd966; }

.cmd-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0 2rem;
}
.cmd-form input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  background: #000;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
}
.cmd-output {
  height: 20vh;
  margin: 0.5rem 2rem 2rem;
  color: #e0e0e0;
}

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2rem;
}
dialog::backdrop { background: rgba(0,0,0,0.7); }
dialog input { padding: 0.6rem; font-family: inherit; border: 1px solid var(--border); background: #000; color: var(--text); border-radius: 2px; width: 100%; }
dialog label { display: block; margin-bottom: 1rem; }

.mods-table {
  width: calc(100% - 4rem);
  margin: 1rem 2rem 2rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.mods-table th, .mods-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.mods-table th {
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.mods-table tr.nested td { color: var(--muted); font-style: italic; }
.mods-table td:nth-child(2), .mods-table td:nth-child(3) {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap;
}
.empty {
  color: var(--muted);
  margin: 2rem;
  font-style: italic;
}

.flash {
  padding: 0.8rem 1.2rem;
  margin: 1rem 2rem;
  border-left: 4px solid var(--green);
  background: var(--surface);
}
.flash.error { border-left-color: var(--red); }
