/* =========================================================
   Minecraft Event-Anmeldung – Design
   ========================================================= */
@font-face {
  font-family: "PressStart";
  src: url("fonts/pressstart2p.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #0b0f14;
  --bg-2: #111821;
  --card: rgba(22, 30, 40, .72);
  --card-solid: #161e28;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #e8edf2;
  --muted: #8b98a7;
  --grass: #5bbf3a;
  --grass-2: #3f9a26;
  --grass-glow: rgba(91, 191, 58, .35);
  --gold: #f2c14e;
  --diamond: #4fd1d9;
  --red: #ef5350;
  --warn: #f0a63a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --pixel: "PressStart", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 191, 58, .14), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(79, 209, 217, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
}
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}
a { color: var(--diamond); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1rem; }
code, .code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9em; }
pre.code, textarea.code {
  display: block; width: 100%; padding: .8rem 1rem; margin: 0 0 1rem;
  background: #0a0e13; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: #cfe8c6; white-space: pre-wrap; word-break: break-all;
}
.muted { color: var(--muted); }
small { font-size: .82em; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 60px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 15, 20, .75);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-block {
  width: 26px; height: 26px; flex: none; border-radius: 4px;
  background:
    linear-gradient(to bottom, var(--grass) 0 38%, #7a5230 38% 100%);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.25), 0 0 18px var(--grass-glow);
  image-rendering: pixelated;
}
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.05); text-decoration: none; }
.nav-admin { color: var(--gold) !important; }
.offline-bar { background: var(--warn); color: #1a1205; text-align: center; padding: 6px 16px; font-weight: 600; font-size: .9rem; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 28px 0 36px; }
.pixel { font-family: var(--pixel); font-weight: 400; letter-spacing: .02em; line-height: 1.4;
  font-size: clamp(1.15rem, 4.2vw, 2rem);
  text-shadow: 3px 3px 0 #1e4d12, 0 0 30px var(--grass-glow);
  color: #eaffdf; }
.hero-sub { color: var(--muted); font-size: 1.1rem; max-width: 620px; margin: 10px auto 0; }

/* ---------- Karten ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.big-icon { font-size: 2.6rem; margin-bottom: 8px; }
.crumbs { margin: 0 0 14px; font-size: .95rem; }

/* ---------- Event-Übersicht ---------- */
.event-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.event-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  position: relative; overflow: hidden;
}
.event-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--grass), var(--diamond));
  opacity: .9;
}
.event-card.state-closed::before { background: #3a4552; }
.event-card.state-soon::before { background: linear-gradient(90deg, var(--gold), var(--warn)); }
.event-card:hover { transform: translateY(-3px); border-color: var(--line-strong); text-decoration: none; box-shadow: 0 16px 40px rgba(0,0,0,.45); }
.event-card h2 { margin: 6px 0 0; font-size: 1.3rem; }
.event-card p { margin: 0; }
.event-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.event-date { color: var(--muted); font-size: .88rem; font-weight: 600; }
.event-stats { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: .93rem; color: var(--muted); }
.event-stats strong { color: var(--text); }
.bar { height: 6px; background: rgba(255,255,255,.07); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--grass), var(--diamond)); border-radius: 99px; }
.heads-preview { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; min-height: 28px; }

.countdown { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  background: rgba(255,255,255,.07); color: var(--muted); border: 1px solid var(--line);
}
.badge-open { background: rgba(91,191,58,.15); color: #8be36a; border-color: rgba(91,191,58,.35); }
.badge-open::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #8be36a; box-shadow: 0 0 8px #8be36a; animation: pulse 1.8s infinite; }
.badge-soon { background: rgba(242,193,78,.13); color: var(--gold); border-color: rgba(242,193,78,.35); }
.badge-full { background: rgba(239,83,80,.13); color: #ff8a80; border-color: rgba(239,83,80,.35); }
.badge-closed { background: rgba(255,255,255,.06); color: #aab4bf; }
.badge-st-open { background: rgba(91,191,58,.15); color: #8be36a; }
.badge-st-draft { background: rgba(242,193,78,.13); color: var(--gold); }
.badge-st-archived { opacity: .6; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Event-Detail ---------- */
.event-hero { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: start; margin-bottom: 26px; }
.event-hero h1 { margin-top: 10px; }
.lead { color: #c3ccd6; font-size: 1.05rem; max-width: 680px; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 10px; min-width: 320px; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.facts dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.action-card { border-color: rgba(91,191,58,.25); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.split > div + div { border-left: 1px solid var(--line); padding-left: 32px; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.section-head h1, .section-head h2, .section-head h3 { margin: 0; }
.empty { padding: 24px 0; }

/* ---------- Teams & Spieler ---------- */
.team-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 24px; }
.team-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.team-card.is-locked { border-style: dashed; opacity: .85; }
.team-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.team-head h3 { margin: 0; overflow-wrap: anywhere; }
.team-count { color: var(--muted); font-size: .85rem; font-weight: 700; background: rgba(255,255,255,.06); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.player {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.035);
}
.player.is-captain { background: linear-gradient(90deg, rgba(242,193,78,.14), rgba(242,193,78,.02)); box-shadow: inset 0 0 0 1px rgba(242,193,78,.25); }
.pname { font-weight: 600; overflow-wrap: anywhere; flex: 1; min-width: 0; }
.crown { font-size: 1rem; }
.tag { font-size: .7rem; font-weight: 800; padding: 1px 6px; border-radius: 5px; }
.tag-bedrock { background: rgba(79,209,217,.15); color: var(--diamond); }
.tag-warn { background: rgba(240,166,58,.18); color: var(--warn); }
.solo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }

.head {
  width: 32px; height: 32px; flex: none; border-radius: 5px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #2a323d; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.heads-preview .head { width: 28px; height: 28px; }
.head-lg { width: 40px; height: 40px; }

.team-meta { font-size: .8rem; margin-top: 10px; }
.team-admin { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.team-admin form { margin: 0; }

/* ---------- Formulare ---------- */
input[type=text], input[type=password], input[type=number], input[type=url], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 14px; font: inherit; color: var(--text);
  background: rgba(5, 8, 12, .6); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #5f6b78; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--grass); box-shadow: 0 0 0 3px var(--grass-glow); }
input[type=datetime-local] { color-scheme: dark; }
select { appearance: auto; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled { opacity: .65; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-weight: 600; font-size: .93rem; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--grass); flex: none; }
.stack { display: flex; flex-direction: column; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 200px; }
.code-input { text-transform: uppercase; letter-spacing: .15em; font-family: ui-monospace, Consolas, monospace; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
.span-2 { grid-column: 1 / -1; }
.form-card { max-width: 860px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.mc-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.mc-row { display: flex; align-items: center; gap: 12px; }
.mc-input-wrap { position: relative; flex: 1; min-width: 0; }
.mc-input-wrap input { padding-right: 150px; }
.mc-status {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: .8rem; font-weight: 700; pointer-events: none; white-space: nowrap;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.mc-status.ok { color: #8be36a; }
.mc-status.bad { color: #ff8a80; }
.mc-status.warn { color: var(--warn); }
.mc-status.info { color: var(--diamond); }
.mc-status.load { color: var(--muted); }
.mc-row.is-ok input { border-color: rgba(91,191,58,.55); }
.mc-row.is-bad input { border-color: rgba(239,83,80,.6); }
.cap { display: flex; align-items: center; cursor: pointer; flex: none; }
.cap input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cap span {
  width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.15rem;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: rgba(5,8,12,.6);
  filter: grayscale(1); opacity: .45; transition: all .15s;
}
.cap:hover span { opacity: .8; }
.cap input:checked + span { filter: none; opacity: 1; border-color: var(--gold); background: rgba(242,193,78,.14); box-shadow: 0 0 0 3px rgba(242,193,78,.18); }
.cap input:focus-visible + span { box-shadow: 0 0 0 3px var(--grass-glow); }

.code-card { border-color: rgba(242,193,78,.45); background: linear-gradient(135deg, rgba(242,193,78,.10), var(--card)); }
.code-display { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0 14px; }
.code-display span { font-family: var(--pixel); font-size: clamp(1.1rem, 5vw, 1.6rem); color: var(--gold); letter-spacing: .1em; }

.danger-zone { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; font: inherit; font-weight: 700; color: #0b1a06; cursor: pointer;
  background: linear-gradient(180deg, #6fd14b, var(--grass-2));
  border: 1px solid #2f7a1b; border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 0 #24601a, 0 6px 16px rgba(0,0,0,.3);
  transition: transform .08s, filter .15s, box-shadow .08s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 1px 0 #24601a; }
.btn-ghost { background: rgba(255,255,255,.05); color: var(--text); border-color: var(--line-strong); box-shadow: none; }
.btn-ghost:active { box-shadow: none; }
.btn-danger { background: rgba(239,83,80,.12); color: #ff8a80; border-color: rgba(239,83,80,.4); box-shadow: none; }
.btn-danger:active { box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }

/* ---------- Hinweise ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; border: 1px solid; font-weight: 500; }
.alert-success { background: rgba(91,191,58,.12); border-color: rgba(91,191,58,.4); color: #b6f09c; }
.alert-error { background: rgba(239,83,80,.12); border-color: rgba(239,83,80,.45); color: #ffb4ab; }
.alert-info { background: rgba(79,209,217,.10); border-color: rgba(79,209,217,.4); color: #a8eef2; }

/* ---------- Admin ---------- */
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-head h1 { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--grass); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: rgba(255,255,255,.02); }
.table tr:last-child td { border-bottom: 0; }
.table-compact td { padding: 7px 14px; }
.card .table-wrap { background: transparent; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.checklist { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.checklist li { padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(255,255,255,.04); font-weight: 600; }
.checklist .ok { color: #8be36a; }
.checklist .bad { color: #ff8a80; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 18px 0; font-size: .82rem; color: #5f6b78; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 14px; }
.footer a { color: var(--muted); }

/* ---------- Mobil ---------- */
@media (max-width: 820px) {
  .event-hero { grid-template-columns: 1fr; }
  .facts { min-width: 0; }
  .split { grid-template-columns: 1fr; gap: 22px; }
  .split > div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 22px; }
  .grid-form { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .card { padding: 18px; }
  .mc-row { gap: 8px; }
  .head-lg { width: 34px; height: 34px; }
  .mc-input-wrap input { padding-right: 14px; }
  .mc-status { position: static; transform: none; display: block; margin-top: 4px; max-width: none; }
  .cap span { width: 40px; height: 40px; }
  .nav a { padding: 8px; }
  .event-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.mt { margin: 12px 0 0; }
.footer-note strong { color: var(--muted); }

/* ---------- Admin: Spieler-Aktionen ---------- */
.p-actions { display: flex; gap: 4px; margin-left: auto; }
.p-actions form { margin: 0; }
.icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center; padding: 0;
  font: inherit; font-size: .85rem; line-height: 1; cursor: pointer; color: var(--muted);
  background: rgba(255,255,255,.05); border: 1px solid var(--line-strong); border-radius: 7px;
  transition: all .15s;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.1); }
.icon-btn-danger:hover { color: #ff8a80; border-color: rgba(239,83,80,.5); background: rgba(239,83,80,.12); }
.p-actions .icon-btn[value=player_captain] { filter: grayscale(1); opacity: .6; }
.p-actions .icon-btn[value=player_captain]:hover { filter: none; opacity: 1; }
.row-clear { width: 36px; height: 36px; flex: none; }
fieldset:disabled .row-clear { display: none; }
