/* SacLANd theme: original CSS, optional local display font, no external requests.
   Palette and typography tokens can be reused by other admin pages. */
@font-face {
  font-family: "Norse";
  src: url("/static/fonts/norse-webfont.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Norse";
  src: url("/static/fonts/norse-bold-webfont.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #171b1d;
  --surface: #22282b;
  --surface-inset: #1b2023;
  --surface-hover: #30383b;
  --text: #eee5d2;
  --text-muted: #b7b5aa;
  --accent: #c7a66b;
  --accent-hover: #e0c18c;
  --accent-ink: #211d16;
  --border: #4e5555;
  --border-subtle: #363e40;
  --success: #2e9d50;
  --success-text: #8bd59a;
  --danger: #c43d3d;
  --danger-text: #ffaaa1;
  --danger-surface: #402a2b;
  --shadow: #00000040;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Norse", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

.version-panel {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-inset);
}

.version-title {
  margin-top: 2px;
  font-size: 1.2em;
  font-weight: 600;
}
.backup-integrity {
  color: var(--success-text);
  font-size: 0.85rem;
}
.server-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.status-indicator {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 7px;
  border-radius: 50%;
}

.status-running {
  background: var(--success);
}

.status-offline {
  background: var(--danger);
}

.status-reconnecting {
  background: var(--accent);
}

.status-unknown {
  background: var(--text-muted);
}

.player-presence {
  white-space: nowrap;
}

.status-updated {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.status-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.status-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.status-value {
  font-size: 1.35rem;
  font-weight: 600;
}

.status-value-small {
  font-size: 1rem;
}

.status-detail {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.update-history-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface-inset);
}

.update-history-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.update-history-item:last-child {
  border-bottom: 0;
}

.update-history-result {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.update-history-message {
  font-size: 0.9rem;
}

.update-history-detail {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.update-history-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-top: 6px;
}

.status-details {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.status-details > div {
  margin-top: 4px;
}

@media (max-width: 650px) {
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .server-status-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
body {
  font-family: var(--font-body);
  background: var(--background);
  color: var(--text);
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
  line-height: 1.5;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

section {
  margin: 32px 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

h1, h2 {
  margin-top: 0;
}

form {
  margin: 8px 0;
}

.add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 8px;
}

button {
  padding: 8px 12px;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.6;
}

  .server-actions {
display: flex;
align-items: center;
gap: 10px;
  }

  .update-button {
border: 1px solid var(--text-muted);
border-radius: 6px;
background: var(--surface);
color: var(--text);
font-weight: 600;
  }

  .update-button:hover:not(:disabled) {
background: var(--surface-hover);
  }

  .restart-button {
border: 1px solid var(--danger-text);
border-radius: 6px;
background: var(--surface);
color: var(--danger-text);
font-weight: 600;
  }

  .restart-button:hover:not(:disabled) {
background: var(--danger-surface);
  }

ul {
  padding-left: 0;
  list-style: none;
}

li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

li:last-child {
  border-bottom: 0;
}

.player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  flex: 0 0 auto;
}

.player-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--border-subtle);
  flex: 0 0 auto;
}

.player-info {
  min-width: 0;
}

.player-name {
  font-weight: 600;
}

.player-name a {
  color: inherit;
  text-decoration: none;
}

.player-name a:hover {
  text-decoration: underline;
}

.player-id {
  color: var(--text-muted);
  font-size: 0.9em;
}

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

.world-backup {
  color: var(--text-muted);
}

code {
  word-break: break-all;
}

.lookup-help {
  color: var(--text-muted);
  margin-top: -8px;
}

#steam-result {
  margin-top: 20px;
}

.steam-player {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.steam-avatar {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  flex: 0 0 auto;
}

.steam-details {
  flex: 1;
  min-width: 0;
}

.steam-details strong {
  font-size: 1.15rem;
}

.steam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.steam-actions form {
  margin: 0;
}

.error {
  color: var(--danger-text);
  margin-top: 12px;
}

@media (max-width: 650px) {
  .add-form,
  .steam-player {
    flex-direction: column;
    align-items: stretch;
  }

  header {
    align-items: flex-start;
  }
}

.world-config-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
}

.world-config-header h2 {
  margin-bottom: 0;
}

.world-config-preset {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.world-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.world-config-source {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 3px;
}

.world-config-override {
  font-weight: 600;
}

.world-config-details {
  margin-top: 18px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.world-config-details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.world-config-keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 18px;
  margin-top: 12px;
  font-size: 0.85rem;
}

.world-config-key {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 650px) {
  .world-config-grid,
  .world-config-keys {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .world-config-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Shared surfaces, typography and controls. Display type is limited to headings. */
header {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--accent);
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.035em;
  color: var(--text);
  line-height: 1.25;
}

h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin-bottom: 10px; }
h2 { font-size: 1.5rem; border-left: 3px solid var(--accent); padding-left: 12px; }

a { color: var(--accent-hover); text-underline-offset: 3px; }
a:hover { color: var(--text); }

section {
  background: var(--surface);
  box-shadow: 0 8px 24px var(--shadow);
}

.status-item, .steam-player {
  min-width: 0;
  background: var(--surface-inset);
  box-shadow: 0 3px 8px var(--shadow);
  border-top-color: var(--border);
}

.status-value { font-variant-numeric: tabular-nums; }
.status-item, .player-info, .steam-details, .world-config-key, .status-details {
  overflow-wrap: anywhere;
}
.status-details strong { color: var(--text); }
.world-config-override { color: var(--accent-hover); }

input[type="text"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
input::placeholder { color: var(--text-muted); opacity: 1; }

button {
  font: inherit;
  font-weight: 600;
  line-height: 1.4;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
button:hover:not(:disabled) { background: var(--surface-hover); }
button:disabled { cursor: not-allowed; }

/* Primary: lookup/add. Secondary: update/sign out. Danger: restart/ban/remove. */
.add-form button, .steam-actions form[action="/players/allowlist/add"] button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.add-form button:hover:not(:disabled),
.steam-actions form[action="/players/allowlist/add"] button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
form[action="/players/bans/add"] button, form[action$="/remove"] button {
  color: var(--danger-text);
  border-color: var(--danger-text);
  background: var(--surface);
}
form[action="/players/bans/add"] button:hover:not(:disabled),
form[action$="/remove"] button:hover:not(:disabled) { background: var(--danger-surface); }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 4px;
}

.server-actions { flex-wrap: wrap; }
#restart-feedback:not(:empty), #update-feedback:not(:empty) {
  padding: 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface-inset);
  color: var(--text);
  overflow-wrap: anywhere;
}

@media (max-width: 650px) {
  body { margin: 24px auto; padding: 0 12px; }
  section { padding: 16px; }
  header { flex-wrap: wrap; }
  .server-actions { align-items: flex-start; }
  .status-updated { flex-basis: 100%; }
}

@media (max-width: 380px) {
  .status-grid, .world-config-grid, .world-config-keys { grid-template-columns: 1fr; }
  li { flex-wrap: wrap; }
}

/* Dashboard navigation progressively enhances ordinary fragment links into tabs. */
.dashboard-tabs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  scroll-padding-inline: 6px;
}
.dashboard-tabs a {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 18px;
  border-bottom: 3px solid transparent;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.dashboard-tabs a:hover { background: var(--surface-hover); }
.dashboard-tabs [aria-selected="true"] {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
  background: var(--surface);
}
.dashboard-panel { min-width: 0; }
.dashboard-panel[hidden] { display: none; }
.dashboard-panel:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 4px;
}

/* Authentication uses the dashboard palette and optional local display font. */
body.auth-page {
  max-width: 560px;
  margin: clamp(24px, 8vh, 96px) auto;
  padding: 0 20px;
}
.auth-card {
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 24px var(--shadow);
}
.auth-brand { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border-subtle); }
.auth-brand h1 { color: var(--accent-hover); margin-bottom: 4px; }
.auth-brand p { color: var(--text-muted); margin: 0; font-size: 0.9rem; }
.auth-card h2 { border: 0; padding: 0; font-family: var(--font-body); font-size: 1.35rem; letter-spacing: 0; }
.auth-intro, .auth-note { color: var(--text-muted); }
.auth-form { display: grid; gap: 10px; margin: 24px 0 0; }
.auth-form label { font-weight: 600; }
.auth-form input:not([type="hidden"]):not([type="checkbox"]) {
  width: 100%; min-width: 0; min-height: 48px; margin: 0 0 10px;
  padding: 12px; font: inherit; font-size: 1rem;
  color: var(--text); background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: 6px;
}
.auth-form button, .auth-continue {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  min-height: 48px; margin-top: 8px;
}
.auth-form button:hover:not(:disabled), .auth-continue:hover { background: var(--accent-hover); color: var(--accent-ink); }
.auth-error { padding: 12px; border-left: 3px solid var(--danger-text); color: var(--danger-text); background: var(--danger-surface); }
.auth-note { font-size: 0.9rem; margin-bottom: 0; }
.auth-card p, .auth-secret, .auth-recovery-codes { overflow-wrap: anywhere; }
.auth-qr { display: block; width: 240px; max-width: 100%; height: auto; margin: 24px auto; }
.auth-secret, .auth-recovery-codes { padding: 16px; border: 1px solid var(--border-subtle); border-radius: 6px; background: var(--surface-inset); }
.auth-recovery-codes { list-style: none; display: grid; gap: 8px; }
.auth-continue { display: block; padding: 12px; text-align: center; border-radius: 6px; text-decoration: none; font-weight: 600; }

.auth-trust { display: flex; align-items: flex-start; gap: 10px; }
.auth-trust input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.auth-form .auth-note { margin: 0; }
.trusted-device-list { list-style: none; padding: 0; display: grid; gap: 16px; }
.trusted-device-list li { display: block; padding: 20px; background: var(--surface-inset); border: 1px solid var(--border-subtle); border-radius: 8px; overflow-wrap: anywhere; }
.trusted-device-list h3 { margin: 0 0 12px; }
.device-current { display: inline-block; margin-left: 8px; font-size: 0.8rem; color: var(--accent-hover); }
.trusted-device-list dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px 16px; }
.trusted-device-list dt { color: var(--text-muted); }
.trusted-device-list dd { margin: 0; }
@media (max-width: 480px) {
  .trusted-device-list li { padding: 16px; }
  .trusted-device-list dl { grid-template-columns: 1fr; gap: 4px; }
  .trusted-device-list dd { margin-bottom: 8px; }
}
