:root {
  --bg: #f7f7f8;
  --text: #111;
  --accent: #2563eb;
  --card-bg: #fff;
  --border: #d1d5db;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

[data-theme='dark'] {
  --bg: #121212;
  --text: #f5f5f5;
  --card-bg: #1e1e1e;
  --border: #374151;
  --accent: #3b82f6;
  --shadow: 0 2px 6px rgba(255,255,255,0.05);
}

/* === Grundlayout === */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
}

html { scroll-behavior: smooth; }

/* === Kopfbereich === */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0.5rem 1rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1rem;
}
.nav-links a {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.nav-links a:hover { color: var(--accent); }

/* === Buttons & Links === */
a, button {
  text-decoration: none;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
a:hover, button:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

/* === Karten-Layout === */
.card, .section-card, .result-card, .result-dice, .dice-section, .ranged-modifier {
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1rem 1.5rem;
  margin-top: 1rem;
}

.card {
  text-align: center;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); }

/* Farbige Karten */
.card-blue { background: #0060fa; color: #fff; }
.card-red { background: #ef4444; color: #fff; }
.card-yellow { background: #facc15; color: #222; }

/* === Gitterlayout === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

/* === Tabellen === */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}
th, td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
}
thead {
  background: #e5e7eb;
  font-weight: 600;
}
[data-theme='dark'] thead { background: #374151; }

/* === Formular-Elemente === */
label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 0.9rem;
}
select, input {
  margin-top: 0.25rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.3);
  outline: none;
}

/* === Würfelbereich === */
.dice-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.quick-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.quick-buttons button {
  background: #e5e7eb;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
[data-theme='dark'] .quick-buttons button { background: #374151; color: #f9fafb; }
[data-theme='dark'] .quick-buttons button:hover { background: #4b5563; }

/* === Fernkampf-Modifikator === */
.fk-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* === Gezielte Schüsse & Trefferzonen === */
.section-card h2 { font-size: 1.6rem; font-weight: 600; margin-bottom: 1rem; }
.section-card h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1rem; }
.section-card ul { list-style: disc; margin-left: 1.5rem; margin-bottom: 0.5rem; }

/* === Footer === */
.foot {
  text-align: right;
  padding: 1rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* === Responsive === */
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .topbar h1 { font-size: 16px; }
  button, a { font-size: 14px; padding: 8px; }
}
