:root {
  --bg: #0f1114;
  --panel: #171a1f;
  --line: #262b33;
  --fg: #e9ecf1;
  --muted: #8b93a1;
  --accent: #e6b450;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  padding: 32px 16px;
}

main {
  max-width: 860px;
  margin: 0 auto;
}

header { margin-bottom: 32px; }

h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .01em;
}

.list-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

h2 { font-size: 1.15rem; font-weight: 600; }

.count { color: var(--muted); font-size: .9rem; }

.characters {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.characters th,
.characters td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.characters tbody tr:last-child td { border-bottom: none; }

.characters th {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.characters .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.characters tbody tr:hover { background: #1d2127; }

.name { font-weight: 600; }

/* The character's class color is set per row via --class-color. */
.name { color: var(--class-color, var(--fg)); }

.role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.role-pvp { color: #f07167; border-color: #5a2e2b; }
.role-pve { color: #7cc6fe; border-color: #24435a; }

.empty { color: var(--muted); text-align: center; }

@media (max-width: 560px) {
  .characters th,
  .characters td { padding: 10px 8px; font-size: .9rem; }
}

/* Admin page */

.admin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: #3a2f17;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.back {
  margin-left: auto;
  color: var(--muted);
  text-decoration: none;
}

.back:hover { color: var(--fg); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 32px;
}

.panel h2 { margin-bottom: 16px; }

.form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 16px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .85rem;
  color: var(--muted);
}

.form input,
.form select {
  font: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.form input:focus,
.form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.form button {
  font: inherit;
  font-weight: 700;
  color: #1a1408;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  cursor: pointer;
}

.form button:disabled { opacity: .6; cursor: default; }

.form-message { color: var(--muted); }
.form-message.success { color: #7bd88f; }
.form-message.error { color: #f07167; }

/* Class and race icons with a tooltip showing the English name */

.icon {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.icon img {
  display: block;
  border-radius: 5px;
  border: 1px solid var(--line);
}

.icon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 5px;
  background: #000;
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: .8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s;
  z-index: 1;
}

.icon:hover::after { opacity: 1; }

/* Homepage header with the admin button */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-button {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .1s, border-color .1s;
}

.admin-button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Admin: edit mode and row actions */

.form button.secondary {
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
}

.form button.secondary:hover { border-color: var(--muted); }

.characters .actions { text-align: right; width: 1%; white-space: nowrap; }

.edit-button {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.edit-button:hover { color: var(--accent); border-color: var(--accent); }

.characters tr.editing { background: #2a2414; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
