/* Kartenstapel und Farbwelten aus mockup1, ohne globale Mockup-Selektoren. */
@property --sky { syntax: "<color>"; inherits: true; initial-value: #203d43; }
@property --horizon { syntax: "<color>"; inherits: true; initial-value: #b47d59; }
@property --glow { syntax: "<color>"; inherits: true; initial-value: rgba(235, 181, 111, .36); }

body {
  --sky: #203d43;
  --horizon: #b47d59;
  --glow: rgba(235, 181, 111, .36);
  --gold: #f3d996;
  --midnight: #182325;
  --slate: #27342f;
  --slate-2: #34433c;
  --text: #f9f4e9;
  --muted: #d3d0c3;
  --amber: #f3d996;
  --cyan: #e5c985;
  --font-head: Georgia, "Times New Roman", serif;
  --font-body: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  background: radial-gradient(ellipse at 50% 46%, var(--glow), transparent 44%), linear-gradient(180deg, var(--sky), #243438 53%, var(--horizon) 120%);
  background-attachment: fixed;
  transition: --sky 900ms ease, --horizon 900ms ease, --glow 900ms ease;
}
body[data-story="einhorn"] { background: radial-gradient(ellipse at 50% 46%, var(--glow), transparent 44%), linear-gradient(180deg, var(--sky), #243438 53%, var(--horizon) 120%); background-attachment: fixed; }
body[data-deck-theme="princess"] { --sky: #51403f; --horizon: #ad746b; --glow: rgba(244, 202, 151, .4); }
body[data-deck-theme="unicorn"] { --sky: #30464c; --horizon: #b58a73; --glow: rgba(237, 211, 161, .36); }
body[data-deck-theme="pirate"] { --sky: #123d51; --horizon: #bd8057; --glow: rgba(236, 173, 104, .4); }
body[data-deck-theme="dinosaur"] { --sky: #385832; --horizon: #89774b; --glow: rgba(204, 172, 103, .38); }
body::before, body::after { position: fixed; z-index: -1; pointer-events: none; content: ""; }
body::before { inset: 0; opacity: .21; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }
body::after { width: min(90vw, 900px); height: min(90vw, 900px); top: 3%; left: 50%; border: 1px solid rgba(255,242,207,.08); border-radius: 50%; box-shadow: 0 0 0 36px rgba(255,242,207,.025), 0 0 0 85px rgba(255,242,207,.018); transform: translateX(-50%); }
.topbar { background: rgba(24,35,37,.8); border-bottom-color: rgba(255,246,224,.16); }
.brand-name { font: 600 14px/1 Georgia, serif; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { width: 25px; height: 25px; border: 1px solid var(--gold); background: transparent; box-shadow: none; }
.brand-mark::after { content: "✦"; inset: 0; display: grid; place-items: center; background: none; color: var(--gold); font-size: 15px; }
.profile-link { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid rgba(255,246,224,.4); border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.profile-link svg { width: 23px; height: 23px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.actions { background: rgba(24,35,37,.94); }
body:has(.story-selection) main { max-width: 1120px; padding: 18px 20px; display: grid; align-items: center; }
body:has(.story-selection) .phases { display: none; }
.story-selection { display: grid; grid-template-columns: minmax(180px,1fr) minmax(280px,390px) minmax(180px,1fr); align-items: center; gap: clamp(18px,4vw,56px); }
.deck-intro { padding-bottom: 48px; }
.deck-intro h1 { max-width: 340px; margin-bottom: 14px; font: 400 48px/.98 Georgia, serif; letter-spacing: 0; }
.deck-intro p:not(.eyebrow) { max-width: 280px; color: rgba(255,248,233,.72); font-size: 14px; line-height: 1.65; }
.story-selection .eyebrow { color: var(--gold); font-size: 10px; letter-spacing: .22em; margin-bottom: 15px; }
.chapter-mark { width: 46px; height: 1px; margin: 26px 0; background: linear-gradient(90deg,var(--gold),transparent); }
.deck-zone { min-width: 0; display: grid; justify-items: center; gap: 17px; }
.deck-caption { width: 100%; display: flex; justify-content: space-between; padding: 0 2px; color: rgba(255,248,233,.79); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.deck-count { color: var(--gold); font-variant-numeric: tabular-nums; }
.card-stack { position: relative; width: min(100%,356px); aspect-ratio: .675; perspective: 1300px; isolation: isolate; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.deck-card { position: absolute; inset: 0; z-index: 4; --drag-x: 0px; --drag-rotation: 0deg; border-radius: 16px; transform: translateX(var(--drag-x)) rotateZ(var(--drag-rotation)); transform-style: preserve-3d; transition: transform 420ms cubic-bezier(.2,.8,.2,1); }
.card-turn { position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 26px 28px rgba(7,16,16,.43); transform: rotateY(0deg); transform-style: preserve-3d; transition: transform 650ms cubic-bezier(.2,.8,.2,1); }
.card-turn::before { position: absolute; inset: 0; border-radius: inherit; background: #27302c; backface-visibility: visible; content: ""; }
.deck-card.is-flipped .card-turn { transform: rotateY(180deg); }
.deck-card:not(.is-active) .card-turn { transition: none; }
.deck-card.is-next { z-index: 2; transform: rotate(5deg) translate(9px,2px) scale(.98); }
.deck-card.is-bottom { z-index: calc(3 - var(--stack-depth)); transform: rotate(calc(-3deg * var(--stack-depth))) translate(calc(-4.5px * var(--stack-depth)),1px) scale(calc(1 - .02 * var(--stack-depth))); }
.deck-card.is-leaving { z-index: 5; pointer-events: none; transition: none; }
.card-stack.is-dragging .is-active { transition: none; }
.deck-card:not(.is-active) { pointer-events: none; }
.story-selection .card-face { position: absolute; inset: 0; overflow: hidden; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.story-selection .front-face { padding: 9px; display: flex; flex-direction: column; border: 0; background: #27302c; text-align: left; cursor: pointer; color: var(--text); transform: translateZ(1px); font: inherit; }
.story-selection .front-face::after { position: absolute; inset: 0; z-index: 3; border-radius: 16px; background: rgba(11,19,18,.42); opacity: 0; pointer-events: none; content: ""; transition: opacity 420ms; }
.is-next .front-face::after, .is-bottom .front-face::after { opacity: 1; }
.front-art { position: absolute; inset: 9px; overflow: hidden; border-radius: 10px; background: #374b42; }
.front-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.front-art::after { position: absolute; inset: 0; background: radial-gradient(ellipse at 52% 35%,rgba(255,246,219,.28),transparent 35%), linear-gradient(180deg,transparent 28%,rgba(11,17,16,.12) 48%,rgba(11,17,16,.95)); pointer-events: none; content: ""; }
.placeholder-art { height: 100%; display: grid; place-items: center; font-size: 110px; background: radial-gradient(circle at 65% 30%,#e0b88155,transparent 40%),linear-gradient(145deg,#24424a,#b47d59); }
.front-head { position: relative; z-index: 1; min-height: 37px; display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 0; color: #fff1c8; text-shadow: 0 1px 5px #000b; }
.front-edition { font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.front-symbol { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #ffeebfc7; border-radius: 50%; font: 16px/1 Georgia,serif; }
.front-title { position: relative; z-index: 1; margin: auto 0 12px; padding: 0 15px 13px; color: #fff7e6; text-shadow: 0 2px 18px #000c; }
.front-title small { display: block; margin-bottom: 7px; color: #f5dfa4; font-size: 9px; font-weight: 700; letter-spacing: .21em; text-transform: uppercase; }
.front-title strong { display: block; font: 400 30px/.98 Georgia,serif; }
.story-selection .flip-hint { position: relative; z-index: 1; margin: 0 15px 13px; color: rgba(255,246,223,.74); font-size: 9px; letter-spacing: .15em; text-transform: uppercase; }
.story-selection .back-face { padding: 25px 23px 20px; display: flex; flex-direction: column; gap: 13px; border: 1px solid rgba(247,226,179,.65); background: radial-gradient(ellipse at 100% 0,rgba(212,169,91,.23),transparent 46%),linear-gradient(145deg,#27342f,#172321 80%); transform: rotateY(180deg) translateZ(1px); }
.back-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid rgba(240,218,164,.34); }
.age-stat { color: #f6e2ae; font-size: 9px; font-weight: 750; letter-spacing: .17em; line-height: 1.45; text-transform: uppercase; }
.tone-tag { max-width: 130px; padding: 6px 9px; border: 1px solid rgba(232,199,133,.45); color: #f4e7ca; font-size: 9px; text-align: right; }
.story-selection .back-title { margin: 0; color: #fff6e2; font: 400 25px/1.05 Georgia,serif; }
.premise { margin: 0; color: rgba(255,248,232,.81); font: 13px/1.48 Georgia,serif; }
.deck-mechanics { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 0; margin: 0; list-style: none; font-size: 10px; color: #e5c985; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); margin-top: auto; border-block: 1px solid rgba(240,218,164,.35); }
.stat { min-width: 0; padding: 11px 6px 10px; text-align: center; }
.stat + .stat { border-left: 1px solid rgba(240,218,164,.28); }
.stat strong { display: block; margin-bottom: 5px; color: #fff1c7; font: 400 16px/1 Georgia,serif; white-space: nowrap; }
.stat span { display: block; color: #d2c8ae; font-size: 8px; line-height: 1.25; text-transform: uppercase; }
.back-actions { display: flex; gap: 10px; margin-top: auto; }
.pick-button { min-height: 42px; flex: 1; border: 1px solid #f3d995; border-radius: 3px; background: linear-gradient(105deg,#f4dfaa,#d6aa60 48%,#f7e8ba); box-shadow: 0 5px 18px #050a0840,inset 0 1px #ffffffa6; color: #33291c; cursor: pointer; font: 750 10px var(--font-body); letter-spacing: .16em; text-transform: uppercase; }
.pick-button:disabled { opacity: .5; cursor: default; }
.pick-button:hover:not(:disabled) { filter: brightness(1.09); }
.card-border { position: absolute; inset: -2px; z-index: 4; border: 2px solid #d6aa60; border-radius: 18px; box-shadow: inset 0 0 0 1px #fff5d566,0 0 0 1px #fff1bd66; pointer-events: none; transform: translateZ(3px); }
.card-border::after { position: absolute; inset: 5px; border: 1px solid rgba(255,235,185,.54); border-radius: 12px; content: ""; }
.occasion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); justify-content: center; gap: 24px; margin: 22px 0; }
.occasion-card { position: relative; min-width: 0; aspect-ratio: .74; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px; border: 0; border-radius: 16px; background: #102124; color: var(--text); box-shadow: 0 16px 26px #07101055; cursor: pointer; font: inherit; text-align: left; transition: transform 180ms ease, box-shadow 180ms ease; }
.occasion-card .card-border { opacity: .7; transition: opacity 180ms ease; }
.occasion-card:hover { transform: translateY(-4px); }
.occasion-card:hover .card-border, .occasion-card.selected .card-border { opacity: 1; }
.occasion-card.selected { box-shadow: 0 0 0 4px #f3d99625, 0 16px 26px #07101055; }
.occasion-art { position: absolute; top: 8px; left: 8px; display: block; width: calc(100% - 16px); height: auto; border-radius: 10px; mask-image: linear-gradient(#000 76%, transparent); }
.occasion-copy { position: relative; min-width: 0; display: grid; gap: 12px; padding: 20px 18px 18px; text-shadow: 0 2px 12px #071010; }
.occasion-copy strong { color: #fff1c7; font: 400 29px/1.1 Georgia, serif; }
.occasion-copy > span { color: #eee9dc; font-size: 14px; line-height: 1.45; }
.occasion-check { position: absolute; z-index: 2; top: 16px; right: 16px; display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--gold); border-radius: 50%; background: var(--midnight); color: var(--gold); visibility: hidden; }
.occasion-card.selected .occasion-check { visibility: visible; }
@media (max-width: 600px) {
  .occasion-grid { gap: 14px; margin: 18px 0; }
  .occasion-card { aspect-ratio: .62; }
  .occasion-copy { gap: 7px; padding: 12px 6px 10px; }
  .occasion-copy strong { font-size: clamp(16px, 4.5vw, 23px); }
  .occasion-copy > span { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .occasion-card, .occasion-card .card-border { transition: none; }
}
.story-selection:not(.is-grid) .card-stack.is-picked .is-next { animation: deck-fall-left 680ms forwards; }
.story-selection:not(.is-grid) .card-stack.is-picked .is-bottom { animation: deck-fall-right 740ms forwards; }
.story-selection:not(.is-grid) .card-stack.is-picked .is-active, .story-card-dialog.is-picked .deck-card { animation: deck-chosen 680ms forwards; }
@keyframes deck-fall-left { to { opacity: 0; transform: translate(-120px,170px) rotate(-35deg) scale(.72); } }
@keyframes deck-fall-right { to { opacity: 0; transform: translate(120px,190px) rotate(34deg) scale(.72); } }
@keyframes deck-chosen { 45% { transform: translateY(-16px) scale(1.025); } to { transform: translateY(3px) scale(1.01); } }
.deck-controls { width: 100%; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; }
.nav-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(250,237,209,.42); border-radius: 50%; background: rgba(11,22,23,.18); color: #fff2d1; cursor: pointer; font: 26px Georgia,serif; }
.nav-button:disabled { opacity: .3; cursor: default; }
.pagination { display: flex; justify-content: center; gap: 8px; }
.page-dot { width: 23px; height: 24px; padding: 0; border: 0; background: linear-gradient(rgba(255,246,226,.3),rgba(255,246,226,.3)) center/100% 3px no-repeat; cursor: pointer; transition: width 240ms; }
.page-dot[aria-current="true"] { width: 37px; background-image: linear-gradient(var(--gold),var(--gold)); }
.deck-note { justify-self: end; width: min(100%,215px); padding: 0 0 0 20px; border-left: 1px solid rgba(240,218,164,.4); color: rgba(255,248,233,.72); font: 17px/1.6 Georgia,serif; }
@media (max-width: 820px) {
  body:has(.story-selection) main { max-width: 520px; padding: 8px 16px 16px; align-items: start; }
  .story-selection { grid-template-columns: 1fr; gap: 8px; }
  .deck-intro { padding: 0; text-align: center; }
  .deck-intro h1 { max-width: none; font-size: 34px; margin-bottom: 5px; }
  .deck-intro h1 br { display: none; }
  .deck-intro p:not(.eyebrow), .chapter-mark, .deck-note { display: none; }
  .story-selection .eyebrow { margin-bottom: 7px; }
  .deck-zone { gap: 11px; }
  .deck-caption { max-width: 360px; }
  .card-stack { width: min(76vw,350px,(100svh - 230px)*.675); min-width: 240px; }
  .story-selection .back-face { padding: 22px 20px 17px; gap: 11px; }
  .topbar-link { font-size: 12px; padding: 6px 9px; }
}
@media (max-width: 430px) {
  .topbar { gap: 8px; padding-inline: 12px; }
  .save-state { position: fixed; top: 64px; right: 12px; pointer-events: none; }
  .brand { margin-right: auto; }
  .brand-name { font-size: 12px; }
  .token-chip { font-size: 10px; padding: 4px; }
  .deck-intro .eyebrow { display: none; }
  .deck-intro h1 { margin: 0; font-size: 27px; }
  .deck-zone { gap: 9px; }
  .deck-caption { max-width: 324px; font-size: 9px; }
  .card-stack { width: min(84vw,324px,(100svh - 235px)*.675); }
  .front-title strong { font-size: 27px; }
  .story-selection .back-face { padding: 19px 17px 15px; gap: 9px; }
  .story-selection .back-title { font-size: 22px; }
  .premise { font-size: 12px; line-height: 1.4; }
  .stat { padding: 9px 3px 8px; }
  .stat strong { font-size: 14px; }
  .stat span { font-size: 7px; }
  .deck-mechanics { font-size: 9px; gap: 2px 7px; }
  .pick-button { min-height: 39px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .story-selection *, body { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media (max-width: 360px) {
  .card-stack { width: min(88vw,280px); min-width: 260px; }
  .story-selection .back-face { padding: 14px; gap: 7px; }
  .story-selection .back-title { font-size: 20px; }
  .premise { font-size: 11px; line-height: 1.35; }
  .tone-tag { max-width: 110px; padding: 4px 6px; font-size: 8px; }
  .deck-mechanics { font-size: 8px; }
  .stat { padding-block: 7px; }
  .story-selection .back-face .flip-hint { margin-bottom: 0; font-size: 8px; }
}

.story-layout-toggle { padding: 0; background: transparent; cursor: pointer; transition: background 180ms, border-color 180ms; }
.story-layout-toggle:hover, .story-layout-toggle[aria-pressed="true"] { border-color: var(--gold); background: rgba(243,217,150,.13); }
.story-layout-toggle[aria-pressed="true"] .story-icon-grid, .story-layout-toggle[aria-pressed="false"] .story-icon-stack { display: none; }
.account-control { position: relative; flex: 0 0 auto; }
.account-menu { position: absolute; top: calc(100% + 12px); right: 0; z-index: 30; width: min(380px,calc(100vw - 40px)); max-height: calc(100dvh - 95px); overflow-y: auto; overscroll-behavior: contain; padding: 22px 18px 18px; border: 1px solid rgba(243,217,150,.45); border-radius: 16px; background: #20302b; box-shadow: 0 20px 55px #0009; transform-origin: top right; animation: account-menu-in 180ms ease-out; }
.account-menu-close { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 24px; cursor: pointer; }
.account-menu .auth { max-width: none; margin: 0; padding: 6px 0 0; text-align: left; }
.account-menu h2 { margin: 0 22px 12px 0; font: 400 24px/1.15 Georgia,serif; }
.account-menu .lead { font-size: 13px; }
.account-menu .auth-form { margin: 14px 0; padding: 0; background: none; box-shadow: none; }
.account-menu .auth-form input:not([type="checkbox"]) { width: 100%; min-width: 0; }
.remember-me { display: flex; align-items: center; gap: 9px; margin-block: 14px; cursor: pointer; font-size: 13px; }
.auth-form .remember-me input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--gold); }
.account-menu .btn { min-height: 42px; font-size: 13px; }
.account-menu .cta-stack { display: flex; gap: 8px; }
.account-menu .cta-stack .btn { flex: 1; padding-inline: 8px; }
.account-menu .small { font-size: 12px; }
.account-adventures { display: flex; justify-content: space-between; margin: 4px 20px 18px 0; padding: 0 0 13px; border-bottom: 1px solid #f3d99640; color: var(--gold); font-weight: 600; text-decoration: none; }
@keyframes account-menu-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
body:has(.story-selection.is-grid) main { max-width: 1120px; align-items: start; padding: 24px 20px 36px; }
.story-selection.is-grid { grid-template-columns: 1fr; gap: 24px; }
.is-grid .deck-intro { padding: 0; text-align: center; }
.is-grid .deck-intro h1 { max-width: none; font-size: clamp(27px,4vw,40px); }
.is-grid .deck-intro h1 br { display: none; }
.is-grid .deck-intro p:not(.eyebrow) { max-width: none; margin-bottom: 0; }
.is-grid .chapter-mark, .is-grid .deck-note, .is-grid .deck-controls { display: none; }
.is-grid .deck-zone { gap: 20px; }
.is-grid .deck-caption { width: 100%; max-width: 960px; }
.is-grid .card-stack { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 32px; width: 100%; max-width: 1000px; min-width: 0; aspect-ratio: auto; }
.is-grid .card-stack > .deck-card { position: relative; inset: auto; z-index: auto; width: 100%; max-width: min(280px,calc(100vw - 90px)); aspect-ratio: .675; justify-self: center; transform: none; pointer-events: auto; transition: none; }
.is-grid .card-stack .front-face::after { opacity: 0; }
.is-grid .card-stack .front-title strong { font-size: 25px; }
.is-grid .card-stack > .deck-card.is-previewed { opacity: 0; }
body.story-card-open { overflow: hidden; }
html:has(.story-card-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
.story-card-dialog { position: fixed; inset: 0; width: min(420px,calc(100vw - 40px),calc((100svh - 110px)*.675)); max-width: none; max-height: none; margin: auto; padding: 0; border: 0; border-radius: 16px; background: transparent; box-shadow: none; overflow: visible; perspective: 1300px; }
.story-card-dialog::backdrop { background: rgba(8,18,18,.78); backdrop-filter: blur(9px); animation: story-backdrop-in 350ms ease both; }
.story-card-dialog.is-closing::backdrop { animation: story-backdrop-out 420ms ease both; }
.story-dialog-content { position: relative; width: 100%; aspect-ratio: .675; }
.story-card-close { position: absolute; top: -48px; right: 0; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(250,237,209,.6); border-radius: 50%; background: #203331; color: var(--text); font: 28px/1 var(--font-body); cursor: pointer; }
.story-card-dialog .back-face { overflow-y: auto; overscroll-behavior: contain; }
.story-card-dialog .back-face > * { flex-shrink: 0; }
.story-card-dialog.is-closing .card-turn { transition-duration: 420ms; }
@keyframes story-backdrop-in { from { background: transparent; backdrop-filter: blur(0); } }
@keyframes story-backdrop-out { to { background: transparent; backdrop-filter: blur(0); } }
@media (min-width: 600px) and (max-width: 1000px) {
  .is-grid .card-stack { grid-template-columns: repeat(2,minmax(0,1fr)); max-width: 660px; }
  .is-grid .deck-caption { max-width: 640px; }
}
@media (max-width: 599px) {
  .is-grid .card-stack { grid-template-columns: 1fr; gap: 28px; }
  .is-grid .deck-caption { max-width: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  .story-card-dialog::backdrop { animation: none; }
  .account-menu { animation: none; }
}
