/* Stadion-Look: immer dunkel, Rasen mit Flutlicht */
:root {
  --bg: #0b2416;
  --surface: rgba(13, 30, 21, .86);
  --surface-solid: #11281b;
  --ink: #eef5f0;
  --muted: #9fb5a8;
  --line: rgba(255, 255, 255, .12);
  --pitch: rgba(6, 18, 12, .72);
  --accent: #c8f031;
  --accent-ink: #0b1a10;
  --train: #f2b544;
  --danger: #ff7a6b;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
img { max-width: 100%; display: block; }

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 16px; padding-top: max(.7rem, env(safe-area-inset-top));
  background: var(--pitch); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 800; display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.crest {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: #fff; color: var(--pitch); font-weight: 900;
}
.top nav { display: flex; gap: .25rem; overflow-x: auto; }
.top nav a { color: #cfe3d7; text-decoration: none; padding: .35rem .6rem; border-radius: 8px; font-size: .95rem; white-space: nowrap; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.12); color: #fff; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 6rem; }
.foot { text-align: center; color: var(--muted); font-size: .9rem; padding: 0 16px 6rem; }

.flash { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); padding: .6rem .9rem; border-radius: 10px; margin: 0 0 .75rem; }
.muted { color: var(--muted); }

/* Buttons & Formulare */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: .65rem 1.1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: .4rem .7rem; min-height: 36px; font-size: .9rem; }
.btn.big { width: 100%; padding: .9rem; font-size: 1.05rem; }
.btn:disabled { opacity: .6; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.linkbtn.red { color: var(--danger); }
form.inline { display: inline; }

input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); width: 100%;
  padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 600; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; color: var(--ink); }
label.check input { width: auto; min-height: 0; }
label.check.small { font-size: .85rem; margin-top: .4rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.card { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); border: 1px solid var(--line); margin-top: 1rem; }
.card.narrow { max-width: 420px; margin: 2rem auto; }
.login { text-align: center; }
.login form { text-align: left; }
.login-mark { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 14px; background: var(--pitch); color: #fff; display: grid; place-items: center; font-size: 1.8rem; font-weight: 900; }

/* Liste */
.listhead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.count { color: var(--muted); font-weight: 500; font-size: 1rem; margin-left: .3rem; }
.filters { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.1rem; }
.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: 2px; align-items: center; }
.chips select { width: auto; flex: 0 0 auto; min-height: 38px; padding: .4rem 2rem .4rem .7rem; font-size: 14px; border-radius: 999px; }
.chips .reset { white-space: nowrap; font-size: .9rem; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.jersey { display: block; text-decoration: none; color: inherit; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); height: 100%; }
.photo { position: relative; aspect-ratio: 3 / 4; background: color-mix(in srgb, var(--pitch) 8%, var(--surface)); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.nophoto { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; font-weight: 900; color: color-mix(in srgb, var(--ink) 18%, transparent); }
.nophoto.big { position: static; aspect-ratio: 3 / 4; font-size: 6rem; border-radius: var(--radius); background: color-mix(in srgb, var(--pitch) 8%, var(--surface)); }
.meta { padding: .6rem .75rem .75rem; display: flex; flex-direction: column; gap: .15rem; }
.meta strong { font-size: .98rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta span { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { display: inline-block; min-width: 1.6em; text-align: center; padding: 0 .3em; margin-right: .25rem; border-radius: 5px; background: var(--ink); color: var(--bg); font-size: .8rem; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .2rem .5rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.photo .tag { position: absolute; top: 8px; left: 8px; }
.tag.training { background: var(--train); color: #1a1205; }
.tag.plain { background: transparent; color: var(--muted); border: 1px solid var(--line); }

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

.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 2rem; font-weight: 300; text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
@media (min-width: 720px) { .fab { display: none; } }
@media (max-width: 719px) { .hide-sm { display: none; } }

/* Formular Trikot */
.editform { display: flex; flex-direction: column; gap: 1.1rem; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop {
  position: relative; aspect-ratio: 3 / 4; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; overflow: hidden; color: var(--ink);
  display: grid; place-items: center; text-align: center;
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop .hint { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; font-weight: 700; pointer-events: none; padding: .5rem; }
.drop .hint small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.drop.has { border-style: solid; }
.drop.has .hint { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; padding: 1.5rem .5rem .6rem; }
.drop.has .hint small { color: #e5e5e5; }
.drop.has .cam { display: none; }
.cam { width: 34px; height: 28px; border-radius: 7px; border: 2.5px solid currentColor; position: relative; }
.cam::after { content: ""; position: absolute; width: 11px; height: 11px; border: 2.5px solid currentColor; border-radius: 50%; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.drop.busy::after { content: "Wird verkleinert …"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-weight: 600; }

.seg { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg legend { font-size: .9rem; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: .3rem; }
.seg .opts { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg label { display: block; color: var(--ink); font-size: .95rem; position: relative; }
.seg label + label { border-left: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.seg span { display: block; text-align: center; padding: .7rem .4rem; cursor: pointer; font-weight: 600; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -4px; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 12px; }
.fields .full { grid-column: 1 / -1; }
.fields .num-field { grid-column: 1; }
.fields .grow { grid-column: 2; }
@media (min-width: 640px) {
  .fields { grid-template-columns: 110px 1fr 1fr; }
  .fields .num-field { grid-column: 1; }
  .fields .grow { grid-column: 2 / -1; }
}
.actions { position: sticky; bottom: 0; padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.danger { text-align: center; margin-top: 1rem; }

/* Detail */
.back { margin: 0 0 .75rem; }
.back a { text-decoration: none; }
.detail { display: grid; gap: 1.5rem; }
@media (min-width: 820px) { .detail { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius); background: var(--surface); }
.gallery figcaption { font-size: .82rem; color: var(--muted); text-align: center; margin-top: .3rem; }
.info .title { display: flex; gap: .9rem; align-items: center; }
.info h1 { margin: 0; }
.bignum { font-size: 3rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.player { margin: .1rem 0 0; color: var(--muted); font-size: 1.1rem; }
.tags { display: flex; gap: .4rem; margin: .9rem 0; }
.info dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.info dt { color: var(--muted); }
.info dd { margin: 0; font-weight: 600; }
.notes { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; white-space: normal; }

/* Benutzer */
.userlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.userlist li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.userlist li.inactive { opacity: .6; }
.userlist .who { display: flex; flex-direction: column; }
.userlist small { color: var(--muted); }
.userlist details { flex: 1 1 100%; }
.userlist summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.useractions { display: flex; flex-direction: column; gap: .6rem; margin-top: .6rem; }
.useractions form { display: flex; flex-wrap: wrap; gap: .5rem; }
.useractions .row input { flex: 1 1 160px; min-height: 36px; }
@media (min-width: 640px) { .userlist details { flex: 0 1 auto; } }

/* Feinschliff */
.drop img[hidden] { display: none; }
body:has(#jerseyform) .fab { display: none; }
@media (max-width: 480px) {
  .brand .name { display: none; }
  .top nav a { padding: .35rem .5rem; }
}

/* Sportart */
.photo .tag.sport { left: auto; right: 8px; background: rgba(0,0,0,.55); color: #fff; max-width: calc(100% - 90px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { flex-wrap: wrap; }
.pills { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pills legend { font-size: .9rem; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: .3rem; width: 100%; }
.pills label { display: block; position: relative; }
.pills input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.pills span { display: block; padding: .55rem .95rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: .95rem; cursor: pointer; }
.pills input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pills input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Hintergrund: Rasen, Linien, Flutlicht ---------- */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; }
body::before {
  background:
    url("pitch.svg") center / cover no-repeat,
    repeating-linear-gradient(180deg, #0f3420 0 9vh, #0c2c1a 9vh 18vh),
    #0c2c1a;
}
body::after {
  background:
    radial-gradient(ellipse 55% 45% at 8% -8%, rgba(255, 252, 220, .26), transparent 70%),
    radial-gradient(ellipse 55% 45% at 92% -8%, rgba(255, 252, 220, .26), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(200, 240, 49, .07), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, .55));
}
@media (prefers-reduced-motion: no-preference) {
  body::after { animation: floodlight 9s ease-in-out infinite alternate; }
  @keyframes floodlight { from { opacity: .85; } to { opacity: 1; } }
}

/* Glas-Optik für Flächen über dem Rasen */
.top { background: var(--pitch); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.crest { background: var(--accent); color: var(--accent-ink); }
.top nav a.on { background: rgba(200, 240, 49, .16); color: var(--accent); }
.card, .jersey, .notes, .userlist li, .drop, .seg .opts, .pills span, .flash, .error {
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.jersey { transition: transform .15s ease, box-shadow .15s ease; }
.jersey:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
.photo, .nophoto.big { background: rgba(255, 255, 255, .05); }
.nophoto { color: rgba(255, 255, 255, .16); }
.num { background: var(--accent); color: var(--accent-ink); }
.bignum { color: var(--accent); text-shadow: 0 0 24px rgba(200, 240, 49, .35); }
select option, select optgroup { background: var(--surface-solid); color: var(--ink); }
input::placeholder, textarea::placeholder { color: rgba(238, 245, 240, .45); }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .7; }
.actions { background: linear-gradient(transparent, rgba(8, 24, 15, .9) 35%); }
.fab { box-shadow: 0 6px 22px rgba(200, 240, 49, .35); }
.foot { color: var(--muted); }
h1 { text-shadow: 0 2px 12px rgba(0, 0, 0, .4); }
@media (orientation: landscape) and (min-width: 720px) {
  body::before {
    background:
      url("pitch-landscape.svg") center / cover no-repeat,
      repeating-linear-gradient(90deg, #0f3420 0 8vw, #0c2c1a 8vw 16vw),
      #0c2c1a;
  }
}
.login-mark { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 30px rgba(200, 240, 49, .3); }

/* Detail: alle Angaben */
.info dl.facts { grid-template-columns: max-content 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; gap: .55rem 1.2rem; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.info dl.facts dt { font-size: .92rem; }
.info dl.facts dd { overflow-wrap: anywhere; }
.info dl.facts .notes-dd { font-weight: 500; }
@media (max-width: 380px) { .info dl.facts { grid-template-columns: 1fr; gap: .1rem; } .info dl.facts dd { margin-bottom: .45rem; } }
.info .title { margin-bottom: 1rem; }
