/* Oral-Systemic Link · 3D-Körperkarte im Skizzenstil (Variante B) */
.o3d {
  --paper: #f4eedd; --paper2: #fbf7ec; --ink: #1c2b3a; --teal: #1d7a66; --gold: #c39a2e;
  --c-mund: #1d8a74; --c-gehirn: #3a68b0; --c-herz: #c8423a; --c-darm: #5a9a35;
  position: relative; overflow: hidden; color: var(--ink);
  padding: 7rem 0 6rem;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .28  0 0 0 0 .15  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(900px 600px at 30% 45%, rgba(255,255,255,0.55), transparent 65%),
    radial-gradient(1200px 800px at 50% 110%, rgba(120,90,40,0.10), transparent 60%);
}
.o3d-inner { max-width: 1280px; margin: 0 auto; padding: 0 4rem; position: relative; }
.o3d .section-label { color: var(--teal); }
.o3d .section-label::before { background: var(--teal); }
.o3d .section-title { color: var(--ink); font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.04; margin-bottom: 1.2rem; max-width: none; }
.o3d .section-title em { color: var(--teal); }
.o3d-intro { max-width: 560px; font-size: 1.05rem; line-height: 1.75; color: #4a5868; font-weight: 400; }

.o3d-stage { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 1.8rem; margin-top: 3.2rem; align-items: stretch; }

/* Zeichenblatt */
.o3d-canvas-wrap {
  position: relative; height: clamp(540px, 78vh, 760px); overflow: hidden;
  border: 2px solid var(--ink); background: rgba(255,252,243,0.6);
  border-radius: 28px 10px 30px 12px / 12px 30px 10px 28px;
  box-shadow: 6px 7px 0 rgba(28,43,58,0.9);
}
.o3d-canvas-wrap::before { /* Klebestreifen */
  content: ''; position: absolute; z-index: 5; top: -10px; left: 50%; width: 120px; height: 28px; transform: translateX(-50%) rotate(-2deg);
  background: rgba(195,154,46,0.35); border-left: 1px dashed rgba(28,43,58,0.25); border-right: 1px dashed rgba(28,43,58,0.25); pointer-events: none;
}
.o3d-canvas-wrap::after { /* Papierkorn über der ganzen Zeichnung */
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: multiply; opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .25  0 0 0 0 .2  0 0 0 0 .12  0 0 0 .55 -.12'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.o3d-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
.o3d-canvas-wrap.dragging canvas { cursor: grabbing; }

.o3d-hint { position: absolute; left: 1.4rem; bottom: 1.1rem; z-index: 3; pointer-events: none; font: 700 1.15rem 'Caveat', 'Segoe Script', cursive; color: rgba(28,43,58,0.6); transition: opacity 0.3s; display: flex; align-items: center; gap: 0.5rem; }
.o3d-hint::after { content: '\2194'; font: 1.3rem sans-serif; animation: o3dnudge 2.4s ease-in-out infinite; }
@keyframes o3dnudge { 0%,100% { transform: translateX(-3px); } 50% { transform: translateX(4px); } }
.o3d.has-sel .o3d-hint { opacity: 0; }
.o3d-reset { position: absolute; right: 1.2rem; top: 1.3rem; z-index: 4; font: 700 1.1rem 'Caveat', cursive; color: var(--ink); background: var(--paper2); border: 2px solid var(--ink); padding: 0.2rem 1rem; cursor: pointer; border-radius: 16px 6px 14px 8px / 8px 14px 6px 16px; opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.2s; transform: rotate(2deg); }
.o3d.has-sel .o3d-reset { opacity: 1; pointer-events: auto; }
.o3d-reset:hover { transform: rotate(-1deg) scale(1.05); }

/* Beschriftungen wie Zettel am Körper */
.o3d-labels { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.o3d-node {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.12rem 0.85rem 0.12rem 0.55rem;
  background: var(--paper2); color: var(--ink); border: 2px solid var(--ink);
  border-radius: 14px 5px 12px 6px / 6px 12px 5px 14px;
  font: 700 1.3rem/1.2 'Caveat', 'Segoe Script', cursive; letter-spacing: 0.02em;
  box-shadow: 2px 3px 0 rgba(28,43,58,0.85); transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s, background 0.2s; will-change: transform;
}
.o3d-node .dot { width: 13px; height: 13px; border-radius: 50% 45% 50% 48%; background: var(--c); border: 1.5px solid var(--ink); }
.o3d-node:hover, .o3d-node:focus-visible, .o3d-node.active { background: color-mix(in srgb, var(--c) 18%, var(--paper2)); outline: none; box-shadow: 3px 4px 0 var(--c); }
.o3d.has-sel .o3d-node:not(.active) { opacity: 0.5; }

/* Notizzettel-Panel */
.o3d-panel {
  display: flex; flex-direction: column; padding: 2.2rem 2.2rem 2rem; min-height: 420px; position: relative;
  background: var(--paper2); border: 2px solid var(--ink); border-radius: 12px 30px 10px 28px / 30px 10px 28px 12px;
  box-shadow: 6px 7px 0 rgba(28,43,58,0.9);
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(29,122,102,0.10) 31px 32px);
}
.o3d-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.o3d-chip { font: 700 1.2rem 'Caveat', cursive; color: var(--ink); background: transparent; cursor: pointer; border: 2px solid var(--ink); padding: 0.05rem 0.85rem; border-radius: 14px 5px 12px 6px / 6px 12px 5px 14px; display: inline-flex; align-items: center; gap: 0.45rem; transition: all 0.2s; }
.o3d-chip i { width: 11px; height: 11px; border-radius: 50%; background: var(--c); border: 1.5px solid var(--ink); display: block; }
.o3d-chip:hover { transform: rotate(-2deg); background: color-mix(in srgb, var(--c) 14%, transparent); }
.o3d-chip[aria-pressed="true"] { background: var(--c); color: #fff; }
.o3d-chip[aria-pressed="true"] i { background: #fff; }
.o3d-chip:focus-visible, .o3d-next:focus-visible, .o3d-reset:focus-visible, .o3d-node:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.o3d-toggle { display: none; gap: 0; margin: -0.6rem 0 1.4rem; align-self: flex-start; border: 2px solid var(--ink); border-radius: 16px 6px 14px 8px / 8px 14px 6px 16px; overflow: hidden; box-shadow: 2px 3px 0 rgba(28,43,58,0.85); background: var(--paper2); }
.o3d.has-sel .o3d-toggle { display: inline-flex; }
.o3d-toggle button { font: 700 1.15rem 'Caveat', cursive; color: var(--ink); background: transparent; border: 0; padding: 0.15rem 1rem; cursor: pointer; transition: background 0.2s, color 0.2s; min-height: 38px; }
.o3d-toggle button + button { border-left: 2px solid var(--ink); }
.o3d-toggle button[aria-pressed="true"]:first-child { background: var(--teal); color: #fff; }
.o3d-toggle button[aria-pressed="true"]:last-child { background: var(--c-herz); color: #fff; }
.o3d-toggle button:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.o3d-body { flex: 1; transition: opacity 0.28s ease, transform 0.28s ease; }
.o3d-body.swap { opacity: 0; transform: translateY(8px); }
.o3d-step { font: 700 1.2rem 'Caveat', cursive; color: var(--c, var(--teal)); margin-bottom: 0.3rem; }
.o3d-title { font-family: 'DM Serif Display', serif; font-size: clamp(1.6rem, 2.4vw, 2.2rem); line-height: 1.12; margin: 0 0 1rem; color: var(--ink); font-weight: 400; }
.o3d-text { font-size: 0.96rem; line-height: 2rem; color: #2f3f50; margin: 0; }
.o3d-study { margin-top: 1.4rem; padding: 0.9rem 1.1rem; background: rgba(255,255,255,0.7); border: 1.5px dashed var(--c, var(--teal)); border-radius: 10px 4px 10px 6px; }
.o3d-study b { display: block; font: 700 1.1rem 'Caveat', cursive; color: var(--c, var(--teal)); margin-bottom: 0.1rem; }
.o3d-study span { font-size: 0.82rem; line-height: 1.6; color: #4a5868; }
.o3d-next { margin-top: 1.6rem; align-self: flex-start; cursor: pointer; font: 700 1.3rem 'Caveat', cursive; color: #fff; background: var(--teal); border: 2px solid var(--ink); padding: 0.3rem 1.4rem; border-radius: 16px 6px 14px 8px / 8px 14px 6px 16px; box-shadow: 3px 4px 0 var(--ink); transition: transform 0.2s, box-shadow 0.2s; }
.o3d-next:hover { transform: translate(-1px, -2px) rotate(-1deg); box-shadow: 5px 6px 0 var(--ink); }

.o3d.no-webgl .o3d-canvas-wrap { display: none; }
.o3d.no-webgl .o3d-stage { grid-template-columns: 1fr; }

@media (max-width: 960px) {
  .o3d { padding: 5rem 0 4rem; }
  .o3d-inner { padding: 0 1.5rem; }
  .o3d-stage { grid-template-columns: 1fr; margin-top: 2.2rem; position: relative; display: block; }
  .o3d-canvas-wrap { height: clamp(560px, calc(100svh - 80px), 820px); }
  /* Panel als Bottom-Sheet über der Zeichnung */
  .o3d-panel {
    position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0.6rem; z-index: 6;
    max-height: 50%; overflow-y: auto; overscroll-behavior: contain;
    padding: 0.9rem 1.1rem 1rem; min-height: 0;
    background-color: rgba(251,247,236,0.96); backdrop-filter: blur(4px);
    box-shadow: 3px 4px 0 rgba(28,43,58,0.9);
    border-radius: 18px 8px 16px 10px / 10px 16px 8px 18px;
    background-image: none;
  }
  .o3d-panel::before { content: ''; display: block; width: 42px; height: 4px; border-radius: 3px; background: rgba(28,43,58,0.3); margin: 0 auto 0.6rem; }
  .o3d-panel > * { flex: none; }
  .o3d-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -0.2rem 0.7rem; padding: 0.15rem 0.2rem 0.3rem; scrollbar-width: none; }
  .o3d-chips::-webkit-scrollbar { display: none; }
  .o3d-chip { flex: 0 0 auto; min-height: 44px; font-size: 1.3rem; padding: 0 1rem; }
  .o3d-toggle { margin: -0.2rem 0 0.7rem; align-self: stretch; position: sticky; top: 0; z-index: 4; background: #fbf7ec; } .o3d-toggle button { flex: 1; min-height: 44px; font-size: 1.05rem; white-space: nowrap; padding: 0.15rem 0.4rem; }
  .o3d-title { font-size: 1.45rem; margin-bottom: 0.5rem; }
  .o3d-text { font-size: 0.92rem; line-height: 1.6; }
  .o3d-study { margin-top: 0.8rem; padding: 0.6rem 0.8rem; }
  .o3d-next { margin-top: 0.9rem; min-height: 44px; width: 100%; align-self: stretch; font-size: 1.4rem; }
  .o3d-hint { left: 50%; transform: translateX(-50%); top: 1rem; bottom: auto; }
  .o3d-reset { min-height: 44px; display: flex; align-items: center; }
  .o3d-node { font-size: 1.15rem; padding: 0.15rem 0.65rem 0.15rem 0.45rem; }
  .o3d.no-webgl .o3d-panel { position: static; max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .o3d-hint::after { animation: none; } .o3d-body { transition: none; } }

.o3d-credit { margin: 1.2rem 0 0; font-size: 0.78rem; line-height: 1.5; color: rgba(28,43,58,0.6); max-width: 60ch; }
.o3d-credit a { color: inherit; text-decoration: underline; }
