:root {
  --bg: hsl(0, 0%, 7%);
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --muted: #cfcfcf;
  --accent: #ffc107; /* very yellowish orange */
  --accent-contrast: #141414;
  --danger: #ef4444;
  --success: #10b981;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  background-image: url("world map.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.center {
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 0.5rem;
}

h1 { margin: 0; font-size: 2.25rem; }
h2 { margin: 0.5rem 0; font-size: 1.25rem; }

.subtitle { margin: 0; color: var(--muted); }

.sep { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

.stack { display: grid; gap: 0.5rem; }

label { margin-right: 0.25rem; }
/* Font stack with Latin Extended support (German ö/ü/ß, Dutch ë/ï, etc.) for inputs */
input, select, textarea {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: 0.4rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
textarea { width: 100%; box-sizing: border-box; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 0.375rem;
  background: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.button.small { padding: 0.35rem 0.6rem; font-weight: 600; }
.button.danger { background: var(--danger); color: #fff; }
.button.info { background: #2563eb; color: #fff; }
.button:hover { opacity: 0.9; }

.msg { min-height: 1.2rem; opacity: 0.9; }

/* Top header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #0e0e0e;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand img { height: 32px; width: auto; }
.brand .title { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.3px; }

/* Icons */
.icon { width: 18px; height: 18px; object-fit: contain; filter: brightness(0) invert(1); }

/* Cards (shared)
   Some pages add inline styles; these ensure consistent base look */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; }

/* Links in navs */
.nav a { color: var(--text); }
.nav a:hover { background: #141414; }

/* Page layout (index) */
.page { max-width: 880px; margin: 0 auto; padding: 1.25rem; display: grid; gap: 1rem; box-sizing: border-box; }
.page.center { text-align: center; }
.page .logo { display: grid; place-items: center; }
.page .logo img { height: 64px; width: auto; }
.section-card { padding: 1rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); display: grid; gap: 0.75rem; }
.section-title { margin: 0; font-size: 1.1rem; }

/* Section separators */
.section-separator { border: 0; border-top: 1px solid var(--border); margin: 0.5rem 0; opacity: 0.6; }
.section-card > .section-separator:first-of-type { margin-top: 0.25rem; }

/* Game section layout */
.current-game { display: grid; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; background: rgba(255, 193, 7, 0.08); }
.current-game strong { color: var(--accent); }
.current-selected { display: grid; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; background: rgba(255, 193, 7, 0.08); }
.current-selected .current-title { margin: 0; color: var(--accent); font-size: 1.1rem; }
.current-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.current-row .button { margin-left: auto; }
.game-selection { display: grid; gap: 0.5rem; }
.create-game { display: grid; place-items: center; }
.select-controls { display: grid; gap: 0.5rem; }
.select-group { display: grid; gap: 0.25rem; }
.select-title { font-weight: 600; opacity: 0.9; }
.select-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; justify-content: center; }

/* Mobile responsiveness */
@media (max-width: 640px) {
  .page { padding: 0.5rem; gap: 0.6rem; max-width: 100%; width: 100%; box-sizing: border-box; padding-left: max(0.5rem, env(safe-area-inset-left)); padding-right: max(0.5rem, env(safe-area-inset-right)); }
  .section-card { padding: 0.75rem; margin: 0; width: 100%; box-sizing: border-box; text-align: center; }
  .page.center { text-align: center; }
  .select-actions { flex-direction: column; align-items: stretch; }
  .select-group select { width: 100%; }
  .select-actions button { width: 100%; }
  html, body { background-attachment: scroll; background-position: top center; background-size: cover; }
  html, body, .page { overflow-x: hidden; }
  .section-card { overflow: hidden; }

  /* Align select/delete buttons side-by-side at 50% width each */
  .select-controls > div { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
  .select-controls > div select { width: 100%; }
  .select-controls > div button { flex: 1 1 calc(50% - 0.25rem); max-width: 50%; }
  .select-controls label { display: block; width: 100%; text-align: center; margin-bottom: 0.25rem; }

  .current-row { flex-direction: column; align-items: stretch; }
  .current-row .button { width: 100%; margin-left: 0; }
  .current-selected .current-title { text-align: center; }
}

/* Alerts */
.alert { padding: 0.6rem 0.8rem; border-radius: 0.375rem; font-weight: 600; border: 1px solid transparent; }
.alert-info { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.35); color: #bfdbfe; }
.alert-success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.35); color: #a7f3d0; }
.alert-warn { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.35); color: #fde68a; }
.alert-error { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.35); color: #fecaca; }

/* Buttons */
.button.secondary { background: #2a2a2a; color: var(--text); }

/* Footer */
.footer { margin-top: 2rem; display: grid; place-items: center; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal .modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.modal .modal-content { position: relative; max-width: 520px; margin: 10vh auto; background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; padding: 1rem; z-index: 1001; }
.modal .modal-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }