/* ==========================================================================
   NOVA ASCENDANCY — chunky cartoon strategy-game UI
   ========================================================================== */
:root {
  --ink: #1b1d2c;
  --paper: #efe7d6;
  --paper-2: #fff8ea;
  --paper-3: #e2d7c0;
  --text: #3a3226;
  --muted: #8a7c66;
  --green: #6fd13a; --green-d: #3f9a1c;
  --yellow: #ffd23f; --yellow-d: #e08a10;
  --orange: #ffa53a; --orange-d: #d4600f;
  --red: #ff5a5a; --red-d: #c42430;
  --blue: #4fa3ff; --blue-d: #1f63d6;
  --purple: #a77bff; --purple-d: #6a36d6;
  --gray: #c9cdd6; --gray-d: #8c93a3;
  --head: linear-gradient(180deg, #4a6cc9, #2d4796);
  --r-common: #9fb3c8; --r-uncommon: #4fd36b; --r-rare: #3ea2ff; --r-epic: #b46bff; --r-legendary: #ffb52e; --r-mythic: #ff3d6e;
  --title: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --body: 'Nunito', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: radial-gradient(1200px 800px at 30% 20%, #2b2470, transparent 60%),
              radial-gradient(900px 700px at 80% 90%, #4a1f6b, transparent 60%), #0b0b24;
  font-family: var(--body); font-weight: 800; color: var(--text);
  user-select: none; -webkit-user-select: none;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }

/* outlined cartoon text */
.ol {
  font-family: var(--title); color: #fff; font-weight: 400; letter-spacing: .02em;
  text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink),
               0 -1.5px 0 var(--ink), 0 1.5px 0 var(--ink), -1.5px 0 0 var(--ink), 1.5px 0 0 var(--ink), 0 3px 0 var(--ink);
}
.ico { display: inline-block; width: 30px; height: 30px; flex: none; }
.ico svg, .ico-inline svg { width: 100%; height: 100%; display: block; }
.ico.big { width: 44px; height: 44px; }
.ico-inline { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em; }

/* ---------------------------------------------------------------- chunky buttons */
.cbtn {
  --c: var(--green); --d: var(--green-d);
  position: relative; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, #fff) 0%, var(--c) 45%, var(--d) 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(0,0,0,.18), 0 4px 0 var(--ink);
  font-family: var(--title); font-size: 18px; color: #fff; letter-spacing: .02em;
  text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink), 0 2.5px 0 var(--ink);
  transition: transform .06s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.cbtn:hover:not(:disabled) { filter: brightness(1.08); }
.cbtn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -2px 0 rgba(0,0,0,.18), 0 1px 0 var(--ink); }
.cbtn:disabled { --c: var(--gray); --d: var(--gray-d); cursor: not-allowed; }
.cbtn.blue { --c: var(--blue); --d: var(--blue-d); }
.cbtn.yellow { --c: var(--yellow); --d: var(--yellow-d); }
.cbtn.orange { --c: var(--orange); --d: var(--orange-d); }
.cbtn.red { --c: var(--red); --d: var(--red-d); }
.cbtn.purple { --c: var(--purple); --d: var(--purple-d); }
.cbtn.big { font-size: 24px; padding: 10px 26px; }
.cbtn.sm { font-size: 15px; padding: 5px 12px; border-radius: 10px; }
.cbtn .ico-inline { width: 1.2em; height: 1.2em; }
.cbtn .cost { display: inline-flex; align-items: center; gap: 4px; }

.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; box-shadow: 0 3px 0 var(--ink); }
.seg button { border: 0; padding: 6px 12px; background: #cfc3aa; font-family: var(--title); font-size: 15px; color: #fff;
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.active { background: var(--blue); }

.badge {
  position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  background: var(--red); border: 2.5px solid var(--ink); color: #fff; font-family: var(--title); font-style: normal; font-size: 13px;
  display: grid; place-items: center; box-shadow: 0 2px 0 var(--ink); animation: bounce 1.2s ease-in-out infinite;
}
@keyframes bounce { 50% { transform: translateY(-3px); } }

/* ---------------------------------------------------------------- login */
.auth { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; align-content: center; gap: 20px; padding: 20px; }
.logo { text-align: center; line-height: .9; }
.logo-top { font-size: clamp(54px, 12vw, 96px); color: #ffd23f; }
.logo-bottom { font-size: clamp(30px, 6.5vw, 52px); color: #6fe3ff; }
.logo-top, .logo-bottom {
  text-shadow: -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink), 3px 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 3px 0 var(--ink), -3px 0 0 var(--ink), 3px 0 0 var(--ink), 0 7px 0 var(--ink);
}
.logo-sub { margin-top: 14px; color: #cfd8ff; font-size: 16px; letter-spacing: .08em; }
.auth-card { width: min(420px, 100%); }
.auth-card label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .06em; }
.auth-card input, .chat-form input, .bet input {
  display: block; width: 100%; margin-top: 4px; padding: 11px 13px; border-radius: 10px; border: 3px solid var(--ink);
  background: #fff; font-family: var(--body); font-weight: 800; font-size: 16px; color: var(--text); outline: none;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.08); user-select: text;
}
.auth-card input:focus, .bet input:focus { border-color: var(--blue-d); }
.auth-actions { display: grid; gap: 12px; margin-top: 18px; }
.auth-error { color: var(--red-d); min-height: 1.2em; text-align: center; margin: 12px 0 0; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* ---------------------------------------------------------------- map */
#app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#map.dragging { cursor: grabbing; }
#overlay, #fx, #selLayer { pointer-events: none; }
.bldg { cursor: pointer; }
.bldg .hit { fill: transparent; }
.bldg.sel .art { animation: selBounce .35s ease-out; }
@keyframes selBounce { 40% { transform: translateY(-8px); } }
.bldg .art { transform-box: fill-box; transform-origin: center bottom; }
.bldg.tap .art { animation: tap .14s ease-out; }
@keyframes tap { 50% { transform: scale(1.04, .94); } }
.sel-ring { fill: rgba(255,255,255,.18); stroke: #fff; stroke-width: 4; stroke-dasharray: 14 8; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -44; } }
.blueprint .art { opacity: .5; filter: saturate(.2) brightness(1.4) hue-rotate(160deg); }
.bp-ring { fill: rgba(79,227,255,.12); stroke: #4fe3ff; stroke-width: 3; stroke-dasharray: 10 8; }
.up-arrow { animation: bounce 1s ease-in-out infinite; }
.svg-title { font-family: var(--title); font-size: 22px; fill: #fff; stroke: var(--ink); stroke-width: 5px; paint-order: stroke; }
.svg-small { font-family: var(--title); font-size: 11px; fill: #fff; stroke: var(--ink); stroke-width: 3px; paint-order: stroke; }
.svg-label { font-family: var(--title); font-size: 20px; fill: #fff; stroke: var(--ink); stroke-width: 5px; paint-order: stroke; }
.svg-label.lvl { font-size: 15px; fill: #ffe066; }
.pop { font-family: var(--title); font-size: 22px; fill: #ffe066; stroke: var(--ink); stroke-width: 5px; paint-order: stroke; animation: popUp 1s ease-out forwards; transform-box: fill-box; }
.pop.small { font-size: 15px; fill: #fff3b0; animation-duration: 1.4s; }
@keyframes popUp { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { transform: translateY(-8px) scale(1.1); opacity: 1; } 100% { transform: translateY(-70px) scale(1); opacity: 0; } }

/* art animations */
.bob { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.blink { animation: blink 1.6s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.pulse { animation: pulse 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pulse-slow { animation: pulse 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
.pulse-fast { animation: pulse .8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { opacity: .55; transform: scale(1.06); } }
.spin { animation: spin 4s linear infinite; }
.spinr { animation: spin 7s linear infinite reverse; }
.spin-slow { animation: spin 9s linear infinite; }
.orbit { animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.smoke { animation: smoke 3s ease-in infinite; }
@keyframes smoke { 0% { transform: translateY(10px); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateY(-30px); opacity: 0; } }
.flicker { animation: flicker .5s steps(3) infinite; }
@keyframes flicker { 50% { opacity: .7; } }
.beam { animation: beam 2s ease-in-out infinite; }
@keyframes beam { 50% { opacity: .5; } }
.wave { animation: wave 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: left center; }
@keyframes wave { 50% { transform: skewY(8deg) scaleX(.9); } }
.sway { animation: sway 4s ease-in-out infinite; transform-box: view-box; }
@keyframes sway { 50% { transform: rotate(2deg); } }
.swing { animation: swingA 3s ease-in-out infinite; }
@keyframes swingA { 50% { transform: rotate(6deg); } }
.bubbles { animation: smoke 2s ease-in infinite; }
.sparkle { animation: sparkle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes sparkle { 0%, 100% { transform: scale(.3) rotate(0); opacity: 0; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }
.waves { animation: blink 1s steps(2, jump-none) infinite; }

/* ---------------------------------------------------------------- HUD */
.hud-tl, .hud-tr, .hud-r, .hud-bl, .hud-br { position: absolute; z-index: 10; }
.hud-tl { top: 12px; left: 12px; display: grid; gap: 8px; }
.player { display: flex; align-items: center; gap: 4px; }
.lvl { position: relative; width: 64px; height: 64px; display: grid; place-items: center; z-index: 1; }
.lvl .star { position: absolute; inset: 0; }
.lvl b { position: relative; font-size: 22px; top: 3px; }
.pinfo { background: rgba(12, 16, 40, .62); border: 3px solid var(--ink); border-radius: 0 12px 12px 0; padding: 4px 14px 6px 18px; margin-left: -18px; min-width: 190px; }
.pname { font-size: 18px; }
.xpbar { height: 12px; border-radius: 6px; background: #13183a; border: 2.5px solid var(--ink); overflow: hidden; margin: 3px 0; }
.xpbar i { display: block; height: 100%; background: linear-gradient(180deg, #8ad7ff, #3b8bff); transition: width .4s; }
.era { font-size: 12px; color: #ffd23f; text-transform: uppercase; letter-spacing: .04em; }
.chips { display: flex; gap: 8px; }
.chip { display: flex; align-items: center; gap: 4px; background: rgba(12, 16, 40, .62); border: 3px solid var(--ink); border-radius: 20px; padding: 2px 12px 2px 4px; }
.chip .ico { width: 26px; height: 26px; }
.chip b { font-size: 16px; }
.chip.online { padding-left: 10px; color: #cfe8ff; font-size: 13px; }
.chip.online i { width: 10px; height: 10px; border-radius: 50%; background: #5df26b; border: 2px solid var(--ink); }

.hud-tr { top: 12px; right: 12px; display: grid; gap: 10px; justify-items: end; }
.res { position: relative; display: flex; align-items: center; }
.rbar { position: relative; width: 210px; height: 32px; background: rgba(12, 16, 40, .75); border: 3px solid var(--ink); border-radius: 8px; overflow: hidden; margin-right: -20px; }
.rbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(180deg, #ffe680, #f5b21b); transition: width .3s; }
.rbar.gem i { background: linear-gradient(180deg, #ff9ae6, #d42fb3); }
.rbar b { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); font-size: 19px; }
.res .ico.big { position: relative; z-index: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.res small { position: absolute; right: 48px; top: 31px; font-size: 13px; color: #c8ff9e; }
.boost { display: flex; align-items: center; gap: 6px; margin-top: 8px; background: linear-gradient(180deg, #ff6fb0, #c42a8a); border: 3px solid var(--ink); border-radius: 20px; padding: 2px 12px 2px 4px; box-shadow: 0 3px 0 var(--ink); animation: bounce 1.4s infinite; }
.boost .ico { width: 26px; height: 26px; }

.hud-r { right: 12px; top: 140px; display: grid; gap: 10px; }
.rbtn { position: relative; width: 62px; height: 62px; border-radius: 14px; border: 3px solid var(--ink); display: grid; place-items: center;
  background: linear-gradient(180deg, #fff6e0, #e2d2ad); box-shadow: inset 0 -4px 0 rgba(0,0,0,.15), 0 4px 0 var(--ink); padding: 0; }
.rbtn .ico { width: 34px; height: 34px; margin-top: -8px; }
.rbtn small { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 12px; }
.rbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.hud-bl { left: 14px; bottom: 14px; display: flex; align-items: flex-end; gap: 10px; }
.hud-br { right: 14px; bottom: 14px; display: flex; align-items: flex-end; gap: 10px; }
.bigbtn {
  --c: var(--orange); --d: var(--orange-d);
  position: relative; width: 104px; height: 104px; border-radius: 22px; border: 4px solid var(--ink); padding: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 65%, #fff), var(--c) 45%, var(--d));
  box-shadow: inset 0 4px 0 rgba(255,255,255,.45), inset 0 -6px 0 rgba(0,0,0,.2), 0 5px 0 var(--ink);
  display: grid; place-items: center; align-content: center; gap: 2px;
}
.bigbtn .ico { width: 56px; height: 56px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); }
.bigbtn b { font-size: 20px; }
.bigbtn.small { width: 80px; height: 80px; border-radius: 18px; }
.bigbtn.small .ico { width: 40px; height: 40px; }
.bigbtn.small b { font-size: 15px; }
.bigbtn.yellow { --c: var(--yellow); --d: var(--yellow-d); }
.bigbtn.blue { --c: var(--blue); --d: var(--blue-d); }
.bigbtn.red { --c: var(--red); --d: var(--red-d); }
.bigbtn:active { transform: translateY(4px); box-shadow: inset 0 4px 0 rgba(255,255,255,.45), 0 1px 0 var(--ink); }

/* selected building bar */
.selbar { position: absolute; z-index: 11; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; animation: rise .2s ease-out; }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }
.sel-title { font-size: 24px; text-align: center; }
.sel-title small { display: block; font-size: 15px; color: #ffe066; }
.sel-actions { display: flex; gap: 10px; }
.act { position: relative; width: 84px; height: 84px; border-radius: 16px; border: 3px solid var(--ink); padding: 4px;
  --c: var(--gray); --d: var(--gray-d);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 65%, #fff), var(--c) 45%, var(--d));
  box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(0,0,0,.18), 0 4px 0 var(--ink);
  display: grid; place-items: center; align-content: center; gap: 2px; }
.act .ico { width: 34px; height: 34px; }
.act b { font-size: 14px; line-height: 1; }
.act .c { display: flex; align-items: center; gap: 2px; font-size: 13px; }
.act .c .ico-inline { width: 15px; height: 15px; }
.act.green { --c: var(--green); --d: var(--green-d); }
.act.blue { --c: var(--blue); --d: var(--blue-d); }
.act.yellow { --c: var(--yellow); --d: var(--yellow-d); }
.act.purple { --c: var(--purple); --d: var(--purple-d); }
.act:disabled { --c: var(--gray); --d: var(--gray-d); cursor: not-allowed; }
.act:disabled .c { color: #ffb3b3; }
.act:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

/* ---------------------------------------------------------------- chat */
.chat-tab { position: absolute; z-index: 12; left: 0; top: 50%; transform: translateY(-50%); width: 46px; height: 72px; padding: 0 0 0 4px;
  border: 3px solid var(--ink); border-left: 0; border-radius: 0 14px 14px 0; background: linear-gradient(180deg, #6fb6ff, #2d6fd6);
  box-shadow: 0 4px 0 var(--ink); display: grid; place-items: center; }
.chat-tab .ico { width: 32px; height: 32px; }
.chat-tab .badge { right: -10px; }
.chat { position: absolute; z-index: 13; left: 0; top: 0; bottom: 0; width: min(380px, 92vw); display: flex; flex-direction: column;
  background: rgba(16, 24, 58, .94); border-right: 4px solid var(--ink); transform: translateX(-105%); transition: transform .25s ease-out; }
.chat.open { transform: none; }
.chat-head { display: flex; gap: 6px; padding: 10px; background: var(--head); border-bottom: 3px solid var(--ink); align-items: center; }
.chat-head button[data-ctab] { flex: 1; border: 3px solid var(--ink); border-radius: 10px; background: #5a76c9; padding: 6px; font-size: 15px; }
.chat-head button.active { background: var(--yellow); }
.x { width: 40px; height: 40px; border-radius: 10px; border: 3px solid var(--ink); background: linear-gradient(180deg, #ff8a8a, #d9303c);
  color: #fff; font-size: 20px; font-family: var(--title); box-shadow: inset 0 3px 0 rgba(255,255,255,.4), 0 3px 0 var(--ink); flex: none;
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); }
.chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-log, .feed-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; user-select: text; }
.msg { background: var(--paper-2); border: 2.5px solid var(--ink); border-radius: 12px; padding: 6px 10px; font-weight: 700; font-size: 15px; color: var(--text); word-wrap: break-word; box-shadow: 0 2px 0 var(--ink); }
.msg .u { display: block; font-family: var(--title); font-weight: 400; font-size: 15px; }
.msg .t { float: right; font-size: 11px; color: var(--muted); }
.msg.mine { background: #dff3ff; }
.msg.system { background: transparent; border: 0; box-shadow: none; color: #9fb3e0; text-align: center; font-size: 13px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 3px solid var(--ink); background: rgba(0,0,0,.2); }
.chat-form input { margin: 0; }
.feed-item { background: var(--paper-2); border: 2.5px solid var(--ink); border-left: 8px solid var(--c); border-radius: 10px; padding: 6px 10px; font-size: 14px; color: var(--text); box-shadow: 0 2px 0 var(--ink); }
.feed-item .t { display: block; font-size: 11px; color: var(--muted); }
.link { padding: 6px 12px; font-size: 12px; color: #9fb3e0; border-top: 2px solid rgba(0,0,0,.3); }
.link.ok { color: #7dff9a; }

/* ---------------------------------------------------------------- popups */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 14px; background: rgba(5, 6, 20, .6); }
.popup { width: min(860px, 100%); max-height: calc(100vh - 28px); display: flex; flex-direction: column;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 20px; box-shadow: 0 8px 0 var(--ink), 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.modal .popup { animation: popIn .22s cubic-bezier(.2,1.4,.4,1); }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } }
.popup.narrow { width: min(560px, 100%); }
.popup-head { position: relative; display: flex; align-items: center; justify-content: center; padding: 10px 56px; min-height: 58px;
  background: var(--head); border-bottom: 4px solid var(--ink); }
.popup-head h2 { margin: 0; font-size: 26px; text-align: center; }
.popup-head .x { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.popup-body { padding: 16px; overflow-y: auto; }
.popup-body h3 { font-family: var(--title); font-weight: 400; font-size: 20px; color: var(--text); margin: 18px 0 10px; }
.popup-body p { margin: 0; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { position: relative; background: var(--paper-2); border: 3px solid var(--ink); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 4px 0 var(--ink); }
.card h4 { margin: 0; font-family: var(--title); font-weight: 400; font-size: 18px; color: var(--text); }
.card p { font-size: 14px; color: var(--muted); font-weight: 700; flex: 1; }
.card .lv { position: absolute; top: 8px; right: 8px; font-size: 15px; }
.card .art-box { height: 120px; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 70%, #a9e37d, #7fc457 70%); border: 2.5px solid var(--ink); border-radius: 10px; overflow: hidden; }
.card .art-box .thumb { width: 100%; height: 100%; }
.card.locked { filter: grayscale(.85); opacity: .7; }
.card.done { background: #eaffd8; }
.card.claimed { opacity: .55; }
.tag { align-self: flex-start; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--blue-d); border: 2px solid var(--ink); border-radius: 6px; padding: 1px 7px; }
.tag.click { background: var(--red-d); }
.tag.global { background: var(--yellow-d); }
.tag.daily { background: var(--purple-d); }
.prod { color: var(--green-d); font-size: 14px; }

.pbar { height: 18px; border-radius: 10px; background: #5a4a35; border: 3px solid var(--ink); overflow: hidden; position: relative; }
.pbar i { display: block; height: 100%; background: linear-gradient(180deg, #a6f36e, #4fb82a); transition: width .4s; }
.pbar.gold i { background: linear-gradient(180deg, #ffe680, #f5a21b); }
.pbar span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--title); font-size: 12px; color: #fff;
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); }
.big-card { background: var(--paper-2); border: 3px solid var(--ink); border-radius: 16px; padding: 14px; box-shadow: 0 4px 0 var(--ink); display: grid; gap: 10px; }
.big-card h3 { margin: 0 !important; }
.reward { color: var(--orange-d); font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }

/* info popup */
.info { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: center; }
.info .art-box { height: 220px; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 70%, #a9e37d, #7fc457 70%); border: 3px solid var(--ink); border-radius: 14px; }
.info .art-box .thumb { width: 100%; height: 100%; }
.stats { display: grid; gap: 8px; }
.stat { display: flex; justify-content: space-between; background: var(--paper-2); border: 2.5px solid var(--ink); border-radius: 10px; padding: 6px 12px; }
.stat b { color: var(--blue-d); }

/* crates */
.crate .art-box { background: radial-gradient(ellipse at 50% 60%, color-mix(in srgb, var(--c) 45%, #fff), color-mix(in srgb, var(--c) 70%, #222)); }
.chest { width: 96px; height: 96px; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
.odds { display: flex; height: 10px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.odds i { display: block; height: 100%; background: var(--c); }
.odds-legend { font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 8px; }
.odds-legend span::before { content: "● "; color: var(--c); }
.relics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.relic { background: var(--paper-2); border: 3px solid var(--ink); border-radius: 12px; padding: 10px; text-align: center; box-shadow: 0 3px 0 var(--ink); }
.relic .gem { width: 38px; height: 38px; margin: 4px auto 8px; transform: rotate(45deg); border-radius: 7px; background: var(--c); border: 3px solid var(--ink); box-shadow: inset 4px 4px 0 rgba(255,255,255,.5); }
.relic b { display: block; font-family: var(--title); font-weight: 400; font-size: 15px; }
.relic small { color: var(--muted); font-size: 12px; }
.relic.missing { opacity: .45; }
.relic.missing .gem { background: #cfc3aa; box-shadow: none; }
.r-common { --c: var(--r-common); } .r-uncommon { --c: var(--r-uncommon); } .r-rare { --c: var(--r-rare); }
.r-epic { --c: var(--r-epic); } .r-legendary { --c: var(--r-legendary); } .r-mythic { --c: var(--r-mythic); }

/* reel */
.reel-wrap { position: relative; overflow: hidden; height: 140px; border: 4px solid var(--ink); border-radius: 14px; background: #2b2140; margin: 8px 0 14px; }
.reel-marker { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 6px; transform: translateX(-3px); background: var(--yellow); border: 2px solid var(--ink); z-index: 2; }
.reel { position: absolute; left: 0; top: 0; display: flex; gap: 8px; padding: 14px 0; will-change: transform; }
.reel-item { flex: none; width: 104px; height: 104px; border: 3px solid var(--ink); border-radius: 12px; display: grid; place-items: center; align-content: center; gap: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #fff), var(--c)); font-family: var(--title); font-size: 13px; color: #fff;
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); text-transform: uppercase; }
.reel-item .gem { width: 32px; height: 32px; transform: rotate(45deg); border-radius: 6px; background: #fff; border: 3px solid var(--ink); box-shadow: inset -5px -5px 0 rgba(0,0,0,.15); }
#reveal { min-height: 90px; }
.reveal { text-align: center; animation: popIn .4s cubic-bezier(.2,1.6,.4,1); }
.reveal .rname { font-family: var(--title); font-size: 34px; text-transform: uppercase; color: var(--c);
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 4px 0 var(--ink); }
.reveal .label { font-size: 20px; margin-top: 4px; }
.shine { animation: shine 1.2s linear infinite; }
@keyframes shine { 50% { box-shadow: 0 8px 0 var(--ink), 0 0 70px var(--r-mythic); } }

/* overload */
.risks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.risk { border: 3px solid var(--ink); border-radius: 14px; background: var(--paper-2); padding: 10px; text-align: left; box-shadow: 0 4px 0 var(--ink); color: var(--text); }
.risk b { font-family: var(--title); font-weight: 400; font-size: 16px; display: block; }
.risk .m { font-family: var(--title); font-size: 34px; color: #fff; text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 3px 0 var(--ink); }
.risk small { color: var(--muted); }
.risk.active { background: #ffe1ec; outline: 4px solid var(--red); }
.risk.active .m { color: var(--red); }
.bet { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0; }
.bet label { flex: 1; min-width: 180px; font-size: 13px; color: var(--muted); text-transform: uppercase; }
.meter { position: relative; height: 60px; border: 4px solid var(--ink); border-radius: 14px; overflow: hidden;
  background: repeating-linear-gradient(-45deg, #ff6b6b 0 14px, #e04848 14px 28px); }
.meter-zone { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-linear-gradient(-45deg, #7ee05a 0 14px, #5bc23a 14px 28px); border-right: 4px solid var(--ink); transition: width .3s; }
.meter-needle { position: absolute; top: -6px; bottom: -6px; width: 10px; left: 0; margin-left: -5px; background: #fff; border: 3px solid var(--ink); border-radius: 5px; }
.result { min-height: 54px; text-align: center; font-family: var(--title); font-size: 28px; margin-top: 12px; }
.result.win { color: var(--green); } .result.lose { color: var(--red); }
.result.win, .result.lose { text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 4px 0 var(--ink); }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* rankings */
.ranks { display: grid; gap: 6px; }
.rank { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; background: var(--paper-2); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 12px; box-shadow: 0 3px 0 var(--ink); }
.rank.me { background: #dff3ff; }
.rank .pos { font-family: var(--title); font-size: 22px; color: #fff; text-align: center; text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink), 0 2px 0 var(--ink); }
.rank:nth-child(1) .pos { color: #ffd23f; } .rank:nth-child(2) .pos { color: #dfe7f5; } .rank:nth-child(3) .pos { color: #ff9a5c; }
.rank .who b { font-family: var(--title); font-weight: 400; font-size: 18px; }
.rank .who small { display: block; color: var(--muted); font-size: 12px; }
.rank .score { display: flex; align-items: center; gap: 4px; font-family: var(--title); font-size: 18px; }
.rank .score .ico-inline { width: 24px; height: 24px; }
.on { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--ink); margin-left: 6px; }

/* toasts */
#toasts { position: fixed; z-index: 40; top: 90px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(460px, 92vw); }
.toast { font-family: var(--title); font-size: 18px; color: #fff; text-align: center; padding: 8px 18px; border-radius: 14px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #5a76c9, #2d4796); box-shadow: 0 4px 0 var(--ink); animation: popIn .25s ease-out;
  text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink); }
.toast.err { background: linear-gradient(180deg, #ff7a7a, #c42430); }
.toast.good { background: linear-gradient(180deg, #8de25b, #3f9a1c); }
.toast.gold { background: linear-gradient(180deg, #ffd23f, #e08a10); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .pinfo { min-width: 0; padding-right: 10px; }
  .pname { font-size: 15px; } .era { display: none; }
  .lvl { width: 52px; height: 52px; } .lvl b { font-size: 18px; }
  .chips .chip.online span { display: none; }
  .rbar { width: 130px; height: 28px; } .rbar b { font-size: 15px; }
  .res .ico.big { width: 36px; height: 36px; }
  .res small { right: 40px; top: 27px; font-size: 11px; }
  .hud-r { top: 150px; } .rbtn { width: 52px; height: 52px; } .rbtn .ico { width: 28px; height: 28px; } .rbtn small { font-size: 10px; }
  .bigbtn { width: 80px; height: 80px; } .bigbtn .ico { width: 42px; height: 42px; } .bigbtn b { font-size: 15px; }
  .bigbtn.small { width: 64px; height: 64px; } .bigbtn.small .ico { width: 32px; height: 32px; } .bigbtn.small b { font-size: 12px; }
  .selbar { bottom: 110px; } .act { width: 70px; height: 70px; } .act .ico { width: 26px; height: 26px; }
  .info { grid-template-columns: 1fr; }
  .popup-head h2 { font-size: 21px; }
}

/* thinner outline for small outlined text */
.cbtn.sm, .act b, .act .c, .rbtn small, .card .lv, .chip.online b, .seg button {
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink), 0 1.5px 0 var(--ink);
}
