/* lib: Deck Library (js/decklib.js) + the big in-battle card preview (js/ui.js showPreview) */

/* ---------- Deck Library ---------- */
#decklib .dlb-active { display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 6px; border-radius: 14px; border: 1px solid rgba(232, 186, 90, .35); background: rgba(20, 11, 40, .7); max-width: 420px; min-width: 0; }
#decklib .dlb-aa { flex: none; width: 52px; height: 52px; border-radius: 10px; background: center / cover no-repeat; box-shadow: 0 0 0 2px var(--gold-1, #f2c14e); }
#decklib .dlb-active span:last-child { display: flex; flex-direction: column; min-width: 0; }
#decklib .dlb-active small { font: 700 11px var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-1, #f2c14e); }
#decklib .dlb-active b { font: 800 18px var(--font-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff4d6; }
#decklib .dlb-cap { font: 700 15px var(--font-ui); color: #bfb0dd; letter-spacing: .08em; }
#decklib .dlb-cap.full { color: #ff8a7a; }
#decklib .dlb-grid { position: absolute; top: 100px; left: 34px; right: 34px; bottom: 196px; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); grid-auto-rows: 290px; gap: 22px; padding: 10px 8px 20px; align-content: start; }
#decklib .dlb-box { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 0 14px 14px; border-radius: 16px; overflow: hidden; cursor: pointer; text-align: left; color: #fff;
  border: 2px solid color-mix(in srgb, var(--c, #8a7aa8) 70%, transparent); background: #120a26; box-shadow: 0 14px 28px rgba(0, 0, 0, .5); content-visibility: auto; contain-intrinsic-size: 196px 290px;
  transition: transform .16s var(--ease-out, ease-out), box-shadow .16s; font: inherit; }
#decklib .dlb-box:hover { transform: translateY(-4px); box-shadow: 0 20px 36px rgba(0, 0, 0, .6), 0 0 22px color-mix(in srgb, var(--c) 40%, transparent); }
#decklib .dlb-face { position: absolute; inset: 0; background: var(--art, none) center 22% / cover no-repeat, linear-gradient(160deg, color-mix(in srgb, var(--c) 45%, #1a0d33), #0b0618); }
#decklib .dlb-face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(8, 4, 18, .55) 58%, rgba(8, 4, 18, .96) 100%); }
#decklib .dlb-lid { position: absolute; left: 0; right: 0; top: 0; height: 10px; background: linear-gradient(90deg, transparent, var(--c), transparent); opacity: .9; }
#decklib .dlb-box > :not(.dlb-face):not(.dlb-lid) { position: relative; }
#decklib .dlb-nm { font: 800 19px/1.15 var(--font-title); color: #fff4d6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-shadow: 0 2px 6px #000; }
#decklib .dlb-sub { display: flex; align-items: center; gap: 7px; font: 600 13px var(--font-ui); color: #d8ccf0; }
#decklib .dlb-sub em { margin-left: auto; font-style: normal; font-weight: 800; color: #bfb0dd; }
#decklib .dlb-sub em.ok { color: #8fe8a8; }
#decklib .dlb-box.short .dlb-face { filter: saturate(.55) brightness(.8); }
#decklib .dlb-bad { position: absolute !important; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 900 18px/1 var(--font-ui); font-style: normal; color: #fff; background: #d8372b; box-shadow: 0 0 0 2px #fff3, 0 0 14px #ff3b2b99; z-index: 2; }
#decklib .dlb-on { position: absolute !important; top: 12px; left: 10px; padding: 3px 10px; border-radius: 999px; font: 800 11px var(--font-ui); font-style: normal; letter-spacing: .14em; text-transform: uppercase; color: #2a1606; background: linear-gradient(180deg, #ffe39a, #e2a93a); z-index: 2; }
#decklib .dlb-box.active { border-color: #f2c14e; box-shadow: 0 0 0 2px rgba(242, 193, 78, .45), 0 14px 28px rgba(0, 0, 0, .5); }
#decklib .dlb-box.sel { outline: 3px solid #fff4d6; outline-offset: 3px; transform: translateY(-4px); }
#decklib .dlb-new { align-items: center; justify-content: center; border-style: dashed; background: rgba(30, 16, 60, .5); border-color: rgba(232, 186, 90, .45); }
#decklib .dlb-new .dlb-plus { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; border: 2px solid rgba(232, 186, 90, .6); margin-bottom: 10px; }
#decklib .dlb-new .dlb-plus b { font: 400 64px/1 var(--font-title); color: #ffe39a; }
#decklib .dlb-new .dlb-plus .lci { display: none; }
#decklib .dlb-new .dlb-nm, #decklib .dlb-new .dlb-sub { text-align: center; justify-content: center; }
#decklib .dlb-new.off { opacity: .5; cursor: not-allowed; }
#decklib .dlb-none { grid-column: 1 / -1; text-align: center; color: #bfb0dd; font-size: 18px; }
#decklib .dlb-bar { position: absolute; left: 34px; right: 34px; bottom: 118px; min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px; border-radius: 16px; background: rgba(12, 6, 28, .82); border: 1px solid var(--line, rgba(255, 255, 255, .12)); z-index: 4; }
#decklib .dlb-bar .btn { display: inline-flex; align-items: center; gap: 6px; }
#decklib .dlb-bar .btn .lci { width: 18px; height: 18px; }
#decklib .dlb-bar .btn.danger, .dlb-sheet .btn.danger { background: linear-gradient(180deg, #b8322a, #7a1a14); color: #fff; border-color: #ff8a7a66; }
#decklib .dlb-selnm { font: 800 18px var(--font-title); color: #fff4d6; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#decklib .dlb-why { font: 600 14px var(--font-ui); color: #ffb09a; }
#decklib .dlb-hint { color: #bfb0dd; font-size: 15px; }
#decklib .dlb-msg.bad { color: #ff9a8a; } #decklib .dlb-msg.good { color: #8fe8a8; }
.dlb-sheet .dlb-input { width: 100%; box-sizing: border-box; font: 600 20px var(--font-ui); padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(232, 186, 90, .4); background: rgba(8, 4, 18, .8); color: #fff; }
.dlb-sheet .dl-lgrid { max-height: min(560px, 60vh); overflow-y: auto; }

/* phones (body.mobile landscape): bigger tap targets */
body.mobile #decklib .dlb-grid { top: 112px; bottom: 262px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: 320px; }
body.mobile #decklib .dlb-bar { bottom: 154px; min-height: 96px; }
body.mobile #decklib .dlb-bar .btn { min-height: 80px; font-size: 22px; }
body.mobile #decklib .dlb-nm { font-size: 24px; } body.mobile #decklib .dlb-sub { font-size: 17px; }

/* portrait: 3 boxes a row, the action bar docked above the nav */
body.portrait #decklib .dlb-active { max-width: 330px; } body.portrait #decklib .dlb-active b { font-size: 22px; } body.portrait #decklib .dlb-active small { font-size: 14px; }
body.portrait #decklib .dlb-cap { display: none; }
body.portrait #decklib .dlb-grid { top: calc(var(--top-h) + 12px); left: 0; right: 0; bottom: calc(var(--nav-h) + 216px); grid-template-columns: repeat(3, 1fr); grid-auto-rows: 380px; gap: 26px 22px; padding: 16px 24px 40px; }
body.portrait #decklib .dlb-box { contain-intrinsic-size: 260px 380px; padding: 0 16px 18px; }
body.portrait #decklib .dlb-nm { font-size: 28px; } body.portrait #decklib .dlb-sub { font-size: 20px; }
body.portrait #decklib .dlb-bad { width: 44px; height: 44px; font-size: 26px; } body.portrait #decklib .dlb-on { font-size: 16px; padding: 5px 14px; }
body.portrait #decklib .dlb-bar { left: var(--gut, 24px); right: var(--gut, 24px); bottom: calc(var(--nav-h) + 10px); min-height: 170px; gap: 12px; align-content: center; }
body.portrait #decklib .dlb-bar .btn { min-height: 72px; font-size: 24px; padding: 0 20px; }
body.portrait #decklib .dlb-selnm { flex-basis: 100%; text-align: center; max-width: none; font-size: 26px; }
body.portrait #decklib .dlb-hint, body.portrait #decklib .dlb-why, body.portrait #decklib .dlb-msg { font-size: 22px; text-align: center; }
body.portrait .dlb-sheet .dlb-input { font-size: 30px; padding: 18px; }

/* lite: no shadows / hover lifts on the boxes */
body.lite #decklib .dlb-box { box-shadow: none; transition: none; }
body.lite #decklib .dlb-box:hover { transform: none; box-shadow: none; }
body.lite #decklib .dlb-bad { box-shadow: none; }

/* ---------- big in-battle card preview (js/ui.js showPreview): card + readable rules, stats and keywords ---------- */
#preview.bigpv { width: auto; height: auto; display: flex; gap: 18px; padding: 14px; border-radius: 18px; max-width: 760px;
  background: linear-gradient(160deg, rgba(24, 12, 48, .97), rgba(8, 4, 18, .97)); border: 1px solid color-mix(in srgb, var(--rc, #e8ba5a) 45%, transparent); box-shadow: 0 24px 60px rgba(0, 0, 0, .7); }
#preview.bigpv .holder { flex: none; position: relative; width: 300px; height: 420px; }
#preview.bigpv .holder > .card, #preview.bigpv .holder > * { position: relative !important; transform: none !important; }
#preview.bigpv .pv-info { width: 400px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#preview.bigpv h3 { margin: 0; font: 900 30px/1.08 var(--font-title); color: #fff4d6; }
#preview.bigpv .cp-rules { font-size: 19px; }
#preview.bigpv .keytips { position: static; display: flex; flex-direction: column; gap: 6px; }
#preview.bigpv .keytips div { font-size: 15px; line-height: 1.4; }
body.lite #preview.bigpv { box-shadow: 0 10px 24px rgba(0, 0, 0, .6); }
body.portrait #preview.bigpv { max-width: 868px; gap: 16px; }
body.portrait #preview.bigpv .pv-info { width: 500px; gap: 14px; }
body.portrait #preview.bigpv h3 { font-size: 40px; }
body.portrait #preview.bigpv .cp-eyebrow { font-size: 20px; }
body.portrait #preview.bigpv .cp-st { font-size: 20px; } body.portrait #preview.bigpv .cp-st i { font-size: 32px; }
body.portrait #preview.bigpv .cp-rules { font-size: 28px; }
body.portrait #preview.bigpv .keytips div { font-size: 23px; }
/* laneC: deck codes */
.dlb-code { width: 100%; min-height: 64px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; box-sizing: border-box; }
.dlb-prev { max-height: 40vh; overflow: auto; }
.dlb-plist { list-style: none; margin: 4px 0; padding: 0; columns: 2 180px; font-size: 13px; }
.dlb-plist li.unowned { color: #e05a5a; }
