/* Bierberg – Die Häuserwahl. Gemütliche Taverne, Lesbarkeit vor Dekoration. */
:root {
  --wood-900: #150d07;
  --wood-800: #1f140b;
  --wood-700: #2c1d10;
  --wood-600: #3b2716;
  --wood-500: #50351d;
  --gold: #d8a440;
  --gold-light: #f3d27f;
  --gold-dark: #9c7224;
  --parchment: #f6ead0;
  --parchment-2: #ecdcb7;
  --parchment-edge: #c9ad78;
  --ink: #2a1b0e;
  --ink-soft: #5a4128;
  --text-light: #f7ecd6;
  --text-muted: #d4c09b;
  --red: #b0342b;
  --yellow: #d9a32f;
  --green: #2e6e3b;
  --blue: #2f55a8;
  --ok: #2e6e3b;
  --warn: #9a5b00;
  --danger: #a3261d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font-head: Georgia, 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text-light);
  background-color: var(--wood-800);
  background-image:
    radial-gradient(ellipse at 15% -10%, rgba(255, 170, 60, 0.28), transparent 55%),
    radial-gradient(ellipse at 90% 0%, rgba(255, 140, 40, 0.18), transparent 50%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 120px);
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: 100% 900px, 100% 900px, auto;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); color: var(--gold-light); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.3rem, 4vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.9em; }

a { color: var(--gold-light); }

:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--gold); color: var(--ink); padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Grundlayout ---------- */

.shell { width: 100%; max-width: 760px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.shell.wide { max-width: 1100px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 1rem; max-width: 1100px; margin: 0 auto;
}
.brand {
  font-family: var(--font-head); color: var(--gold-light); font-size: 1.15rem;
  display: flex; align-items: center; gap: 0.6rem; text-decoration: none;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--gold);
  background: radial-gradient(circle at 35% 35%, var(--gold-light), var(--gold-dark));
  display: grid; place-items: center; color: var(--ink); font-weight: 700; font-size: 1rem;
}

.parchment {
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  color: var(--ink);
  border-radius: var(--radius);
  border: 1px solid var(--parchment-edge);
  box-shadow: var(--shadow), inset 0 0 40px rgba(150, 110, 50, 0.18);
  padding: 1.25rem;
}
.parchment h1, .parchment h2, .parchment h3 { color: var(--ink); }
.parchment a { color: #7a4f10; }

.panel {
  background: rgba(20, 12, 6, 0.72);
  border: 1px solid rgba(216, 164, 64, 0.35);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.row.spread { justify-content: space-between; }
.muted { color: var(--text-muted); }
.parchment .muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }

/* ---------- Der alte Kater ---------- */

.kater-hero {
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid rgba(216, 164, 64, 0.55);
  box-shadow: var(--shadow);
  background: var(--wood-900);
}
.kater-hero img { width: 100%; height: auto; aspect-ratio: 16 / 9; }

.kater-says {
  display: flex; gap: 0.9rem; align-items: flex-start;
}
.kater-portrait {
  flex: 0 0 auto;
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--gold);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  object-fit: cover;
  background: var(--wood-900);
}
.kater-portrait.small { width: 44px; height: 44px; border-width: 2px; }
.bubble { position: relative; flex: 1; min-width: 0; }
.bubble-name {
  font-family: var(--font-head); font-size: 0.95rem; color: var(--gold-light); margin-bottom: 0.3rem;
}
.parchment .bubble-name { color: var(--gold-dark); }

/* ---------- Buttons ---------- */

button, .button {
  font: inherit;
  cursor: pointer;
  min-height: 48px;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  border: 2px solid var(--gold-dark);
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--ink);
  font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:hover:not(:disabled), .button:hover { filter: brightness(1.06); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.btn-secondary {
  background: transparent; color: var(--gold-light); border-color: rgba(216, 164, 64, 0.7);
}
.parchment .btn-secondary { color: var(--ink); border-color: var(--parchment-edge); background: rgba(255, 255, 255, 0.35); }
.btn-danger { background: linear-gradient(180deg, #d0564b, var(--danger)); color: #fff; border-color: #6e150f; }
.btn-small { min-height: 40px; padding: 0.4rem 0.8rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

.nav-buttons {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1.25rem;
}
.nav-buttons > :only-child { grid-column: 1 / -1; }

/* ---------- Fortschritt ---------- */

.progress-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.9rem; }
.progress-label { font-weight: 650; color: var(--gold-light); }
.progress {
  height: 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(216, 164, 64, 0.4); overflow: hidden; flex: 1;
}
.progress > span {
  display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  transition: width 0.3s ease;
}

/* ---------- Fragen ---------- */

.question-title { font-family: var(--font-head); color: var(--gold-dark); font-size: 1rem; margin: 0 0 0.25rem; text-transform: uppercase; letter-spacing: 0.06em; }
.question-text { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.4rem; }
.question-hint { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 1rem; }

.options { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }

.option {
  border: 2px solid var(--parchment-edge);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}
.option.is-first { border-color: var(--gold-dark); background: #fff6dc; box-shadow: 0 0 0 2px rgba(216, 164, 64, 0.35); }
.option.is-second { border-color: #8a7350; background: #fbf3e2; }
.option-text { margin: 0 0 0.6rem; }
.option-badge {
  display: inline-block; font-size: 0.8rem; font-weight: 700; border-radius: 999px;
  padding: 0.1rem 0.6rem; margin-bottom: 0.4rem;
}
.option.is-first .option-badge { background: var(--gold); color: var(--ink); }
.option.is-second .option-badge { background: #8a7350; color: #fff; }

.rank-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.rank-buttons button {
  min-height: 44px; font-size: 0.95rem; font-weight: 600;
  background: #fff; color: var(--ink); border: 2px solid var(--parchment-edge);
}
.rank-buttons button[aria-pressed='true'].first { background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-color: var(--gold-dark); }
.rank-buttons button[aria-pressed='true'].second { background: #8a7350; color: #fff; border-color: #5d4b31; }

/* Einzel- und Skalenwahl als Radio-Karten */
.choice {
  display: flex; gap: 0.75rem; align-items: flex-start;
  border: 2px solid var(--parchment-edge); border-radius: 12px;
  background: rgba(255, 255, 255, 0.55); padding: 0.8rem 0.9rem; cursor: pointer;
  min-height: 48px;
}
.choice input { width: 1.35rem; height: 1.35rem; margin: 0.15rem 0 0; accent-color: var(--gold-dark); flex: 0 0 auto; }
.choice:has(input:checked) { border-color: var(--gold-dark); background: #fff6dc; }
.choice:has(input:focus-visible) { outline: 3px solid var(--gold-dark); outline-offset: 2px; }
.scale-step {
  flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: var(--parchment-2); border: 1px solid var(--parchment-edge);
}
.choice:has(input:checked) .scale-step { background: var(--gold); }
.scale-ends { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.4rem; }

/* Speichern-Status */
.save-status { min-height: 1.6em; margin-top: 0.9rem; font-size: 0.95rem; }
.save-status.ok { color: var(--ok); }
.save-status.pending { color: var(--ink-soft); }
.save-status.error { color: var(--danger); font-weight: 600; }

.alert {
  border-radius: 10px; padding: 0.8rem 1rem; border: 2px solid; margin: 0 0 1rem;
}
.alert-info { border-color: var(--gold-dark); background: rgba(216, 164, 64, 0.15); }
.alert-error { border-color: var(--danger); background: rgba(163, 38, 29, 0.12); }
.parchment .alert-error { color: #6e150f; }
.panel .alert-error { color: #ffd2cc; }

/* ---------- Übersicht ---------- */

.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.review-item {
  border: 1px solid var(--parchment-edge); border-radius: 10px; padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.45);
}
.review-item .q { font-weight: 650; }
.review-item .a { margin: 0.2rem 0 0; }
.review-item .label { font-size: 0.8rem; font-weight: 700; color: var(--gold-dark); text-transform: uppercase; letter-spacing: 0.04em; }
.review-item.missing { border-color: var(--danger); }

/* ---------- Warten ---------- */

.count-dots { display: flex; gap: 0.45rem; flex-wrap: wrap; margin: 0.6rem 0 0.2rem; }
.count-dots span {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--gold-dark); background: rgba(0, 0, 0, 0.06);
}
.count-dots span.done { background: radial-gradient(circle at 35% 35%, var(--gold-light), var(--gold)); }

.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ---------- Häuser ---------- */

.house-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .house-grid { grid-template-columns: 1fr 1fr; } }

.house-card {
  border-radius: var(--radius); overflow: hidden; background: var(--wood-900);
  border: 3px solid var(--house-color, var(--gold));
  box-shadow: var(--shadow);
}
.house-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #0c0703; }
.house-card .house-body { padding: 0.9rem 1rem 1.1rem; }
.house-card .house-name { font-family: var(--font-head); font-size: 1.45rem; color: var(--gold-light); margin: 0; }
.house-card .house-trait { font-weight: 700; color: var(--house-accent, var(--gold-light)); margin: 0.1rem 0 0.4rem; }
.house-card .house-desc { color: var(--text-muted); margin: 0 0 0.7rem; }
.house-card .duo { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--text-light); }
.house-card.mine { box-shadow: 0 0 0 4px var(--gold-light), var(--shadow); }
.mine-flag {
  display: inline-block; background: var(--gold); color: var(--ink); font-weight: 800;
  border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.85rem; margin-bottom: 0.4rem;
}

.house-saufendor { --house-color: var(--red); --house-accent: #ff8f84; }
.house-hopfenpuff { --house-color: var(--yellow); --house-accent: #ffd36b; }
.house-slytherhop { --house-color: var(--green); --house-accent: #8fdc9c; }
.house-bieravinclaw { --house-color: var(--blue); --house-accent: #9bb8ff; }

/* ---------- Admin ---------- */

.tabs { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.3rem; margin-bottom: 1rem; scrollbar-width: thin; }
.tabs a {
  flex: 0 0 auto; text-decoration: none; padding: 0.6rem 1rem; border-radius: 999px;
  border: 1px solid rgba(216, 164, 64, 0.5); color: var(--text-light); min-height: 44px; display: inline-flex; align-items: center;
}
.tabs a[aria-current='page'] { background: var(--gold); color: var(--ink); font-weight: 700; }

.status-badge {
  display: inline-block; border-radius: 999px; padding: 0.15rem 0.65rem; font-size: 0.85rem; font-weight: 700;
}
.status-not_started { background: #5b4a3a; color: #f1e4cf; }
.status-in_progress { background: #8a5a00; color: #fff3d6; }
.status-submitted { background: var(--ok); color: #fff; }

.player-cards { display: grid; gap: 0.9rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .player-cards { grid-template-columns: 1fr 1fr; } }

.field { display: grid; gap: 0.3rem; }
.field label { font-weight: 600; }
input[type='text'], input[type='password'], input[type='file'] {
  font: inherit; width: 100%; min-height: 46px; padding: 0.55rem 0.75rem;
  border-radius: 10px; border: 2px solid var(--parchment-edge); background: #fffdf6; color: var(--ink);
}
.panel input[type='text'], .panel input[type='password'], .panel input[type='file'] { border-color: rgba(216, 164, 64, 0.6); }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { flex: 1; min-width: 0; }

.link-box {
  word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.35); border: 1px dashed var(--gold); border-radius: 8px; padding: 0.6rem;
}

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.8rem; font-size: 0.95rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

.bars { display: grid; gap: 0.35rem; }
.bar-row { display: grid; grid-template-columns: 7.5rem 1fr 3.8rem; gap: 0.5rem; align-items: center; font-size: 0.9rem; }
.bar { height: 12px; background: rgba(255, 255, 255, 0.12); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--house-color, var(--gold)); }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; }

.score-big { font-size: 1.4rem; font-weight: 800; color: var(--gold-light); }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; padding: 0; margin: 0.4rem 0 0; }
.chips li { background: rgba(216, 164, 64, 0.18); border: 1px solid rgba(216, 164, 64, 0.45); border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.88rem; }
.notes { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--text-muted); font-size: 0.92rem; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid rgba(216, 164, 64, 0.25); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; }

dialog {
  border: none; padding: 0; border-radius: var(--radius); max-width: min(520px, calc(100vw - 2rem)); width: 100%;
  background: transparent; color: inherit;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.65); }

.image-admin { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .image-admin { grid-template-columns: 1fr 1fr; } }

.danger-zone { border-color: rgba(208, 86, 75, 0.7); }

.footer-note { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-top: 2rem; }

.loading { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

@media (min-width: 640px) {
  .shell { padding: 1.5rem 1.5rem 3rem; }
  .parchment { padding: 1.6rem; }
  .kater-portrait { width: 76px; height: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
