/* Game app on top of the website's css/main.css (same palette, fonts and components). */
[hidden] { display: none !important; }
.app { padding: 24px 0 64px; display: grid; gap: var(--gap); }
.app > *, .app-cols > *, .app-tab { min-width: 0; }
.site-header .wrap { flex-wrap: wrap; gap: 8px 16px; }
.app-tabs { display: flex; flex-wrap: wrap; gap: 2px; order: 3; width: 100%; }
.app-tabs a { font: 700 15px/1 var(--f-ui); text-decoration: none; color: var(--paper);
  padding: 10px 12px; min-height: 40px; display: inline-flex; align-items: center; }
.app-tabs a[aria-current="page"], .app-tabs a:hover { background: var(--slate); color: var(--pad); }
.app-wallet { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.app-wallet select, .app-row select { min-height: 40px; background: var(--navy); color: var(--paper); border: 2px solid var(--mist);
  font: 400 14px var(--f-body); padding: 4px 8px; max-width: 100%; }
@media (min-width: 1000px) { .app-tabs { order: 0; width: auto; margin-left: 24px; } }

.app-banner { padding: 10px 14px; background: var(--slate); color: var(--paper); box-shadow: 0 0 0 2px var(--ink); font-size: 15px; }
.app-banner:empty, .app-banner[hidden] { display: none; }
.app-banner.is-ok { background: var(--green-d); }
.app-banner.is-warn { background: var(--wood-d); }
.app-banner.is-err { background: var(--red-d); }

.app-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; }
@media (min-width: 640px) { .app-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .app-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .app-kpis--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.app-kpis dt { font: 400 15px/1.2 var(--f-ui); color: var(--text-dim); }
.app-kpis dd { margin: 0; font: 400 26px/1.1 var(--f-num); color: var(--white); overflow-wrap: anywhere; }

.app-head h1 { font-size: clamp(24px, 4vw, 34px); margin: 0 0 4px; }
.app-h2 { font-size: 20px; margin: 20px 0 6px; }
.app-cols { display: grid; gap: var(--gap); }
@media (min-width: 900px) { .app-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.app-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.app-row .check { align-items: center; }

.app-lawyers { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: var(--gap); }
@media (min-width: 700px) { .app-lawyers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .app-lawyers { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.app-lawyer { display: flex; gap: 12px; padding: 12px; align-items: flex-start; }
.app-card { flex: 0 0 96px; position: relative; }
.app-card canvas { width: 96px; height: 128px; }
.app-lbody { min-width: 0; flex: 1; }
.app-lbody h3 { font-size: 16px; margin: 0 0 2px; color: var(--white); }
.app-lbody p { margin: 0 0 2px; }
.app-stats { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--text-dim); }
.app-stats b { color: var(--white); font-size: 18px; }
.app-lawyers--sealed { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.app-sealed canvas { width: 96px; height: 128px; }

.app-orders td, .app-orders th { white-space: nowrap; }
.app-orders input[type="radio"] { width: 22px; height: 22px; accent-color: var(--pad); }

.app-items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.app-item { padding: 8px 10px; background: var(--ink); box-shadow: 0 0 0 2px var(--slate); }
.window__bar .faint { color: var(--mist); }
.app-item .app-row { margin-top: 4px; }
.app-gear { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.t-common { color: var(--mist); } .t-uncommon { color: var(--mint); } .t-rare { color: var(--sky); }
.t-epic { color: var(--lilac); } .t-legendary { color: var(--pad); } .t-mythic, .t-royalty { color: var(--rose); }

.app-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 480px; overflow-y: auto; }
.app-walletlist { list-style: none; padding: 0; display: grid; gap: 6px; }
.app-dialog { max-width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; }
.app-dialog::backdrop { background: rgba(14, 19, 33, .7); }

/* reveal: sealed case file flips to the lawyer */
.app-reveal { display: flex; flex-wrap: wrap; gap: var(--gap); justify-content: center; padding: 16px; background: var(--navy); box-shadow: 0 0 0 2px var(--ink); }
.app-flip { position: relative; width: 144px; margin: 0; text-align: center; perspective: 600px; }
.app-flip canvas { width: 144px; height: 192px; display: block; backface-visibility: hidden; transition: transform 600ms steps(6, end); }
.app-flip__back { position: absolute; top: 0; left: 0; transform: rotateY(180deg); }
.app-flip.is-open .app-flip__front { transform: rotateY(180deg); }
.app-flip.is-open .app-flip__back { transform: rotateY(0deg); }
.app-flip figcaption { margin-top: 8px; opacity: 0; transition: opacity 300ms steps(3, end) 500ms; }
.app-flip.is-open figcaption { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .app-flip canvas, .app-flip figcaption { transition: none; } }
.app-lawyers--sealed > li.small { grid-column: 1 / -1; }
@media (max-width: 639px) { .app-wallet .chip { display: none; } .app-wallet select { max-width: 150px; } }
