/* ---------- Shop, inventory and crate opening ---------- */
:root { --r-common: #8fbf3a; --r-rare: #4fb6ff; --r-legendary: #ffd23c; --r-mythical: #b84dff; }
.r-common { --rc: var(--r-common); } .r-rare { --rc: var(--r-rare); } .r-legendary { --rc: var(--r-legendary); } .r-mythical { --rc: var(--r-mythical); }
/* mythical things: purple names with a slow shimmer, wherever they're shown */
.mythname, .r-mythical .iname, #invdetail.r-mythical h3, .wslot.r-mythical .t, .hrow.r-mythical .hn {
  color: #c77dff; text-shadow: 0 0 8px rgba(184, 77, 255, 0.75); animation: mythshine 2.4s ease-in-out infinite alternate;
}
@keyframes mythshine { to { color: #efd9ff; text-shadow: 0 0 14px rgba(184, 77, 255, 1); } }
.itile.r-mythical { box-shadow: 0 0 16px rgba(184, 77, 255, 0.5); }
#invdetail.r-mythical .rar { color: #c77dff; }
/* the reveal when yer goblins bring one home */
#mythic { position: fixed; inset: 0; z-index: 96; display: none; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 50% 45%, rgba(90, 20, 140, 0.92), rgba(6, 2, 12, 0.96) 70%); }
#mythic.open { display: flex; }
#mythic .myrays { position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(184, 77, 255, 0.16) 0deg 8deg, transparent 8deg 22deg); animation: myspin 24s linear infinite; pointer-events: none; }
@keyframes myspin { to { transform: rotate(360deg); } }
#mythcard { position: relative; width: min(460px, 100%); padding: 22px 20px 18px; border-radius: 22px; text-align: center; background: linear-gradient(170deg, #2a0f44, #0d0418); border: 3px solid #b84dff; box-shadow: 0 0 60px rgba(184, 77, 255, 0.7); animation: cardpop 0.8s cubic-bezier(.2, 1.6, .4, 1); }
#mythcard .mylab { font-family: var(--f-ui); font-size: 14px; letter-spacing: 0.3em; text-transform: uppercase; color: #c77dff; }
#mythcard .myart { display: grid; place-items: center; height: 190px; }
#mythcard .myart svg { width: 170px; height: 170px; overflow: visible; filter: drop-shadow(0 0 16px rgba(184, 77, 255, 0.9)); animation: myfloat 2.6s ease-in-out infinite alternate; }
@keyframes myfloat { to { transform: translateY(-8px) rotate(3deg); } }
#mythcard h3 { margin: 4px 0 6px; font-family: var(--f-head); font-weight: 400; font-size: clamp(26px, 6vw, 36px); }
#mythcard p { margin: 6px 0; font-family: var(--f-ui); font-size: 17px; color: var(--ink); }
#mythcard .mybonus { color: #7ee07a; }
#mythcard .acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
/* and the banner everyone else sees */
#mythbanner { position: fixed; top: 12px; left: 50%; z-index: 97; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 24px); padding: 10px 18px 10px 10px; border-radius: 18px; pointer-events: none;
  background: linear-gradient(170deg, rgba(42, 15, 68, 0.97), rgba(13, 4, 24, 0.97)); border: 2px solid #b84dff; box-shadow: 0 0 40px rgba(184, 77, 255, 0.6);
  transform: translate(-50%, -160%); transition: transform 0.6s cubic-bezier(.2, 1.4, .4, 1); }
#mythbanner.show { transform: translate(-50%, 0); }
#mythbanner .mbart svg { width: 56px; height: 56px; display: block; overflow: visible; filter: drop-shadow(0 0 10px rgba(184, 77, 255, 0.9)); }
#mythbanner .mbtext { display: flex; flex-direction: column; font-family: var(--f-ui); font-size: 16px; color: var(--ink); }
#mythbanner .mbtext b { font-family: var(--f-ui); font-weight: 400; font-size: 14px; color: #efd9ff; }
/* a hint on the War Plan, and nothing more */
.wmyth { font-family: var(--f-ui); font-style: italic; font-size: 14px; color: #b98ae6; }
.scrate {
  position: relative; padding: 18px 16px 16px; border-radius: 22px; overflow: hidden; text-align: center;
  background: radial-gradient(ellipse at 50% 20%, rgba(var(--cg), 0.22), rgba(0, 0, 0, 0.35) 70%); border: 2px solid rgba(var(--cg), 0.45);
}
.scrate.goblin { --cg: 143, 255, 90; } .scrate.decor { --cg: 255, 190, 90; } .scrate.workwear { --cg: 126, 200, 255; } .scrate.cosmetic { --cg: 255, 154, 208; } .scrate.armour { --cg: 255, 106, 74; } .scrate.zombie { --cg: 155, 226, 45; } .scrate.gobbopack { --cg: 199, 125, 255; }
.scrate .art { height: 170px; display: flex; align-items: flex-end; justify-content: center; }
.scrate h3 { margin: 8px 0 2px; font-family: var(--f-ui); font-size: 20px; color: var(--ink); }
.scrate p { margin: 0 0 8px; font-family: var(--f-ui); font-size: 16px; color: var(--ink-dim); }
.scrate .odds { margin: 6px 0 10px; }
.scrate .own { font-family: var(--f-ui); font-size: 16px; color: var(--ink); margin-bottom: 10px; }
.qty { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-bottom: 12px; max-width: 100%; }
.qty button { width: 34px; height: 34px; padding: 0; border-radius: 10px; font-size: 18px; }
.qty .n { min-width: 2.2em; font-family: var(--f-ui); font-size: 22px; color: var(--gold); }
.qty .presets { display: flex; gap: 4px; }
.qty .presets button { width: auto; padding: 0 8px; font-size: 12px; }
.scrate .buy:disabled { filter: grayscale(0.8) brightness(0.6); cursor: not-allowed; animation: none; }
.scrate .after { margin-top: 10px; }

#inventory .shopcard { max-width: 1100px; width: min(1100px, calc(100vw - 32px)); }
.invtabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0; }
.invtabs button.on { color: #2b1d02; background: var(--gold); border-color: var(--gold); }
.invbody { display: flex; gap: 16px; align-items: flex-start; text-align: left; }
#invgrid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; max-height: 62vh; overflow-y: auto; padding: 4px; }
#invgrid:empty::after { content: "Nothing here yet. Buy a crate in the shop!"; grid-column: 1 / -1; font-family: var(--f-ui); font-size: 18px; color: var(--ink-dim); padding: 30px 0; text-align: center; }
.itile {
  position: relative; height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 6px 10px; cursor: pointer;
  border-radius: 12px; overflow: hidden; background: linear-gradient(170deg, #26331c, #11180b); border: 2px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.12s, border-color 0.12s;
}
.itile::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 70%); opacity: 0.8; }
.itile::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--rc); box-shadow: 0 0 10px var(--rc); }
.itile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--rc) 60%, transparent); }
.itile.sel { border-color: var(--rc); box-shadow: 0 0 16px color-mix(in srgb, var(--rc) 50%, transparent); }
.itile > * { position: relative; }
.itile .iname { max-width: 100%; font-family: var(--f-ui); font-size: 15px; line-height: 1.1; color: var(--ink); text-align: center; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-wrap: balance; flex: none; }
.itile .icount { position: absolute; top: 6px; right: 7px; padding: 0 6px; border-radius: 999px; font-family: var(--f-ui); font-size: 11px; color: #2b1d02; background: var(--gold); }
.itile .iworn { position: absolute; top: 6px; left: 7px; font-size: 12px; }
.ipv { display: flex; align-items: center; justify-content: center; height: 70px; font-size: 44px; line-height: 1; font-family: initial; }
.ipv svg { width: 78px; height: 78px; }
.ipv .aa { font-size: 30px; color: var(--ink); }
.ipv .player { font-size: 14px; }
.ipv.big { height: 150px; font-size: 96px; }
.ipv.big svg { width: 170px; height: 170px; }
.ipv.big .aa { font-size: 64px; }
.ipv.big .player { font-size: 26px; }
#invdetail { width: 300px; flex: none; padding: 16px; border-radius: 16px; background: rgba(0, 0, 0, 0.3); border: 2px solid var(--rc, rgba(154, 168, 184, 0.3)); text-align: center; }
#invdetail:empty { display: none; }
#invdetail h3 { margin: 6px 0 2px; font-family: var(--f-ui); font-size: 20px; color: var(--ink); }
#invdetail .rar { font-family: var(--f-ui); font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; font-size: 14px; color: var(--rc); }
#invdetail p { font-family: var(--f-ui); font-size: 16px; color: var(--ink-dim); margin: 8px 0; }
#invdetail .acts { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 10px; }
#invdetail .contents { margin-top: 12px; text-align: left; font-family: var(--f-ui); font-size: 15px; color: var(--ink-dim); }
#invdetail .contents b { color: var(--rc); }
@media (max-width: 760px) { .invbody { flex-direction: column; align-items: stretch; } #invdetail { width: auto; } #invgrid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } }

/* the crate opening: a dark stage, a crate full of light, a reel of loot and a blazing reveal */
#unbox { position: fixed; inset: 0; z-index: 85; display: none; overflow: hidden; --glow: 143, 255, 90; color: var(--ink); }
#unbox.open { display: block; }
#unbox.decor { --glow: 255, 190, 90; }
#unbox.r-common.revealed { --glow: 143, 191, 58; } #unbox.r-rare.revealed { --glow: 79, 182, 255; } #unbox.r-legendary.revealed { --glow: 255, 200, 60; }
.ub-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(var(--glow), 0.2), transparent 55%), radial-gradient(ellipse at 50% 55%, #141d0d, #050803 60%, #000 100%); }
.ub-close { position: absolute; top: 16px; right: 20px; z-index: 3; background: none; border: none; color: var(--ink-dim); font-size: 26px; cursor: pointer; }
.ub-title { position: absolute; top: 6vh; left: 0; right: 0; text-align: center; z-index: 2; }
.ub-title h2 { margin: 0; font-family: var(--f-head); font-weight: 400; font-size: clamp(30px, 6vw, 54px); color: var(--gold); text-shadow: 0 0 24px rgba(var(--glow), 0.6); }
.ub-title .ub-sub { font-family: var(--f-ui); font-size: 20px; color: var(--ink-dim); }
.ub-reveal { position: absolute; left: 50%; top: 50%; display: none; transform: translate(-50%, -50%); }
#unbox.revealed .ub-reveal { display: block; }
.ub-card {
  position: relative; width: min(360px, calc(100vw - 40px)); padding: 26px 24px 22px; border-radius: 24px; text-align: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--rc) 28%, #1b2412), #0c1208 75%); border: 3px solid var(--rc);
  box-shadow: 0 0 40px color-mix(in srgb, var(--rc) 60%, transparent), 0 0 120px color-mix(in srgb, var(--rc) 30%, transparent);
  animation: cardpop 0.7s cubic-bezier(.2, 1.6, .4, 1);
}
.ub-cards { display: flex; gap: 16px; justify-content: center; align-items: stretch; }
.ub-cards.multi { width: 100vw; padding: 0 16px; overflow-x: auto; scroll-snap-type: x mandatory; justify-content: flex-start; }
/* centred when they fit, and scrollable from the first card when they don't */
.ub-cards.multi > :first-child { margin-left: auto; } .ub-cards.multi > :last-child { margin-right: auto; }
@media (min-width: 820px) { .ub-cards.multi { width: auto; overflow: visible; } }
.ub-card.small { flex: none; width: min(250px, calc(100vw - 64px)); padding: 18px 16px 16px; scroll-snap-align: center; animation-fill-mode: both; }
.ub-card.small h3 { font-size: 21px; } .ub-card.small .note { font-size: 15px; } .ub-card.small .rar { font-size: 13px; }
.ub-card.small .ipv.big { transform: scale(0.8); }
.ub-cardacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; position: relative; z-index: 1; }
.ub-count { display: flex; align-items: center; gap: 6px; font-family: var(--f-ui); font-size: 17px; }
.ub-count .chip.on { color: #2b1d02; background: var(--gold); border-color: var(--gold); }
.ub-card::after { content: ""; position: absolute; top: -50%; left: -60%; width: 40%; height: 200%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); transform: rotate(20deg); animation: shine 2.6s ease-in-out 0.5s infinite; }
.ub-card.r-legendary { animation: cardpop 0.7s cubic-bezier(.2, 1.6, .4, 1), legendpulse 1.4s ease-in-out 0.7s infinite alternate; }
@keyframes cardpop { 0% { transform: scale(0.2) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.12) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes shine { 0% { left: -60%; } 60%, 100% { left: 130%; } }
@keyframes legendpulse { to { box-shadow: 0 0 70px rgba(255, 200, 60, 0.9), 0 0 200px rgba(255, 120, 0, 0.6); } }
.ub-card .rar { font-family: var(--f-ui); font-weight: 800; letter-spacing: 0.25em; text-transform: uppercase; font-size: 16px; color: var(--rc); text-shadow: 0 0 12px var(--rc); }
.ub-card h3 { margin: 6px 0; font-family: var(--f-ui); font-size: 28px; color: var(--ink); }
.ub-card .note { font-family: var(--f-ui); font-size: 18px; color: var(--ink-dim); }
.ub-card .new { display: inline-block; margin-top: 6px; padding: 2px 12px; border-radius: 999px; font-family: var(--f-ui); font-size: 13px; color: #2b1d02; background: var(--rc); animation: glowpulse 1.2s ease-in-out infinite; }
.ub-card .ipv.big { animation: itemfloat 3s ease-in-out infinite; filter: drop-shadow(0 0 20px var(--rc)); }
@keyframes itemfloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.ub-actions { position: absolute; left: 0; right: 0; bottom: 7vh; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; z-index: 2; padding: 0 16px; }
.ub-actions .gob:disabled { filter: grayscale(0.8) brightness(0.6); cursor: not-allowed; animation: none; }
/* (shaking and quaking, for the Gobbomon pack opening) */
@keyframes crateshake { 0% { transform: translate(-3px, 1px) rotate(-3deg); } 25% { transform: translate(3px, -2px) rotate(2deg); } 50% { transform: translate(-2px, -1px) rotate(3deg); } 75% { transform: translate(2px, 2px) rotate(-2deg); } 100% { transform: translate(-3px, 1px) rotate(-3deg); } }
@keyframes quake { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-8px, 4px); } 40% { transform: translate(7px, -5px); } 60% { transform: translate(-5px, -3px); } 80% { transform: translate(6px, 4px); } }
/* the 3D stage under it all (items/opening/scene.js), the white of a big pull's flash over it, and the cards along the
   bottom once it's out (the stage shows the item itself, so the card keeps to its words) */
.ub-view { position: absolute; inset: 0; cursor: pointer; }
.ub-view canvas { display: block; width: 100%; height: 100%; }
#unbox.shaking .ub-view, #unbox.revealed .ub-view { cursor: default; }
.ub-glare { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: #fff4d0; }
.ub-title, .ub-actions, .ub-reveal, .ub-close { text-shadow: 0 2px 0 #0a0612; }
.ub-bottom { position: absolute; left: 0; right: 0; bottom: 5vh; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 12px; }
#unbox .ub-bottom .ub-actions { position: static; }
#unbox .ub-reveal { position: static; transform: none; display: none; justify-content: center; max-width: 100%; }
#unbox.revealed .ub-reveal { display: flex; }
#unbox .ub-card { padding: 14px 18px 14px; background: linear-gradient(175deg, rgba(44, 48, 56, 0.94), rgba(20, 21, 26, 0.94)); }
#unbox .ub-card h3 { font-size: 22px; } #unbox .ub-card .note { font-size: 15px; }
#unbox.shaking .ub-actions, #unbox.burst .ub-actions { opacity: 0; pointer-events: none; }
.ub-pick { max-width: min(320px, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 40px; }
.ub-count .chip, .ub-actions .chip { min-height: 40px; min-width: 40px; }
/* the crate shelf: every crate you've got, as buttons, sliding up from the bottom */
.ub-shelf { position: absolute; left: 50%; bottom: 0; z-index: 4; width: min(760px, 100%); max-height: 88%; overflow-y: auto; box-sizing: border-box; padding: 12px 14px 16px;
  background: linear-gradient(175deg, #2c3038, #1c1e24); border: 3px solid #0a0612; border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 0 rgba(10, 6, 18, 0.6), 0 -20px 60px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, 105%); transition: transform 0.25s ease; visibility: hidden; }
.ub-shelf.open { transform: translate(-50%, 0); visibility: visible; }
.ub-shelftop { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ub-shelftop h3 { margin: 0; flex: 1; font-family: var(--f-head); font-weight: 400; font-size: 22px; color: var(--gold); }
.ub-shelftop small { font-family: var(--f-ui); font-size: 13px; color: var(--ink-dim); }
.ub-shelfx { min-width: 40px; min-height: 40px; background: none; border: none; color: var(--ink-dim); font-size: 22px; cursor: pointer; }
.ub-shelfgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.ub-shelfcard { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 44px; padding: 6px 6px 8px; cursor: pointer; font-family: var(--f-ui); color: var(--ink);
  background: #14151a; border: 3px solid #0a0612; border-radius: 10px; box-shadow: 0 4px 0 #0a0612; transition: transform 0.12s; }
.ub-shelfcard:hover, .ub-shelfcard.padfocus, .ub-shelfcard:focus-visible { border-color: #7aff2a; box-shadow: 0 4px 0 #0a0612, 0 0 16px rgba(122, 255, 42, 0.55); transform: translateY(-3px); outline: none; }
.ub-shelfcard .pic { width: 100%; aspect-ratio: 1.25; display: flex; align-items: center; justify-content: center; }
.ub-shelfcard .pic img, .ub-shelfcard .pic svg { width: 100%; height: 100%; object-fit: contain; }
.ub-shelfcard b { font-size: 12px; line-height: 1.2; min-height: 2.4em; }
.ub-shelfcard i { position: absolute; top: 4px; right: 6px; font-style: normal; font-weight: 800; font-size: 13px; color: #fff3b0; background: #0a0612; border-radius: 8px; padding: 1px 7px; }
.ub-shelfcard em { position: absolute; top: 4px; left: 6px; font-style: normal; font-weight: 800; font-size: 9px; text-transform: uppercase; color: #0a0612; background: var(--gold); border-radius: 6px; padding: 2px 5px; }
.ub-shelfcard.out .pic { filter: grayscale(1) brightness(0.45); } .ub-shelfcard.out b { color: var(--ink-dim); }
.ub-shelfcard u { display: block; width: 100%; margin-top: 4px; padding: 6px 0; text-decoration: none; font-size: 12px; font-weight: 800; color: #0a0612; background: #ff3ac0; border-radius: 6px; }
.ub-shelfcard.shop { justify-content: center; color: #ff7ad8; background: repeating-linear-gradient(135deg, #2a1830 0 10px, #22142a 10px 20px); }
.ub-shelfcard.shop span { font-size: 34px; line-height: 1.2; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 12px; border-radius: 12px; cursor: pointer; font-family: var(--f-ui); font-size: 14px; color: var(--ink);
  background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(154, 168, 184, 0.35);
}
.chip.r-border-rare { border-color: rgba(79, 182, 255, 0.5); }
.chip.r-border-legendary { border-color: rgba(255, 210, 60, 0.6); }
.chip.locked { opacity: 0.4; cursor: default; font-family: var(--f-ui); }
.chip.worn { outline: 3px solid var(--bile); outline-offset: 2px; background: rgba(217, 226, 60, 0.12); }
.chip:not(.locked):hover { filter: brightness(1.25); }
#purse { color: var(--gold); font-weight: 800; display: inline-block; }
#purse.jingle { animation: jingle 0.6s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes jingle { 30% { transform: scale(1.6) rotate(-10deg); } 60% { transform: scale(0.9) rotate(6deg); } }
.bubble .reward { margin: -6px 0 12px; font-family: var(--f-ui); font-size: 15px; color: #6b5310; }
#goblin.pressing .reward { display: none; }
#historypanel h2 { margin: 0 0 12px; font-family: var(--f-ui); font-weight: 800; font-size: 21px; color: var(--skin); letter-spacing: 0.06em; }
#history { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#history .entry { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; }
#history .entry.secret { font-family: var(--f-ui); font-size: 15px; color: var(--gold); }
#history .entry.moved { font-family: var(--f-ui); font-size: 15px; color: var(--torch); }
#history .who { font-family: var(--f-ui); font-size: 14px; color: var(--ink-dim); }
#livedot { display: inline-block; width: 9px; height: 9px; margin-left: 4px; vertical-align: middle; border-radius: 50%; background: #555; }
#livedot.on { background: var(--skin); box-shadow: 0 0 8px var(--skin); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }
#history .gob { --fs: 12px; --py: 7px; --px: 10px; min-height: 32px; max-width: 100%; overflow-wrap: anywhere; }
#history:empty::after { content: "Nothin' yet. Go on, make a stink."; font-family: var(--f-ui); color: var(--ink-dim); font-size: 16px; }

#main {
  flex: 1; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start;
  gap: 16px 12px; min-height: 50vh; padding: 6px 0 20px;
}

