/* Nachlass: Omas Schmuckkästchen. Desktop Kästchen links, Karte rechts; Handy untereinander, nichts überdeckt.
   Animiert wird nur transform und opacity: Deckel (CSS-3D), Anheben der Stücke, Einblenden. */

/* ---------- Raster ---------- */
.nl-raster { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); gap: var(--r4) clamp(32px, 4.5vw, 72px); align-items: center; }
@media (max-width: 899px) { .nl-raster { grid-template-columns: minmax(0, 1fr); gap: var(--r2); } }

/* ---------- Bühne ---------- */
.nl-rahmen { position: relative; }
.nl-rahmen::before { content: ""; position: absolute; inset: 14% 0 -4%; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 58%, rgba(36, 64, 47, .9), rgba(36, 64, 47, .35) 55%, rgba(36, 64, 47, 0) 100%); }
@media (max-width: 899px) { .nl-rahmen { margin-inline: calc(6px - var(--rand)); } }
.nl-bühne { position: relative; width: 100%; aspect-ratio: 1; }
.nl-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.nl-körper { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.nl-hinten { z-index: 1; }
.nl-vorn-ebene { z-index: 4; }
.nl-glanz { position: absolute; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 1.4s ease .55s;
  background: radial-gradient(60% 70% at 38% 55%, rgba(255, 214, 160, .22), rgba(255, 214, 160, 0) 72%); }
.nl-bühne.auf .nl-glanz { opacity: 1; }
.nl-stücke { position: absolute; inset: 0; z-index: 3; }
.nl-wache { position: absolute; left: 50%; width: 1px; height: 1px; pointer-events: none; }
.nl-bühne.ohne-übergang *, .nl-bühne.ohne-übergang *::before, .nl-bühne.ohne-übergang *::after { transition: none !important; }

/* Deckel: drei flache Flächen (außen, innen, Kante), jede mit voller 3D-Transformation um die Scharnierlinie.
   Kein preserve-3d nötig. Steht der Deckel hochkant zur Kamera, wechselt er hinter den Korpus und zeigt statt der
   Außen- die Innenseite (Klasse „oben“, dazu backface-visibility). Zu = rotateX(55°), offen = 105° weiter. */
.nl-deckel { position: absolute; inset: 0; z-index: 0; pointer-events: none; perspective: calc(var(--e, .6px) * 3600); }
.nl-deckel.oben { z-index: 6; }
.nl-deckel.oben .nl-deckel-innen, .nl-deckel:not(.oben) .nl-deckel-außen { opacity: 0; }
.nl-deckel-fläche { position: absolute; transform-origin: 50% 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform var(--deckel-zeit, 1.7s) cubic-bezier(.42, 0, .22, 1.06); will-change: transform;
  --z: calc(var(--e, .6px) * var(--deckel-d)); --l: calc(var(--e, .6px) * var(--deckel-l)); }
.nl-deckel-fläche svg { display: block; width: 100%; height: 100%; }
.nl-deckel-außen { transform: rotateX(55deg) translateZ(var(--z)); }
.nl-deckel-innen { transform: rotateX(55deg) translateY(var(--l)) rotateX(180deg); }
.nl-deckel-kante { transform: rotateX(55deg) translateY(var(--l)) translateZ(var(--z)) rotateX(-90deg); }
.nl-bühne.auf .nl-deckel-außen { transform: rotateX(160deg) translateZ(var(--z)); }
.nl-bühne.auf .nl-deckel-innen { transform: rotateX(160deg) translateY(var(--l)) rotateX(180deg); }
.nl-bühne.auf .nl-deckel-kante { transform: rotateX(160deg) translateY(var(--l)) translateZ(var(--z)) rotateX(-90deg); }

/* ---------- Stücke ---------- */
.nl-stück { position: absolute; display: block; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.nl-stück:focus-visible { outline: 2px solid var(--gold-hell); outline-offset: -2px; }
.nl-stück > * { position: absolute; inset: 0; pointer-events: none; }
.nl-stück svg { width: 100%; height: 100%; overflow: visible; }
.nl-bild { transform-origin: 50% 75%; transition: transform .6s var(--aus-expo); }
.nl-stück.an { z-index: 2; }
.nl-stück.an .nl-bild { transform: translateY(-17%) scale(1.07); }
.nl-schatten { inset: 34% 10% 4%; opacity: 0; transform: scale(.75); transition: opacity .5s ease, transform .6s var(--aus-expo);
  background: radial-gradient(closest-side, rgba(28, 8, 12, .6), rgba(28, 8, 12, 0)); }
.nl-stück.an .nl-schatten { opacity: 1; transform: none; }
@media (hover: hover) { .nl-stück:hover:not(.an) .nl-bild { transform: translateY(-5%); } }
.nl-foto-stück img { position: absolute; max-width: none; height: auto; filter: drop-shadow(1px 3px 2px rgba(40, 10, 16, .45)); }

/* Merkzeichen: Ring = noch offen, gefüllt mit Haken = sortiert */
.nl-stück .nl-marke { inset: auto; top: 6%; right: 7%; width: 18px; height: 18px; border-radius: 50%; opacity: 0; transform: scale(.4);
  transition: opacity .35s ease, transform .5s var(--aus-expo), background-color .3s; border: 2px solid var(--gold-hell); box-shadow: 0 1px 4px rgba(0, 0, 0, .55); }
.nl-bühne.auf .nl-marke { opacity: .95; transform: scale(.62); }
.nl-stück.sortiert .nl-marke { opacity: 1; transform: none; border-color: #14120E; }
.nl-stück.sortiert .nl-marke::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid #14120E; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.nl-stück.gold .nl-marke { background: var(--gold-hell); }
.nl-stück.silber .nl-marke { background: #D3D6D9; }
.nl-stück.mode .nl-marke { background: #DDA7A4; }
.nl-stück.prüfen .nl-marke { background: var(--gold-blass); }

/* ---------- Fotomodus ---------- */
.nl-echt .nl-foto, .nl-film { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: var(--ecke); }
.nl-foto-auf { z-index: 1; opacity: 0; transition: opacity .8s ease; }
.nl-echt.auf .nl-foto-auf { opacity: 1; }
.nl-film { z-index: 2; opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.nl-film.an { opacity: 1; }
.nl-echt .nl-stücke { z-index: 3; }
.nl-echt .nl-stück { transform: translate(-50%, -50%); min-width: 44px; min-height: 44px; }
.nl-ausschnitt { opacity: 0; background-repeat: no-repeat; transition: opacity .3s ease, transform .6s var(--aus-expo);
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent); mask-image: radial-gradient(closest-side, #000 62%, transparent); }
.nl-stück.an .nl-ausschnitt { opacity: 1; }
.nl-punkt-ziel { inset: auto; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid var(--gold-hell);
  box-shadow: 0 0 0 3px rgba(18, 19, 17, .35); opacity: 0; transition: opacity .4s ease; }
.nl-echt.auf .nl-punkt-ziel { opacity: .9; }
.nl-echt .nl-stück.an .nl-punkt-ziel, .nl-echt .nl-stück.sortiert .nl-punkt-ziel, .nl-echt .nl-stück:not(.sortiert) .nl-marke { opacity: 0; }
.nl-muster { margin-top: 8px; }

/* ---------- Karte ---------- */
.nl-karte { position: relative; display: grid; gap: var(--r3); padding: clamp(22px, 3vw, 36px); background: var(--eisen-2); border: 1px solid rgba(216, 184, 120, .2);
  border-radius: var(--ecke); box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .85); scroll-margin: calc(var(--kopf-h) + 12px) 0 calc(84px + var(--sicher-unten)); }
.nl-inhalt { display: grid; gap: 16px; align-content: start; min-height: 16.5rem; }
@media (max-width: 899px) { .nl-inhalt { min-height: 0; } }
.nl-inhalt.neu { animation: nl-ein .5s var(--aus-expo); }
@keyframes nl-ein { from { opacity: 0; transform: translateY(8px); } }
.nl-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.nl-name { font-size: clamp(1.65rem, 2.6vw, 2.1rem); }
.nl-name:focus:not(:focus-visible) { outline: none; }
.nl-text { color: var(--hell-2); }
.nl-etiketten { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.nl-etikett { display: inline-flex; align-items: center; min-height: 30px; padding: 0 13px; border-radius: 999px; font-weight: 750; font-size: .9rem; letter-spacing: .01em; white-space: nowrap; }
.nl-etikett.gold { background: var(--gold-hell); color: #14120E; }
.nl-etikett.silber { background: #D3D6D9; color: #14120E; }
.nl-etikett.mode { background: #DDA7A4; color: #14120E; }
.nl-etikett.mit { color: var(--gold-hell); border: 1px solid rgba(216, 184, 120, .6); }
.nl-etikett.sammler { background: var(--samt-2); color: var(--gold-blass); border: 1px solid rgba(216, 184, 120, .4); }
.nl-punkte { margin: 0; display: grid; gap: 16px; }
.nl-punkt dt { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .76rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hell); }
.nl-punkt dt .ic { width: 16px; height: 16px; flex: none; }
.nl-punkt dd { margin: 0; color: var(--hell); line-height: 1.55; }
.nl-weiter { justify-self: start; }
.nl-weiter .ic { width: 18px; height: 18px; }
.nl-weiter-text { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--gold-hell); font-weight: 700; cursor: pointer; }
.nl-weiter-text:hover { color: var(--gold-blass); }

/* Stand: Zähler, Leiste, vier Fächer */
.nl-stand { display: grid; gap: 12px; padding-top: var(--r3); border-top: 1px solid rgba(216, 184, 120, .16); }
.nl-zähler { font-weight: 650; color: var(--hell-2); }
.nl-zähler b { color: var(--hell); font-weight: 800; }
.nl-leiste { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.nl-leiste li { height: 4px; border-radius: 2px; background: rgba(237, 230, 216, .14); transition: background-color .4s ease; }
.nl-leiste li.gold { background: var(--gold-hell); }
.nl-leiste li.silber { background: #D3D6D9; }
.nl-leiste li.mode { background: #DDA7A4; }
.nl-leiste li.prüfen { background: var(--gold-blass); }
.nl-fächer { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nl-fach { display: grid; gap: 3px; align-content: start; min-height: 58px; padding: 9px 11px 10px; border: 1px solid rgba(216, 184, 120, .16); border-radius: var(--ecke); transition: border-color .4s ease; }
.nl-fach-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.nl-fach-name { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--hell-2); }
.nl-fach-name::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.nl-fach.gold .nl-fach-name::before { background: var(--gold-hell); }
.nl-fach.silber .nl-fach-name::before { background: #D3D6D9; }
.nl-fach.mode .nl-fach-name::before { background: #DDA7A4; }
.nl-fach.prüfen .nl-fach-name::before { background: var(--gold-blass); }
.nl-fach b { font-family: var(--antiqua); font-size: 1.3rem; font-weight: 400; line-height: 1; color: var(--hell-3); }
.nl-fach.voll { border-color: rgba(216, 184, 120, .4); }
.nl-fach.voll b { color: var(--hell); }
.nl-fach small { font-size: .8rem; line-height: 1.35; color: var(--hell-3); }

/* Zusammenfassung */
.nl-schluss { display: grid; gap: 14px; padding-top: var(--r3); border-top: 1px solid rgba(216, 184, 120, .16); animation: nl-ein .6s var(--aus-expo); }
.nl-summe span { white-space: nowrap; }
.nl-summe { font-family: var(--antiqua); font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.35; color: var(--gold-hell); }
.nl-schluss-text { color: var(--hell-2); }
.nl-schluss .knopf { justify-self: start; }
@media (max-width: 520px) { .nl-schluss .knopf { justify-self: stretch; } }

/* Knopfreihe unter dem Modul: nach dem Sortieren steht der Knopf in der Karte */
.nachlass-knöpfe { margin-top: var(--r4); align-items: center; gap: 12px 24px; }
.nachlass.nl-fertig .nachlass-knöpfe .knopf { display: none; }
