/* Roleplay Studio — Startseite, Abschnitt „Die Werkstatt": ein Zettelkasten aus Holz mit sechs Karteikarten.
   Immer nur eine Karte steht oben (Reiter wählen, Pfeiltasten, wechselt von selbst, solange niemand eingreift).
   Beim Aufschlagen schreibt sich das Beispiel in blauer Tinte von selbst ein. Ohne Skript stehen alle Karten untereinander. */

.werkstatt { position: relative; overflow: hidden; isolation: isolate; color: var(--creme);
  padding: clamp(80px, 9vw, 130px) clamp(12px, 4vw, 44px) clamp(80px, 9vw, 120px);
  background: linear-gradient(rgba(22, 9, 4, .84), rgba(22, 9, 4, .84)), url(/site/holz.svg) center / cover, #26120a; }
/* oben der dunkle Übergang aus dem Marmorpapier, darüber das Licht einer Schreibtischlampe */
.werkstatt::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(3, 14, 18, .92), rgba(0, 0, 0, 0) 150px),
    radial-gradient(52% 46% at 50% 46%, rgba(255, 196, 120, .24), rgba(255, 150, 60, .06) 60%, rgba(0, 0, 0, 0) 80%),
    radial-gradient(130% 100% at 50% 42%, rgba(0, 0, 0, 0) 45%, rgba(8, 3, 1, .82) 100%); }
.werkstatt-kopf { max-width: 1100px; margin: 0 auto clamp(40px, 5vw, 64px); text-align: center; }
.werkstatt-kopf h2 { margin: 6px auto 12px; color: #ffe9bf; text-shadow: 0 2px 18px rgba(0, 0, 0, .7); }
.werkstatt-lead { font-size: 21px; color: #dccfa8; text-wrap: balance; }
.werkstatt-tun { display: flex; justify-content: center; margin-top: clamp(40px, 5vw, 60px); }

/* ---------- Kasten ---------- */
.kasten { position: relative; max-width: 960px; margin: 0 auto; padding: 0 clamp(0px, 2vw, 26px); }
.zettel-karte { position: relative; z-index: 1; padding-top: 50px; transition: transform .42s cubic-bezier(.5, 0, .3, 1); }
.zettel-karte.zieht { transform: translateY(38px); transition-duration: .26s; }
.zettel-karte.zieht .zettel-flaeche { filter: brightness(.86); }

/* Reiter: die oberen Kanten der Karten dahinter; der gewählte gehört zur vorderen Karte */
.reiter { position: absolute; left: 0; right: 0; top: 0; height: 52px; display: flex; align-items: flex-end; gap: 6px; padding: 0 16px; }
.reiter-knopf { position: relative; flex: 1 1 0; min-width: 0; height: 42px; padding: 0 10px 4px; border: 0; border-radius: 10px 10px 0 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; overflow: hidden;
  font: 600 17px/1 var(--serif); color: #5a3a1a; -webkit-tap-highlight-color: transparent;
  background: url(/site/papier.svg), linear-gradient(180deg, #e2cb98, #cfb27a);
  box-shadow: inset 0 1px 0 rgba(255, 250, 230, .5), inset 0 -8px 10px -8px rgba(80, 45, 10, .55), 0 -3px 8px -2px rgba(0, 0, 0, .35);
  transform: translateY(8px); transition: transform .3s var(--weich), color .25s ease, filter .25s ease; }
.reiter-knopf i { font: 600 21px/1 var(--hand); font-style: normal; color: #b3261e; }
.reiter-knopf:hover { transform: translateY(2px); filter: brightness(1.05); }
.reiter-knopf[aria-selected="true"] { z-index: 2; height: 52px; transform: none; color: #2c1406; cursor: default;
  background: url(/site/papier.svg), linear-gradient(180deg, #f8f1dc, #f6eed8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 -4px 10px -3px rgba(0, 0, 0, .4); }
.reiter-knopf:focus-visible { outline: 3px solid #ffcf7a; outline-offset: -3px; border-radius: 10px 10px 0 0; }
/* Lauflinie: so lange bleibt die Karte oben, dann zieht der Kasten die nächste */
.reiter-knopf::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px; border-radius: 1px; background: #b3261e; opacity: .7; transform: scaleX(0); transform-origin: 0 50%; }
.kasten.laeuft .reiter-knopf[aria-selected="true"]::after { animation: reiter-lauf var(--takt, 7s) linear forwards; }
.kasten.haelt .reiter-knopf[aria-selected="true"]::after { animation-play-state: paused; }
@keyframes reiter-lauf { to { transform: scaleX(1); } }

/* Die vordere Karteikarte: rote Kopflinie, blaue Zeilen */
.zettel-flaeche { position: relative; display: grid; padding: 0 clamp(20px, 3.4vw, 40px) 118px; border-radius: 3px 3px 6px 6px; color: #2a2118;
  background: linear-gradient(180deg, transparent 0 55px, rgba(190, 40, 40, .62) 55px 57px, transparent 57px),
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(70, 110, 170, .16) 33px 34px) 0 57px,
    url(/site/papier.svg), linear-gradient(175deg, #f6eed8, #ebdfc0);
  box-shadow: 0 26px 44px -16px rgba(0, 0, 0, .85), 0 2px 2px rgba(0, 0, 0, .3); transition: filter .26s ease; }

/* ---------- eine Karte ---------- */
.zettel { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); grid-template-rows: auto 1fr; gap: 0 clamp(22px, 4vw, 46px); align-items: start; align-content: start; outline: none; }
.js .zettel { grid-area: 1 / 1; visibility: hidden; opacity: 0; transition: opacity .2s ease, visibility 0s linear .2s; }
.js .zettel.an { visibility: visible; opacity: 1; transition: opacity .3s ease .05s; }
.zettel + .zettel { margin-top: 40px; }   /* ohne Skript: untereinander */
.js .zettel + .zettel { margin-top: 0; }
.zettel:focus-visible .z-text h3 { outline: 3px solid #e0a040; outline-offset: 6px; border-radius: 3px; }
.z-kopf { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; height: 55px; padding: 0 2px 9px;
  font: 700 13px/1 "Courier New", Courier, monospace; letter-spacing: .14em; text-transform: uppercase; color: #6a4a2a; }
.z-ki { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 999px; font: 700 12px/1 "Courier New", Courier, monospace; letter-spacing: .1em;
  color: #9a2a14; background: rgba(179, 38, 30, .08); box-shadow: inset 0 0 0 1px rgba(179, 38, 30, .3); }
.z-ki::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffb36b, #c2410c 70%); box-shadow: 0 0 8px rgba(255, 140, 40, .8); }
.z-ki.leise { color: #4e5f7a; background: rgba(60, 90, 140, .07); box-shadow: inset 0 0 0 1px rgba(60, 90, 140, .28); }
.z-ki.leise::before { background: #6c86b0; box-shadow: none; }
.z-text { padding-top: 22px; }
.z-text h3 { margin-bottom: 12px; font: 400 clamp(28px, 3.1vw, 38px)/1.08 var(--alt); color: #2c1406; text-wrap: balance; }
.z-text p { font-size: 19px; line-height: 1.52; color: #40260f; text-wrap: pretty; hyphens: auto; }

/* Beispiel: ein ausgefüllter Vordruck in blauer Tinte */
.eintrag, .route, .begegnung { position: relative; margin-top: 26px; }
.eintrag { padding: 12px 18px 14px; border-radius: 3px; rotate: 1.2deg; background: rgba(255, 252, 240, .62); box-shadow: inset 0 0 0 1px rgba(120, 80, 30, .2), 0 10px 18px -12px rgba(60, 30, 8, .55); }
.eintrag p { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 7px 0 6px; border-bottom: 1px dotted rgba(90, 55, 20, .4); }
.eintrag p:last-of-type { border-bottom: 0; }
.eintrag b, .route b { font: 700 12px/1.25 "Courier New", Courier, monospace; letter-spacing: .1em; text-transform: uppercase; color: #8a5a2a; }
.handschrift { font: 500 25px/1.12 var(--hand); color: #1f3d75; }
.geschwaerzt { position: relative; color: transparent; border-radius: 2px; cursor: help;
  background: repeating-linear-gradient(-8deg, #1c1410 0 3px, #2c221c 3px 5px); box-shadow: 0 0 0 2px #1c1410; }
.wuerfel { position: absolute; right: -16px; top: -24px; width: 48px; height: 48px; rotate: 14deg; filter: drop-shadow(0 6px 6px rgba(60, 30, 8, .45)); }
.wuerfel svg { width: 100%; height: 100%; }
.wuerfel rect { fill: #f8f1e0; stroke: #8a5a2a; stroke-width: 1.6; }
.wuerfel circle { fill: #b3261e; }
.spielen { position: absolute; right: -12px; bottom: -22px; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; rotate: -12deg;
  font: 700 15px/1 "Courier New", Courier, monospace; letter-spacing: .12em; text-transform: uppercase; color: rgba(150, 30, 20, .85);
  box-shadow: inset 0 0 0 3px rgba(150, 30, 20, .7), inset 0 0 0 6px transparent, inset 0 0 0 7px rgba(150, 30, 20, .5); }

/* Roter Faden: drei Kapitel an einem Band */
.route { padding: 6px 0 4px; }
.route ol { position: relative; display: grid; gap: 18px; padding-left: 46px; }
.route li { position: relative; display: grid; gap: 3px; }
.route li::before { content: ""; position: absolute; left: -36px; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: #f6eed8; box-shadow: inset 0 0 0 3px #b3261e, 0 2px 4px rgba(60, 20, 8, .4); }
.route li.ok::before { background: radial-gradient(circle, #b3261e 0 5px, #f6eed8 5.5px); }
.route li.jetzt::before { background: #b3261e; box-shadow: inset 0 0 0 3px #b3261e, 0 0 0 6px rgba(179, 38, 30, .18), 0 2px 4px rgba(60, 20, 8, .4); }
.route li.zu::before { background: #e7dcc0; box-shadow: inset 0 0 0 3px rgba(179, 38, 30, .45); }
.route li.zu b { opacity: .7; }
.route .handschrift { font-size: 23px; }
.r-faden { position: absolute; left: 0; top: 0; width: 40px; height: 100%; overflow: visible; }
.r-faden path { fill: none; stroke: #b3261e; stroke-width: 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* Begegnung: ein Satz aus dem Buch, der Name wird erkannt, ein Figurenblatt rutscht herein */
.begegnung { display: grid; gap: 16px; }
.b-satz { padding: 2px 2px 0; font: italic 400 19px/1.5 var(--serif); color: #3a2410; }
.b-satz mark { color: inherit; background: linear-gradient(transparent 62%, rgba(255, 190, 70, .65) 62%) 0 0 / 100% 100% no-repeat; padding: 0 2px; font-style: normal; font-weight: 600; }
.b-zettel { position: relative; justify-self: end; display: grid; gap: 2px; width: min(100%, 300px); padding: 12px 16px 14px; border-radius: 3px; rotate: -1.6deg;
  background: url(/site/papier.svg), linear-gradient(175deg, #fffaf0, #f1e4c3); box-shadow: inset 4px 0 0 #b3261e, 0 14px 22px -12px rgba(60, 30, 8, .7); }
.b-neu { font: 700 11.5px/1.2 "Courier New", Courier, monospace; letter-spacing: .12em; text-transform: uppercase; color: #9a2a14; }
.b-zettel b { font: 400 26px/1.1 var(--alt); color: #2c1406; }
.b-zettel .handschrift { font-size: 22px; }
.b-knopf { justify-self: start; display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; padding: 7px 12px; border-radius: 7px; font: 600 15.5px/1 var(--serif); color: #fff4dc;
  background: linear-gradient(180deg, #4a2a12, #2a1608); box-shadow: 0 3px 0 #120803; }
.b-knopf i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font: 700 12px/1 var(--serif); font-style: normal; color: #2a1608; background: #ffc56e; }

/* ---------- Kasten aus Holz, davor ---------- */
.kasten-front { position: relative; z-index: 2; height: 128px; margin-top: -96px; border-radius: 5px 5px 12px 12px;
  background: linear-gradient(180deg, rgba(255, 220, 160, .16), rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, .25)), url(/site/holz.svg) center / 260% auto, linear-gradient(180deg, #8a5428, #4e2c12);
  box-shadow: inset 0 2px 0 rgba(255, 224, 170, .45), inset 0 0 0 1px rgba(40, 18, 6, .6), inset 0 -14px 22px rgba(0, 0, 0, .45), 0 30px 40px -14px rgba(0, 0, 0, .9); }
.kasten-front::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 12px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #a86c38, #6a4020); box-shadow: inset 0 1px 0 rgba(255, 230, 180, .5); }
/* Messing-Schild mit Zettel und Griffloch */
.schild { position: absolute; left: 50%; top: 22px; width: 230px; height: 52px; margin-left: -115px; padding: 5px; border-radius: 4px;
  background: linear-gradient(180deg, #f2d27a, #b8892c 55%, #7a561a); box-shadow: 0 2px 4px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 245, 200, .8); }
.schild::before, .schild::after { content: ""; position: absolute; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: #6e4c14; box-shadow: inset 0 1px 1px rgba(255, 240, 200, .6); }
.schild::before { left: 4px; } .schild::after { right: 4px; }
.schild span { display: grid; place-items: center; height: 100%; margin: 0 8px; border-radius: 2px; font: 500 25px/1 var(--hand); color: #2a1a0c; background: url(/site/papier.svg), #f4e8c8; box-shadow: inset 0 1px 3px rgba(60, 30, 8, .45); }
.griff { position: absolute; left: 50%; bottom: 14px; width: 64px; height: 22px; margin-left: -32px; border-radius: 0 0 32px 32px / 0 0 22px 22px; background: radial-gradient(120% 100% at 50% 0, #160a03 40%, #2c1608); box-shadow: inset 0 3px 6px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 220, 160, .25); }

/* ---------- Bewegung beim Aufschlagen einer Karte ---------- */
.js .zettel .handschrift { clip-path: inset(-20% 100% -20% 0); }
.js .zettel.an .handschrift { animation: tinte .85s cubic-bezier(.4, .1, .4, 1) forwards; animation-delay: calc(.35s + var(--n, 0) * .42s); }
.js .zettel .route li .handschrift { animation-delay: calc(.9s + var(--n, 0) * .45s); }
@keyframes tinte { to { clip-path: inset(-20% -4% -20% 0); } }
.js .zettel .geschwaerzt { clip-path: none; transform: scaleX(0); transform-origin: 0 50%; }
.js .zettel.an .geschwaerzt { animation: schwaerzen .5s ease forwards; animation-delay: 1.75s; }
@keyframes schwaerzen { to { transform: scaleX(1); } }
.js .zettel .wuerfel { opacity: 0; transform: translate(30px, -30px) rotate(140deg); }
.js .zettel.an .wuerfel { animation: wurf .9s cubic-bezier(.3, 1.4, .5, 1) 1.5s forwards; }
@keyframes wurf { 60% { opacity: 1; } to { opacity: 1; transform: none; } }
.js .zettel .spielen { opacity: 0; transform: scale(1.8); }
.js .zettel.an .spielen { animation: stempel .32s cubic-bezier(.3, 1.3, .6, 1) 2s forwards; }
@keyframes stempel { to { opacity: 1; transform: scale(1); } }
.js .zettel .r-faden { clip-path: inset(0 -20px 100% -20px); }
.js .zettel.an .r-faden { animation: faden-zieht 1.6s cubic-bezier(.4, .1, .3, 1) .3s forwards; }
@keyframes faden-zieht { to { clip-path: inset(0 -20px 0 -20px); } }
.js .zettel .route li::before { transform: scale(0); }
.js .zettel.an .route li::before { animation: punkt .4s cubic-bezier(.3, 1.5, .5, 1) forwards; animation-delay: calc(.45s + var(--n, 0) * .45s); }
@keyframes punkt { to { transform: scale(1); } }
.js .zettel .b-satz mark { background-size: 0 100%; }
.js .zettel.an .b-satz mark { animation: markieren .6s ease .7s forwards; }
@keyframes markieren { to { background-size: 100% 100%; } }
.js .zettel .b-zettel { opacity: 0; transform: translate(40px, 14px) rotate(6deg); }
.js .zettel.an .b-zettel { animation: herein .6s cubic-bezier(.2, .9, .3, 1.1) 1.35s forwards; }
@keyframes herein { to { opacity: 1; transform: none; } }
.js .zettel .b-zettel .handschrift { animation-delay: 1.9s; }
.js .zettel .b-knopf i { transform: scale(0); }
.js .zettel.an .b-knopf { animation: druecken .35s ease 2.9s; }
.js .zettel.an .b-knopf i { animation: punkt .35s cubic-bezier(.3, 1.6, .5, 1) 3.1s forwards; }
@keyframes druecken { 50% { transform: translateY(2px) scale(.97); box-shadow: 0 1px 0 #120803; } }

/* ---------- schmale Fenster ---------- */
@media (max-width: 860px) {
  .zettel { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  /* untereinander sind die Karten verschieden hoch: nur die obere steht im Fluss (der Sprung fällt ins Absinken) */
  .js .zettel:not(.an) { display: none; }
  .zettel-flaeche { padding-bottom: 112px; }
  .eintrag, .route, .begegnung { margin-top: 20px; }
  .b-zettel { justify-self: start; }
}
@media (max-width: 760px) {
  .kasten { padding: 0; }
  /* Reiter: eine Reihe zum Wischen; der gewählte rückt von selbst ins Bild */
  .reiter { overflow-x: auto; overflow-y: hidden; gap: 4px; padding: 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .reiter::-webkit-scrollbar { display: none; }
  /* Nichts ragt unten aus der Leiste: Ein Wischbereich ließe sich sonst auch senkrecht verschieben, und der Reiter hinge in der Luft */
  .reiter { overscroll-behavior-x: contain; }
  .reiter-knopf, .reiter-knopf:hover { flex: 0 0 auto; padding: 0 14px 4px; font-size: 16px; transform: none; }
  .z-text p { font-size: 17.5px; }
  .eintrag p { grid-template-columns: 92px minmax(0, 1fr); gap: 8px; }
  .handschrift { font-size: 23px; }
  .wuerfel { right: -6px; top: -26px; width: 40px; height: 40px; }
  .spielen { right: -4px; width: 72px; height: 72px; font-size: 13px; }
  .schild { width: 190px; margin-left: -95px; } .schild span { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .zettel .handschrift, .js .zettel.an .handschrift { clip-path: none; }
  .js .zettel .geschwaerzt, .js .zettel .wuerfel, .js .zettel .spielen, .js .zettel .route li::before, .js .zettel .b-zettel, .js .zettel .b-knopf i { opacity: 1; transform: none; }
  .js .zettel .r-faden { clip-path: none; }
  .js .zettel .b-satz mark { background-size: 100% 100%; }
  .zettel-karte.zieht { transform: none; }
}
