:root {
  /* HHL-Farben (Hafenpanorama, Logo) – alte Namen bleiben als Aliase */
  --blue: #1F5876;        /* Mützen-Blau */
  --blue-dark: #174762;
  --blue-deep: #0F3047;
  --blue-light: #3D7FA6;
  --gold: #F5A93A;        /* Schnabel-Orange */
  --gold-strong: #E0902A;
  --red: #B3121B;         /* Rumpf-Rot */
  --hull: #2B2B2B;
  --sky: #D6E6F0;
  --water: #8FB4D0;
  --quay: #A9A9A9;
  --ink: #1C2B36;
  --muted: #5A6B78;
  --card: #F5F7F8;
  --white: #fff;
  --radius: 6px;
  --shadow: 0 4px 14px rgba(15, 48, 71, .16);
  --shadow-lg: 0 18px 50px rgba(15, 48, 71, .38);
  --font: 'Brother 1816', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #D6E6F0 0%, #CFE1EC 40%, #A9C7DB 75%, #8FB4D0 100%) fixed;
  background-color: var(--sky);
  overflow-x: hidden;
}

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* ------------------------------------------------------- Kopfleiste (schmal) */
.hero {
  position: relative; z-index: 3; display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap;
  padding: 10px clamp(12px, 3vw, 28px); min-height: 92px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.94) 0%, rgba(255,255,255,.86) 32%, rgba(255,255,255,.35) 62%, rgba(255,255,255,.55) 100%),
    url('/img/hero-strip.jpg') center 40% / cover no-repeat, var(--sky);
  border-bottom: 5px solid var(--red); box-shadow: 0 2px 10px rgba(15,48,71,.15);
}
.hero-brand { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.logo { height: 52px; width: auto; display: block; flex: none; }
.hero-eyebrow { display: block; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--red); }
.hero h1 { margin: 0; font-size: clamp(20px, 2.6vw, 28px); font-weight: 900; color: var(--blue-deep); line-height: 1.1; }
.subtitle { margin: 2px 0 0; color: var(--blue); font-weight: 700; font-size: 13px; }

.streams { display: flex; gap: 8px; flex-wrap: wrap; }
.stream {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
  font-weight: 700; font-size: 13px; text-decoration: none; color: #fff; white-space: nowrap;
  box-shadow: 0 2px 0 rgba(0,0,0,.25); transition: filter .15s, transform .1s;
}
.stream:hover { filter: brightness(1.1); }
.stream:active { transform: scale(.97); }
.stream.yt { background: var(--red); }
.stream.tw { background: #6441A5; }
.stream img { height: 16px; width: auto; background: #fff; border-radius: 4px; padding: 1px 2px; }
.stream.tw img { background: none; padding: 0; height: 18px; }

.toolbar { display: flex; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 13px var(--font); color: var(--blue);
  background: rgba(255, 255, 255, .9); border: 1px solid rgba(31, 88, 118, .25); border-radius: 999px;
  padding: 7px 12px; cursor: pointer; box-shadow: var(--shadow); transition: background .2s, transform .1s;
}
.tool:hover { background: #fff; }
.tool:active { transform: scale(.96); }
.tool[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.tool-icon { font-size: 15px; line-height: 1; }

.banner {
  display: block; width: fit-content; max-width: calc(100% - 32px); margin: 12px auto 0; padding: 7px 14px; border-radius: 999px; position: relative; z-index: 2;
  background: #FFF1DC; border: 1px solid var(--gold); color: #7A4A00; font-weight: 600; font-size: 13px;
}
.banner[hidden] { display: none; }

@media (max-width: 860px) {
  .hero { min-height: 0; }
  .hero-brand { flex: 1 1 0; }
  .streams { order: 3; width: 100%; }
  .tool-label { display: none; }
  .tool { padding: 8px 10px; }
}
@media (max-width: 480px) {
  .hero { gap: 10px; }
  .logo { height: 40px; }
  .hero-eyebrow { font-size: 9px; letter-spacing: 1px; }
  .hero h1 { font-size: 18px; }
  .toolbar { gap: 6px; }
  .tool { padding: 6px 8px; }
  .subtitle { display: none; }
  .stream { padding: 6px 10px; font-size: 12px; }
}

/* ------------------------------------------------------------------- Layout */
.layout {
  position: relative; z-index: 2;
  max-width: 1180px; margin: 0 auto; padding: 26px 16px 40px;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; gap: 28px; }
}

/* ----------------------------------------------------------------- Calendar */
/* Containerstapel auf einem Schiff: Türen = Container (Stirnseite mit zwei Flügeln) */
.ship { position: relative; }
.calendar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  grid-auto-flow: dense;
  gap: 6px 4px;
  padding: 0 4%;
}
@media (max-width: 640px) { .calendar { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 3%; } }
@media (max-width: 420px) { .calendar { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Schiff von hinten: Aufbau, Laschbrücke, Heck, Wasser */
.ship { position: relative; padding-top: clamp(30px, 4vw, 46px); }
.deckhouse { /* Brücke hinter dem Stapel */
  position: absolute; top: 0; left: 50%; transform: translateX(-62%); width: 30%; height: 90px; z-index: 0;
  background:
    linear-gradient(180deg, transparent 0 10px, #9DB9CC 10px 18px, transparent 18px) 8% 0 / 84% 100% no-repeat,
    linear-gradient(180deg, #F0F0EC, #D9D9D4);
  border-radius: 3px 3px 0 0; box-shadow: inset 0 0 0 2px rgba(0,0,0,.12);
}
.deckhouse::before { /* Brückennock */
  content: ''; position: absolute; top: 4px; left: -14%; right: -14%; height: 6px; background: #E4E4DF; border-radius: 2px;
}
.funnel {
  position: absolute; right: -34%; top: -6px; width: 22%; height: 96px;
  background: linear-gradient(180deg, #2B2B2B 0 12px, var(--red) 12px 24px, #2B2B2B 24px);
  border-radius: 3px 3px 0 0;
}
.calendar { position: relative; z-index: 1; }
.lashing { /* rotes Stahlfachwerk unter dem Stapel */
  position: relative; z-index: 1; height: clamp(12px, 1.8vw, 18px); margin: 0 3%;
  border-top: 3px solid var(--red); border-bottom: 3px solid var(--red);
  background:
    repeating-linear-gradient(60deg, transparent 0 9px, var(--red) 9px 12px),
    repeating-linear-gradient(-60deg, transparent 0 9px, var(--red) 9px 12px),
    #3A2A2A;
}
.hull {
  position: relative; z-index: 1; height: clamp(86px, 12vw, 130px); margin: 0 1%;
  background: linear-gradient(180deg, #24292E 0 76%, var(--red) 76% 100%);
  border-radius: 0 0 46% 46% / 0 0 34% 34%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: clamp(22px, 3vw, 32px); color: #fff; font-weight: 900; white-space: nowrap;
  box-shadow: inset 0 6px 0 rgba(255,255,255,.06);
}
.hull::before { /* Öffnungen oben im Heck */
  content: ''; position: absolute; left: 4%; right: 4%; top: 6px; height: clamp(8px, 1.2vw, 12px);
  background: repeating-linear-gradient(90deg, #121518 0 28px, transparent 28px 36px);
}
.hull-name { font-size: clamp(13px, 2.2vw, 22px); letter-spacing: clamp(1px, .3vw, 3px); line-height: 1.1; }
.hull-port { font-size: clamp(9px, 1.2vw, 13px); letter-spacing: 2px; margin-top: 3px; opacity: .9; }
.hull-imo { font-size: clamp(7px, .9vw, 10px); letter-spacing: 1px; font-weight: 700; opacity: .75; }
.water {
  position: relative; z-index: 2; height: 30px; margin: -14px -16px 0; border-radius: 0 0 12px 12px;
  background:
    radial-gradient(14px 6px at 20px 0, transparent 98%, #6E9CC0 100%) 0 0 / 40px 10px repeat-x,
    linear-gradient(180deg, #6E9CC0, #8FB4D0);
}

.door {
  --c1: #B3121B; --c2: #8E0E15;
  position: relative; aspect-ratio: 1 / 1.06; perspective: 900px;
  border: 0; padding: 0; background: none; cursor: pointer; font: inherit; color: inherit;
  border-radius: 2px;
}
.door.big { grid-column: span 2; grid-row: span 2; }
.door:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; z-index: 3; }
.box-red { --c1: #B3121B; --c2: #8A0D14; }
.box-blue { --c1: #1F5876; --c2: #163F55; }
.box-green { --c1: #3D7A4A; --c2: #2C5A36; }
.box-orange { --c1: #D9822B; --c2: #B0661D; }
.box-grey { --c1: #7D8A93; --c2: #5F6B73; }
.box-teal { --c1: #2B7F86; --c2: #1E5E64; }
.box-navy { --c1: #2B3A55; --c2: #1D283C; }
.box-rust { --c1: #9C4A2F; --c2: #763622; }

/* Innenraum (hinter den Flügeln) */
.door-inside {
  position: absolute; inset: 3px; border-radius: 1px;
  background: linear-gradient(180deg, #F3EBDD 0%, #E4D6BE 100%);
  box-shadow: inset 0 0 0 3px var(--c2), inset 0 10px 18px rgba(0,0,0,.18);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px; text-align: center; overflow: hidden;
}
.door-inside .in-icon { font-size: clamp(22px, 3.2vw, 34px); line-height: 1; }
.door.big .door-inside .in-icon { font-size: clamp(40px, 6vw, 64px); }
.door-inside .in-cat { font-size: 10px; font-weight: 800; color: var(--blue); text-transform: uppercase; letter-spacing: .6px; }
.door-inside .in-title { font-size: 11px; color: var(--muted); font-weight: 600; line-height: 1.2; display: none; }
.door.big .door-inside .in-title { display: block; font-size: 13px; padding: 0 10px; }
.door-inside .in-day { position: absolute; top: 6px; left: 8px; font-size: 11px; font-weight: 900; color: var(--red); }

/* Containerflügel mit Wellblech */
.wing {
  position: absolute; top: 0; bottom: 0; width: 50%;
  transform-style: preserve-3d; backface-visibility: hidden;
  transition: transform .9s cubic-bezier(.3, 1.2, .5, 1), filter .3s;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 3px, rgba(0,0,0,.16) 3px 5px, transparent 5px 9px),
    linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.28);
  z-index: 2;
}
.wing.left { left: 0; transform-origin: left center; border-right: 1px solid rgba(0,0,0,.45); }
.wing.right { right: 0; transform-origin: right center; }
/* Verriegelungsstangen */
.wing .bar { position: absolute; top: 6%; bottom: 6%; width: 3px; background: linear-gradient(90deg, #D9D9D9, #8A8A8A); border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.wing .b1 { left: 28%; } .wing .b2 { left: 66%; }
.wing .bar::after { /* Hebel */
  content: ''; position: absolute; left: -3px; top: 56%; width: 9px; height: 4px; background: #B5B5B5; border-radius: 2px;
}
.door.big .wing .bar { width: 5px; }
/* Containernummer (ISO 6346) */
.box-code {
  position: absolute; right: 8%; top: 7%; font-size: clamp(5px, .7vw, 8px); font-weight: 800; color: rgba(255,255,255,.9);
  letter-spacing: .3px; white-space: nowrap;
}
.box-code b { display: inline-block; border: 1px solid rgba(255,255,255,.9); padding: 0 1px; line-height: 1.1; }
.door.big .box-code { font-size: clamp(8px, 1.1vw, 12px); }
.door:not(.big) .box-code { display: none; }
/* Eckbeschläge */
.corner { position: absolute; width: 10%; height: 9%; background: #3A3A3A; border-radius: 1px; z-index: 4; pointer-events: none; }
.corner::after { content: ''; position: absolute; left: 25%; right: 25%; top: 32%; bottom: 32%; background: #111; border-radius: 40%; }
.corner.tl { top: 0; left: 0; } .corner.tr { top: 0; right: 0; } .corner.bl { bottom: 0; left: 0; } .corner.br { bottom: 0; right: 0; }
/* Nummer als Schablonen-Schrift über beiden Flügeln */
.door-num {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; pointer-events: none;
  font-weight: 900; color: #fff; font-size: clamp(22px, 3.6vw, 38px);
  text-shadow: 0 2px 0 rgba(0,0,0,.35); transition: opacity .25s;
}
.door.big .door-num { font-size: clamp(48px, 8vw, 88px); }
/* Plombe an verschlossenen Containern */
.seal {
  position: absolute; z-index: 4; left: calc(50% - 5px); top: 78%; width: 10px; height: 14px;
  background: var(--gold); border-radius: 2px 2px 5px 5px; box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.seal::before { content: ''; position: absolute; left: 2px; right: 2px; top: -7px; height: 9px; border: 2px solid #CFCFCF; border-bottom: 0; border-radius: 5px 5px 0 0; }
.door.big .seal { transform: scale(1.5); }

/* Schneehauben (nur bei eingeschaltetem Schnee) */
.snow-on .door.stack-top::before, .snow-on .card::before {
  content: ''; position: absolute; z-index: 5; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' preserveAspectRatio='none'%3E%3Cpath d='M0 14V7C3 3 7 2 11 5c3-4 9-5 13-2 4-3 10-3 13 1 4-4 11-4 15 0 3-3 9-3 12 0 4-4 11-3 14 1 4-3 10-2 13 2 2-1 4-1 5 0V14z' fill='%23fff'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  filter: drop-shadow(0 2px 1.5px rgba(0, 60, 100, .28));
  /* --snow (0..1) wird von snow.js langsam erhöht; --max variiert pro Tür */
  transform-origin: 50% 100%;
  transform: scale(var(--flip, 1), calc(var(--snow, 0) * var(--max, 1)));
  opacity: calc(var(--snow, 0) * 6); /* sanft einblenden, ab ~17 % voll deckend */
  transition: transform 1.5s linear, opacity 1.5s linear;
}
/* Unterkante sitzt 2px unter der Oberkante -> Schnee wächst nach oben, nie ins Türblatt */
.snow-on .door.stack-top::before { left: -3px; right: -3px; top: -12px; height: 14px; }
.snow-on .door.big.stack-top::before { top: -18px; height: 20px; }
.snow-on .door:nth-child(3n)::before { --flip: -1; }
.snow-on .door:nth-child(3n+1)::before { --max: .75; }
.snow-on .door:nth-child(5n+2)::before { --max: .55; }
.snow-on .card::before { left: -3px; right: -3px; top: -12px; height: 14px; }

/* Zustände */
.door.today .wing { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25) drop-shadow(0 0 6px rgba(245,169,58,.9)); }
}
.door.today::after { /* Signallampe */
  content: ''; position: absolute; z-index: 6; top: -7px; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px 3px rgba(245,169,58,.8); animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .35; } }
.door.opened .wing.left { transform: rotateY(-112deg); }
.door.opened .wing.right { transform: rotateY(112deg); }
.door.opened:hover .wing.left { transform: rotateY(-104deg); }
.door.opened:hover .wing.right { transform: rotateY(104deg); }
.door.opened .door-num { opacity: 0; }
.door:not(.opened).available:hover .wing.left { transform: rotateY(-14deg); }
.door:not(.opened).available:hover .wing.right { transform: rotateY(14deg); }
.door.locked { cursor: not-allowed; }
.door.locked .wing { filter: saturate(.75) brightness(.92); }
.door.shake { animation: shake .45s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-1.5deg); }
  40% { transform: translateX(5px) rotate(1.5deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.door-tip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 5px 9px; border-radius: 6px; pointer-events: none; z-index: 5;
  animation: tip 1.8s forwards;
}
@keyframes tip { 0% { opacity: 0; transform: translate(-50%, 4px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.countdown {
  text-align: center; margin: 0 0 22px; padding: 18px; border-radius: var(--radius);
  background: rgba(255,255,255,.82); box-shadow: var(--shadow); color: var(--blue); font-weight: 700;
}
.countdown .cd-num { display: inline-block; min-width: 2.2ch; font-size: 30px; color: var(--blue-dark); }
.countdown .cd-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-right: 12px; }

/* ------------------------------------------------------------------ Sidebar */
.sidebar { display: grid; gap: 22px; }
.card { position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { background: var(--hull); color: #fff; padding: 14px 16px 12px; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 5px solid var(--red); }
.card-head h2 { margin: 2px 0 0; font-size: 17px; font-weight: 700; }
.eyebrow { display: block; font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--gold); }
.card-body { padding: 14px 16px 16px; }
.hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.small { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.small a { color: var(--blue); }

.letters { display: flex; flex-wrap: wrap; gap: 5px; min-height: 40px; touch-action: none; }
.letter {
  width: 34px; height: 38px; border-radius: 3px; display: grid; place-items: center;
  font-weight: 900; font-size: 18px; color: #fff;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 2px, transparent 2px 6px), linear-gradient(180deg, #D23A2F, var(--red));
  box-shadow: 0 2px 0 #6F0A10, 0 3px 6px rgba(0,0,0,.14);
  cursor: grab; user-select: none; -webkit-user-select: none; transition: transform .15s;
}
.letter.empty { background: #EEF3F7; color: #B3C3CF; box-shadow: inset 0 0 0 1px #DCE6EE; cursor: default; font-size: 15px; }
.letter.dragging { opacity: .35; }
.letter.ghost { position: fixed; z-index: 100; pointer-events: none; transform: scale(1.15) rotate(-4deg); box-shadow: 0 8px 18px rgba(0,0,0,.25); }
.letter.new { animation: pop .7s ease; }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.progress-text { margin: 10px 0 0; font-size: 12px; font-weight: 700; color: var(--blue); }
.bag-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 700 13px var(--font); border-radius: 8px; padding: 9px 14px; cursor: pointer; text-decoration: none;
  border: 0; transition: transform .1s, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn-gold { background: var(--gold); color: #3A2400; }
.btn-gold:hover { filter: brightness(1.05); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); }
.btn-ghost { background: #EEF4F8; color: var(--blue); }
.btn-ghost:hover { background: #E1ECF4; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn[hidden] { display: none; }



.legend-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--muted); }

.footer { position: relative; z-index: 2; text-align: center; padding: 10px 16px 28px; font-size: 13px; color: var(--blue-deep); }
.footer .sep { margin: 0 8px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* -------------------------------------------------------------------- Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 35, 60, .55); backdrop-filter: blur(3px); animation: fade .25s; }
.modal-card {
  position: relative; width: min(760px, 100%); max-height: min(88vh, 900px);
  display: flex; flex-direction: column; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: rise .35s cubic-bezier(.2, 1.2, .4, 1); outline: none;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px 14px; background: var(--hull); color: #fff; border-bottom: 6px solid var(--red); }
.modal-head h2 { margin: 3px 0 0; font-size: 21px; line-height: 1.25; font-weight: 800; }
.modal-close { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 34px; height: 34px; font-size: 16px; cursor: pointer; flex: none; }
.modal-close:hover { background: rgba(255,255,255,.3); }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid #E6EEF4; background: var(--card); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.modal-foot:empty { display: none; }
.letter-reveal { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--blue); font-size: 14px; }
.letter-reveal .letter { cursor: default; }

/* -------------------------------------------------------------- Türinhalte */
.content { font-size: 15px; line-height: 1.65; }
.content h1, .content h2, .content h3 { color: var(--blue); line-height: 1.3; }
.content h1 { font-size: 22px; margin: 0 0 12px; }
.content h2 { font-size: 18px; margin: 22px 0 8px; }
.content h3 { font-size: 16px; margin: 18px 0 6px; }
.content p { margin: 0 0 12px; }
.content ul, .content ol { padding-left: 22px; margin: 0 0 12px; }
.content li { margin-bottom: 4px; }
.content img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px auto; }
.content blockquote { margin: 14px 0; padding: 10px 16px; border-left: 4px solid var(--gold); background: #FFF6E8; border-radius: 0 8px 8px 0; color: #4F3A14; }
.content blockquote p:last-child { margin: 0; }
.content table { border-collapse: collapse; width: 100%; margin: 8px 0 14px; font-size: 14px; }
.content th, .content td { border-bottom: 1px solid #E3ECF2; padding: 7px 8px; text-align: left; vertical-align: top; }
.content th { color: var(--blue); }
.content a:not(.btn) { color: var(--blue); font-weight: 600; }
.content hr { border: 0; height: 1px; background: #E3ECF2; margin: 18px 0; }
.content code { background: #EEF4F8; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.content .emoji-riddle { font-size: 28px; letter-spacing: 4px; line-height: 1.6; }
.content .todo { background: #FFF0F0; border: 1px dashed #E57373; color: #A33; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.content .downloads { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 16px; }
.content .dl-card { flex: 1 1 220px; background: var(--card); border-radius: 10px; padding: 10px; text-align: center; box-shadow: inset 0 0 0 1px #E3ECF2; }
.content .dl-card img { margin: 0 0 8px; border-radius: 6px; }
.content .dl-card .btn { width: 100%; }
.content .compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .content .compare { grid-template-columns: 1fr; } }

.solution { margin-top: 22px; border-radius: 10px; overflow: hidden; border: 2px solid var(--gold); }
.solution-head { background: #FFF4D6; color: #7A5200; font-weight: 700; padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
.solution-body { padding: 14px 16px 4px; }
.solution.locked .solution-head { background: #F1F5F8; color: var(--muted); }
.solution.locked { border-color: #DCE6EE; }
.solution summary { cursor: pointer; list-style: none; }
.solution summary::-webkit-details-marker { display: none; }
.solution details[open] .solution-head { background: #FFF4D6; color: #7A5200; }

/* Quiz */
.quiz { margin: 14px 0; display: grid; gap: 14px; }
.quiz-q { background: var(--card); border-radius: 10px; padding: 12px 14px; box-shadow: inset 0 0 0 1px #E3ECF2; }
.quiz-q h4 { margin: 0 0 8px; color: var(--blue); font-size: 15px; }
.quiz-answers { display: grid; gap: 6px; }
.quiz-a {
  text-align: left; font: 600 14px var(--font); padding: 9px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid #D3E2EC; background: #fff; color: var(--ink); transition: background .15s;
}
.quiz-a:hover:not([disabled]) { background: #EEF6FB; }
.quiz-a.right { background: #E3F6E8; border-color: #59B56F; }
.quiz-a.wrong { background: #FDEBEB; border-color: #E57373; }
.quiz-a[disabled] { cursor: default; }
.quiz-result { font-weight: 700; color: var(--blue); text-align: center; padding: 6px; }

/* Konfetti/Sterne beim Öffnen */
.sparkle { position: fixed; pointer-events: none; z-index: 60; font-size: 18px; animation: sparkle 1.1s ease-out forwards; }
@keyframes sparkle { to { transform: translate(var(--dx), var(--dy)) rotate(200deg) scale(.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------- Mini-Spiel */
.bit-game { margin: 14px 0; }
.bg-hud { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--blue); font-weight: 600; margin-bottom: 8px; }
.bg-hud strong { font-size: 18px; color: var(--blue-dark); }
.bg-sound { margin-left: auto; background: #EEF4F8; border: 0; border-radius: 999px; padding: 5px 10px; cursor: pointer; font-size: 15px; }
.bg-stage { position: relative; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.bg-stage canvas { width: 100%; height: auto; display: block; outline: none; cursor: none; }
.bg-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 35, 60, .55); padding: 16px; }
.bg-overlay[hidden] { display: none; }
.bg-panel { background: #fff; border-radius: 12px; padding: 18px 22px; max-width: 440px; text-align: center; box-shadow: var(--shadow-lg); }
.bg-panel h3 { margin: 0 0 8px; color: var(--blue); }
.bg-hud .bg-sound + .bg-fs { margin-left: 0; }
.bg-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.bg-rotate { display: none; }
.bg-short { display: none; }
@media (max-width: 600px), (max-height: 480px) {
  .bg-panel .bg-desc { display: none; }
  .bg-panel .bg-short { display: block; }
}
@media (max-width: 600px) { .bg-hud { gap: 10px; font-size: 13px; } .bg-hud strong { font-size: 15px; } .bg-sound { padding: 4px 8px; } }
/* Panel muss auch auf kleinen Spielfeldern komplett erreichbar sein */
.bg-overlay { overflow: auto; align-items: safe center; }
@media (max-width: 600px) {
  .bg-overlay { padding: 6px; }
  .bg-panel { padding: 10px 12px; }
  .bg-panel h3 { font-size: 16px; margin-bottom: 4px; }
  .bg-panel p { font-size: 12px; margin-bottom: 8px; line-height: 1.35; }
  .bg-panel .small { display: none; }
  .bg-big { font-size: 22px !important; }
}
/* Vollbild (echt oder per CSS) */
html.bg-full-open, html.bg-full-open body { overflow: hidden; }
.bit-game.bg-full {
  position: fixed; inset: 0; z-index: 5000; margin: 0; background: #0E2A3D;
  display: flex; flex-direction: column;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.bit-game.bg-full .bg-hud { color: #fff; margin-bottom: 6px; }
.bit-game.bg-full .bg-hud strong { color: var(--gold); }
.bit-game.bg-full .bg-song { color: #BFD6E6; }
.bit-game.bg-full .bg-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; border-radius: 0; box-shadow: none; overflow: visible; }
.bit-game.bg-full .bg-stage canvas { flex: none; border-radius: 10px; }
.bit-game.bg-full .bg-overlay { border-radius: 0; }
@media (orientation: portrait) { .bit-game.bg-full .bg-rotate { display: block; color: #fff; text-align: center; font-size: 14px; margin: 8px 0 0; } }
@media (max-height: 480px) {
  .bit-game.bg-full .bg-hud { font-size: 12px; gap: 10px; margin-bottom: 4px; }
  .bit-game.bg-full .bg-hud strong { font-size: 14px; }
  .bit-game.bg-full .bg-panel { padding: 10px 14px; }
  .bit-game.bg-full .bg-panel p { font-size: 12px; margin-bottom: 6px; }
  .bit-game.bg-full .bg-panel .small { display: none; }
}
.bg-panel p { margin: 0 0 12px; font-size: 14px; }
.bg-big { font-size: 30px !important; font-weight: 800; color: var(--blue-dark); }

/* ------------------------------------------------------------ Wo ist Bit? */
.bit-hidden {
  border: 0; padding: 0; background: none; cursor: pointer; line-height: 0; position: relative;
  animation: bitWiggle 7s ease-in-out infinite; animation-delay: var(--wiggle-delay, 0s);
}
.bit-hidden img { margin: 0 !important; border-radius: 0 !important; display: block; }
.bit-hidden.bit-inline { display: inline-block; vertical-align: -3px; height: 18px; width: 20px; overflow: hidden; }
.bit-hidden.bit-inline img { width: 20px; height: auto; }
.bit-hidden.bit-inline.on-blue { height: 20px; }
.bit-imgwrap { position: relative; display: block; }
.bit-hidden.bit-corner { position: absolute; bottom: -2px; width: 30px; height: 22px; overflow: hidden; }
.bit-hidden.bit-corner.right { right: 6px; }
.bit-hidden.bit-corner.left { left: 6px; }
.bit-hidden.bit-corner img { width: 30px; }
.bit-hidden.is-found { animation: none; }
.bit-hidden.is-found.bit-inline { height: 26px; width: 20px; vertical-align: -7px; overflow: visible; }
.bit-hidden.is-found.bit-corner { height: 40px; overflow: visible; }
.bit-hidden.just-found img { animation: pop .7s ease; }
@keyframes bitWiggle {
  0%, 88%, 100% { transform: none; }
  91% { transform: translateY(-2px) rotate(-8deg); }
  94% { transform: translateY(-1px) rotate(8deg); }
  97% { transform: rotate(-4deg); }
}
.bit-toast {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--gold); color: var(--blue-deep); font: 700 13px var(--font); white-space: nowrap;
  padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow); line-height: 1.2; z-index: 5;
  animation: tip 2.6s forwards;
}
.bit-slots { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.bit-slot { position: relative; aspect-ratio: 1; border-radius: 6px; background: #EEF3F7; display: grid; place-items: center; overflow: hidden; }
.bit-slot img { display: none; width: 88%; }
.bit-slot span { font-size: 11px; font-weight: 700; color: #A7B8C5; }
.bit-slot.got { background: #FFF4D6; box-shadow: inset 0 0 0 1px var(--gold); }
.bit-slot.got img { display: block; }
.bit-slot.got span { display: none; }

/* Sidebar zweispaltig, wenn Platz ist (breite Bildschirme bzw. unter dem Kalender) */
@media (min-width: 1400px) {
  .layout { max-width: 1520px; grid-template-columns: minmax(0, 1fr) 680px; }
}
@media (min-width: 1400px), (min-width: 640px) and (max-width: 980px) {
  .sidebar {
    grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; align-items: start;
    grid-template-areas: "bag bit" "bag legend";
  }
  #bag { grid-area: bag; }
  #bitcard { grid-area: bit; }
  .sidebar .legend { grid-area: legend; }
}

/* ---------------------------------------------------------------- Memory */
.memory { margin: 14px 0; }
.mem-hud { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--blue); font-weight: 600; margin-bottom: 10px; }
.mem-hud strong { color: var(--blue-dark); }
.mem-restart { margin-left: auto; padding: 6px 12px; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 520px; margin: 0 auto; }
.mem-card { aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; perspective: 600px; font: inherit; }
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.3, 1.3, .5, 1); transform-style: preserve-3d; }
.mem-card.up .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; display: grid; place-items: center; }
.mem-back {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 3px, rgba(0,0,0,.14) 3px 5px, transparent 5px 9px),
    linear-gradient(180deg, #D23A2F, var(--red));
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(0,0,0,.2);
}
.mem-back::after { content: '⚓'; color: rgba(255,255,255,.8); font-size: clamp(18px, 4vw, 28px); }
.mem-card:hover:not(.up) .mem-back { filter: brightness(1.1); }
.mem-front { transform: rotateY(180deg); background: #fff; box-shadow: var(--shadow), inset 0 0 0 2px #E3ECF2; font-size: clamp(28px, 7vw, 46px); line-height: 1; }
.mem-front img { width: 62%; margin: 0 !important; border-radius: 0 !important; }
.mem-card.done .mem-front { box-shadow: 0 0 0 3px var(--gold), var(--shadow); background: #FFF9EC; animation: pop .5s ease; }
.mem-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
.mem-win { min-height: 8px; }
.mem-winbox { margin: 14px auto 0; max-width: 520px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; justify-content: center;
  background: #FFF4D6; border: 1px solid var(--gold); border-radius: 10px; padding: 12px 16px; color: #5B4A1F; text-align: center; }
.mem-winbox strong { font-size: 16px; color: var(--blue-dark); }
.content img.inline-logo { height: 22px; width: auto; vertical-align: middle; margin: 0; box-shadow: none; border-radius: 0; }
.bg-song { color: var(--muted); font-weight: 600; font-size: 13px; }
.mem-front img.mem-wide { width: 92%; }
.mem-front img.mem-fill { width: 100%; height: 100%; border-radius: 10px !important; }

/* ------------------------------------------------------- HHL-Ergänzungen */
.mem-front.front-mem-ship { background: linear-gradient(180deg, #2E5F82, #1F4560); }
.mem-front img.mem-ship { width: 86%; }
.mem-front img.mem-logo { width: 74%; }
.mem-front.front-mem-logo-red { background: linear-gradient(180deg, #D6E6F0, #A9C7DB); }
.mem-card.done .mem-front.front-mem-ship { background: linear-gradient(180deg, #2E5F82, #1F4560); }
.mem-card.done .mem-front.front-mem-logo-red { background: linear-gradient(180deg, #D6E6F0, #A9C7DB); }

/* Edgar im Seitenkasten */
#bitcard .card-body { position: relative; }
.edgar-card-img { float: right; width: 52px; height: auto; margin: -4px 0 4px 10px; }

/* Lösungswort prüfen */
.solve-form { display: grid; gap: 6px; margin-top: 4px; }
.solve-form label { font-weight: 700; color: var(--blue); font-size: 12px; }
.solve-form input {
  font: 800 16px var(--font); letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink);
  padding: 9px 11px; border-radius: 6px; border: 1px solid #C9D6DF; background: #fff; width: 100%;
}
.solve-form input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.solve-form input.shake { animation: shake .45s; }
.solve-msg { min-height: 1.3em; font-weight: 600; color: var(--red); }

/* Hörquiz + Bildquiz */
.quiz-media { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.quiz-play { min-width: 128px; }
.quiz-wave { font-size: 22px; }
.content img.quiz-img { max-height: 160px; width: auto; margin: 0 auto 10px; background: linear-gradient(180deg, #2E5F82, #1F4560); padding: 14px 18px; border-radius: 10px; }

/* Finale */
.finale { text-align: center; }
.content .finale-danke { width: 180px; margin: 0 auto 4px; }
.finale-birds { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.content .finale-birds img { width: 92px; margin: 0; border-radius: 0; }

/* Figuren im Text */
.content .figure-row { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 6px 0 14px; }
.content .figure-row img { width: 86px; margin: 0; border-radius: 0; }
.content .story-figure { float: right; width: 96px; margin: 0 0 8px 14px; border-radius: 0; }
@media (max-width: 520px) { .content .story-figure { width: 70px; } }

/* Bild-Zoom (Fehlerbild u. a.) */
.content img.zoomable { cursor: zoom-in; }
.content .zoom-btn { margin: 4px 0 12px; }
.zoom-overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(10, 25, 38, .92);
  display: grid; place-items: center; padding: 56px 16px 16px; overflow: auto; animation: fade .2s; cursor: zoom-out;
}
.zoom-grid { display: grid; gap: 16px; width: min(1800px, 100%); }
.zoom-grid.multi { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px), (orientation: portrait) { .zoom-grid.multi { grid-template-columns: 1fr; } }
.zoom-grid figure { margin: 0; cursor: default; }
.zoom-grid img { display: block; width: 100%; height: auto; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 8px; background: #fff; }
.zoom-grid figcaption { color: #fff; text-align: center; font-weight: 700; margin-top: 6px; font-size: 14px; }
.zoom-close {
  position: fixed; top: 12px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.18); color: #fff; font-size: 18px;
}
.zoom-close:hover { background: rgba(255,255,255,.32); }

/* Suchspiel: die verlorene Lichterkette */
.chain {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px 2px; padding-top: 6px;
  background: repeating-linear-gradient(180deg, transparent 0 2px, #2B2B2B 2px 4px, transparent 4px 52px) 0 0 / 100% 52px;
}
.chain-bulb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.chain-bulb img { width: 72%; max-width: 20px; display: block; transition: filter .3s; }
.chain-bulb span { font-size: 9px; font-weight: 700; color: #A7B8C5; }
.chain-bulb.got img { filter: drop-shadow(0 0 4px rgba(255, 220, 120, .95)); }
.chain-bulb.got span { color: var(--blue); }
.chain.complete .chain-bulb img { animation: twinkle 1.6s ease-in-out infinite; animation-delay: calc(var(--i) * -0.37s); }
@keyframes twinkle { 50% { filter: drop-shadow(0 0 8px rgba(255, 230, 140, 1)) brightness(1.25); } }
#bitcard[hidden] { display: none; }
.bit-hidden.bulb.bit-inline { width: 13px; height: 20px; }
.bit-hidden.bulb.bit-inline img { width: 13px; }
.bit-hidden.bulb.bit-corner { width: 18px; height: 22px; }
.bit-hidden.bulb.bit-corner img { width: 18px; }
.bit-hidden.bulb.is-found img { filter: drop-shadow(0 0 4px rgba(255, 220, 120, .95)); }
.bit-hidden.bulb.is-found.bit-inline { height: 20px; vertical-align: -3px; }
.bit-hidden.bulb.is-found.bit-corner { height: 22px; }
/* Fund-Meldung am rechten Rand nicht abschneiden */
.bit-hidden.bit-corner.right .bit-toast { left: auto; right: 0; transform: none; animation-name: tipR; }
@keyframes tipR { 0% { opacity: 0; transform: translateY(4px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* Gutschein (Container 6) */
.content .coupon { margin: 0 0 18px; border: 2px dashed var(--red); border-radius: 12px; background: #FFF6E8; padding: 12px 16px 6px; }
.content .coupon-head { font-weight: 900; color: var(--red); font-size: 17px; margin-bottom: 6px; }
.content .coupon p { margin-bottom: 8px; }
.content .coupon-code { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.content .coupon-code code { font: 900 20px var(--font); letter-spacing: 2px; background: #fff; border: 1px solid #E8C48F; padding: 6px 12px; border-radius: 8px; color: var(--blue-deep); }
