:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #faf9f5;
  --ink: #20231f;
  --ink-soft: #686d68;
  --muted: #8d918d;
  --line: #e2dfd7;
  --line-strong: #cfcac0;
  --club: #5a625c;
  --club-dark: #343a36;
  --clay: #b4512d;
  --clay-dark: #873b20;
  --gold: #d8a62d;
  --sky: #256d8f;
  --ok: #3f6f55;
  --warn: #a76312;
  --err: #b3261e;
  --shadow-sm: 0 1px 2px rgba(38, 34, 28, .07);
  --shadow: 0 14px 38px rgba(50, 44, 36, .12);
  --shadow-lg: 0 24px 70px rgba(32, 28, 23, .22);
  --radius: 8px;
  --focus: 0 0 0 3px rgba(216, 166, 45, .35);
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; overflow-y: scroll; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(60, 64, 56, .035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(60, 64, 56, .028) 1px, transparent 1px),
    radial-gradient(1200px 640px at 50% -260px, rgba(216, 166, 45, .16), transparent 64%),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto, auto;
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, #4d514d, var(--gold) 46%, var(--clay));
  z-index: 850; /* knapp ueber dem fixen Header, damit der Streifen oben sichtbar bleibt */
  pointer-events: none;
}

a { color: #5d4d39; }

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 800;
  height: 72px;
  padding: 0 clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: .9rem 1.25rem;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid rgba(196, 208, 198, .76);
  box-shadow: 0 10px 30px rgba(17, 35, 26, .06);
  backdrop-filter: blur(18px);
}

/* Damit der Inhalt unter dem fixen Header startet */
body { padding-top: 72px; }

header h1 {
  position: relative;
  margin: 0;
  padding-left: 2.45rem;
  color: var(--club-dark);
  font-size: clamp(1.08rem, 1.8vw, 1.42rem);
  font-weight: 620;
  letter-spacing: 0;
}

header h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  transform: translateY(-50%);
  background:
    radial-gradient(circle at 34% 28%, #ffffd7 0 16%, #ddf95f 17% 54%, #89a81b 100%);
  box-shadow: inset -4px -5px 10px rgba(44, 67, 5, .22), 0 5px 12px rgba(58, 51, 39, .14);
}

header h1::after {
  content: "";
  position: absolute;
  left: .23rem;
  top: 50%;
  width: 1.33rem;
  height: .62rem;
  border-top: 2px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  transform: translateY(-53%) rotate(-16deg);
  pointer-events: none;
}

header nav {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: nowrap;
  min-width: 0;
}

header nav a {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .94rem;
  font-weight: 560;
  padding: .48rem .82rem;
  border-radius: 999px;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}

header nav a:hover,
header nav a.active {
  color: #3b332a;
  background: #f1eee6;
  box-shadow: inset 0 0 0 1px rgba(96, 76, 48, .16);
}

/* Logout/Login immer ganz rechts */
header nav a.nav-right { margin-left: auto; }
/* Nav-Items die per Auth-State weggeschaltet werden — kein Layout-Sprung */
header nav a.nav-hidden { display: none; }

/* Admin-Zahnrad neben Logout */
header nav a.nav-admin {
  margin-left: .15rem;
  padding: .42rem .55rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink-soft);
}
header nav a.nav-admin:hover,
header nav a.nav-admin.active {
  color: var(--clay);
  background: transparent;
  box-shadow: none;
}

main {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2rem) clamp(.8rem, 2.8vw, 2rem) 4rem;
}

footer {
  text-align: center;
  padding: 1.4rem 1rem 2.2rem;
  color: var(--ink-soft);
}

.site-footer {
  margin-top: 2.5rem;
  padding: 1.2rem 1rem 2rem;
  text-align: center;
  font-size: .82rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.site-footer .sep { color: var(--line-strong); }
.site-footer a {
  color: var(--club-dark);
  text-decoration: none;
  border-bottom: 1px dotted var(--line-strong);
}
.site-footer a:hover { color: var(--clay); border-bottom-color: var(--clay); }

/* Page-Banner (Impersonation, NoPlayer) */
.page-banner {
  padding: .65rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  font-size: .95rem;
  border-bottom: 2px solid transparent;
}
.banner-impersonate {
  background: #fef3c7;
  border-bottom-color: var(--gold);
  color: #6e5310;
}
.banner-noplayer {
  background: #fce7e7;
  border-bottom-color: var(--err);
  color: #6b1410;
}
.banner-action-link {
  background: var(--err);
  color: #fff;
  padding: .4rem .9rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 560;
}
.banner-action-link:hover { background: #8b1d16; }

h2, h3 {
  margin: 0 0 .8rem;
  color: var(--club-dark);
  line-height: 1.2;
  letter-spacing: 0;
}

h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }

.card {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(196, 208, 198, .9);
  border-radius: var(--radius);
  padding: clamp(1rem, 2vw, 1.35rem);
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.card.narrow {
  max-width: 420px;
  margin: clamp(1.5rem, 7vh, 4rem) auto;
  box-shadow: var(--shadow);
}

#meCard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .25rem;
  background: linear-gradient(135deg, rgba(92, 84, 73, .98), rgba(62, 57, 51, .98));
  color: #fff;
  border-color: rgba(255, 255, 255, .16);
  box-shadow: var(--shadow);
}

#meCard h2,
#meCard p { margin: 0; color: inherit; }
#meCard p { color: rgba(255, 255, 255, .82); }

label {
  display: block;
  margin-bottom: .8rem;
  color: var(--ink-soft);
  font-size: .9rem;
  font-weight: 560;
}

input[type=email],
input[type=password],
input[type=text],
input[type=number],
input[type=date],
input:not([type]),
select,
textarea {
  display: block;
  width: 100%;
  min-height: 2.6rem;
  margin-top: .3rem;
  padding: .58rem .72rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 450;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input[type=checkbox] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--clay);
  vertical-align: -.18rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--focus);
}

button {
  min-height: 2.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: .56rem .95rem;
  background: var(--club);
  color: #fff;
  font: inherit;
  font-size: .93rem;
  font-weight: 620;
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(58, 51, 39, .14);
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease, color .14s ease;
}

button:hover {
  background: var(--club-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(58, 51, 39, .18);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button.secondary {
  background: var(--clay);
  box-shadow: 0 7px 16px rgba(180, 81, 45, .18);
}

button.secondary:hover { background: var(--clay-dark); }

button.ghost {
  background: transparent;
  color: #5d554b;
  border-color: rgba(94, 82, 67, .35);
  box-shadow: none;
}

button.ghost:hover {
  color: #3b332a;
  background: #f1eee6;
  border-color: rgba(94, 82, 67, .55);
  box-shadow: none;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.error { color: var(--err); font-weight: 560; }
.hint { color: var(--ink-soft); font-size: .9rem; }
.loading {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 560;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: .8rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: .91rem;
}

th, td {
  text-align: left;
  padding: .72rem .75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tr:last-child td { border-bottom: 0; }
th {
  background: #f4f1ea;
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tbody tr:hover { background: #fbfaf6; }
td code {
  color: var(--clay-dark);
  white-space: pre-wrap;
  word-break: break-word;
}

.tabs {
  position: sticky;
  top: 73px;
  z-index: 40;
  display: flex;
  gap: .35rem;
  margin: 1rem 0 .75rem;
  padding: .45rem;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(196, 208, 198, .88);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.tab {
  flex: 1 1 9rem;
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
  border-radius: 6px;
  box-shadow: none;
}

.tab:hover {
  background: #f1eee6;
  color: #3b332a;
  box-shadow: none;
}

.tab.active {
  background: #5d554b;
  color: #fff;
  border-color: #5d554b;
  box-shadow: 0 8px 18px rgba(58, 51, 39, .16);
}

.tabpane { display: none; }
.tabpane.active { display: block; }

#pyramidContainer,
#tab-pyramid {
  min-width: 0;
}

.pyramid-status {
  max-width: 880px;
  margin: .4rem auto 1.1rem;
  padding: .85rem 1rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.pyramid-status strong { color: #3b332a; }

.pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .85rem;
  padding: 1rem .25rem 1.5rem;
  overflow-x: auto;
  overflow-y: visible;
}

.pyramid-row {
  display: flex;
  justify-content: center;
  gap: .44rem;
}

.pyramid-cell {
  position: relative;
  width: clamp(104px, 9vw, 138px);
  min-height: 86px;
  padding: .85rem .46rem .55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .18rem;
  background:
    linear-gradient(180deg, #fff, #fbfaf6);
  border: 1px solid var(--line-strong);
  border-bottom: 3px solid #cbd7ca;
  border-radius: var(--radius);
  color: var(--ink);
  text-align: center;
  font-size: .8rem;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(27, 48, 37, .08);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}

.pyramid-cell:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(27, 48, 37, .14);
}

.pyramid-cell .cell-pos {
  position: absolute;
  top: -.55rem;
  left: 50%;
  transform: translateX(-50%);
  min-width: 2rem;
  padding: .13rem .42rem;
  border-radius: 999px;
  background: #4d514d;
  color: #fff;
  font-size: .69rem;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
}

.pyramid-cell .cell-first {
  max-width: 100%;
  margin-top: .2rem;
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 620;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.pyramid-cell .cell-last {
  max-width: 100%;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 620;
  line-height: 1.12;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.pyramid-cell.me {
  color: #fff;
  background: linear-gradient(145deg, #70685e, #4e4841);
  border-color: rgba(255, 255, 255, .16);
  border-bottom-color: var(--gold);
  box-shadow: 0 16px 34px rgba(58, 51, 39, .22);
}

.pyramid-cell.me .cell-pos {
  background: var(--gold);
  color: #30220a;
}

.pyramid-cell.me .cell-first,
.pyramid-cell.me .cell-last { color: #fff; }

.pyramid-cell.target {
  background: linear-gradient(180deg, #fffdf2, #fff8dc);
  border-color: var(--gold);
  border-bottom-color: var(--gold);
}

.pyramid-cell.target::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(216, 166, 45, .7);
  border-radius: 5px;
  pointer-events: none;
}

.pyramid-cell.target:hover {
  z-index: 5;
  background: linear-gradient(180deg, #fffaf0, #ffefc3);
  border-color: #c48327;
  border-bottom-color: var(--clay);
  transform: translateY(-5px) scale(1.025);
  box-shadow: 0 18px 38px rgba(113, 74, 30, .22);
}

.pyramid-cell.target:hover::after {
  content: "Fordern";
  position: absolute;
  right: .45rem;
  bottom: .42rem;
  padding: .13rem .45rem;
  border-radius: 999px;
  background: var(--clay);
  color: #fff;
  font-size: .66rem;
  font-weight: 620;
  line-height: 1.2;
  box-shadow: 0 4px 10px rgba(180, 81, 45, .28);
}

.pyramid-cell.inactive {
  opacity: .52;
  filter: grayscale(.35);
}

.entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
  margin-bottom: .72rem;
  padding: .9rem 1rem;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-left: 4px solid var(--clay);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.entry strong { color: #3b332a; }
.entry .meta {
  margin-top: .16rem;
  color: var(--ink-soft);
  font-size: .85rem;
}

.entry .actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: .16rem .55rem;
  border-radius: 999px;
  background: #edf1ee;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.badge.pending { background: #fff2cb; color: #7b5409; }
.badge.accepted { background: #e3f3fa; color: #15536e; }
.badge.completed { background: #dff5e7; color: #0f6338; }
.badge.declined,
.badge.cancelled { background: #fbe6e3; color: #812315; }
.badge.forfeit { background: #f4e8dc; color: #7d3b1d; }

.set-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: .48rem 0;
  flex-wrap: wrap;
}

.set-row .set-label {
  min-width: 3.7rem;
  color: var(--club-dark);
  font-weight: 650;
}

.set-row .set-inputs,
.set-row .tb-wrap {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.set-row .colon {
  color: var(--ink-soft);
  font-weight: 650;
}

.set-row input.score-input {
  display: inline-block;
  width: 3.35rem;
  min-height: 2.35rem;
  margin: 0;
  padding: .38rem .25rem;
  text-align: center;
}

.set-row .tb-label {
  margin-left: .4rem;
  color: var(--ink-soft);
  font-size: .82rem;
  font-weight: 650;
}

.set-header {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin: .25rem 0 .5rem 4.45rem;
  color: var(--ink-soft);
  font-size: .75rem;
  font-weight: 650;
}

.set-header span {
  flex: 0 0 3.35rem;
  text-align: center;
}

.set-header span:nth-child(2) { flex: 0 0 .5rem; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(7, 22, 15, .55);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(520px, 100%);
  max-height: min(90vh, 780px);
  overflow: auto;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin: 0 0 .9rem;
  font-size: 1.15rem;
}

.modal-body p:first-child { margin-top: 0; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* Radio-Liste für Modale (z.B. Forderung auflösen) */
fieldset.award-options {
  border: 0;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
fieldset.award-options legend {
  padding: 0 0 .35rem;
  font-size: .9rem;
  color: var(--ink-soft);
  font-weight: 560;
}
.radio-row {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .65rem .8rem;
  margin: 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.radio-row:hover {
  border-color: var(--gold);
  background: #fff;
}
.radio-row input[type=radio] {
  margin: 0;
  margin-top: .2rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--clay);
  flex-shrink: 0;
}
.radio-row:has(input[type=radio]:checked) {
  border-color: var(--clay);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(180, 81, 45, .14);
}
.radio-row .radio-title {
  color: var(--ink);
  font-weight: 620;
  font-size: .95rem;
  line-height: 1.25;
}
.radio-row .radio-sub {
  color: var(--ink-soft);
  font-size: .82rem;
  margin-top: .15rem;
  line-height: 1.3;
}

.flying-ball {
  position: absolute;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 100;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, .35));
  will-change: transform, opacity;
}

.flying-ball.fly {
  animation: ball-arc 700ms cubic-bezier(.35, .05, .65, 1) forwards;
}

@keyframes ball-arc {
  0%   { transform: translate(0, 0) scale(.7) rotate(0); opacity: 0; }
  8%   { opacity: 1; transform: translate(calc(var(--tx) * .08), calc(var(--ty) * .08 - 12px)) scale(1) rotate(80deg); }
  50%  { transform: translate(calc(var(--tx) * .5),  calc(var(--ty) * .5  - 80px)) scale(1.25) rotate(400deg); opacity: 1; }
  90%  { transform: translate(calc(var(--tx) * .95), calc(var(--ty) * .95 - 10px)) scale(1.1) rotate(680deg); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(.9) rotate(720deg); opacity: 0; }
}

.pyramid-cell.react {
  animation: cell-react 1.1s ease-out forwards;
}

@keyframes cell-react {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(180, 81, 45, 0); }
  12%  { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(180, 81, 45, .78); }
  32%  { transform: scale(1.06); box-shadow: 0 0 0 9px rgba(180, 81, 45, 0); }
  48%  { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(216, 166, 45, .72); }
  70%  { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(216, 166, 45, 0); }
  100% { transform: scale(1);    box-shadow: var(--shadow-sm); }
}

.pyramid-cell.open-challenge {
  background: linear-gradient(180deg, #fff7f3, #ffede7);
  border-color: var(--clay);
  border-bottom-color: var(--clay);
  animation: open-pulse 1.8s ease-in-out infinite;
}

@keyframes open-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 81, 45, .45); }
  50%      { box-shadow: 0 0 0 9px rgba(180, 81, 45, 0); }
}

.pyramid-cell.open-challenge::after {
  content: "";
  position: absolute;
  top: -7px;
  right: -7px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffcf, #ddf95f 52%, #718b10);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
}

.pyramid-cell.busy {
  background: #eef1ee;
  color: var(--ink-soft);
  border-color: #d3dbd4;
  cursor: not-allowed;
  box-shadow: none;
}

.pyramid-cell.busy .cell-pos,
.pyramid-cell.busy .cell-first,
.pyramid-cell.busy .cell-last { opacity: .58; }

.pyramid-cell.busy::after {
  content: "busy";
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 2.45rem;
  height: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 .36rem;
  border-radius: 999px;
  background: #6d7770;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  font-size: .62rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pyramid-cell.busy:hover {
  transform: none;
  box-shadow: none;
}

.pyramid-cell.incoming-challenge {
  background: linear-gradient(180deg, #f3fbff, #e8f5fb);
  border-color: var(--sky);
  border-bottom-color: var(--sky);
  animation: incoming-pulse 1.8s ease-in-out infinite;
}

@keyframes incoming-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 109, 143, .45); }
  50%      { box-shadow: 0 0 0 9px rgba(37, 109, 143, 0); }
}

.pyramid-cell.incoming-challenge::after {
  content: "!";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--sky);
  color: #fff;
  border: 2px solid #fff;
  font-size: .78rem;
  font-weight: 620;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  z-index: 2000;
  max-width: min(520px, calc(100vw - 2rem));
  padding: .72rem 1rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  font-size: .92rem;
  font-weight: 620;
}

.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* Admin: dichter, weniger verspielt, mehr Werkzeugcharakter */
.admin-page body,
body.admin-page {
  background:
    linear-gradient(90deg, rgba(58, 58, 52, .024) 1px, transparent 1px),
    linear-gradient(0deg, rgba(58, 58, 52, .02) 1px, transparent 1px),
    #f7f6f2;
  background-size: 36px 36px, 36px 36px, auto;
}

body.admin-page header {
  min-height: 58px;
  padding-block: .72rem;
}

body.admin-page main {
  width: min(1500px, 100%);
  padding-top: .9rem;
}

/* Admin: Sidebar-Layout */
.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(196, 208, 198, .9);
  border-radius: var(--radius);
  padding: .55rem;
  box-shadow: var(--shadow-sm);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.admin-nav-item {
  display: block;
  padding: .55rem .8rem;
  color: var(--ink-soft);
  font-size: .88rem;
  font-weight: 560;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.admin-nav-item:hover {
  background: #f4f1ea;
  color: var(--ink);
}

.admin-nav-item.active {
  background: var(--clay);
  color: #fff;
  border-color: var(--clay-dark);
  box-shadow: 0 2px 6px rgba(180, 81, 45, .22);
}

.admin-content {
  min-width: 0;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

@media (max-width: 800px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    position: static;
    padding: .35rem;
  }
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .25rem;
  }
  .admin-nav-item {
    flex: 1 1 auto;
    text-align: center;
    padding: .45rem .55rem;
    font-size: .82rem;
  }
}

body.admin-page h2 {
  margin-bottom: .55rem;
  font-size: 1rem;
}

body.admin-page .card {
  margin: .7rem 0;
  padding: .8rem .9rem;
  box-shadow: none;
  background: rgba(255, 255, 255, .94);
}

body.admin-page .hint {
  margin: .25rem 0 .55rem;
  font-size: .82rem;
}

body.admin-page button {
  min-height: 2rem;
  padding: .34rem .62rem;
  border-radius: 6px;
  font-size: .8rem;
  box-shadow: none;
}

body.admin-page button:hover {
  box-shadow: none;
}

body.admin-page table {
  margin-top: .55rem;
  font-size: .82rem;
}

body.admin-page th,
body.admin-page td {
  padding: .42rem .52rem;
}

body.admin-page th {
  font-size: .68rem;
}

body.admin-page .badge {
  min-height: 1.25rem;
  padding: .08rem .42rem;
  font-size: .64rem;
}

.row-actions {
  width: 1%;        /* nimmt nur den Platz den der Inhalt braucht */
  white-space: nowrap;
}

.row-actions-wrap {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: nowrap;
}

button.row-test-as {
  min-height: 2rem;
  padding: .28rem .8rem;
  font-size: .8rem;
  font-weight: 620;
  border-radius: 6px;
  background: var(--gold);
  color: #2c2200;
  box-shadow: 0 4px 10px rgba(216, 166, 45, .25);
  white-space: nowrap;
}
button.row-test-as:hover {
  background: #c9991f;
  box-shadow: 0 6px 14px rgba(216, 166, 45, .35);
}

select.row-action-select {
  width: 7.5rem;       /* feste, kompakte Breite */
  min-width: 7.5rem;
  min-height: 2rem;
  margin: 0;
  padding: .28rem 1.6rem .28rem .55rem;
  border-radius: 6px;
  background-color: #fff;
  color: var(--ink);
  font-size: .8rem;
  font-weight: 560;
  flex: 0 0 auto;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: .55rem;
  flex-wrap: wrap;
  margin: .35rem 0 .2rem;
}

.inline-control {
  display: inline-flex;
  flex-direction: column;
  gap: .18rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: .72rem;
}

.inline-control select {
  min-height: 2rem;
  min-width: 9rem;
  margin: 0;
  padding: .28rem 1.75rem .28rem .56rem;
  font-size: .8rem;
}

.audit-list {
  margin-top: .55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.audit-item {
  border-bottom: 1px solid var(--line);
}

.audit-item:last-child {
  border-bottom: 0;
}

.audit-item summary {
  min-height: 2.15rem;
  display: grid;
  grid-template-columns: 8.5rem minmax(12rem, 1fr) 7rem;
  align-items: center;
  gap: .7rem;
  padding: .34rem .6rem;
  cursor: pointer;
  list-style: none;
  font-size: .78rem;
}

.audit-item summary::-webkit-details-marker {
  display: none;
}

.audit-item summary::before {
  content: "+";
  width: 1rem;
  color: var(--ink-soft);
  font-weight: 620;
}

.audit-item[open] summary::before {
  content: "-";
}

.audit-item summary {
  grid-template-columns: 1rem 8.5rem minmax(12rem, 1fr) 7rem;
}

.audit-item summary:hover {
  background: #fbfaf6;
}

.audit-time,
.audit-entity {
  color: var(--ink-soft);
  white-space: nowrap;
}

.audit-action {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-detail {
  display: grid;
  gap: .35rem;
  padding: .5rem .75rem .7rem 10.8rem;
  background: #fbfaf6;
  border-top: 1px solid var(--line);
  font-size: .78rem;
}

.audit-detail div {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: .6rem;
}

.audit-detail span {
  color: var(--ink-soft);
}

.audit-detail code {
  white-space: pre-wrap;
  word-break: break-word;
  color: #514538;
}

@media (max-width: 900px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .tabs { top: 70px; }

  .audit-item summary {
    grid-template-columns: 1rem 7rem minmax(9rem, 1fr);
  }

  .audit-entity {
    display: none;
  }

  .audit-detail {
    padding-left: .75rem;
  }
}

@media (max-width: 640px) {
  body {
    background-size: 34px 34px, 34px 34px, auto, auto;
  }

  header {
    position: static;
    min-height: 0;
    padding: .9rem .85rem;
  }

  header nav {
    width: 100%;
    min-width: 0;
    gap: .28rem;
  }

  header nav a {
    flex: 1 1 calc(50% - .28rem);
    min-height: 2.2rem;
    padding: .42rem .55rem;
    font-size: .84rem;
    white-space: nowrap;
  }

  main { padding: .8rem .65rem 3.5rem; }

  .tabs {
    position: static;
    padding: .35rem;
  }

  .tab {
    flex-basis: calc(50% - .35rem);
    padding-inline: .5rem;
    font-size: .86rem;
  }

  .pyramid {
    align-items: flex-start;
    padding-left: .2rem;
    padding-right: .2rem;
  }

  .pyramid-row {
    min-width: max-content;
  }

  .pyramid-cell {
    width: 104px;
    min-height: 78px;
    padding: .75rem .32rem .42rem;
    font-size: .72rem;
  }

  .pyramid-cell .cell-first { font-size: .72rem; }
  .pyramid-cell .cell-last { font-size: .78rem; }

  .entry {
    align-items: stretch;
  }

  .entry .actions,
  .entry .actions button {
    width: 100%;
  }

  .modal {
    padding: 1rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}
