/* ---------- Rätsel: Rahmen ---------- */
[data-riddle] { container-type: inline-size; }
.r-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); }
.r-head h3 { font: 700 28px/1.1 var(--serif); margin: 2px 0 6px; }
.r-intro { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.rb-board { border-radius: 22px; }
.board-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.r-msg { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--panel2); font: italic 500 19px/1.4 var(--serif); }
.r-msg.ok { background: rgba(239,233,220,.08); border: 1px solid rgba(239,233,220,.4); color: #fff8e8; }
.r-msg.bad { background: rgba(181,51,42,.12); border: 1px solid rgba(181,51,42,.5); }
.r-ctrl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.r-solution { margin-top: 12px; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.r-solution span { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: var(--accent-hi); }
.r-solution em { font-style: normal; }
.rb-help { text-align: center; color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }

/* ---------- Brett & Schnitzereien ---------- */
.numeral { font: 700 34px var(--serif); fill: #2a1508; }
.insc { font-family: var(--serif); font-style: italic; font-weight: 700; fill: #2a1508; }
.numeral.hi, .insc.hi, .carve-title.hi { fill: rgba(255,226,182,.3); }
.carve-title { font: 700 40px var(--serif); fill: #2a1508; }
.carve { fill: none; stroke: #2c1609; stroke-width: 5; }
.carve-hi { fill: none; stroke: rgba(255,226,182,.28); stroke-width: 2.5; transform: translate(1.6px, 1.6px); }
.carve.faint { stroke-dasharray: 3 9; stroke-width: 3; opacity: .55; }
.g-rim { fill: none; stroke: rgba(10,4,0,.55); stroke-width: 3; transition: stroke .15s; }
.groove.hot .g-rim { stroke: var(--gold); stroke-width: 5; filter: drop-shadow(0 0 8px rgba(210,162,76,.9)); }
.rope-l { font: 600 17px var(--sans); fill: rgba(239,226,196,.55); letter-spacing: .06em; pointer-events: none; }
.meaning {
  font: 700 21px var(--sans); letter-spacing: .16em; text-transform: uppercase; fill: #ffd98a;
  paint-order: stroke; stroke: #1a0d05; stroke-width: 5px; animation: meaningIn .9s ease both;
}
@keyframes meaningIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Schnüre ---------- */
.rope { touch-action: none; }
.st-open .rope { cursor: grab; }
.st-open .rope:hover .r-base, .st-open .rope:hover .r-tw { stroke-width: 16; }
.rope.lift { cursor: grabbing; filter: drop-shadow(0 14px 10px rgba(0,0,0,.6)); }
.rope path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.r-sh { stroke: #000; opacity: .45; stroke-width: 15; transform: translate(2px, 5px); }
.r-base { stroke: var(--c); stroke-width: 14; transition: stroke-width .12s; }
.r-tw { stroke: color-mix(in srgb, var(--c), #000 45%); stroke-width: 14; stroke-dasharray: 3 7; opacity: .6; transition: stroke-width .12s; }
.r-hi { stroke: #fff; opacity: .25; stroke-width: 3; transform: translateY(-3px); }
.r-end { fill: var(--c); stroke: color-mix(in srgb, var(--c), #000 50%); stroke-width: 3; }
.r-hit { stroke: transparent; stroke-width: 46; pointer-events: stroke; }
.rope.loose .r-sh { opacity: .6; }

/* ---------- Gelöst: drei Fäden knoten sich am Medaillon, der weiße löst sie ---------- */
.k-ring, .k-free { fill: none; stroke: var(--c); stroke-dasharray: 100; stroke-linecap: round; transform-box: view-box; transform-origin: var(--ox) var(--oy); }
.k-ring { stroke-width: 10; stroke-dashoffset: 0; transform: scale(1.12); filter: drop-shadow(0 3px 3px rgba(0,0,0,.6)); }
.k-free { stroke-width: 7; stroke-dashoffset: 0; }
.st-solved .carve.faint { opacity: 0; }
.st-solved .rope.tied { opacity: .28; }
.st-solved .rope.free { filter: drop-shadow(0 0 9px rgba(255,246,220,.9)); }
.anim .k-ring { animation: kDraw 1s ease-out calc(var(--d, 0s) + var(--t, 0s)) both, kLoosen 1.4s ease-in-out calc(3.4s + var(--t, 0s)) both; }
.anim .k-free { animation: kDraw 1.5s ease-in-out calc(1.9s + var(--t, 0s)) both, kGlow 2.4s ease-in-out calc(3.4s + var(--t, 0s)) infinite alternate; }
.anim .rope.tied { animation: tie 1.4s ease-in-out calc(.2s + var(--t, 0s)) both; }
.anim .rope.free { animation: freeGlow 1.6s ease-out calc(1.9s + var(--t, 0s)) both; }
.done .k-free { animation: kGlow 2.4s ease-in-out infinite alternate; }
@keyframes kDraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes kLoosen { from { transform: scale(.94); } to { transform: scale(1.12); } }
@keyframes kGlow { from { opacity: .85; } to { opacity: 1; stroke-width: 9; } }
@keyframes tie { 0% { opacity: 1; transform: none; } 45% { opacity: 1; transform: translateY(-6px); } 100% { opacity: .28; transform: none; } }
@keyframes freeGlow { from { filter: none; } to { filter: drop-shadow(0 0 9px rgba(255,246,220,.9)); } }

/* ---------- Falsch: die Schnüre springen aus den Vertiefungen ---------- */
.st-wrong .rope.placed { opacity: .2; }
.anim.st-wrong .rope.placed { animation: fall 1.5s cubic-bezier(.4,0,.6,1) calc(.1s + var(--t, 0s)) both; transform-box: fill-box; transform-origin: center; }
.anim.st-wrong .rope.placed[data-i="1"] { --fx: -40px; --fr: -9deg; }
.anim.st-wrong .rope.placed[data-i="2"] { --fx: 50px; --fr: 7deg; }
.anim.st-wrong .rope.placed[data-i="3"] { --fx: -25px; --fr: 12deg; }
@keyframes fall {
  0% { opacity: 1; transform: none; }
  25% { opacity: 1; transform: translateY(-14px) rotate(-2deg); }
  100% { opacity: .2; transform: translate(var(--fx, 30px), 70px) rotate(var(--fr, 6deg)); }
}
.anim.st-wrong .rb-board { animation: shake .5s calc(.1s + var(--t, 0s)) both; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

/* ---------- Hinweis-Sprechblase für die Spieler ---------- */
.rb-hint {
  position: relative; margin: 0 auto 16px; max-width: 760px; padding: 14px 20px; border-radius: 14px;
  background: linear-gradient(180deg, #2a2019, #1e1712); border: 1px solid var(--gold);
  font: italic 500 clamp(18px, 2vw, 23px)/1.45 var(--serif); color: #f6ecd8; animation: fadein .8s ease;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
.rb-hint::after { content: ''; position: absolute; left: 40px; bottom: -9px; width: 16px; height: 16px; background: #1e1712; border-right: 1px solid var(--gold); border-bottom: 1px solid var(--gold); transform: rotate(45deg); }
.rb-hint .who { display: block; font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--gold); font-style: normal; margin-bottom: 2px; }

/* ---------- Spieler-Bildschirm ---------- */
.riddle-player .r-head { text-align: center; margin-bottom: 14px; }
.riddle-player .r-head h3 { font-size: clamp(30px, 4.5vw, 48px); }
.riddle-player .r-intro { font-size: 15px; }
.riddle-player .r-ctrl { justify-content: center; }
.riddle-player .r-msg { text-align: center; font-size: clamp(19px, 2.2vw, 25px); }
.player #stage:has(.riddle-player) { width: min(1100px, 100%); }

/* ---------- Spielleiter: Brett + Regiepult ---------- */
.rgm { display: grid; gap: 18px; }
@container (min-width: 680px) { .rgm { grid-template-columns: minmax(0, 52fr) minmax(0, 48fr); align-items: start; } .rgm-r { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; } }
.regie { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.rg-title { display: flex; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 10px; }
.rg-title span { color: var(--accent-hi); }
.rg-now { border-left: 3px solid var(--gold); padding-left: 12px; margin-bottom: 12px; }
.rg-now .say, .rg-now .read { margin-bottom: 10px; }
.rg-now .read { font-size: 17px; padding: 10px 14px; }
.rg-state { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 10px; }
.rg-state.ok { color: var(--ok); border-color: var(--ok); }
.rg-state.bad { color: #e88a83; border-color: #5a2a26; }
.rg-tip { font-size: 13.5px; color: #dccfb5; background: rgba(210,162,76,.08); border: 1px dashed rgba(210,162,76,.4); border-radius: 8px; padding: 8px 10px; }
.sw { display: inline-block; width: 26px; height: 9px; border-radius: 99px; background: var(--c); border: 1px solid rgba(255,255,255,.3); vertical-align: middle; margin-right: 8px; }
.rg-place { padding: 8px 10px; border-radius: 8px; background: var(--panel2); margin-bottom: 8px; border-left: 3px solid var(--line); }
.rg-place.ok { border-left-color: var(--ok); }
.rg-place.bad { border-left-color: var(--accent); }
.rg-ph { font-size: 13.5px; }
.rg-ph .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin-left: 6px; }
.rg-place.ok .tag { color: var(--ok); }
.rg-place.bad .tag { color: #e88a83; }
.rg-line { font: italic 500 17px/1.45 var(--serif); margin-top: 4px; color: #efe4d0; }
.rg-sub { font-weight: 600; margin: 14px 0 8px; }
.rg-sub small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.rg-explain { padding: 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 8px; }
.rg-explain.on { border-color: rgba(111,174,124,.6); }
.rg-eh { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rg-eh em { color: var(--gold); font-style: normal; font-size: 13.5px; }
.rg-eh .mini { margin-left: auto; }
.rg-expect { font-size: 13px; color: var(--muted); margin: 6px 0; }
.rg-explain .say { margin: 6px 0 0; font-size: 16.5px; padding: 8px 12px; }
.rg-sec { border-top: 1px solid var(--line); padding: 8px 0; }
.rg-sec > summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0; }
.rg-sec .qa { border: 0; padding: 4px 0 0; background: transparent; }
.rg-hint { display: grid; grid-template-columns: 26px 1fr; gap: 4px 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid #261f1b; }
.rg-hint > div { font: italic 500 16.5px/1.45 var(--serif); }
.rg-hint .mini { grid-column: 2; justify-self: start; }
.rg-hint.on > div { color: var(--gold); }
.rg-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line); font: 700 14px var(--serif); color: var(--gold); }
.rg-links { list-style: none; padding: 0; margin: 6px 0; }
.rg-links li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 13.5px; padding: 5px 0; color: var(--muted); }
.rg-links li.on { color: var(--text); }

/* ---------- Die vier Fäden: Eichenbrett ---------- */
.f-phase { color: var(--gold); font-size: 14px; margin: 2px 0 10px; }
.riddle-player .f-phase { font-size: clamp(15px, 1.8vw, 19px); }
.f-verse { max-width: 620px; margin: 0 auto 16px; padding: 12px 18px; border-radius: 10px; text-align: center;
  background: radial-gradient(ellipse at 30% 20%, #f6ecd2, var(--parch) 60%, #dcc89f); color: var(--parch-ink);
  font: italic 600 clamp(16px, 1.9vw, 20px)/1.5 var(--serif); box-shadow: 0 8px 22px rgba(0,0,0,.4); }
.f-verse .who { display: block; font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .16em; color: #6b2b1c; font-style: normal; margin-bottom: 4px; }
.rgm .f-verse { font-size: 15px; padding: 8px 12px; margin-bottom: 10px; }
.f-panel { stroke: rgba(210,160,80,.4); stroke-width: 2; }
.f-star { fill: #c9973f; opacity: .8; }
.f-who { font: 700 24px var(--serif); fill: #f0cf86; letter-spacing: .08em; text-transform: uppercase; animation: meaningIn .9s ease both; }
.f-mean { font: 500 14px var(--sans); fill: #d8c7a6; animation: meaningIn .9s .2s ease both; }
.f-hole-ring { stroke: transparent; stroke-width: 5; transition: stroke .15s; }
.f-hole.hot .f-hole-ring { stroke: var(--gold); filter: drop-shadow(0 0 8px rgba(210,162,76,.9)); }
.f-zone circle { fill: rgba(255,230,180,.04); stroke: rgba(240,207,134,.55); stroke-width: 3; stroke-dasharray: 8 9; }
.f-zone text { font: 600 16px var(--sans); fill: rgba(240,207,134,.7); letter-spacing: .2em; text-transform: uppercase; }
.st-bind .f-zone circle { animation: zonePulse 2.4s ease-in-out infinite; }
.f-zone.hot circle { stroke: var(--gold); fill: rgba(240,207,134,.12); stroke-dasharray: none; }
@keyframes zonePulse { 50% { stroke-opacity: .25; } }
.twinkle { animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .3; } }

/* geflochtene Schnüre mit Messingperle und Quaste */
.cord { touch-action: none; }
.fb.st-open .cord, .fb.st-bind .cord, .fb.st-bound .cord.white, .fb.st-threaded .cord.white { cursor: grab; }
.cord.lift { cursor: grabbing; filter: drop-shadow(0 16px 12px rgba(0,0,0,.65)); }
.cord path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.c-sh { stroke: #000; opacity: .5; stroke-width: 17; transform: translate(3px, 6px); }
.c-base { stroke: var(--c); stroke-width: 15; }
.c-br1 { stroke: color-mix(in srgb, var(--c), #000 45%); stroke-width: 15; stroke-dasharray: 5 6; opacity: .65; }
.c-br2 { stroke: color-mix(in srgb, var(--c), #fff 35%); stroke-width: 6; stroke-dasharray: 3 8; stroke-dashoffset: 4; opacity: .45; }
.c-hit { stroke: transparent; stroke-width: 48; pointer-events: stroke; }
.c-fr { stroke: var(--c); stroke-width: 3.2; opacity: .95; }
.c-bead { stroke: #4a300d; stroke-width: 1.5; }
.c-bead-l { stroke: rgba(60,35,8,.6); stroke-width: 1.5; }
.cord.white.threaded { filter: drop-shadow(0 0 5px rgba(255,246,220,.6)); }
.st-solved .cord.white { filter: drop-shadow(0 0 10px rgba(255,246,220,.9)); }
.st-solved .cord.fallen { opacity: .55; }

/* Knoten */
.knot-g { transform-box: view-box; transform-origin: var(--kx) var(--ky); }
.knot-g circle, .loop-eye path, .loop-eye ellipse { fill: none; }
.k-sh { stroke: #000; stroke-width: 15; opacity: .45; transform: translate(2px, 4px); }
.k-loop { stroke: var(--c); stroke-width: 12; }
.k-br { stroke: color-mix(in srgb, var(--c), #000 45%); stroke-width: 12; stroke-dasharray: 5 6; opacity: .6; }
.loop-eye.hot ellipse.k-loop { filter: drop-shadow(0 0 9px rgba(240,207,134,1)); }
.anim.st-bound .knot-g { animation: tighten 1.4s cubic-bezier(.3,1.4,.5,1) calc(.1s + var(--t, 0s)) both; }
.anim.st-bound .loop-eye { animation: fadeIn 1s calc(1.2s + var(--t, 0s)) both; }
@keyframes tighten { 0% { transform: scale(1.35) rotate(-25deg); } 100% { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.st-trapped .knot-g { filter: drop-shadow(0 0 12px rgba(140,190,255,.95)); }
.anim.st-trapped .knot-g { animation: trapShake .6s calc(.1s + var(--t, 0s)) 3 both, trapBurst .8s calc(2.4s + var(--t, 0s)) both; }
@keyframes trapShake { 0%,100% { transform: none; } 25% { transform: rotate(-6deg) scale(.95); } 75% { transform: rotate(6deg) scale(.95); } }
@keyframes trapBurst { to { transform: scale(1.5); opacity: 0; } }
.anim.st-slip .knot-g { animation: trapBurst 1.2s calc(.3s + var(--t, 0s)) both; }
.anim.st-wrong .cord.hang { animation: cordFall 1.5s cubic-bezier(.4,0,.6,1) calc(.15s + var(--t, 0s)) both; transform-box: fill-box; transform-origin: top center; }
@keyframes cordFall { 0% { transform: none; } 30% { transform: translateY(-16px) rotate(-3deg); } 100% { transform: translateY(150px) rotate(8deg); opacity: .1; } }
.anim.st-wrong .rb-board { animation: shake .5s calc(.1s + var(--t, 0s)) both; }

/* Gelöst: Geisterknoten zerfällt, Geheimfach gleitet heraus */
.ghost-knot circle { fill: none; stroke: var(--c); stroke-width: 12; transform-box: view-box; transform-origin: var(--kx) var(--ky); animation: ghostApart 2.6s ease-in calc(.2s + var(--t, 0s)) both; }
@keyframes ghostApart { from { transform: none; opacity: 1; } to { transform: rotate(var(--a)) translateX(120px); opacity: 0; } }
.drawer { transform: translateY(28px); }
.anim .drawer { animation: drawerOut 1.4s ease-out calc(2.8s + var(--t, 0s)) both; }
@keyframes drawerOut { from { transform: translateY(0); opacity: .4; } to { transform: translateY(28px); opacity: 1; } }

.f-jump { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); margin-left: auto; }
.rg-phase { display: inline-block; font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--accent-hi); margin-bottom: 2px; font-style: normal; }
.rg-handout { margin: 10px 0; }
.rg-handout .parchment { font-size: 16px; padding: 14px 18px; margin-bottom: 8px; }
