/* Khazana v9 round 2: deck-of-cards flashcards, glass folders with fanned tool logos, folder poster view */

/* ---------- flashcards: a deck of playing cards ---------- */
.dk9 { position: relative; height: 340px; margin: 6px auto 4px; max-width: 520px; touch-action: pan-y; }
.dk9.fan { height: 360px; }
.dk9-c { position: absolute; left: 50%; top: 8px; width: 214px; margin-left: -107px; transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s; transform-origin: 50% 110%;
  transform: translateY(calc(var(--k) * 7px)) scale(calc(1 - var(--k) * .045)) rotate(calc((var(--k) - 2) * 1.6deg)); }
.dk9-c:not(.top) { pointer-events: none; }
.dk9-c:not(.top) .fc9-g, .dk9-c:not(.top) .fc8-acts, .dk9-c:not(.top) .fc9-due { opacity: 0; }
.dk9-c.top { transform: rotate(0); }
.dk9-c.top.drag { transition: none; transform: translateX(var(--dx, 0)) rotate(calc(var(--dx, 0px) / 18px * 1deg)); cursor: grabbing; }
.dk9-c.out-l { transform: translateX(-130%) rotate(-18deg); opacity: 0; }
.dk9-c.out-r { transform: translateX(130%) rotate(18deg); opacity: 0; }
.dk9.fan .dk9-c { pointer-events: auto; cursor: pointer; transform: translateX(var(--fx)) rotate(var(--fa)); }
.dk9.fan .dk9-c:hover, .dk9.fan .dk9-c:focus-within { transform: translateX(var(--fx)) translateY(-26px) rotate(var(--fa)); z-index: 99 !important; }
.dk9.fan .fc9-g, .dk9.fan .fc8-acts, .dk9.fan .fc9-due { display: none; }

/* glass playing-card face with a glowing border (from your reference) */
.dk9 .fc8-face { border-radius: 20px; }
.dk9 .fc8-front { background: linear-gradient(145deg, color-mix(in srgb, var(--c, var(--brand)) 26%, var(--surface)), color-mix(in srgb, var(--c, var(--brand)) 8%, var(--surface)));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .45); }
.dk9 .fc8-front::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0deg, var(--c, var(--brand)) 60deg, transparent 180deg, color-mix(in srgb, var(--c, var(--brand)) 50%, transparent) 240deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.dk9 .fc8-front::after { content: ''; position: absolute; left: 12px; right: 12px; top: 10px; height: 2px; border-radius: 1px; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); }
.dk9-cn { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; align-items: center; line-height: 1; font-size: 15px; color: var(--c, var(--brand)); font-weight: 700; }
.dk9-cn b { font-size: 13px; color: var(--ink); }
.dk9-cn.br { left: auto; right: 10px; top: auto; bottom: 10px; transform: rotate(180deg); }
.dk9 .fc8-front .fc8-hint { margin-top: auto; padding-bottom: 22px; }
.dk9-nav { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dk9-count { min-width: 92px; text-align: center; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.dk9-hint { text-align: center; margin-top: 6px; }
@media (max-width: 420px) { .dk9-c { width: 190px; margin-left: -95px; } .dk9 { height: 310px; } .dk9.fan { height: 330px; } }

/* ---------- glass folders with fanned tool logos ---------- */
.fd9-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 14px; padding-top: 52px; }
.fd9w { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.fd9 { position: relative; width: 100%; max-width: 172px; aspect-ratio: 1.25; border: 0; padding: 0; background: none; font: inherit; color: inherit; cursor: pointer; perspective: 700px; }
.fd9-back { position: absolute; inset: 10% 0 0; border-radius: 14px; background: color-mix(in srgb, var(--c) 55%, #1a1a2e); box-shadow: 0 8px 22px color-mix(in srgb, var(--c) 30%, transparent); }
.fd9-back::before { content: ''; position: absolute; left: 0; top: -12%; width: 42%; height: 18%; border-radius: 10px 10px 0 0; background: inherit; }
.fd9-ls { position: absolute; inset: 0; z-index: 1; }
.fd9-l { position: absolute; left: 50%; top: 26%; width: 46px; height: 46px; margin-left: -23px; transition: transform .45s cubic-bezier(.2, .9, .2, 1.15); transition-delay: calc(var(--i) * 35ms);
  transform: translate(calc(var(--a) * 10px), 6px) rotate(calc(var(--a) * 6deg)); }
.fd9:hover .fd9-l, .fd9:focus-visible .fd9-l { transform: translate(calc(var(--a) * 44px), -64px) rotate(calc(var(--a) * 13deg)); }
.fd9 .fd9-l:hover { transform: translate(calc(var(--a) * 44px), -78px) rotate(0) scale(1.12); z-index: 5; }
.fd9-l::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 650; padding: 3px 7px; border-radius: 7px; background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity .15s; }
.fd9 .fd9-l:hover::after { opacity: 1; }
.lg9 { position: relative; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 12px; background: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .22); overflow: hidden; }
.lg9 i { font-style: normal; font-weight: 750; font-size: 18px; color: var(--c, var(--brand)); }
.lg9 img { position: absolute; inset: 14%; width: 72%; height: 72%; object-fit: contain; }
.fd9-front { position: absolute; left: 0; right: 0; bottom: 0; height: 66%; z-index: 2; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 1px; padding: 10px 12px; border-radius: 14px; text-align: left;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 34%, rgba(255, 255, 255, .55)), color-mix(in srgb, var(--c) 22%, rgba(255, 255, 255, .25)));
  -webkit-backdrop-filter: blur(14px) saturate(170%); backdrop-filter: blur(14px) saturate(170%); border: 1px solid rgba(255, 255, 255, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 6px 16px rgba(0, 0, 0, .14); transform-origin: 50% 100%; transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.fd9:hover .fd9-front, .fd9:focus-visible .fd9-front { transform: rotateX(-14deg); }
.fd9-front b { font-size: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.fd9-front small { font-size: 11.5px; color: rgba(255, 255, 255, .92); text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.fd9-front .fd9-ic { position: absolute; top: 9px; right: 10px; color: #fff; opacity: .9; }
.fd9-front .fd9-ic svg { width: 18px; height: 18px; }
.fd9:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; border-radius: 14px; }
.fd9-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 172px; }
.fd9-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); transition: background .15s, color .15s; }
.fd9-tag.on { background: var(--c); border-color: var(--c); color: #fff; }

/* ---------- open folder: every poster ---------- */
#fo9 { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 20, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; }
#fo9.on { opacity: 1; }
body.fo9-open { overflow: hidden; }
body.fo9-open #toast { z-index: 500; }
.fo9-panel { width: min(980px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border-radius: 22px; padding: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); transform: translateY(14px) scale(.97); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
#fo9.on .fo9-panel { transform: none; }
.fo9-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fo9-head h2 { margin: 0; font-size: 20px; }
.fo9-head .fd9-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--c); color: #fff; flex: none; }
.fo9-tools { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.fo9-tl { display: flex; align-items: center; gap: 8px; flex: none; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2, var(--surface)); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.fo9-tl .lg9 { width: 30px; height: 30px; border-radius: 9px; }
.fo9-tl .lg9 i { font-size: 13px; }
.fo9-drop { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.fo9-dt { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 5px 10px; border-radius: 10px; border: 1px dashed var(--line); color: var(--ink-2); transition: transform .15s, background .15s; }
.fo9-dt svg { width: 14px; height: 14px; }
#fo9.dragging .fo9-dt { border-color: var(--c); }
.fo9-dt.over { background: var(--c); color: #fff; transform: scale(1.06); border-style: solid; }
.fo9-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.fo9-p { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; min-width: 0;
  animation: fo9in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 40ms); transition: transform .2s; }
.fo9-p:hover, .fo9-p:focus-visible { transform: translateY(-4px); }
.fo9-p .cover { box-shadow: 0 8px 20px rgba(0, 0, 0, .15); }
.fo9-p.dragging { opacity: .4; }
.fo9-cap { display: flex; flex-direction: column; min-width: 0; }
.fo9-cap b { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fo9-cap small { font-size: 11.5px; color: var(--muted); }
@keyframes fo9in { from { opacity: 0; transform: translateY(40px) scale(.7) rotate(calc((var(--i) - 2) * 4deg)); } }
@media (max-width: 520px) { .fo9-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fo9-head .btn:not([data-a="fo9-close"]) { display: none; } .fd9-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  .dk9-c, .fd9-l, .fd9-front, .fo9-p, .fo9-panel, #fo9 { transition: none !important; animation: none !important; }
}
