:root {
  --bg: #14213d; --bg2: #1d2f57; --card: #fff8ec; --ink: #2a2438; --muted: #6d6680;
  --gold: #f4c05a; --red: #c8453f; --green: #3f8f5f; --blue: #3b7ddd; --line: #e6dcc6;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: #fdf6e6;
  font-family: ui-rounded, "Avenir Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, var(--bg2), var(--bg));
  background-attachment: fixed;
}
.snow { position: fixed; inset: 0; pointer-events: none; opacity: .35;
  background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(2px 2px at 140px 90px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 80px 160px, #fff, transparent), radial-gradient(2px 2px at 200px 200px, #fff, transparent);
  background-size: 230px 230px; animation: fall 22s linear infinite; }
@keyframes fall { to { background-position: 40px 230px; } }
main { position: relative; max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; margin: .2em 0 .1em; text-align: center; }
a { color: var(--gold); }
button { font: inherit; cursor: pointer; }
.sub { text-align: center; color: #c5cbe0; margin: 0 0 18px; }

/* Kalender */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(6, 1fr); gap: 14px; } }
.door { aspect-ratio: 1 / 1.1; border: 0; border-radius: var(--radius); color: #fff; position: relative; overflow: hidden;
  font: 700 clamp(1.5rem, 6vw, 2.2rem) Georgia, serif; background: linear-gradient(145deg, #b83a3a, #8f2a35);
  box-shadow: 0 6px 14px #0006, inset 0 0 0 3px #ffffff22; transition: transform .15s; }
.door:nth-child(3n+1) { background: linear-gradient(145deg, #2f7a54, #1f5a40); }
.door:nth-child(3n+2) { background: linear-gradient(145deg, #3b6bb5, #284b86); }
.door:hover { transform: translateY(-3px) rotate(-1deg); }
.door.locked { filter: saturate(.35) brightness(.7); }
.door.locked:hover { transform: none; }
.door.today { outline: 3px solid var(--gold); outline-offset: 2px; animation: glow 2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 22px var(--gold); } }
.door .tick { position: absolute; right: 8px; bottom: 6px; font-size: 1.1rem; }
.door.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.footerbar { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn { background: var(--gold); color: #3a2a05; border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 700; text-decoration: none; display: inline-block; }
.btn.ghost { background: #ffffff1a; color: #fdf6e6; }
.btn:disabled { opacity: .5; cursor: default; }

/* Tag */
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.top a { text-decoration: none; }
.todo { background: #5a3f12; border: 1px dashed var(--gold); color: #ffe6b0; padding: 8px 12px; border-radius: 10px; font-size: .85rem; margin: 10px 0; }
.intro { text-align: center; color: #c5cbe0; max-width: 560px; margin: 6px auto 16px; }

.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 18px; margin: 12px 0; box-shadow: 0 8px 20px #0004; }
.card h3 { margin-top: 0; }
.progress { color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.q { font-size: 1.15rem; margin: .5em 0 1em; } .q.big { font-size: 2.2rem; letter-spacing: .1em; text-align: center; }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; padding: 12px 14px; border: 2px solid var(--line); background: #fff; border-radius: 10px; color: var(--ink); }
.opt:hover:not(:disabled) { border-color: var(--gold); }
.opt.ok { background: #d7f0df; border-color: var(--green); }
.opt.bad { background: #fadbd8; border-color: var(--red); animation: shake .35s; }
.fb { min-height: 1.4em; margin: 10px 0 0; font-weight: 600; }
.fb.ok { color: var(--green); } .fb.bad { color: var(--red); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type=text] { font: inherit; padding: 11px 13px; border: 2px solid var(--line); border-radius: 10px; flex: 1; min-width: 0; color: var(--ink); background: #fff; }
input[type=text]:focus { outline: none; border-color: var(--gold); }
.card .btn { margin-top: 10px; }

.reward { background: linear-gradient(135deg, #2c4a2e, #1e3a3a); border: 2px solid var(--gold); border-radius: var(--radius); padding: 16px; margin: 14px 0; text-align: center; }
.reward .note { transform: rotate(-2deg); display: inline-block; background: #fff3b0; color: #3a3220; padding: 14px 22px; border-radius: 4px; box-shadow: 0 6px 12px #0006; }
.note b { font: 700 1.4rem Georgia, serif; display: block; }
.letters { display: flex; justify-content: center; gap: 10px; margin: 12px 0; }
.letter { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 10px; background: var(--card); color: var(--ink); font: 700 1.8rem Georgia, serif; box-shadow: 0 4px 8px #0006; }
.letter.empty { background: #ffffff14; color: #ffffff55; box-shadow: none; border: 2px dashed #ffffff44; }

/* Bilder */
.imgframe { overflow: hidden; border-radius: 10px; background: #000; aspect-ratio: 4 / 3; }
.imgframe img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .7s ease; }
.mapbox { height: 340px; border-radius: 10px; margin: 10px 0; z-index: 0; }
.mapbox.leaflet-container { background: #bcd9ee; }

/* Cipher */
.cipher { font: 1.2rem/1.6 ui-monospace, Menlo, monospace; background: #fffdf5; border: 2px dashed var(--line); border-radius: 10px; padding: 14px; word-break: break-word; }
.dial { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.dial input[type=range] { flex: 1; accent-color: var(--gold); }

/* Logic */
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
@media (min-width: 640px) { .figures { grid-template-columns: repeat(6, 1fr); } }
.figure { position: relative; font: inherit; background: #dceaf7; border: 3px solid var(--line); border-radius: 12px; padding: 8px 4px 6px; text-align: center; color: var(--ink); }
.figure svg { display: block; width: 100%; height: auto; }
.figure > span:first-child { display: block; }
.figure .acc { position: absolute; right: 4px; bottom: 26px; font-size: 1.5rem; }
.figure .tag { font-size: .75rem; font-weight: 700; min-height: 1.2em; }
.figure.r0 { border-color: var(--blue); } .figure.r1 { border-color: var(--red); }
.seg { display: inline-flex; border-radius: 999px; overflow: hidden; border: 2px solid var(--line); }
.seg button { border: 0; padding: 8px 14px; background: #fff; color: var(--ink); }
.seg button.on { background: var(--gold); font-weight: 700; }
ul.hints { padding-left: 1.1em; margin: 6px 0 12px; }

/* Pinnwand */
.board { background: #a8774a; background-image: repeating-linear-gradient(45deg, #ffffff10 0 4px, transparent 4px 8px); border: 10px solid #6b4423; border-radius: 10px; padding: 20px; min-height: 240px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px; box-shadow: inset 0 0 30px #0006; }
.pin { background: #fff3b0; color: #3a3220; padding: 16px 10px 10px; border-radius: 3px; box-shadow: 0 5px 8px #0005; position: relative; font-size: .85rem; min-height: 100px; }
.pin::before { content: ""; position: absolute; top: 5px; left: 50%; width: 11px; height: 11px; margin-left: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a80, #c62828); }
.pin b { display: block; font: 700 1.1rem Georgia, serif; margin-bottom: 4px; }
.pin small { color: #7a6f50; display: block; margin-bottom: 4px; }
.pin:nth-child(odd) { transform: rotate(-2deg); } .pin:nth-child(even) { transform: rotate(1.5deg); background: #d9f0ff; }
.pin:nth-child(3n) { background: #ffd9e0; }
.pin.unknown { opacity: .55; text-align: center; font-size: 1.6rem; display: grid; place-items: center; }

/* Weekly */
.weeklist { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.chip { background: #fff3b0; border-radius: 6px; padding: 8px 12px; font-weight: 700; box-shadow: 0 2px 5px #0003; }
.chip.unknown { background: #eee; color: #999; }

/* Slide */
.tiles { display: grid; gap: 3px; width: min(100%, 420px); aspect-ratio: 4/3; margin: 10px auto; background: #0003; padding: 3px; border-radius: 8px; }
.tile { background-repeat: no-repeat; border-radius: 4px; cursor: pointer; transition: transform .1s; }
.tile.blank { visibility: hidden; }
.tile:hover { filter: brightness(1.12); }
.tiles.solved { gap: 0; padding: 0; } .tiles.solved .tile { border-radius: 0; }

/* Spot */
.spots { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .spots { grid-template-columns: 1fr 1fr; } }
.spot { position: relative; cursor: crosshair; border-radius: 10px; overflow: hidden; line-height: 0; border: 3px solid transparent; }
.spot img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.spot .marker { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 3px solid var(--green); border-radius: 50%; pointer-events: none; }
.spot .marker.bad { border-color: var(--red); }

/* Wortsuchsel */
.ws { display: grid; gap: 3px; width: min(100%, 440px); margin: 10px auto; user-select: none; }
.ws button { aspect-ratio: 1; border: 0; border-radius: 6px; background: #fff; color: var(--ink); font: 700 clamp(.9rem, 4vw, 1.3rem) ui-monospace, Menlo, monospace; padding: 0; }
.ws button.start { background: var(--gold); } .ws button.found { background: #b6e3c3; }
.words { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.words span { padding: 4px 10px; border-radius: 999px; background: #eee; font-weight: 600; }
.words span.found { text-decoration: line-through; background: #b6e3c3; color: #555; }

/* Sort */
.sortlist { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.sortlist li { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.sortlist li.ok { border-color: var(--green); background: #e6f6ec; } .sortlist li.bad { border-color: var(--red); }
.sortlist li span { flex: 1; }
.sortlist button { border: 0; background: var(--line); border-radius: 8px; width: 34px; height: 34px; }

/* Wordle */
.wboard { display: grid; gap: 6px; justify-content: center; margin: 10px 0; }
.wrow { display: flex; gap: 6px; justify-content: center; }
.wc { width: 46px; height: 46px; display: grid; place-items: center; font: 700 1.5rem ui-monospace, Menlo, monospace; border: 2px solid var(--line); border-radius: 8px; background: #fff; }
.wc.fill { border-color: #aaa; } .wc.g { background: var(--green); color: #fff; border-color: var(--green); }
.wc.y { background: #d9a627; color: #fff; border-color: #d9a627; } .wc.x { background: #8a8794; color: #fff; border-color: #8a8794; }
.kb { display: grid; gap: 6px; margin-top: 12px; }
.kbrow { display: flex; gap: 4px; justify-content: center; }
.kbrow button { border: 0; background: var(--line); border-radius: 6px; min-width: 28px; height: 42px; padding: 0 6px; font-weight: 700; color: var(--ink); flex: 1; max-width: 42px; }
.kbrow button.wide { max-width: 64px; }
.kbrow button.g { background: var(--green); color: #fff; } .kbrow button.y { background: #d9a627; color: #fff; } .kbrow button.x { background: #8a8794; color: #fff; }

/* Kreuzwort */
.cw { display: grid; gap: 2px; margin: 10px auto; width: max-content; max-width: 100%; }
.cw .cell { position: relative; width: clamp(28px, 7.5vw, 40px); height: clamp(28px, 7.5vw, 40px); }
.cw .cell.black { visibility: hidden; }
.cw input { width: 100%; height: 100%; text-align: center; text-transform: uppercase; font: 700 1.1rem ui-monospace, Menlo, monospace; border: 2px solid #b9ae95; border-radius: 4px; padding: 0; background: #fff; color: var(--ink); caret-color: transparent; }
.cw input:focus { background: #fff0c4; border-color: var(--gold); outline: none; }
.cw input.ok { background: #d7f0df; } .cw input.bad { background: #fadbd8; }
.cw .num { position: absolute; top: 1px; left: 3px; font-size: .6rem; color: var(--muted); pointer-events: none; }
.clues { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: .9rem; }
.clues h4 { margin: 0 0 4px; } .clues ol { margin: 0; padding-left: 0; list-style: none; } .clues li { padding: 2px 0; cursor: pointer; }

/* Kryptex */
.kryptex { display: flex; justify-content: center; gap: 6px; margin: 20px 0; padding: 18px 10px; background: linear-gradient(#5a4126, #3a2916 50%, #5a4126); border-radius: 18px; box-shadow: inset 0 0 20px #0008, 0 8px 20px #0008; }
.ring { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ring button.step { border: 0; background: #ffffff22; color: #fdf6e6; width: 38px; height: 28px; border-radius: 6px; }
.ring .face { width: 38px; height: 52px; display: grid; place-items: center; background: linear-gradient(#e8d9b5, #fff8ec 50%, #e8d9b5); color: var(--ink); font: 700 1.7rem Georgia, serif; border-radius: 6px; box-shadow: inset 0 0 8px #0006; }
@media (min-width: 520px) { .kryptex { gap: 10px; } .ring button.step { width: 48px; } .ring .face { width: 48px; } }
.kryptex.open { animation: glow 1.4s ease-in-out 3; }
.reveal { text-align: center; padding: 24px; }
.reveal h2 { font: 700 3rem Georgia, serif; color: var(--gold); margin: 0 0 8px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 80px); background: #000c; color: #fff; padding: 10px 18px; border-radius: 999px; transition: transform .3s; max-width: 90vw; text-align: center; z-index: 9999; }
#toast.show { transform: translate(-50%, 0); }
