/* CrateMarket responsive popup reliability helpers.
   User browser zoom and Android pinch zoom remain enabled. */
html.cm-production .cm-zoom-aware-popup-card,
html.cm-production .cm-zoom-aware-popup-card {
  box-sizing: border-box;
  max-width: calc(100vw - 16px) !important;
  max-height: calc(var(--cm-visible-height, 100dvh) - 16px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}


/* CrateMarket 1.1.0 production web scroll reliability.
   The website uses the document as the only vertical scroll surface.
   Native Android/iOS WebViews keep their platform-specific scroll handling. */
html.cm-production.cm-web-scroll-ready:not(.crate-market-android):not(.crate-market-ios) {
  width: 100% !important;
  height: auto !important;
  min-height: 100% !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto !important;
  touch-action: pan-y pinch-zoom !important;
  scrollbar-gutter: stable;
}
html.cm-production.cm-web-scroll-ready:not(.crate-market-android):not(.crate-market-ios) body {
  position: static !important;
  width: 100% !important;
  height: auto !important;
  min-height: 100vh !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  overscroll-behavior-y: auto !important;
  touch-action: pan-y pinch-zoom !important;
}
html.cm-production.cm-web-scroll-ready:not(.crate-market-android):not(.crate-market-ios) body > main.page,
html.cm-production.cm-web-scroll-ready:not(.crate-market-android):not(.crate-market-ios) body > .page {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* CrateMarket UI Refresh - Phase 1 scoped design foundation. */
/*
 * CrateMarket UI Refresh - Phase 1 design foundation
 *
 * This stylesheet is opt-in through html.cm-ui-refresh and deliberately avoids
 * navigation, authentication/startup gates, VIP, crate/conveyor, Dynamic
 * Market, tutorial, native overlay, and native shell selectors.
 */

html.cm-ui-refresh {
  --cm-ui-font-sans: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;

  --cm-ui-type-page: clamp(1.75rem, 4vw, 2.5rem);
  --cm-ui-type-section: clamp(1.08rem, 2vw, 1.3rem);
  --cm-ui-type-card: 0.96rem;
  --cm-ui-type-value: clamp(1.08rem, 2.4vw, 1.42rem);
  --cm-ui-type-body: 0.9rem;
  --cm-ui-type-helper: 0.8rem;
  --cm-ui-type-caption: 0.75rem;
  --cm-ui-leading-tight: 1.18;
  --cm-ui-leading-body: 1.56;

  --cm-ui-space-1: 4px;
  --cm-ui-space-2: 8px;
  --cm-ui-space-3: 12px;
  --cm-ui-space-4: 16px;
  --cm-ui-space-5: 20px;
  --cm-ui-space-6: 24px;
  --cm-ui-space-7: 28px;
  --cm-ui-space-8: 32px;

  --cm-ui-surface-1:
    linear-gradient(145deg, rgba(42, 48, 72, 0.82), rgba(21, 25, 39, 0.98));
  --cm-ui-surface-2:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 42%),
    rgba(20, 24, 38, 0.96);
  --cm-ui-surface-3: rgba(11, 14, 24, 0.52);
  --cm-ui-border-soft: rgba(148, 157, 191, 0.18);
  --cm-ui-border-strong: rgba(149, 135, 255, 0.34);
  --cm-ui-shadow-1: 0 16px 42px rgba(0, 0, 0, 0.23);
  --cm-ui-shadow-2: 0 22px 58px rgba(0, 0, 0, 0.31);

  --cm-ui-accent: #9587ff;
  --cm-ui-accent-soft: rgba(149, 135, 255, 0.12);
  --cm-ui-success: #65d9a8;
  --cm-ui-success-soft: rgba(101, 217, 168, 0.1);
  --cm-ui-warning: #f2c96f;
  --cm-ui-warning-soft: rgba(242, 201, 111, 0.1);
  --cm-ui-error: #ff7f8a;
  --cm-ui-error-soft: rgba(255, 127, 138, 0.1);
  --cm-ui-info: #b6a5ff;
  --cm-ui-info-soft: rgba(182, 165, 255, 0.09);
  --cm-ui-muted: #aeb7d0;

  --cm-ui-radius-card: 16px;
  --cm-ui-radius-control: 11px;
  --cm-ui-motion-fast: 140ms;
}

/* Typography: route-scoped hierarchy only. */
html.cm-ui-page-game body > main.page .cm-ui-section > .heading h2,
html.cm-ui-page-account #app > .top h1,
html.cm-ui-page-admin #app .main > .topbar h2,
html.cm-ui-page-about body > main.shell > .top h1,
html.cm-ui-page-legal body > main > .top h1,
html.cm-ui-page-delete body > main.shell > .card > h1 {
  font-family: var(--cm-ui-font-sans);
  font-size: var(--cm-ui-type-page);
  font-weight: 900;
  line-height: var(--cm-ui-leading-tight);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

html.cm-ui-page-game body > main.page .cm-ui-section > .heading h2,
html.cm-ui-page-account #app .head h2,
html.cm-ui-page-admin #app .main .panel-head h3,
html.cm-ui-page-about body > main.shell .card h2,
html.cm-ui-page-legal body > main article h2,
html.cm-ui-page-delete body > main.shell .card h2 {
  font-size: var(--cm-ui-type-section);
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

html.cm-ui-page-game body > main.page .cm-ui-section :where(p, li),
html.cm-ui-page-account #app :where(.head p, .body p, .event),
html.cm-ui-page-admin #app .main :where(.panel-head p, .message, .muted),
html.cm-ui-page-about body > main.shell :where(.top p, .card p),
html.cm-ui-page-legal body > main article :where(p, li),
html.cm-ui-page-delete body > main.shell .card :where(p, li) {
  line-height: var(--cm-ui-leading-body);
}

html.cm-ui-page-game body > main.page .cm-ui-section .eyebrow,
html.cm-ui-page-account #app .eyebrow,
html.cm-ui-page-admin #app .main .eyebrow,
html.cm-ui-page-about body > main.shell .eyebrow,
html.cm-ui-page-legal body > main .eyebrow,
html.cm-ui-page-delete body > main.shell .eyebrow {
  font-size: var(--cm-ui-type-caption);
  line-height: 1.35;
}

html.cm-ui-page-game body > main.page .inventory-value-card strong,
html.cm-ui-page-account #app .fact strong,
html.cm-ui-page-admin #app .main .metric strong,
html.cm-ui-page-admin #app .main :where(.cm-health-card, .cm-economy-card, .cm-pa-card) strong {
  font-size: var(--cm-ui-type-value);
  font-variant-numeric: tabular-nums;
  line-height: 1.22;
}

html.cm-ui-page-account #app :where(.field > span, .fact > span, .event > span),
html.cm-ui-page-admin #app .main :where(.field > span, .metric > span),
html.cm-ui-page-game body > main.page .inventory-value-card :where(span, small) {
  font-size: var(--cm-ui-type-caption);
  line-height: 1.4;
}

/* Secondary feature surfaces and utility information. */
html.cm-ui-page-game body > main.page .cm-ui-section {
  border-color: var(--cm-ui-border-strong);
  background: var(--cm-ui-surface-2);
  box-shadow: var(--cm-ui-shadow-1);
}

html.cm-ui-page-game body > main.page .cm-ui-section > .heading {
  gap: var(--cm-ui-space-4);
  margin-bottom: var(--cm-ui-space-4);
}

html.cm-ui-page-game body > main.page .cm-ui-section :where(.inventory-value-card, .history-row) {
  border-color: var(--cm-ui-border-soft);
  background: var(--cm-ui-surface-3);
  box-shadow: none;
}

html.cm-ui-page-account #app .card {
  border-color: var(--cm-ui-border-soft);
  background: var(--cm-ui-surface-2);
  box-shadow: var(--cm-ui-shadow-1);
}

html.cm-ui-page-account #app .head {
  padding: var(--cm-ui-space-4) var(--cm-ui-space-5);
  border-bottom-color: var(--cm-ui-border-soft);
}

html.cm-ui-page-account #app .head p {
  margin-top: var(--cm-ui-space-1);
  font-size: var(--cm-ui-type-helper);
}

html.cm-ui-page-account #app .body {
  padding: var(--cm-ui-space-5);
}

html.cm-ui-page-account #app :where(.fact, .qr, .step9-provider-row, .step9-setup-box) {
  border-color: var(--cm-ui-border-soft);
  background: var(--cm-ui-surface-3);
}

html.cm-ui-page-account #app .stack {
  gap: var(--cm-ui-space-3);
}

html.cm-ui-page-admin #app .main .panel {
  border-color: var(--cm-ui-border-soft);
  background: var(--cm-ui-surface-2);
  box-shadow: var(--cm-ui-shadow-1);
}

html.cm-ui-page-admin #app .main .panel-head {
  gap: var(--cm-ui-space-4);
  padding: var(--cm-ui-space-4) var(--cm-ui-space-5);
  border-bottom-color: var(--cm-ui-border-soft);
}

html.cm-ui-page-admin #app .main .panel-head p {
  margin-top: var(--cm-ui-space-1);
  font-size: var(--cm-ui-type-helper);
}

html.cm-ui-page-admin #app .main .panel-body {
  padding: var(--cm-ui-space-5);
}

html.cm-ui-page-admin #app .main :where(
  .metric,
  .detail-card,
  .action-box,
  .cm-health-card,
  .cm-economy-card,
  .cm-pa-card,
  .chat-admin-message,
  .chat-admin-report,
  .chat-admin-restriction
) {
  border-color: var(--cm-ui-border-soft);
  background: var(--cm-ui-surface-3);
  box-shadow: none;
}

html.cm-ui-page-admin #app .main :where(.metrics, .grid-2, .action-grid) {
  gap: var(--cm-ui-space-3);
}

html.cm-ui-page-about body > main.shell .card,
html.cm-ui-page-legal body > main article,
html.cm-ui-page-delete body > main.shell .card {
  border-color: var(--cm-ui-border-soft);
  background: var(--cm-ui-surface-2);
  box-shadow: var(--cm-ui-shadow-2);
}

html.cm-ui-page-about body > main.shell .card,
html.cm-ui-page-delete body > main.shell .card {
  padding: var(--cm-ui-space-6);
}

html.cm-ui-page-about body > main.shell :where(.platform, .website),
html.cm-ui-page-legal body > main :where(.legal-note, article blockquote),
html.cm-ui-page-delete body > main.shell .note {
  border-color: var(--cm-ui-border-soft);
  background: var(--cm-ui-surface-3);
}

/* Empty and loading states use existing request lifecycles only. */
html.cm-ui-page-game body > main.page .cm-ui-section .empty-state,
html.cm-ui-page-game body > main.page #onlineMarketplace .empty-state,
html.cm-ui-page-account #app .cm-state--empty,
html.cm-ui-page-admin #app .main :where(.empty, .cm-health-empty, .cm-economy-empty, .cm-pa-empty) {
  border: 1px dashed var(--cm-ui-border-soft);
  border-radius: var(--cm-ui-radius-control);
  background: rgba(11, 14, 24, 0.34);
  color: var(--cm-ui-muted);
  font-size: var(--cm-ui-type-helper);
  line-height: 1.5;
  text-align: center;
}

html.cm-ui-page-account #app .cm-state--empty,
html.cm-ui-page-admin #app .main :where(.cm-health-empty, .cm-economy-empty, .cm-pa-empty) {
  padding: var(--cm-ui-space-4);
}

html.cm-ui-page-admin #app .main td.empty {
  padding: var(--cm-ui-space-5);
}

html.cm-ui-refresh .cm-state--loading::before,
html.cm-ui-page-game body > main.page .online-form-message.loading::before,
html.cm-ui-page-account #app .message.loading::before,
html.cm-ui-page-admin #app .main .message.loading::before,
html.cm-ui-page-admin #app .main #section-analytics.cm-pa-loading #paMessage::before {
  content: "";
  display: inline-block;
  width: 0.95rem;
  height: 0.95rem;
  margin-right: var(--cm-ui-space-2);
  border: 2px solid rgba(182, 165, 255, 0.25);
  border-top-color: var(--cm-ui-accent);
  border-radius: 50%;
  vertical-align: -0.18rem;
  animation: cm-ui-spin 720ms linear infinite;
}

html.cm-ui-page-game body > main.page #onlineMarketplace .empty-state.cm-state--loading {
  border-style: solid;
  border-color: var(--cm-ui-border-strong);
  background: var(--cm-ui-info-soft);
  color: var(--cm-ui-info);
}

html.cm-ui-page-admin #app .main td.cm-state--loading {
  border-style: solid;
  border-color: var(--cm-ui-border-strong);
  background: var(--cm-ui-info-soft);
  color: var(--cm-ui-info);
}

@keyframes cm-ui-spin {
  to { transform: rotate(360deg); }
}

/* Inline feedback states stay invisible while their live region is empty. */
html.cm-ui-page-game body > main.page .online-form-message:not(:empty),
html.cm-ui-page-account #app .message:not(:empty),
html.cm-ui-page-admin #app .main .message:not(:empty) {
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid var(--cm-ui-border-soft);
  border-left: 3px solid var(--cm-ui-info);
  border-radius: var(--cm-ui-radius-control);
  background: var(--cm-ui-info-soft);
  color: var(--cm-ui-muted);
  font-size: var(--cm-ui-type-helper);
  line-height: 1.48;
}

html.cm-ui-page-game body > main.page :where(.online-form-message.success),
html.cm-ui-page-account #app .message.success,
html.cm-ui-page-admin #app .main .message.success {
  border-color: rgba(101, 217, 168, 0.34);
  border-left-color: var(--cm-ui-success);
  background: var(--cm-ui-success-soft);
  color: var(--cm-ui-success);
}

html.cm-ui-page-game body > main.page #onlineMarketplace :where(.online-form-message.error, .cm-state--error),
html.cm-ui-page-account #app .message.error,
html.cm-ui-page-admin #app .main :where(.message.error, td.cm-state--error) {
  border-color: rgba(255, 127, 138, 0.38);
  border-left-color: var(--cm-ui-error);
  background: var(--cm-ui-error-soft);
  color: var(--cm-ui-error);
}

html.cm-ui-page-account #app .message.warning,
html.cm-ui-page-admin #app .main .message.warning {
  border-color: rgba(242, 201, 111, 0.38);
  border-left-color: var(--cm-ui-warning);
  background: var(--cm-ui-warning-soft);
  color: var(--cm-ui-warning);
}

html.cm-ui-page-account #app :where(.pill.success, .pill.warning, .pill.danger),
html.cm-ui-page-admin #app .main :where(.pill.success, .pill.warning, .pill.danger) {
  background: rgba(255, 255, 255, 0.025);
}

html.cm-ui-page-account #app .pill.success,
html.cm-ui-page-admin #app .main .pill.success {
  background: var(--cm-ui-success-soft);
}

html.cm-ui-page-account #app .pill.warning,
html.cm-ui-page-admin #app .main .pill.warning {
  background: var(--cm-ui-warning-soft);
}

html.cm-ui-page-account #app .pill.danger,
html.cm-ui-page-admin #app .main .pill.danger {
  background: var(--cm-ui-error-soft);
}

html.cm-ui-page-admin #app .main .pill.loading {
  border-color: var(--cm-ui-border-strong);
  background: var(--cm-ui-info-soft);
  color: var(--cm-ui-info);
}

html.cm-ui-page-admin #app .main .pill.loading::before {
  content: "";
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  margin-right: 6px;
  border: 2px solid rgba(182, 165, 255, 0.25);
  border-top-color: var(--cm-ui-accent);
  border-radius: 50%;
  vertical-align: -0.08rem;
  animation: cm-ui-spin 720ms linear infinite;
}

html.cm-ui-page-admin body > #toast {
  border-left: 3px solid var(--cm-ui-info);
  background: rgba(30, 34, 52, 0.98);
  box-shadow: var(--cm-ui-shadow-2);
  color: #f7f8ff;
}

html.cm-ui-page-admin body > #toast.success {
  border-color: rgba(101, 217, 168, 0.42);
  border-left-color: var(--cm-ui-success);
  background: linear-gradient(90deg, var(--cm-ui-success-soft), rgba(30, 34, 52, 0.98) 42%);
}

html.cm-ui-page-admin body > #toast.error {
  border-color: rgba(255, 127, 138, 0.46);
  border-left-color: var(--cm-ui-error);
  background: linear-gradient(90deg, var(--cm-ui-error-soft), rgba(30, 34, 52, 0.98) 42%);
}

html.cm-ui-page-admin body > #toast.warning {
  border-color: rgba(242, 201, 111, 0.44);
  border-left-color: var(--cm-ui-warning);
  background: linear-gradient(90deg, var(--cm-ui-warning-soft), rgba(30, 34, 52, 0.98) 42%);
}

/* Existing retry actions keep their handlers and request behavior. */
html.cm-ui-page-game body > main.page .btn.cm-retry-action {
  border-color: rgba(242, 201, 111, 0.5);
  background: var(--cm-ui-warning-soft);
  color: var(--cm-ui-warning);
  box-shadow: inset 0 0 0 1px rgba(242, 201, 111, 0.08);
}

/* Consistent interaction without changing control dimensions or layout. */
html.cm-ui-page-game body > main.page .btn:not(.cm-android-jump-button):not(.cm-ios-jump-button),
html.cm-ui-page-account #app .btn,
html.cm-ui-page-admin #app .main .btn,
html.cm-ui-page-about body > main.shell .btn,
html.cm-ui-page-legal body > main .btn,
html.cm-ui-page-delete body > main.shell .btn {
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--cm-ui-motion-fast) ease,
    border-color var(--cm-ui-motion-fast) ease,
    background-color var(--cm-ui-motion-fast) ease,
    box-shadow var(--cm-ui-motion-fast) ease,
    opacity var(--cm-ui-motion-fast) ease;
}

html.cm-ui-page-game body > main.page .btn:not(.cm-android-jump-button):not(.cm-ios-jump-button):focus-visible,
html.cm-ui-page-account #app .btn:focus-visible,
html.cm-ui-page-admin #app .main .btn:focus-visible,
html.cm-ui-page-about body > main.shell .btn:focus-visible,
html.cm-ui-page-legal body > main .btn:focus-visible,
html.cm-ui-page-delete body > main.shell .btn:focus-visible {
  outline: 2px solid var(--cm-ui-accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(149, 135, 255, 0.17);
}

html.cm-ui-page-game body > main.page .btn:not(.cm-android-jump-button):not(.cm-ios-jump-button):active:not(:disabled),
html.cm-ui-page-account #app .btn:active:not(:disabled),
html.cm-ui-page-admin #app .main .btn:active:not(:disabled),
html.cm-ui-page-about body > main.shell .btn:active,
html.cm-ui-page-legal body > main .btn:active,
html.cm-ui-page-delete body > main.shell .btn:active {
  transform: translateY(0) scale(0.98);
}

html.cm-ui-page-game body > main.page .btn:not(.cm-android-jump-button):not(.cm-ios-jump-button):disabled,
html.cm-ui-page-account #app .btn:disabled,
html.cm-ui-page-admin #app .main .btn:disabled {
  transform: none;
  box-shadow: none;
}

html.cm-ui-page-game body > main.page .btn.primary:not(.cm-android-jump-button):not(.cm-ios-jump-button),
html.cm-ui-page-account #app .btn.primary,
html.cm-ui-page-admin #app .main .btn.primary,
html.cm-ui-page-about body > main.shell .btn.primary,
html.cm-ui-page-legal body > main .btn.primary,
html.cm-ui-page-delete body > main.shell .btn.primary {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 20px rgba(85, 63, 180, 0.2);
}

html.cm-ui-page-account #app .btn.warning,
html.cm-ui-page-admin #app .main .btn.warning {
  border-color: rgba(242, 201, 111, 0.42);
  background: var(--cm-ui-warning-soft);
  color: var(--cm-ui-warning);
}

html.cm-ui-page-account #app .btn.danger,
html.cm-ui-page-admin #app .main .btn.danger {
  border-color: rgba(255, 127, 138, 0.42);
  background: var(--cm-ui-error-soft);
  color: var(--cm-ui-error);
}

@media (hover: hover) and (pointer: fine) {
  html.cm-ui-page-game body > main.page .btn:not(.cm-android-jump-button):not(.cm-ios-jump-button):hover:not(:disabled),
  html.cm-ui-page-account #app .btn:hover:not(:disabled),
  html.cm-ui-page-admin #app .main .btn:hover:not(:disabled),
  html.cm-ui-page-about body > main.shell .btn:hover,
  html.cm-ui-page-legal body > main .btn:hover,
  html.cm-ui-page-delete body > main.shell .btn:hover {
    transform: translateY(-1px);
    border-color: rgba(149, 135, 255, 0.64);
    box-shadow: 0 9px 22px rgba(0, 0, 0, 0.2);
  }
}

@media (max-width: 640px) {
  html.cm-ui-page-account #app .head,
  html.cm-ui-page-account #app .body,
  html.cm-ui-page-admin #app .main .panel-head,
  html.cm-ui-page-admin #app .main .panel-body,
  html.cm-ui-page-about body > main.shell .card,
  html.cm-ui-page-delete body > main.shell .card {
    padding: var(--cm-ui-space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  html.cm-ui-page-game body > main.page .btn:not(.cm-android-jump-button):not(.cm-ios-jump-button),
  html.cm-ui-page-account #app .btn,
  html.cm-ui-page-admin #app .main .btn,
  html.cm-ui-page-about body > main.shell .btn,
  html.cm-ui-page-legal body > main .btn,
  html.cm-ui-page-delete body > main.shell .btn {
    transition-duration: 0.01ms;
  }

  html.cm-ui-refresh .cm-state--loading::before,
  html.cm-ui-page-game body > main.page .online-form-message.loading::before,
  html.cm-ui-page-account #app .message.loading::before,
  html.cm-ui-page-admin #app .main .message.loading::before,
  html.cm-ui-page-admin #app .main #section-analytics.cm-pa-loading #paMessage::before,
  html.cm-ui-page-admin #app .main .pill.loading::before {
    animation: none;
  }
}

/* ================================================================
   CrateMarket UI Refresh Phase 3
   Main game and crate-area hierarchy. Presentation only: the real
   catalog icons, prices, line state, purchase controls, DOM order and
   crate-opening behavior remain owned by the existing game code.
   ================================================================ */

html.cm-ui-refresh.cm-ui-page-game body > main.page > .cm-game-primary {
  position: relative;
  isolation: isolate;
  padding: clamp(18px, 2.4vw, 30px);
  border-color: rgba(149, 135, 255, 0.46);
  background:
    radial-gradient(circle at 18% 0%, rgba(109, 80, 214, 0.22), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(64, 112, 204, 0.1), transparent 30%),
    linear-gradient(150deg, rgba(26, 28, 48, 0.98), rgba(11, 14, 25, 0.99));
  box-shadow:
    0 24px 62px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(149, 135, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

/* Step 12 hid the old verbose heading. Phase 3 restores this one real,
   dynamically updated line identity without reopening other helper blocks. */
html.cm-ui-refresh.cm-ui-page-game body > main.page > .cm-game-primary > .cm-game-heading {
  display: flex !important;
  align-items: flex-end;
  margin-bottom: var(--cm-ui-space-5);
  padding-bottom: var(--cm-ui-space-4);
  border-bottom: 1px solid rgba(149, 135, 255, 0.18);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-heading .eyebrow {
  color: var(--cm-ui-info);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-heading #lineHeading {
  max-width: 760px;
  font-size: clamp(1.42rem, 2.4vw, 2.05rem);
  letter-spacing: -0.025em;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-heading #lineDescription {
  max-width: 610px;
  color: var(--muted, #aab3cd);
  font-size: 0.84rem;
  line-height: 1.55;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-lines {
  gap: 10px;
  margin-bottom: var(--cm-ui-space-4);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-lines .line-tab {
  min-height: 82px;
  transition:
    border-color var(--cm-ui-motion-fast) ease,
    background-color var(--cm-ui-motion-fast) ease,
    box-shadow var(--cm-ui-motion-fast) ease,
    transform var(--cm-ui-motion-fast) ease;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-lines .line-tab.active {
  box-shadow:
    0 0 0 1px rgba(149, 135, 255, 0.18),
    0 12px 28px rgba(29, 20, 65, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-lines .line-tab.active small {
  display: block !important;
  color: var(--muted, #aab3cd);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor {
  height: 286px;
  min-height: 286px;
  border-radius: 20px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 -28px 70px rgba(0, 0, 0, 0.24),
    0 16px 34px rgba(0, 0, 0, 0.24);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .belt {
  bottom: 31px;
  border-color: rgba(91, 103, 143, 0.82);
  background:
    repeating-linear-gradient(
      90deg,
      #22283b 0,
      #22283b 28px,
      #343d59 28px,
      #343d59 54px
    );
}

/* Width stays exactly 154px because conveyor recycling uses that value. */
html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .moving-crate {
  top: 23px;
  display: grid;
  width: 154px;
  height: 222px;
  min-height: 222px;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  align-content: start;
  gap: 5px;
  padding: 12px 10px;
  border-radius: 18px;
  box-shadow:
    0 15px 30px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .moving-crate.selected {
  box-shadow:
    0 0 0 3px rgba(149, 135, 255, 0.24),
    0 18px 38px rgba(0, 0, 0, 0.42),
    0 0 34px rgba(109, 80, 214, 0.2);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .moving-crate.cloud-verified {
  box-shadow:
    0 0 0 1px rgba(99, 229, 176, 0.2),
    0 15px 30px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .crate-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-size: 2rem;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .crate-label {
  min-height: 2.3em;
  color: var(--text, #f7f8ff);
  font-size: 0.75rem;
  line-height: 1.15;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .crate-cost {
  display: inline-flex;
  max-width: 126px;
  min-height: 25px;
  margin: 1px auto 0;
  padding: 4px 8px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(242, 201, 111, 0.24);
  border-radius: 999px;
  background: rgba(242, 201, 111, 0.09);
  color: #f3d487;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .free-crate .crate-cost {
  border-color: rgba(99, 229, 176, 0.3);
  background: rgba(99, 229, 176, 0.1);
  color: var(--free, #63e5b0);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .crate-cost.progression-discount-active {
  display: grid;
  justify-items: center;
  gap: 1px;
  overflow: visible;
  white-space: normal;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .line-badge {
  justify-self: center;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection {
  display: grid;
  min-height: 126px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--cm-ui-space-4);
  margin-top: var(--cm-ui-space-4);
  padding: var(--cm-ui-space-4);
  border-color: rgba(149, 135, 255, 0.35);
  border-radius: 17px;
  background:
    radial-gradient(circle at 0% 50%, rgba(149, 135, 255, 0.13), transparent 36%),
    rgba(8, 11, 20, 0.76);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection #selectedDetails {
  min-width: 0;
  line-height: 1.5;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .selected-main {
  align-items: flex-start;
  gap: var(--cm-ui-space-4);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .selected-main > div:last-child {
  min-width: 0;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection #selectedDetails,
html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .selected-main > div:last-child,
html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .drops {
  overflow-wrap: anywhere;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .big-icon {
  width: 84px;
  height: 84px;
  border: 1px solid rgba(149, 135, 255, 0.42);
  border-radius: 18px;
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.1), transparent 32%),
    rgba(109, 80, 214, 0.17);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: 2.6rem;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .selected-main h3 {
  margin-bottom: 6px;
  font-size: clamp(1rem, 1.7vw, 1.25rem);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .drops {
  color: var(--muted, #aab3cd);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .buy-controls {
  flex-wrap: wrap;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .auto-buy-option,
html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .speed-control {
  border-color: rgba(104, 113, 148, 0.42);
  background: rgba(25, 29, 46, 0.78);
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-selection #buy {
  min-width: 170px;
  min-height: 48px;
  padding-inline: 18px;
  border-color: rgba(177, 159, 255, 0.34);
  background: linear-gradient(135deg, #a79aff, #8877f2);
  color: #101321;
  font-size: 0.88rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 24px rgba(76, 52, 169, 0.28);
}

/* Keep real line guidance present as lightweight utility information. */
html.cm-ui-refresh.cm-ui-page-game body > main.page > .cm-game-primary > #lineRule {
  display: block !important;
  margin-top: var(--cm-ui-space-4);
  padding: 8px 0 8px 12px;
  border: 0;
  border-left: 2px solid currentColor;
  border-radius: 0;
  background: transparent;
  font-size: 0.76rem;
}

html.cm-ui-refresh.cm-ui-page-game body > main.page > .cm-game-primary > #lineRule strong {
  color: var(--text, #f7f8ff);
}

/* Secondary game systems remain readable and complete, with less elevation
   than the main crate experience. Later phases still own their internals. */
html.cm-ui-refresh.cm-ui-page-game body > main.page .cm-game-secondary {
  border-color: rgba(80, 88, 119, 0.46);
  background: linear-gradient(150deg, rgba(20, 24, 39, 0.86), rgba(12, 15, 26, 0.92));
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result .modal-card {
  border-color: rgba(149, 135, 255, 0.48);
  background:
    radial-gradient(circle at 50% 0%, rgba(109, 80, 214, 0.18), transparent 38%),
    linear-gradient(150deg, rgba(25, 28, 47, 0.99), rgba(10, 13, 23, 0.99));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(149, 135, 255, 0.1);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result .modal-icon:not(.rarity-result-icon) {
  display: grid;
  width: 72px;
  height: 72px;
  margin-inline: auto;
  place-items: center;
  border: 1px solid rgba(149, 135, 255, 0.35);
  border-radius: 18px;
  background: rgba(109, 80, 214, 0.14);
  font-size: 2.5rem;
  line-height: 1;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result .close,
html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result #modalDone {
  min-width: 44px;
  min-height: 44px;
}

@media (max-width: 1080px) {
  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection {
    grid-template-columns: minmax(0, 1fr);
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .buy-controls {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  html.cm-ui-refresh.cm-ui-page-game body > main.page > .cm-game-primary {
    padding: 14px;
    border-radius: 18px;
  }

  html.cm-ui-refresh.cm-ui-page-game body > main.page > .cm-game-primary > .cm-game-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-heading #lineDescription {
    max-width: none;
    text-align: left;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-lines {
    display: grid;
    grid-auto-columns: minmax(148px, 44vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    gap: 8px;
    padding: 2px 2px 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: none;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-lines::-webkit-scrollbar {
    display: none;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-lines .line-tab {
    min-height: 92px;
    scroll-snap-align: start;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor {
    height: 278px;
    min-height: 278px;
    border-radius: 17px;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection {
    min-height: 0;
    padding: 14px;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .selected-main {
    align-items: flex-start;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .big-icon {
    width: 72px;
    height: 72px;
    font-size: 2.2rem;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .buy-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .auto-buy-option,
  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection .speed-control,
  html.cm-ui-refresh.cm-ui-page-game .cm-game-selection #buy {
    width: 100%;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.cm-ui-refresh.cm-ui-page-game .cm-game-lines .line-tab {
    transition-duration: 0.01ms;
  }
}

/* --------------------------------------------------------------------------
   Phase 4: server-confirmed crate and item reveal experience
   --------------------------------------------------------------------------
   The explicit data marker is applied only after a cloud opening response has
   already updated the real game state. Every other shared modal remains on its
   existing presentation path. */

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] {
  --cm-opening-duration: 620ms;
  --cm-opening-rarity: #a99cff;
  --cm-opening-border: rgba(169, 156, 255, 0.5);
  --cm-opening-aura: rgba(117, 82, 222, 0.18);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="common"] {
  --cm-opening-rarity: #d2d7e6;
  --cm-opening-border: rgba(210, 215, 230, 0.38);
  --cm-opening-aura: rgba(210, 215, 230, 0.09);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="uncommon"] {
  --cm-opening-rarity: #78e8aa;
  --cm-opening-border: rgba(120, 232, 170, 0.42);
  --cm-opening-aura: rgba(85, 217, 147, 0.12);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="rare"] {
  --cm-opening-rarity: #8cbcff;
  --cm-opening-border: rgba(140, 188, 255, 0.5);
  --cm-opening-aura: rgba(82, 142, 255, 0.17);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="epic"] {
  --cm-opening-rarity: #d7a0ff;
  --cm-opening-border: rgba(215, 160, 255, 0.52);
  --cm-opening-aura: rgba(174, 94, 255, 0.18);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="legendary"] {
  --cm-opening-rarity: #f4d68d;
  --cm-opening-border: rgba(244, 214, 141, 0.56);
  --cm-opening-aura: rgba(244, 190, 68, 0.19);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="ascendant"] {
  --cm-opening-rarity: #ff9fd8;
  --cm-opening-border: rgba(255, 159, 216, 0.56);
  --cm-opening-aura: rgba(255, 87, 181, 0.19);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="mythic"] {
  --cm-opening-rarity: #ff9b8f;
  --cm-opening-border: rgba(255, 155, 143, 0.56);
  --cm-opening-aura: rgba(255, 96, 86, 0.19);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="celestial"] {
  --cm-opening-rarity: #8ff4ff;
  --cm-opening-border: rgba(143, 244, 255, 0.56);
  --cm-opening-aura: rgba(73, 220, 240, 0.19);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="transcendent"] {
  --cm-opening-rarity: #b7a8ff;
  --cm-opening-border: rgba(183, 168, 255, 0.56);
  --cm-opening-aura: rgba(125, 103, 255, 0.19);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="primordial"] {
  --cm-opening-rarity: #ffb56b;
  --cm-opening-border: rgba(255, 181, 107, 0.56);
  --cm-opening-aura: rgba(255, 137, 48, 0.19);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-result-rarity="eternal"] {
  --cm-opening-rarity: #fff39a;
  --cm-opening-border: rgba(255, 243, 154, 0.58);
  --cm-opening-aura: rgba(255, 229, 77, 0.2);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .modal-card {
  border-color: rgba(149, 135, 255, 0.48);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(149, 135, 255, 0.1);
  animation: none;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-stage {
  position: relative;
  display: grid;
  width: 96px;
  min-height: 86px;
  margin: 0 auto 2px;
  place-items: center;
  isolation: isolate;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(153, 102, 255, 0.34), rgba(109, 80, 214, 0.12) 46%, transparent 72%);
  box-shadow: 0 0 24px rgba(149, 104, 255, 0.32);
  opacity: 0;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-crate-icon,
html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] #modalIcon {
  grid-area: 1 / 1;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-crate-icon {
  display: none;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid rgba(169, 156, 255, 0.36);
  border-radius: 18px;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.12), transparent 32%),
    rgba(109, 80, 214, 0.16);
  color: #c9beff;
  font-size: 2.5rem;
  line-height: 1;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] #modalIcon {
  margin: 0;
  animation: none;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-meta {
  margin: 0 auto 12px;
  color: var(--cm-opening-rarity);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .single-rarity-result {
  border-color: var(--cm-opening-border);
  box-shadow: 0 0 20px var(--cm-opening-aura), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-result-copy {
  display: inline-grid;
  min-width: 0;
  gap: 2px;
  text-align: left;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-result-copy small {
  color: currentColor;
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1.35;
  opacity: 0.82;
}

html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .multi-result-item-name {
  display: inline-flex;
  min-width: 0;
  align-items: center;
}

@keyframes cm-opening-crate-move {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  36% {
    opacity: 1;
    transform: translateY(-4px) scale(1.03);
  }
  62%,
  100% {
    opacity: 0;
    transform: translateY(-7px) scale(0.97);
  }
}

@keyframes cm-opening-purple-glow {
  0%,
  22% {
    opacity: 0;
    transform: scale(0.8);
  }
  46% {
    opacity: 0.92;
    transform: scale(1.04);
  }
  72%,
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes cm-opening-item-reveal {
  0%,
  42% {
    opacity: 0;
    transform: translateY(6px) scale(0.95);
  }
  72% {
    opacity: 1;
    transform: translateY(0) scale(1.035);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cm-opening-copy-reveal {
  0%,
  46% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cm-opening-rarity-frame {
  0%,
  48% {
    border-color: rgba(149, 135, 255, 0.48);
    box-shadow:
      0 30px 80px rgba(0, 0, 0, 0.5),
      0 0 0 1px rgba(149, 135, 255, 0.1);
  }
  76%,
  100% {
    border-color: var(--cm-opening-border);
    box-shadow:
      0 30px 80px rgba(0, 0, 0, 0.5),
      0 0 0 1px var(--cm-opening-aura),
      0 0 34px var(--cm-opening-aura);
  }
}

@keyframes cm-opening-simple-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-opening-has-crate="true"] .cm-opening-crate-icon {
    display: grid;
    animation: cm-opening-crate-move var(--cm-opening-duration) ease-out 1 both;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-opening-has-crate="true"] .modal-card {
    animation: cm-opening-rarity-frame var(--cm-opening-duration) ease-out 1 both;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-opening-has-crate="true"] .cm-opening-stage::after {
    animation: cm-opening-purple-glow var(--cm-opening-duration) ease-out 1 both;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-opening-has-crate="true"] #modalIcon {
    animation: cm-opening-item-reveal var(--cm-opening-duration) ease-out 1 both;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-opening-has-crate="true"] #modalTitle,
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-opening-has-crate="true"] #cmOpeningMeta,
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"][data-cm-opening-has-crate="true"] #modalText {
    animation: cm-opening-copy-reveal var(--cm-opening-duration) ease-out 1 both;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"]:not([data-cm-opening-has-crate="true"]) .modal-card {
    animation: cm-opening-simple-fade 420ms ease-out 1 both;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .modal-card {
    animation: cm-opening-simple-fade 160ms ease-out 1 both;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-crate-icon,
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-stage::after {
    display: none;
    animation: none;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] #modalIcon,
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] #modalTitle,
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] #cmOpeningMeta,
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] #modalText {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 430px) {
  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-stage {
    width: 86px;
    min-height: 78px;
  }

  html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result[data-cm-result-kind="crate-open"] .cm-opening-meta {
    font-size: 0.73rem;
  }
}

/* ========================================================================
   CrateMarket UI Refresh Phase 5: Dynamic Market presentation
   Presentation only. Existing prices, changes, countdown, filters, selling,
   Auto-sell and Market Alert behavior remain authoritative and unchanged.
   ======================================================================== */

html.cm-ui-refresh.cm-ui-page-game body > main.page > .cm-dynamic-market {
  position: relative;
  isolation: isolate;
  gap: var(--cm-ui-space-4, 16px);
  border-color: rgba(125, 96, 255, 0.28);
  background:
    radial-gradient(circle at 92% 3%, rgba(109, 57, 255, 0.11), transparent 34%),
    linear-gradient(155deg, rgba(19, 23, 39, 0.98), rgba(13, 17, 29, 0.98));
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .marketplace-heading {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(320px, 1.28fr);
  align-items: start;
  gap: var(--cm-ui-space-4, 16px);
  padding-bottom: var(--cm-ui-space-4, 16px);
  border-bottom: 1px solid rgba(125, 96, 255, 0.18);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .marketplace-heading h2 {
  margin-top: 2px;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  letter-spacing: -0.025em;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .marketplace-heading-side {
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: end;
  align-items: start;
  gap: 10px;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .marketplace-heading-side > p {
  grid-column: 1 / -1;
  max-width: 680px;
  color: var(--muted, #aab3cd);
  font-size: 0.82rem;
  line-height: 1.55;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .market-refresh-card {
  min-height: 44px;
  border-color: rgba(244, 190, 36, 0.3);
  background: rgba(244, 190, 36, 0.07);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .market-refresh-card span {
  color: var(--muted, #aab3cd);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .market-refresh-card #timer {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .market-owned-filter {
  min-height: 44px;
  margin: 0;
  border-color: rgba(125, 96, 255, 0.42);
  background: rgba(125, 96, 255, 0.1);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .cm-market-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, 0.8fr));
  gap: 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(57, 65, 95, 0.62);
  border-radius: 14px;
  background: rgba(7, 10, 18, 0.38);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .cm-market-filters .field {
  min-width: 0;
  gap: 6px;
  color: var(--muted, #aab3cd);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.025em;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .cm-market-filters :where(input, select) {
  min-height: 44px;
  border-color: rgba(72, 82, 119, 0.82);
  background: rgba(8, 11, 20, 0.84);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .cm-market-filters :where(input, select):focus-visible {
  border-color: rgba(155, 115, 255, 0.92);
  outline: 3px solid rgba(125, 96, 255, 0.2);
  outline-offset: 1px;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .cm-market-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  justify-items: stretch;
  gap: 12px;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 282px;
  gap: 11px;
  padding: 14px;
  border-color: rgba(69, 79, 116, 0.74);
  background: linear-gradient(155deg, rgba(29, 35, 57, 0.98), rgba(19, 24, 41, 0.98));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .market-icon {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(125, 96, 255, 0.28);
  border-radius: 12px;
  background: rgba(125, 96, 255, 0.1);
  font-size: 1.35rem;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card h3 {
  min-height: 0;
  font-size: 0.82rem;
  line-height: 1.28;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-price-row {
  padding: 10px;
  border: 1px solid rgba(57, 65, 95, 0.58);
  border-radius: 11px;
  background: rgba(7, 10, 18, 0.42);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-price-stack {
  display: grid;
  min-width: 0;
  gap: 3px;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-value-label {
  color: var(--muted, #aab3cd);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .price {
  color: var(--text, #f7f8ff);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-reference {
  display: flex;
  max-width: none;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin-top: 2px;
  color: var(--muted, #aab3cd);
  font-size: 0.59rem;
  line-height: 1.35;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-reference span:last-child {
  color: #c5cbe0;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .change {
  min-width: 64px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.61rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .change.up {
  color: #64e7a2;
  background: rgba(62, 209, 137, 0.1);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .change.down {
  color: #ff858f;
  background: rgba(239, 89, 103, 0.1);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .change.flat {
  color: #b6bed3;
  background: rgba(166, 176, 201, 0.08);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .auto-sell-option {
  border-color: rgba(57, 65, 95, 0.58);
  background: rgba(8, 11, 20, 0.34);
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .market-actions .btn {
  min-height: 44px;
}

@media (hover: hover) and (pointer: fine) {
  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card:hover {
    border-color: rgba(125, 96, 255, 0.48);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26);
    transform: translateY(-2px);
  }
}

@media (max-width: 780px) {
  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .marketplace-heading {
    grid-template-columns: 1fr;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .marketplace-heading-side {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .marketplace-heading-side > * {
    width: 100%;
    max-width: none;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .cm-market-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market > .cm-market-grid {
    grid-template-columns: 1fr;
  }

  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card {
    transition: none;
  }
}

/* CrateMarket UI refresh — Phase 7 desktop Web shell.
   The rail is inert by default and opts in only after the production Web
   viewport gate is installed. Native shells and narrower layouts retain their
   existing navigation and header contracts. */
.cm-desktop-rail {
  display: none;
}

@media (min-width: 1200px) {
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) {
    --cm-desktop-rail-width: 15rem;
    --cm-desktop-header-height: 5.5rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body {
    padding-left: var(--cm-desktop-rail-width);
    padding-top: var(--cm-desktop-header-height);
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > .cm-desktop-rail {
    position: fixed;
    z-index: 45;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--cm-desktop-rail-width);
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    overflow-y: auto;
    padding: 1rem;
    border-right: 1px solid rgba(84, 68, 132, 0.44);
    background:
      radial-gradient(circle at 18% 4%, rgba(149, 94, 255, 0.17), transparent 28%),
      linear-gradient(180deg, rgba(11, 12, 22, 0.99), rgba(7, 9, 16, 0.995));
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.2);
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.72rem;
    padding: 0.25rem 0.25rem 1rem;
    border-bottom: 1px solid rgba(113, 91, 169, 0.28);
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-brand > img {
    width: 2.4rem;
    height: 2.4rem;
    flex: 0 0 auto;
    border-radius: 0.65rem;
    object-fit: cover;
    box-shadow: 0 0 24px rgba(126, 78, 255, 0.3);
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-brand > span {
    display: grid;
    min-width: 0;
    gap: 0.18rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-brand strong {
    overflow: hidden;
    color: #f7f8ff;
    font-size: 1.02rem;
    font-weight: 950;
    letter-spacing: 0.035em;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-brand strong span {
    color: #a96cff;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-brand small {
    overflow: hidden;
    color: #8f98b2;
    font-size: 0.64rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-links {
    display: grid;
    gap: 0.38rem;
    margin-top: 1.15rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-links a {
    display: grid;
    min-height: 2.9rem;
    grid-template-columns: 1.8rem minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 0.78rem;
    color: #c5ccdf;
    font-size: 0.78rem;
    font-weight: 820;
    line-height: 1.2;
    text-decoration: none;
    transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-links a > span:first-child {
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border-radius: 0.55rem;
    background: rgba(139, 83, 255, 0.13);
    color: #bd91ff;
    font-size: 0.92rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-links a:hover {
    border-color: rgba(147, 103, 255, 0.34);
    background: linear-gradient(90deg, rgba(111, 55, 210, 0.26), rgba(111, 55, 210, 0.08));
    color: #ffffff;
    transform: translateX(2px);
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-links a:focus-visible {
    outline: 3px solid rgba(149, 135, 255, 0.48);
    outline-offset: 2px;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-note {
    margin: auto 0.3rem 0;
    padding-top: 6.5rem;
    color: #777f97;
    font-size: 0.6rem;
    font-weight: 850;
    letter-spacing: 0.14em;
    line-height: 1.55;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar {
    position: fixed;
    z-index: 44;
    top: 0;
    right: 0;
    left: var(--cm-desktop-rail-width);
    display: block;
    width: auto;
    min-height: var(--cm-desktop-header-height);
    padding: 0.7rem 1rem;
    border-bottom-color: rgba(76, 62, 115, 0.48);
    background: rgba(8, 10, 18, 0.94);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(18px);
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar > div:first-child {
    display: none;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar > .top-actions {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 11.5rem 15rem;
    align-items: stretch;
    gap: 0.55rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .cloud-account-box {
    order: 1;
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.7rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .cloud-account-copy {
    min-width: 0;
    overflow: hidden;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar #cloudAccountName,
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar #marketplaceConnectionStatus {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .cloud-account-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .cloud-account-actions .btn {
    min-width: 0;
    min-height: 2.5rem;
    padding-inline: 0.65rem;
    white-space: nowrap;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar #vipSubscriptionButton {
    order: 2;
    min-width: 0;
    min-height: 3.75rem;
    padding: 0.52rem 0.65rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .info-box {
    min-width: 0;
    min-height: 3.75rem;
    padding: 0.52rem 0.65rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .info-box:has(#balance) {
    order: 3;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .free-chance-box {
    order: 4;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .hard-mode-box {
    order: 5;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .activity-popup-toggle {
    order: 6;
    min-width: 0;
    min-height: 3.75rem;
    padding: 0.52rem 0.65rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar #vipSubscriptionButton small,
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > header.topbar .activity-popup-toggle small {
    display: none;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body > main.page {
    width: calc(100% - 2rem);
    max-width: 100rem !important;
    margin: 1rem auto 3rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) #cmCratesSection,
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) #cmInventorySection,
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) #cmDynamicMarketSection,
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) #onlineMarketplace,
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) #cmActivitySection {
    scroll-margin-top: calc(var(--cm-desktop-header-height) + 1rem);
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) #cmGlobalChatLauncher.cm-chat-launcher:not([hidden]) {
    top: 24rem;
    right: auto;
    bottom: auto;
    left: 1rem;
    width: calc(var(--cm-desktop-rail-width) - 2rem);
    min-height: 2.9rem;
    justify-content: flex-start;
    border-radius: 0.78rem;
    box-shadow: none;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-global-chat-shell.desktop {
    top: var(--cm-chat-desktop-top, calc(var(--cm-desktop-header-height) + 0.9rem));
    right: 1rem;
    bottom: 1rem;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) body.cm-chat-desktop-open > main.page {
    width: calc(100% - 26rem);
    max-width: none !important;
    margin-right: 25rem;
    margin-left: 1rem;
  }
}

@media (min-width: 1200px) and (prefers-reduced-motion: reduce) {
  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-links a {
    transition: none;
  }

  html.cm-production.cm-web-scroll-ready.cm-ui-refresh.cm-ui-page-game:not(.crate-market-android):not(.crate-market-ios) .cm-desktop-rail-links a:hover {
    transform: none;
  }
}

/* ========================================================================
   CrateMarket v1.1.26: exact-value readability and pre-auth Support pane.
   Values remain complete; narrow surfaces scroll the value instead of
   inserting breaks, ellipses, or compact-number suffixes.
   ======================================================================== */

html.cm-ui-refresh.cm-ui-page-game .cm-coin-value,
html.cm-ui-refresh.cm-ui-page-game .cm-value-scroll {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  scrollbar-width: thin;
}

html.cm-ui-refresh.cm-ui-page-game .cm-value-scroll,
html.cm-ui-refresh.cm-ui-page-game #balance,
html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-card .price,
html.cm-ui-refresh.cm-ui-page-game .online-price-total,
html.cm-ui-refresh.cm-ui-page-game .online-price-unit,
html.cm-ui-refresh.cm-ui-page-game .marketplace-trade-amount,
html.cm-ui-refresh.cm-ui-page-game .history-row p,
html.cm-ui-refresh.cm-ui-page-game #modal.cm-game-result .cm-opening-meta,
html.cm-ui-refresh.cm-ui-page-game .step12-personal-rank .cm-coin-value,
html.cm-ui-refresh.cm-ui-page-game .step12-status-card strong,
html.cm-ui-refresh.cm-ui-page-game .step14-wealth-panel strong {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  scrollbar-width: thin;
}

html.cm-ui-refresh.cm-ui-page-game .inventory-name-market-row,
html.cm-ui-refresh.cm-ui-page-game .inventory-market-change {
  min-width: 0;
  max-width: 100%;
}

html.cm-ui-refresh.cm-ui-page-game .inventory-market-change {
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
  white-space: nowrap;
  scrollbar-width: thin;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .crate-cost {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .crate-cost.progression-discount-active {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

html.cm-ui-refresh.cm-ui-page-game .cm-game-conveyor .crate-cost.progression-discount-active > * {
  flex: 0 0 auto;
  white-space: nowrap;
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-price-stack,
html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-reference,
html.cm-ui-refresh.cm-ui-page-game .online-price,
html.cm-ui-refresh.cm-ui-page-game .marketplace-trade-copy,
html.cm-ui-refresh.cm-ui-page-game .item-select-copy,
html.cm-ui-refresh.cm-ui-page-game .crate-select-copy {
  min-width: 0;
}

html.cm-ui-refresh.cm-ui-page-game .inv-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex-wrap: wrap;
}

html.cm-ui-refresh.cm-ui-page-game .inv-card > .item-select-option,
html.cm-ui-refresh.cm-ui-page-game .inv-card > .crate-select-option,
html.cm-ui-refresh.cm-ui-page-game .inv-card > .crate-inventory-heading,
html.cm-ui-refresh.cm-ui-page-game .inv-card > .actions,
html.cm-ui-refresh.cm-ui-page-game .inv-card .item-select-copy,
html.cm-ui-refresh.cm-ui-page-game .inv-card .crate-select-copy,
html.cm-ui-refresh.cm-ui-page-game .inv-card .step12-sell-control {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 570px) {
  html.cm-ui-refresh.cm-ui-page-game .inv-card > .item-select-option,
  html.cm-ui-refresh.cm-ui-page-game .inv-card > .crate-select-option,
  html.cm-ui-refresh.cm-ui-page-game .inv-card > .crate-inventory-heading,
  html.cm-ui-refresh.cm-ui-page-game .inv-card > .actions {
    width: 100%;
  }
}

html.cm-ui-refresh.cm-ui-page-game .cm-dynamic-market .cm-market-reference > span {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

html.cm-ui-refresh.cm-ui-page-game .online-price-total,
html.cm-ui-refresh.cm-ui-page-game .online-price-unit {
  display: block;
}

html.cm-ui-refresh.cm-ui-page-game .history-row p {
  margin-right: 0;
}

html.cm-ui-refresh.cm-ui-page-game .multi-result-section-heading > span,
html.cm-ui-refresh.cm-ui-page-game .multi-result-summary-line > strong,
html.cm-ui-refresh.cm-ui-page-game .step12-leaderboard-table td:last-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html.cm-ui-refresh.cm-ui-page-game #authModal > .auth-card {
  position: relative;
  max-height: calc(100dvh - max(1.5rem, env(safe-area-inset-top)) - max(1.5rem, env(safe-area-inset-bottom)));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

html.cm-ui-refresh.cm-ui-page-game #authModal .auth-support-corner {
  position: absolute;
  z-index: 2;
  top: max(.75rem, env(safe-area-inset-top));
  left: max(.75rem, env(safe-area-inset-left));
  min-width: 4.7rem;
  min-height: 2.75rem;
  padding: .55rem .7rem;
}

html.cm-ui-refresh.cm-ui-page-game #authModal .auth-guest-support-pane {
  display: grid;
  gap: 1rem;
  text-align: center;
}

html.cm-ui-refresh.cm-ui-page-game #authModal .auth-support-contact {
  display: grid;
  min-width: 0;
  gap: .4rem;
  padding: 1rem;
  border: 1px solid rgba(159, 122, 255, .28);
  border-radius: .9rem;
  background: rgba(3, 7, 18, .42);
}

html.cm-ui-refresh.cm-ui-page-game #authModal .auth-support-contact > span {
  color: var(--muted, #aab3cd);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

html.cm-ui-refresh.cm-ui-page-game #authModal .auth-support-contact > a {
  color: #d1c5ff;
  font-weight: 850;
  overflow-wrap: anywhere;
}

html.cm-ui-refresh.cm-ui-page-game #authModal .auth-support-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

html.cm-ui-refresh.cm-ui-page-game #authModal .auth-support-actions .btn {
  min-height: 2.9rem;
}

html.cm-ui-refresh.cm-ui-page-admin .cm-economy-card,
html.cm-ui-refresh.cm-ui-page-admin .cm-economy-source-row {
  min-width: 0;
}

html.cm-ui-refresh.cm-ui-page-admin .cm-economy-card strong,
html.cm-ui-refresh.cm-ui-page-admin .cm-economy-source-row strong {
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  scrollbar-width: thin;
}

html.cm-ui-refresh.cm-ui-page-admin .cm-economy-table td {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 420px) {
  html.cm-ui-refresh.cm-ui-page-game #authModal .auth-support-actions {
    grid-template-columns: 1fr;
  }
}
