:root {
  --bg: #EFEDE6;
  --bg-2: #E4E1D7;
  --surface: #EFEDE6;
  --surface-2: #E4E1D7;
  --ink: #111110;
  --on-blue: #111110;
  --text-2: #3A3A36;
  --field: #FFFFFF;
  --line: rgba(17, 17, 16, 0.16);
  --line-strong: rgba(17, 17, 16, 0.42);
  --text: #111110;
  --muted: #5A5A55;
  --red: #C8300F;
  --red-soft: rgba(200, 48, 15, 0.1);
  --blue: #1F86F0;
  --blue-soft: rgba(31, 134, 240, 0.16);
  --gold: #0B62C4;
  --gold-soft: rgba(31, 134, 240, 0.14);
  --green: #1F86F0;
  --green-rgb: 31, 134, 240;
  --radius: 0px;
  --radius-sm: 0px;
  --display: "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, sans-serif;
  --pixel: "Geist Mono", ui-monospace, monospace;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #111110;
  --bg-2: #1E1E1C;
  --surface: #111110;
  --surface-2: #2A2A27;
  --ink: #EFEDE6;
  --text-2: #C9C6BC;
  --field: #1E1E1C;
  --line: rgba(239, 237, 230, 0.16);
  --line-strong: rgba(239, 237, 230, 0.42);
  --text: #EFEDE6;
  --muted: #A5A39B;
  --red: #FF6A4D;
  --red-soft: rgba(255, 106, 77, 0.14);
  --blue-soft: rgba(31, 134, 240, 0.24);
  --gold: #6CB4FF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 81, 72, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(62, 230, 154, 0.09), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
main, .topbar, .foot { position: relative; z-index: 1; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.pixel { font-family: var(--pixel); letter-spacing: 0.04em; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; margin: 0; font-size: 14px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  background: rgba(17, 17, 16, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { font: 800 22px/1 var(--display); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { color: var(--gold); }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tabs a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 7px 12px; border-radius: 999px;
}
.tabs a:hover { color: var(--text); background: var(--surface); }
.account { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Buttons */
.btn {
  border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 700; cursor: pointer;
  transition: transform .12s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 24px -8px rgba(255, 81, 72, .7); }
.btn-primary:hover { background: #ff6474; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.icon-btn {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.chip-user {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); font-weight: 600; font-size: 14px;
}
.badge-admin { font: 10px var(--pixel); color: var(--gold); background: var(--gold-soft); padding: 2px 6px; border-radius: 6px; }

/* Layout */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 80px; }
.eyebrow { color: var(--gold); font-size: 12px; margin: 0 0 10px; text-transform: uppercase; }
h1 {
  font: 800 clamp(60px, 9vw, 116px)/0.9 var(--display); margin: 0; letter-spacing: -0.05em;
  background: linear-gradient(180deg, #fff 30%, #ffd9dd 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-dot { color: var(--red); -webkit-text-fill-color: var(--red); }
.hero-sub { max-width: 560px; font-size: 18px; color: var(--text-2); margin: 22px 0 28px; }
.hero-sub strong { color: var(--text); }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; min-width: 130px;
}
.stat b { display: block; font: 700 26px/1.1 var(--display); }
.stat span { color: var(--muted); font-size: 13px; }
.stat.hot b { color: var(--gold); }

.block { padding-top: 48px; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
h2 { font: 700 clamp(26px, 4vw, 36px)/1.1 var(--display); margin: 0; letter-spacing: -0.02em; }
h3 { font: 700 20px/1.2 var(--display); margin: 0 0 6px; }
.card {
  background: linear-gradient(180deg, var(--surface), rgba(239, 237, 230, .7));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
.step + .step { margin-top: 16px; }
.step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.step-head p { margin: 0; color: var(--muted); font-size: 14px; }
.step-num { font: 11px var(--pixel); color: var(--gold); margin-right: 8px; }

.save-state { font-size: 13px; color: var(--muted); }
.save-state.ok { color: var(--green); }
.save-state.err { color: var(--red); }

/* Quests / XP */
.xp-bar { height: 12px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.xp-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: repeating-linear-gradient(90deg, var(--gold) 0 10px, #1F86F0 10px 12px);
  transition: width .5s cubic-bezier(.2, .9, .3, 1.2);
}
.xp-label { font: 12px var(--pixel); color: var(--gold); white-space: nowrap; }

/* Login CTA */
.cta { text-align: center; padding: 44px 20px; }
.cta p { color: var(--muted); max-width: 420px; margin: 8px auto 20px; }

/* Availability grid */
.grid-wrap { overflow-x: auto; }
.avail {
  --cols: 16;
  display: grid; grid-template-columns: 64px repeat(var(--cols), minmax(18px, 1fr));
  gap: 3px; user-select: none; -webkit-user-select: none; min-width: 420px;
}
.avail .corner { }
.avail .hh {
  font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 4px; cursor: pointer; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.avail .dh {
  font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; flex-direction: column; justify-content: center;
  line-height: 1.1; cursor: pointer; border-radius: 6px; padding-left: 2px;
}
.avail .dh small { color: var(--muted); font-weight: 500; font-size: 11px; }
.avail .dh.weekend { color: var(--gold); }
.avail.edit .hh:hover, .avail.edit .dh:hover { background: var(--surface-2); }
.avail.heat .hh, .avail.heat .dh { cursor: default; }
.cell {
  height: 32px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line);
  transition: background .08s;
}
.avail.edit .cell { touch-action: none; }
.avail.edit .cell { cursor: pointer; }
.avail.edit .cell.on { background: var(--green); border-color: transparent; box-shadow: 0 0 12px -2px rgba(var(--green-rgb), .6); }
.avail .cell.night { border-style: dashed; }
.avail.heat .cell { background: rgba(var(--green-rgb), var(--a, 0)); cursor: pointer; }
.avail.heat .cell.empty { background: var(--bg-2); }
.avail.heat .cell.mine { outline: 2px solid #111110; outline-offset: -2px; }
.avail.heat .cell.sel { outline: 2px solid var(--gold); outline-offset: -1px; }
.grid-help { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* Games */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.game {
  position: relative; border-radius: 12px; overflow: hidden; background: var(--bg-2);
  border: 2px solid transparent; cursor: pointer; text-align: left; padding: 0;
  transition: transform .12s ease, border-color .15s;
}
.game:hover { transform: translateY(-2px); }
.game .art { aspect-ratio: 3 / 4; width: 100%; display: block; object-fit: cover; filter: saturate(.75) brightness(.8); transition: filter .2s; }
.game.on { border-color: var(--green); }
.game.on .art { filter: none; }
.game .meta { padding: 8px 10px 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.game .title { font-weight: 600; font-size: 14px; line-height: 1.25; }
.game .by { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.game .check {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(17, 17, 16, .7); display: grid; place-items: center; font-size: 14px; color: transparent; border: 1px solid var(--line-strong);
}
.game.on .check { background: var(--green); color: #111110; border-color: transparent; }
.star {
  flex: none; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--muted); cursor: pointer; font: 12px var(--pixel);
  display: grid; place-items: center;
}
.star:hover { color: var(--gold); border-color: var(--gold); }
.star.in { background: var(--gold); color: #111110; border-color: transparent; }
.game .del { position: absolute; top: 6px; right: 6px; background: rgba(17, 17, 16, .8); }
.art-fallback {
  aspect-ratio: 3 / 4; display: grid; place-items: center; padding: 10px; text-align: center;
  font: 800 20px/1.05 var(--display); letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--h1, #3b2a6b), var(--h2, #12324a));
}
.suggest { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.suggest input { flex: 1 1 220px; }

input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* Top 5 */
.top5 { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.top5 li {
  display: grid; grid-template-columns: 34px 44px 1fr auto; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px 6px 6px;
}
.top5 li.filled { cursor: grab; }
.top5 li.filled:active { cursor: grabbing; }
.top5 li.empty { color: var(--muted); border-style: dashed; grid-template-columns: 34px 1fr; min-height: 50px; }
.top5 .rank { font: 16px var(--pixel); color: var(--gold); text-align: center; }
.top5 .thumb { width: 44px; aspect-ratio: 3 / 4; border-radius: 6px; object-fit: cover; display: block; }
.top5 .thumb.art-fallback { font-size: 8px; padding: 2px; }
.top5 .name { font-weight: 600; }
.top5 .handle { color: var(--muted); font-size: 18px; padding: 0 4px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { border-color: var(--gold) !important; }

/* Formate */
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.format {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 2px solid var(--line); border-radius: 12px; padding: 12px;
}
.format .emo { font-size: 24px; line-height: 1; }
.format b { display: block; font-size: 14px; }
.format span { font-size: 13px; color: var(--muted); }
.format.on { border-color: var(--red); background: var(--red-soft); }

/* Kalender */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 140px;
  display: flex; flex-direction: column; gap: 8px;
}
.day.today { border-color: var(--gold); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-head b { font: 700 18px var(--display); }
.day-head span { font-size: 12px; color: var(--muted); }
.day.weekend .day-head span { color: var(--gold); }
.day-empty { color: rgba(90, 90, 85, .5); font-size: 13px; margin: auto 0; text-align: center; }
.event {
  position: relative; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line-strong);
  padding: 8px 10px; font-size: 13px;
}
.event::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--red); }
.event > * { position: relative; }
.event .time { font: 11px var(--pixel); color: var(--gold); }
.event .ttl { font-weight: 700; line-height: 1.25; margin: 2px 0; }
.event .desc { color: var(--muted); font-size: 12px; }
.event .who { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.event .del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; }
.event-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.event-form .wide { grid-column: span 2; }
.event-form .full { grid-column: 1 / -1; }
.event-form .actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

/* Crew */
.crew-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.crew-grid > .full { grid-column: 1 / -1; }
.best { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.best li { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: var(--bg-2); border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); }
.best .when { font-weight: 700; }
.best .names { font-size: 12px; color: var(--muted); }
.best .count { font: 14px var(--pixel); color: var(--green); white-space: nowrap; }

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank-row { width: 100%; background: none; border: 0; padding: 4px; border-radius: 10px; cursor: pointer; text-align: left; display: grid; grid-template-columns: 22px 36px 1fr; gap: 10px; align-items: center; }
.ranking .pos { font: 13px var(--pixel); color: var(--muted); text-align: right; }
.ranking li:nth-child(-n+3) .pos { color: var(--gold); }
.ranking .thumb { width: 36px; aspect-ratio: 3 / 4; border-radius: 6px; object-fit: cover; display: block; }
.ranking .thumb.art-fallback { font-size: 7px; padding: 1px; }
.ranking .t { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.ranking .t small { color: var(--muted); font-weight: 500; white-space: nowrap; }
.game .game-edit-btn { position: absolute; top: 6px; right: 40px; background: rgba(17, 17, 16, .8); }
.edit-icon { width: 15px; height: 15px; fill: currentColor; }
.game-edit { display: grid; gap: 6px; padding: 8px; }
.game-edit input { width: 100%; box-sizing: border-box; }
.game-edit-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.logo-dash { display: inline-block; width: .15em; height: .1em; margin: 0 .05em 0 .06em; background: currentColor; vertical-align: .3em; }
.event-open { cursor: pointer; }
.event.event-open:hover { background: var(--surface-2); }
.event .event-edit { position: absolute; top: 4px; right: 30px; width: 24px; height: 24px; }
.jump-track .rail-title { display: block; }
.suggs { display: grid; gap: 8px; }
.sugg { position: relative; overflow: hidden; padding: 8px; border: 2px solid var(--ink); font-size: 13px; }
.sugg > * { position: relative; }
.sugg .desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sugg-empty { margin: 0; font-size: 13px; }
@media (min-width: 1100px) { #suggestions { max-height: calc(100vh - 92px); overflow-y: auto; } }
.event .event-backdrop, .sugg .event-backdrop { position: absolute; inset: -12px; display: flex; opacity: .3; filter: blur(4px); pointer-events: none; }
.event .event-backdrop.mixed { inset: -40px; opacity: .38; filter: blur(26px) saturate(1.3); }
.event-backdrop i { flex: 1; background-size: cover; background-position: center; }
.tl-covers { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.tl-cover { width: 20px; aspect-ratio: 3 / 4; display: block; object-fit: cover; }
.tl-cover.art-fallback { display: none; }
.picker-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.game-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.pick { padding: 0; background: none; border: 3px solid transparent; color: var(--muted); font-size: 11px; line-height: 1.2; cursor: pointer; text-align: left; }
.pick.on { border-color: var(--blue); color: var(--ink); }
.pick span { display: block; padding: 3px 2px; overflow-wrap: anywhere; }
.pick-cover { width: 100%; aspect-ratio: 3 / 4; display: block; object-fit: cover; }
.pick-cover.art-fallback { font-size: 9px; padding: 2px; }
.player-dialog .rsvp { margin-top: 14px; max-width: 360px; }
.player-dialog .rsvp-btn { padding: 8px 10px; font-size: 13px; }
@media (max-width: 640px) { .tl-covers { display: none; } }
.event .who.going { color: var(--ink); font-weight: 600; }
.rsvp { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.rsvp-btn { flex: 1 1 auto; padding: 5px 6px; background: none; border: 2px solid var(--ink); color: var(--ink); font-size: 11px; font-weight: 800; cursor: pointer; }
.rsvp-btn:hover { background: var(--surface-2); }
.rsvp-btn.on, .rsvp-btn.on:hover { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.rank-stats { display: inline-flex; align-items: center; gap: 10px; }
.rank-stats span { display: inline-flex; align-items: center; gap: 4px; }
.rank-icon { width: 14px; height: 14px; flex: none; fill: var(--blue); }
.bar { height: 6px; border-radius: 999px; background: var(--bg-2); margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); border-radius: inherit; }

.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font: 14px var(--pixel); color: #111110;
  background: linear-gradient(135deg, var(--h1), var(--h2));
}
.empty-state { color: var(--muted); text-align: center; padding: 24px; }

/* Dialog, Toast */
.dialog {
  border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); color: var(--text);
  padding: 24px; width: min(420px, calc(100vw - 32px));
}
.dialog::backdrop { background: rgba(17, 17, 16, .7); backdrop-filter: blur(4px); }
.dialog form { display: grid; gap: 14px; }
.dialog p { margin: 0; font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 999px;
  font-weight: 600; font-size: 14px; z-index: 50; transition: .25s ease; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 16px; }
.foot .pixel { color: var(--gold); }

@media (max-width: 980px) {
  .crew-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tabs { display: none; }
  .hero-sub { font-size: 16px; }
  .day { min-height: 0; }
  .card { padding: 16px; }
  .games { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .game .title { font-size: 12px; }
  .game .meta { padding: 6px 6px 8px; align-items: flex-start; }
  .star { width: 26px; height: 26px; border-radius: 8px; font-size: 10px; }
  .avail { grid-template-columns: 40px repeat(var(--cols), minmax(14px, 1fr)); gap: 2px; min-width: 0; }
  .cell { height: 28px; border-radius: 4px; }
  .event-form { grid-template-columns: 1fr 1fr; }
  .event-form .wide { grid-column: 1 / -1; }
  .top5 li { grid-template-columns: 28px 40px 1fr auto; gap: 8px; }
  .top5 .thumb { width: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Wechsel zwischen Anmelden und Eintragen */
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer; justify-self: start;
  color: var(--gold); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); }
.cta-login { display: block; margin: 14px auto 0; }

/* Terminraster: Tage horizontal, Uhrzeiten vertikal */
.avail .hh { display: flex; align-items: center; justify-content: flex-end; padding: 0 6px 0 0; }
.avail .dh { align-items: center; text-align: center; padding: 0 0 6px; }
.avail .dh small { font-variant-numeric: tabular-nums; }

/* Crew-Liste */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.person {
  display: grid; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  transition: background .15s, border-color .15s;
}
.person:hover { background: var(--surface-2); border-color: var(--line-strong); }
.person.me { border-color: rgba(31, 134, 240, .45); }
.avatar { flex: none; }
.person-text { min-width: 0; flex: 1; }
.person-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-text small { color: var(--muted); font-size: 12px; }
.person-arrow { color: var(--muted); font-size: 22px; line-height: 1; }

/* Detailansicht */
.player-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.player-dialog h4 { font: 700 15px/1.2 var(--display); margin: 22px 0 10px; }
.detail-head { display: flex; align-items: center; gap: 12px; }
.detail-head > div:nth-child(2) { flex: 1; min-width: 0; }
.detail-head h3 { margin: 0; overflow-wrap: anywhere; }
.detail-note { margin: 14px 0 0; font-style: italic; color: var(--text-2); }
.detail-top { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.detail-top li { position: relative; min-width: 0; }
.detail-top .cover { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; display: block; }
.detail-top .cover.art-fallback { font-size: 12px; padding: 4px; }
.detail-top em {
  position: absolute; left: 4px; top: 4px; min-width: 22px; height: 22px; display: grid; place-items: center;
  font: 12px var(--pixel); font-style: normal; color: #111110; background: var(--gold); border-radius: 6px;
}
.detail-top span { display: block; font-size: 12px; font-weight: 600; line-height: 1.25; margin-top: 5px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.avail.view .hh, .avail.view .dh { cursor: default; }
.avail.view .cell.on { background: var(--green); border-color: transparent; }
@media (max-width: 640px) {
  .player-dialog { padding: 16px; }
  .detail-top span { font-size: 11px; }
}

/* Hero als eigenes Panel */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 32px; align-items: stretch;
  margin-top: 24px; padding: 40px; border-radius: 24px; border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(255, 81, 72, .13), rgba(239, 237, 230, .94) 55%);
}
.hero-date { font: 700 clamp(20px, 3vw, 28px)/1.2 var(--display); color: var(--gold); margin: 16px 0 0; }
.hero-sub { margin: 8px 0 22px; font-size: 16px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-cta .btn { text-decoration: none; display: inline-block; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 10px; }
.hero-stats .stat { display: flex; flex-direction: column; justify-content: center; min-width: 0; background: rgba(17, 17, 16, .55); }
.block { padding-top: 56px; }

/* Mein Eintrag: mitlaufende Checkliste */
.rail-title { margin: 0; font-size: 12px; color: var(--gold); text-transform: uppercase; }
.quests { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.quest {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 6px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer;
}
.quest:hover { background: var(--surface-2); color: var(--text); }
.quest.done { color: var(--green); }
.quest-box {
  flex: none; width: 18px; height: 18px; display: grid; place-items: center; font-size: 12px;
  border: 1.5px solid var(--line-strong); border-radius: 5px;
}
.quest.done .quest-box { background: var(--green); border-color: transparent; color: #111110; }
.day.first { grid-column-start: var(--start, 1); }

.event-form[hidden] { display: none; }
.cal-wd {
  padding: 8px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.cal-wd.weekend { color: var(--gold); }

/* Umschalter */
.seg { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; }
.seg button { border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 14px; padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--gold); color: #111110; }

/* Events-Kalender: Blöcke auf dem Heatmap-Raster */
.tl-event {
  position: relative; z-index: 1; min-width: 0; justify-self: start; overflow: hidden; display: grid; align-content: start; gap: 1px;
  padding: 4px 5px; font-size: 11px; line-height: 1.25; overflow-wrap: anywhere;
  background: #1F86F0; border-left: 3px solid var(--red); border-radius: 6px;
}
.tl-event b { font-size: 12px; }
.tl-event span { color: #111110; }

/* Heatmap-Fenster */
.slot-pop {
  position: absolute; z-index: 30; width: max-content; max-width: min(300px, calc(100vw - 16px)); display: grid; gap: 8px; padding: 12px;
  pointer-events: none; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8);
}
.slot-pop[hidden] { display: none; }
.slot-pop.pinned { pointer-events: auto; border-color: var(--gold); }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.pop-names { display: flex; flex-wrap: wrap; gap: 5px; }
.pop-name { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-strong); }
button.pop-name { cursor: pointer; }
button.pop-name:hover { border-color: var(--gold); color: var(--gold); }
.slot-pop small { color: var(--muted); font-size: 12px; }

/* Ranking und Details */
.rank-row:hover { background: var(--surface-2); }
.detail-cover { width: 54px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; display: block; flex: none; font-size: 8px; padding: 0; }
.detail-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.detail-person {
  display: flex; align-items: center; gap: 10px; padding: 8px; cursor: pointer; text-align: left;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.detail-person:hover { border-color: var(--gold); }
.detail-person b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.detail-person small { color: var(--gold); font-size: 12px; white-space: nowrap; }

/* Crew-Karten */
.person-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-games { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.person-games img, .person-games .art-fallback, .person-games .none {
  display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 5px; font-size: 7px; padding: 1px;
}
.person-games .none { border: 1px dashed var(--line-strong); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 24px; gap: 22px; }
}
@media (max-width: 820px) {
  .calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day.first { grid-column-start: auto; }
  .cal-wd { display: none; }
}

/* Checkliste neben dem gesamten Inhalt */
.with-rail { position: relative; }
.with-rail.has-rail { padding-left: 252px; }
.rail-track { position: absolute; left: 0; top: var(--rail-top, 56px); bottom: var(--rail-bottom, 0); width: 220px; }
.rail-track[hidden] { display: none; }
.quest-rail {
  position: sticky; top: 76px; display: grid; gap: 8px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
/* Sprung-Card rechts neben der Übersicht, Gegenstück zur Checkliste */
.crew-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; }
.overview-stack { display: grid; grid-template-columns: minmax(0, 1fr); }
.overview-stack > * { grid-area: 1 / 1; }
.overview-stack > .is-off { visibility: hidden; }
.jump-btn { width: 100%; padding-left: 8px; padding-right: 8px; text-align: center; }
/* Breite Fenster: Leiste im freien Rand, Inhalt behält die volle Breite */
@media (min-width: 1660px) {
  .with-rail.has-rail { padding-left: 0; }
  .rail-track { left: auto; right: 100%; margin-right: 32px; }
  .crew-layout { display: block; position: relative; }
  .jump-track { position: absolute; left: 100%; top: 0; bottom: 0; width: 220px; margin-left: 32px; }
}
/* Schmale Fenster: kompakte Leiste über dem Inhalt */
@media (max-width: 1099px) {
  .with-rail.has-rail { padding-left: 0; }
  .crew-layout { grid-template-columns: minmax(0, 1fr); }
  .jump-track { order: -1; }
  .rail-track { position: sticky; top: 62px; bottom: auto; width: auto; z-index: 5; margin-top: 16px; }
  .quest-rail { position: static; padding: 10px 12px; gap: 5px; }
  .rail-title { display: none; }
  .quests { display: flex; flex-wrap: wrap; margin: 0; gap: 2px 8px; }
  .quest { width: auto; padding: 3px 2px; font-size: 12px; gap: 5px; }
  .quest-box { width: 15px; height: 15px; font-size: 10px; }
}

@media (max-width: 640px) {
  .tl-event { writing-mode: vertical-rl; padding: 3px 1px; border-left-width: 2px; }
  .tl-event span { display: none; }
}

/* ==========================================================
   Design 3.0 „Multiplikator“: Papier, Tinte, Frostblau
   Flocke und Weihnachtsmann wechseln sich ab, nie zusammen
   ========================================================== */
* { border-radius: 0 !important; }
body { background: var(--bg); color: var(--text); }
::selection { background: var(--blue); color: var(--on-blue); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
html[data-logo="flake"] .only-santa, html[data-logo="santa"] .only-flake { display: none; }

/* Wortmarke: Text in Archivo, Flocke oder Weihnachtsmann als Glyphe */
.brand, h1 { font-family: var(--display); font-weight: 900; font-stretch: 125%; white-space: nowrap; }
.g-flake { display: inline; height: .7em; width: .7em; margin-right: .05em; vertical-align: baseline; }
.g-santa { display: inline; height: .78em; width: .7em; margin: 0 .04em; vertical-align: baseline; }
.brand { font-size: 24px; line-height: 1; letter-spacing: -.04em; color: var(--ink); }

/* Kopfzeile */
.topbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 2px solid var(--ink); }
.tabs a { color: var(--ink); font: 500 14px var(--pixel); padding: 7px 10px; }
.tabs a:hover { background: none; color: var(--gold); }
.chip-user { background: var(--bg); border: 2px solid var(--ink); }
.badge-admin { font-size: 11px; color: var(--on-blue); background: var(--blue); }

/* Typo */
h1 {
  font-size: clamp(56px, 20vw, 236px); line-height: .92; letter-spacing: -.035em;
  background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--ink);
}
/* Mit Checkliste links wird es enger, das Logo muss in die Restbreite passen */
@media (min-width: 1100px) and (max-width: 1659px) {
  h1 { font-size: min(17.2vw, 208px); }
}
h2 { font: 900 clamp(32px, 5vw, 56px)/1 var(--display); font-stretch: 125%; letter-spacing: -.03em; }
h3 { font: 900 24px/1.1 var(--display); font-stretch: 125%; letter-spacing: -.02em; }
.player-dialog h4 { font: 800 18px/1.2 var(--display); font-stretch: 125%; }
.eyebrow { color: var(--gold); font-size: 13px; line-height: 1.2; margin-bottom: 8px; letter-spacing: 0; text-transform: none; }
.hero-date { font: 900 clamp(24px, 3.4vw, 36px)/1.1 var(--display); font-stretch: 125%; letter-spacing: -.02em; color: var(--ink); margin-top: 18px; }
.hero-sub { font-size: 20px; font-weight: 500; color: var(--ink); margin: 10px 0 24px; }
.stat b { font: 900 40px/1 var(--display); font-stretch: 125%; letter-spacing: -.02em; }
.stat.hot b { color: var(--ink); }
.day-head b { font: 900 24px/1 var(--display); font-stretch: 125%; letter-spacing: -.02em; }
.day-lvl { font: 500 12px/1 var(--pixel); color: var(--muted); }
.step-num { font-size: 14px; color: var(--gold); }
.xp-label, .rail-title { font-size: 13px; line-height: 1.2; text-transform: none; color: var(--gold); }
.top5 .rank { font-size: 18px; }
.best .count { font-size: 15px; color: var(--gold); }
.ranking .pos { font-size: 14px; }
.avatar { font-size: 13px; background: var(--ink); color: var(--bg); }
.event .time { font-size: 12px; color: var(--gold); }
.star { font-size: 13px; }
.foot .pixel { font-size: 13px; color: var(--ink); }
.art-fallback { font-family: var(--body); color: #fff; }
.game .art-fallback { font: 900 20px/1.05 var(--display); font-stretch: 125%; }

/* Flächen: harte Linien statt Karten */
.card, .quest-rail, .dialog, .day, .person { background: var(--bg); border: 2px solid var(--ink); }
.card { padding: 24px; }
.day.today { background: var(--blue-soft); }
.person:hover { background: var(--surface-2); border-color: var(--ink); }
.person.me { border-color: var(--blue); }
.dialog::backdrop { backdrop-filter: none; }
.toast { background: var(--ink); color: var(--bg); border: 0; }
input, select, textarea { background: var(--field); border: 2px solid var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }

/* Hero */
.hero { grid-template-columns: 1fr; gap: 32px; margin-top: 0; padding: 36px 0 0; border: 0; background: none; }
.hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; gap: 0; border: 2px solid var(--ink); }
.hero-stats .stat { background: none; border: 0; border-right: 2px solid var(--ink); padding: 18px 20px; }
.hero-stats .stat:last-child { border-right: 0; }
.stat b.stat-num { display: flex; align-items: center; gap: 12px; }
.stat-icon { width: .8em; height: .8em; flex: none; fill: var(--blue); }
.hero-stats .stat-fav { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.stat-cover { width: 48px; aspect-ratio: 3 / 4; flex: none; display: block; object-fit: cover; border: 2px solid var(--ink); }
.stat-cover.art-fallback { font-size: 7px; padding: 2px; }
.stat-fav-text { min-width: 0; }
.stat-fav-text b { font-size: clamp(15px, 1.6vw, 22px); line-height: 1.1; overflow-wrap: break-word; }
.hero-cta { gap: 10px; }

/* Knöpfe */
.btn, .btn-primary, .btn-ghost { border: 2px solid var(--ink); padding: 11px 20px; font-weight: 800; box-shadow: none; transition: background .12s; }
.btn-primary { background: var(--blue); color: var(--on-blue); border-color: var(--blue); }
.btn-primary:hover { background: #4A9DF4; border-color: #4A9DF4; }
.btn-ghost { background: none; }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn-small { padding: 5px 10px; }

/* XP-Leiste */
.xp-bar { height: 14px; border: 2px solid var(--ink); background: none; }
.xp-fill { background: var(--blue); }

/* Akzente in Blau statt Gold */
.star.in, .seg button.on, .detail-top em { background: var(--blue); color: var(--on-blue); }
.seg { background: none; border: 2px solid var(--ink); }
.seg button { color: var(--ink); }
.save-state.ok, .quest.done { color: var(--gold); }
.bar i { background: var(--blue); }
.bar { background: var(--surface-2); }
.game { border-width: 3px; }
.game.on { border-color: var(--blue); }
.avail.edit .cell.on { box-shadow: none; }
.avail.heat .cell.mine { outline-color: var(--ink); }
.event { border: 0; }
.event::before { display: none; }
.tl-event { border-left: 0; color: var(--on-blue); }
.foot { color: var(--muted); }
.day-empty { color: var(--muted); }

/* Dunkel und hell */
html[data-theme="dark"] .only-light, html:not([data-theme="dark"]) .only-dark { display: none; }
.theme-toggle { flex: none; width: 40px; height: 40px; border: 2px solid var(--ink); color: var(--ink); }
.theme-toggle:hover { background: var(--ink); color: var(--bg); }

@media (max-width: 900px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats .stat { border-bottom: 2px solid var(--ink); }
  .hero-stats .stat:nth-child(2n) { border-right: 0; }
}
@media (max-width: 640px) {
  .brand { font-size: 20px; }
  .card { padding: 16px; }
  .stat b { font-size: 30px; }
  .hero-sub { font-size: 17px; }
}

/* Skelette: blasse Flächen mit durchlaufendem Glanz, auch hinter noch ladenden Covern */
.sk, img.is-loading {
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--ink) 9%, transparent) 40%,
    color-mix(in srgb, var(--ink) 20%, transparent) 50%,
    color-mix(in srgb, var(--ink) 9%, transparent) 60%);
  background-size: 220% 100%;
  animation: sk-sweep 1.5s linear infinite;
}
.sk { display: block; max-width: 100%; flex: none; }
.sk + .sk { margin-top: 8px; }
.hero-cta .sk + .sk { margin-top: 0; }
.sk-cover { width: 100%; aspect-ratio: 3 / 4; }
.sk-cover + .sk-cover { margin-top: 0; }
.card .sk:first-child { margin-bottom: 14px; }
@keyframes sk-sweep { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@media (prefers-reduced-motion: reduce) { .sk, img.is-loading { animation: none; } }

/* Touch: kein hängenbleibender Hover */
@media (hover: none) {
  .game:hover { transform: none; }
}
/* Unter der Desktop-Leiste: Vorschläge zum Wischen, damit der Kalender nicht nach unten rutscht */
@media (max-width: 1099px) {
  #suggestions { grid-template-columns: minmax(0, 1fr); }
  .suggs { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
  .sugg { flex: 0 0 min(260px, 80%); scroll-snap-align: start; }
}
/* Handy */
@media (max-width: 640px) {
  html { scroll-padding-top: 72px; }
  body { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  /* Unter 16px zoomt iOS beim Antippen in das Feld */
  input, select, textarea { font-size: 16px; }

  /* Navigation als Leiste am unteren Rand, in Daumenreichweite */
  .tabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0;
    background: var(--bg); border-top: 2px solid var(--ink); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs a { flex: 1; padding: 15px 2px; font-size: 13px; text-align: center; white-space: nowrap; }
  .toast { bottom: calc(66px + env(safe-area-inset-bottom)); }
  .topbar { gap: 8px; }

  .hero { gap: 24px; padding-top: 24px; }
  .hero-stats .stat { padding: 14px; }
  .hero-stats .stat-fav { padding: 10px; gap: 8px; }
  .stat-cover { width: 40px; }
  .block { padding-top: 40px; }
  .block-head { flex-wrap: wrap; align-items: flex-start; }

  /* Checkliste läuft nicht mit, sonst bleibt zu wenig Bildschirm */
  .rail-track { position: static; margin-top: 20px; }
  .quest { padding: 6px 4px; font-size: 13px; }

  .calendar { grid-template-columns: minmax(0, 1fr); }
  .rsvp-btn { padding: 11px 6px; font-size: 13px; }
  .event .del, .event .event-edit { width: 34px; height: 34px; }
  .event .event-edit { right: 40px; }
  .event .time { min-height: 30px; }

  .event-form .actions .btn { flex: 1; }
  .game-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 220px; }
  .player-dialog .rsvp { max-width: none; }
  .detail-top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
