/* Tasken (taske.js): læder, syninger, fag og ting, der hopper ind */
.taske-bg { padding: 8px; }
.taske { position: relative; width: min(100%, 760px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); display: grid; grid-template-rows: auto minmax(0, 1fr); box-sizing: border-box; overflow: hidden;
  background: linear-gradient(180deg, #8a5430, #6a3a1c 55%, #54300f); border: 4px solid #2a160a; box-shadow: 0 0 0 3px #a8703c inset, 0 10px 0 rgba(0,0,0,.45); color: #f6e8c8; }
.taske-bg.taske-aaben .taske { animation: taske-ind .42s cubic-bezier(.3,1.35,.5,1) both; }
@keyframes taske-ind { from { transform: scale(.12) rotate(-6deg); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
.taske::before { content: ""; position: absolute; inset: 7px; border: 2px dashed rgba(255,205,120,.4); pointer-events: none; z-index: 1; }   /* syning */
.taske-top { position: relative; z-index: 2; display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 12px 16px 8px; background: rgba(42,22,10,.35); border-bottom: 3px solid #2a160a; }
.taske-top h2 { margin: 0; color: var(--gold, #ffcc4d); font-size: 1.3em; }
.taske-top-ik { line-height: 0; animation: taske-vip 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
.taske-top-ik svg { display: block; filter: drop-shadow(0 3px 0 rgba(0,0,0,.5)); }
@keyframes taske-vip { 0%, 80%, 100% { transform: rotate(0); } 86% { transform: rotate(-7deg); } 93% { transform: rotate(6deg); } }
.taske-antal { color: #e8c88a; font-size: .85em; }
.taske-krop { position: relative; z-index: 2; overflow-y: auto; padding: 14px 16px 16px; min-height: 0; }
.taske-tom-tekst { margin: 0 0 12px; padding: 10px 12px; background: rgba(42,22,10,.45); border: 2px dashed rgba(255,205,120,.45); }
.taske-fag { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .taske-fag { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } }
.taske-note { margin: 12px 0 0; color: #e8c88a; font-size: .85em; }

/* et fag med en ting */
.taske-ting, .taske-fag-tom { position: relative; aspect-ratio: 1 / 1; min-height: 0; border: 3px solid #2a160a; background: radial-gradient(circle at 50% 38%, #4a2810 0%, #35190a 100%); box-shadow: inset 0 4px 0 rgba(0,0,0,.35), 0 2px 0 rgba(255,205,120,.25); }
.taske-fag-tom { opacity: .55; border-style: dashed; background: rgba(42,22,10,.4); box-shadow: none; animation: fag-ind .3s both; animation-delay: calc(.4s + var(--i, 0) * 40ms); }
.taske-ting { display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 8px 4px 5px; font: inherit; color: #f6e8c8; cursor: pointer; animation: ting-ind .5s cubic-bezier(.3,1.7,.5,1) both; animation-delay: calc(.38s + var(--i, 0) * 60ms); }
.taske-ting:hover, .taske-ting:focus-visible { outline: none; border-color: var(--gold, #ffcc4d); background: radial-gradient(circle at 50% 38%, #6a3c18 0%, #42200c 100%); }
.taske-ting:hover .ti-ik, .taske-ting:focus-visible .ti-ik { animation: ting-vift .5s steps(6) infinite; }
.taske-ting.laast { cursor: default; opacity: .6; }
.taske-ting.laast:hover { border-color: #2a160a; }
.taske-ting.laast .ti-ik { filter: grayscale(1) brightness(.7); }
.ti-ik { line-height: 0; display: block; transform-origin: 50% 80%; }
.ti-ik svg { display: block; width: clamp(44px, 9vw, 72px); height: auto; filter: drop-shadow(0 3px 0 rgba(0,0,0,.55)); }
.ti-navn { font-size: .72em; line-height: 1.15; text-align: center; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-width: 100%; }
.ti-antal { position: absolute; right: -6px; top: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--gold, #ffcc4d); color: #1a1420; border: 2px solid #1a1420; font-size: .72em; font-weight: 700; line-height: 18px; text-align: center; box-sizing: border-box; z-index: 1; }
@keyframes ting-ind { from { transform: translateY(46px) scale(.2) rotate(-14deg); opacity: 0; } 70% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes fag-ind { from { opacity: 0; } to { opacity: .55; } }
@keyframes ting-vift { 0% { transform: rotate(0) translateY(0); } 25% { transform: rotate(-9deg) translateY(-3px); } 75% { transform: rotate(9deg) translateY(-3px); } 100% { transform: rotate(0) translateY(0); } }

/* tingene har hver deres liv */
.e-rune { --farve: #5a9ee0; }
.e-rune .ti-ik svg, .e-rune.vis-ik svg { animation: rune-gloed 2.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -.3s); }
@keyframes rune-gloed { 0%, 100% { filter: drop-shadow(0 0 2px var(--farve)) drop-shadow(0 3px 0 rgba(0,0,0,.5)); } 50% { filter: drop-shadow(0 0 11px var(--farve)) drop-shadow(0 0 3px #fff) drop-shadow(0 3px 0 rgba(0,0,0,.5)); } }
.e-rulle .ti-ik { animation: rulle-vip 3.4s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -.4s); }
@keyframes rulle-vip { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-2px); } }
.e-pung .ti-ik::after, .e-moent .ti-ik::after, .e-pung.vis-ik::after, .e-moent.vis-ik::after { content: ""; position: absolute; width: 6px; height: 6px; right: 18%; top: 14%; background: #fff7c0; box-shadow: -14px 10px 0 -1px #fff7c0, 3px 22px 0 -2px #fff7c0; animation: glimt-stjerne 1.8s steps(2) infinite; pointer-events: none; }
.e-pung .ti-ik, .e-moent .ti-ik { position: relative; }
@keyframes glimt-stjerne { 0%, 60%, 100% { opacity: 0; transform: scale(.4); } 70%, 90% { opacity: 1; transform: scale(1); } }
.e-moent .ti-ik svg, .e-moent.vis-ik svg { animation: moent-drej 3s linear infinite; }
@keyframes moent-drej { 0% { transform: rotateY(0); } 40% { transform: rotateY(0); } 60% { transform: rotateY(180deg); } 80%, 100% { transform: rotateY(360deg); } }
.e-pung .ti-ik svg { animation: pung-gunge 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes pung-gunge { 0%, 70%, 100% { transform: scale(1, 1); } 80% { transform: scale(1.08, .93); } 90% { transform: scale(.96, 1.05); } }

/* klappen, der slås op */
.taske-klap { position: absolute; inset: 0; z-index: 5; pointer-events: none; transform-origin: 50% 0; background: linear-gradient(180deg, #7a4426, #5a3016); border-bottom: 5px solid #2a160a; display: grid; place-items: center; animation: klap-op .55s steps(6) .12s both; }
.taske-bg:not(.taske-aaben) .taske-klap { animation: none; }
.taske-klap::before { content: ""; position: absolute; inset: 7px; border: 2px dashed rgba(255,205,120,.4); }
.klap-spaende { width: 38px; height: 46px; background: #ffcc4d; border: 4px solid #2a160a; box-shadow: inset 0 -6px 0 #c8902a; position: relative; }
.klap-spaende::after { content: ""; position: absolute; left: 50%; top: 14px; width: 8px; height: 14px; margin-left: -4px; background: #2a160a; }
@keyframes klap-op { 0% { transform: none; opacity: 1; } 60% { transform: perspective(900px) rotateX(-70deg); opacity: 1; } 100% { transform: perspective(900px) rotateX(-95deg); opacity: 0; visibility: hidden; } }

/* en ting løftet frem */
.taske-vis { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 14px; background: rgba(20,10,4,.72); animation: vis-bg .2s both; }
@keyframes vis-bg { from { opacity: 0; } to { opacity: 1; } }
.taske-kort { width: min(100%, 560px); display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 18px 20px; background: linear-gradient(180deg, #f3e6c4, #e4d0a0); color: #3a2616; border: 4px solid #2a160a; box-shadow: 0 0 0 3px #c8a868 inset, 0 8px 0 rgba(0,0,0,.4); }
@media (max-width: 520px) { .taske-kort { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.vis-ik { position: relative; line-height: 0; padding: 10px; background: radial-gradient(circle, #fff7d8 0%, rgba(255,247,216,0) 70%); }
.vis-ik svg { display: block; width: clamp(72px, 22vw, 112px); height: auto; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.vis-tekst h3 { margin: 0 0 6px; font-size: 1.25em; color: #6a3410; }
.vis-tekst h3 small { color: #8a6a3a; font-size: .7em; }
.vis-tekst p { margin: 0 0 8px; line-height: 1.4; }
.vis-fundet { font-size: .85em; color: #6a5030; }
.vis-note { font-size: .82em; color: #6a5030; }
.vis-knapper { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 520px) { .vis-knapper { justify-content: center; } }
.taske-flyver svg { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  .taske-bg.taske-aaben .taske, .taske-ting, .taske-fag-tom, .taske-vis { animation: none; }
  .taske-klap { display: none; }
  .taske-top-ik, .e-rune .ti-ik svg, .e-rulle .ti-ik, .e-moent .ti-ik svg, .e-pung .ti-ik svg, .e-pung .ti-ik::after, .e-moent .ti-ik::after, .taske-ting:hover .ti-ik { animation: none; }
}
.taske-kort .btn { color: var(--txt, #f4efff); }
.taske-kort .btn.primary { color: #1a1420; }
.taske-top .btn { color: var(--txt, #f4efff); }
