/* Existing ticket controls and sprite styling. */
.cw-ui-runtime { overflow: visible; }

.cw-runtime-body[data-cw-shell-bg="slate"] {
  background:
    radial-gradient(circle at 12% 18%, rgba(91, 119, 136, 0.23), transparent 31%),
    radial-gradient(circle at 77% 82%, rgba(78, 99, 109, 0.14), transparent 36%),
    linear-gradient(155deg, #27313a, #111922 72%, #0e151c);
}
.cw-runtime-body[data-cw-shell-bg="bronze"] {
  background:
    radial-gradient(circle at 17% 24%, rgba(138, 98, 58, 0.25), transparent 31%),
    linear-gradient(155deg, #302b27, #1b1c1d 68%, #141819);
}
.cw-runtime-body[data-cw-shell-bg="petrol"] {
  background:
    radial-gradient(circle at 22% 15%, rgba(44, 117, 126, 0.26), transparent 34%),
    linear-gradient(155deg, #19343b, #12262c 64%, #10191e);
}
.cw-runtime-body[data-cw-shell-bg="charcoal"] {
  background:
    linear-gradient(106deg, transparent 0 40%, rgba(5, 8, 8, 0.3) 40.05% 40.2%, transparent 40.3% 100%),
    linear-gradient(71deg, transparent 0 54%, rgba(119, 87, 59, 0.2) 54.05% 54.2%, transparent 54.3% 100%),
    radial-gradient(ellipse 23% 36% at 35% 17%, rgba(120, 75, 43, 0.25), transparent 80%),
    radial-gradient(ellipse 18% 32% at 82% 62%, rgba(92, 62, 42, 0.27), transparent 85%),
    radial-gradient(ellipse 8% 28% at 4% 64%, rgba(5, 9, 9, 0.32), transparent 85%),
    radial-gradient(ellipse 16% 16% at 64% 92%, rgba(9, 13, 13, 0.28), transparent 90%),
    linear-gradient(155deg, #392a23 0%, #2b2422 53%, #201d1c 100%);
  background-size: 440px 190px, 290px 180px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  background-position: 7% 73%, 82% 18%, center, center, center, center, center;
  background-repeat: no-repeat;
}
.cw-runtime-body[data-cw-shell-bg="stone"] {
  background:
    radial-gradient(circle at 16% 18%, rgba(219, 205, 175, 0.14), transparent 34%),
    linear-gradient(160deg, #81786c, #67645f 68%, #565653);
}

.cw-bet-dock {
  position: absolute;
  left: calc(var(--cw-bet1-left) - var(--cw-stage-left));
  top: calc(var(--cw-bet-top) - var(--cw-stage-top));
  width: calc(var(--cw-bet-width) * 2 + 46px);
  height: var(--cw-bet-height);
  pointer-events: none;
  z-index: 11;
  transform: translateY(-9px);
}

.cw-bet-card {
  position: absolute;
  width: var(--cw-bet-width);
  height: var(--cw-bet-height);
  padding: 0;
  pointer-events: auto;
  box-shadow: none;
  overflow: hidden;
}

.cw-bet-card-left {
  left: 0;
  top: 0;
}

.cw-bet-card-right {
  left: calc(var(--cw-bet2-left) - var(--cw-bet1-left));
  top: 0;
}

.cw-bet-card--hidden {
  display: none;
}

.cw-bet-shell,
.cw-run-shell-mini,
.cw-bet-main,
.cw-run-main {
  height: 100%;
}

.cw-bet-main,
.cw-run-main {
  position: relative;
  display: block;
  gap: 0;
}

.cw-bet-head,
.cw-run-head {
  position: absolute;
  left: 0;
  right: 0;
  top: 16px;
  text-align: center;
}

.cw-bet-head h3,
.cw-run-head h3 {
  margin: 0;
  color: var(--cw-gold);
  font: 800 24px/1 "Cinzel", "Marcellus", serif;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
}

.cw-bet-grid {
  position: absolute;
  inset: 0;
  display: block;
}

.cw-bet-grid.is-hidden,
.cw-stepper.is-hidden,
.cw-preset-row.is-hidden,
.cw-auto-toggle.is-hidden,
.cw-auto-value.is-hidden {
  display: none;
}

.cw-field-card {
  position: absolute;
  top: 36px;
  width: 248px;
  display: grid;
  gap: 8px;
}

.cw-field-card:nth-child(1) {
  left: 24px;
}

.cw-field-card:nth-child(2) {
  left: 301px;
}

.cw-field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transform: translateY(25px);
  color: var(--cw-gold);
  font: 700 14px/1 "Rajdhani", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cw-field-label {
  transform: translateX(20px);
}

.cw-unit-tag {
  color: #f7f0db;
}

.cw-stepper {
  display: grid;
  grid-template-columns: 52px 143px 53px;
  gap: 0;
  align-items: center;
  width: 248px;
  margin-top: 24px;
  background: transparent;
}

.cw-value-display {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 248px;
  min-height: 50px;
  margin-top: 24px;
}

.cw-value-display .cw-bet-input {
  transform: none;
}

.cw-stepper--display-only {
  grid-template-columns: 52px 143px 53px;
}

.cw-stepper-spacer {
  width: 52px;
  height: 50px;
  visibility: hidden;
}

.cw-value-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 143px;
  min-height: 50px;
}

.cw-preset-row--ghost {
  visibility: hidden;
}

.cw-stepper-btn {
  width: 52px;
  height: 50px;
  cursor: pointer;
  appearance: none;
  background-color: transparent;
  box-shadow: none;
  position: relative;
}

.cw-stepper-btn[data-ui-sprite="BoutonPlus.png"] {
  transform: translateX(8px);
}

.cw-stepper-btn[data-ui-sprite="BoutonMoins.png"] {
  transform: translateX(5px);
}

.cw-stepper-btn.is-disabled,
.cw-preset.is-disabled,
.cw-auto-toggle.is-disabled,
.cw-bet-input:disabled {
  opacity: 1;
  filter: none;
  cursor: default;
}

.cw-stepper-btn.is-disabled::after,
.cw-preset.is-disabled::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.75);
  -webkit-mask-image: var(--cw-sprite-url);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-image: var(--cw-sprite-url);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 100% 100%;
  pointer-events: none;
}

.cw-bet-input {
  min-width: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 0;
  background: transparent !important;
  box-shadow: none;
  padding: 0;
  min-height: 50px;
  background-image: none !important;
  border-color: transparent !important;
  outline: 0;
  transform: translateX(15px);
  color: #fff5d6;
  text-shadow: 0 0 8px rgba(242, 203, 121, 0.7), 0 0 16px rgba(242, 203, 121, 0.4);
}

.cw-bet-input--lit {
  color: #8fd5ff;
  text-shadow: 0 0 8px rgba(92, 188, 255, 0.9), 0 0 18px rgba(92, 188, 255, 0.52);
}

.cw-bet-input--muted {
  color: #9a9a9a;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.cw-preset-row {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  gap: 5px;
  width: 220px;
  margin-left: 17px;
  margin-top: 0;
  background: transparent;
}

.cw-preset {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 31px;
  border: 0;
  padding: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  cursor: pointer;
}

.cw-preset-label {
  position: relative;
  top: -1px;
  color: #e8dfcd;
  font: 800 16px/1 "Rajdhani", sans-serif;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.32);
}

.cw-preset.is-active .cw-preset-label {
  color: #24160f;
  text-shadow: 0 1px 0 rgba(255, 246, 221, 0.35);
}

.cw-bet-footer {
  position: absolute;
  left: 28px;
  top: 165px;
  width: calc(100% - 56px);
  display: grid;
  grid-template-columns: 1fr 1fr 165px;
  gap: 24px;
  align-items: start;
}

.cw-auto-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin-top: 19px;
  color: var(--cw-text-soft);
  font: 700 15px/1 "Rajdhani", sans-serif;
  grid-column: 1;
}

.cw-bet-note {
  grid-column: 1 / span 2;
  align-self: center;
  min-height: 30px;
  color: #d4c7aa;
  font: 700 13px/1.2 "Rajdhani", sans-serif;
  letter-spacing: 0.04em;
  opacity: 0;
  justify-self: start;
  text-align: left;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.cw-bet-note.is-visible {
  opacity: 1;
}

.cw-auto-value {
  display: flex;
  align-items: flex-end;
  min-height: 50px;
  margin-top: 34px;
}

.cw-auto-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cw-auto-toggle__chrome {
  position: relative;
  width: 59px;
  height: 30px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex: 0 0 auto;
}

.cw-auto-toggle.is-disabled .cw-auto-toggle__chrome::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.75);
  -webkit-mask-image: var(--cw-sprite-url);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-image: var(--cw-sprite-url);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 100% 100%;
  pointer-events: none;
}

.cw-auto-toggle input:checked ~ .cw-auto-toggle__chrome {
  opacity: 1;
  background-color: transparent;
}

.cw-bet-submit {
  grid-column: 3;
  grid-row: 1;
  position: relative;
  display: grid;
  place-items: center;
  width: 165px;
  min-height: 64px;
  border: 0;
  padding: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  cursor: pointer;
  overflow: hidden;
  margin-top: 10px;
  justify-self: end;
  z-index: 3;
}

.cw-bet-submit__label {
  position: relative;
  top: -5px;
  color: #27180e;
  font: 800 22px/1 "Cinzel", "Marcellus", serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.28);
}

.cw-bet-submit--collect .cw-bet-submit__label {
  color: #e7f6ff;
  text-shadow: 0 1px 0 rgba(5, 18, 28, 0.44);
}

.cw-bet-submit--cancel .cw-bet-submit__label {
  color: #fff4ee;
}

.cw-bet-submit--cancel {
  filter: hue-rotate(-32deg) saturate(1.2) brightness(0.94);
}

.cw-bet-submit--next .cw-bet-submit__label {
  color: #f4ead3;
}

.cw-bet-submit--queue {
  filter: hue-rotate(-32deg) saturate(1.15) brightness(0.94);
}

.cw-bet-submit--queue .cw-bet-submit__label {
  color: #fff4ee;
}

.cw-bet-submit--disabled {
  opacity: 1;
  filter: none;
  cursor: default;
}

.cw-bet-submit--disabled::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  -webkit-mask-image: var(--cw-sprite-url);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-image: var(--cw-sprite-url);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 100% 100%;
  pointer-events: none;
}


/* Landscape composition in the 1920 × 937 reference frame. */
.cw-ui-top-border { display: none; }
.cw-logo-shell { left: 53px; top: 0; width: 400px; height: 126px; }
.cw-ui-border-left { bottom: -143px; }
.cw-corner-bottom-left { bottom: -143px; z-index: 10; }
.cw-left-column { left: 61px; top: 305px; }
.cw-balance-shell { top: -176px; }
.cw-chat-shell { height: 636px; max-height: 636px; }
.cw-chat-list {
  top: 106px;
  height: 350px;
  gap: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 22px), transparent 100%);
}
.cw-chat-item {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 9px;
  padding: 10px 12px;
  border-radius: 14px;
}
.cw-chat-item strong {
  max-width: 78px;
  margin: 0;
  overflow-wrap: anywhere;
  letter-spacing: 0.08em;
}
.cw-chat-item span { min-width: 0; overflow-wrap: anywhere; }
.cw-chat-item[data-kind="step"] { grid-template-columns: 1fr; row-gap: 4px; }
.cw-chat-item[data-kind="step"] span { font-size: 17px; }
.cw-chat-compose { gap: 39px; }
.cw-chat-input { transform: none; }
.cw-settings-toggle { bottom: -93px; }
.cw-sound-toggle { left: 175px; bottom: -143px; }

.cw-run-column { left: 455px; top: 59px; }
.cw-bet-dock { transform: translateY(61px); }
.cw-ui-runtime .cw-players-panel { top: 155px; }
.cw-stage-frame,
.cw-stage-frame canvas#c {
  border-radius: 34px;
}
.cw-stage-frame { box-shadow: 0 10px 0 rgba(0, 0, 0, 0.46), 0 20px 24px rgba(0, 0, 0, 0.66); }
.cw-chat-shell,
.cw-balance-shell { filter: drop-shadow(6px 11px 2px rgba(0, 0, 0, 0.7)); }

.cw-run-top,
.cw-run-bottom { display: none; }

.cw-results-column { top: 59px; width: 54px; height: 895px; }
.cw-results-column--left { left: 1772px; }
.cw-results-column--right { left: 1836px; }
.cw-results-strip { gap: 6px; }
.cw-result-slip { width: 54px; height: 53px; }
.cw-result-slip__value { font-size: 16px; }

/* One ticket component, with a preparation and a committed state. */
.cw-bet-card {
  --ticket-surface: #30343b;
  --ticket-inset: #11151c;
  --ticket-edge: rgba(156, 168, 178, 0.46);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.07), transparent 25%),
    linear-gradient(180deg, #393d45 0%, var(--ticket-surface) 52%, #20242a 100%);
  border: 1px solid rgba(142, 150, 156, 0.46);
  border-radius: 30px;
  box-shadow:
    inset 0 2px 1px rgba(237, 239, 238, 0.15),
    inset 0 -4px 8px rgba(0, 0, 0, 0.42),
    0 9px 0 rgba(0, 0, 0, 0.42),
    0 16px 20px rgba(0, 0, 0, 0.62);
  transition: top 280ms ease, height 280ms ease;
}

.cw-bet-card-left { left: 0; }
.cw-bet-card-right { left: calc(var(--cw-bet2-left) - var(--cw-bet1-left)); }
.cw-bet-card--editing { top: -166px; height: 420px; z-index: 2; }
.cw-bet-card--committed,
.cw-bet-card:not(.cw-bet-card--editing) { top: 13px; height: 241px; z-index: 3; }

.cw-bet-main {
  display: grid;
  height: 100%;
  padding: 14px 16px 12px;
  grid-template-rows: 36px minmax(0, 1fr) 75px;
  gap: 7px;
}

.cw-bet-head,
.cw-bet-grid,
.cw-bet-footer,
.cw-field-card {
  position: relative;
  inset: auto;
  width: auto;
}

.cw-bet-head { display: grid; place-items: center; }
.cw-bet-head h3 { font-size: 31px; }
.cw-bet-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cw-bet-card--editing .cw-bet-grid { grid-template-rows: repeat(2, minmax(0, 1fr)); }
.cw-bet-grid > .cw-field-card { left: auto; top: auto; }

.cw-field-card,
.cw-bet-card--committed .cw-field-card {
  display: grid;
  min-width: 0;
  height: auto;
  border: 1px solid var(--ticket-edge);
  border-radius: 19px;
  background:
    linear-gradient(145deg, rgba(124, 135, 145, 0.18), transparent 38%),
    linear-gradient(180deg, #242932, var(--ticket-inset));
  box-shadow:
    inset 0 2px 2px rgba(221, 227, 229, 0.1),
    inset 0 -3px 6px rgba(0, 0, 0, 0.48);
}

.cw-bet-card--editing .cw-field-card {
  grid-template-rows: 20px minmax(0, 1fr) 31px;
  gap: 3px;
  padding: 7px 12px;
}

.cw-field-top {
  height: auto;
  transform: none;
  align-items: center;
}
.cw-field-label { transform: none; }
.cw-bet-card--editing .cw-field-top { font-size: 19px; }

.cw-bet-card--editing .cw-stepper {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 66px;
  align-items: center;
  width: 100%;
  margin: 0;
}
.cw-bet-card--editing .cw-stepper-btn {
  width: 58px;
  height: 48px;
  transform: none;
  background-size: contain;
}
.cw-bet-card--editing .cw-bet-input {
  width: 100%;
  min-height: 48px;
  font-size: 38px;
  transform: none;
}
.cw-bet-card--editing .cw-bet-input,
.cw-bet-card--editing .cw-value-inline {
  min-height: 48px;
  border: 1px solid rgba(155, 173, 182, 0.52) !important;
  border-radius: 12px;
  background: linear-gradient(180deg, #0c1118, #070a0f) !important;
  background-image: linear-gradient(180deg, #0c1118, #070a0f) !important;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.78), 0 1px 0 rgba(255, 255, 255, 0.1);
}
.cw-bet-card--editing .cw-preset-row {
  display: grid;
  grid-template-columns: repeat(5, 48px);
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0;
}
.cw-bet-card--editing .cw-preset {
  width: 48px;
  min-height: 31px;
  background-size: contain;
}
.cw-bet-card--editing .cw-preset-label { font-size: 18px; }

.cw-bet-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 12px;
  align-items: center;
}
.cw-bet-note { display: none; }
.cw-auto-toggle { margin: 0; }
.cw-bet-card--editing .cw-auto-toggle { font-size: 20px; }
.cw-bet-card--editing .cw-auto-toggle__chrome { width: 75px; height: 38px; }
.cw-bet-submit {
  grid-column: 2;
  grid-row: 1;
  justify-self: stretch;
  width: 100%;
  aspect-ratio: 165 / 64;
  min-height: 0;
  margin: 0;
  background-size: contain;
}
.cw-bet-card--editing .cw-bet-submit__label { font-size: 22px; }

/* The placed bet leaves the whole run unobstructed. */
.cw-bet-card:not(.cw-bet-card--editing) .cw-bet-main {
  grid-template-columns: minmax(0, 1fr) 318px;
  grid-template-rows: minmax(0, 1fr);
  gap: 11px;
  padding: 10px 12px;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-bet-head { display: none; }
.cw-bet-card:not(.cw-bet-card--editing) .cw-bet-grid {
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--ticket-edge);
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(124, 135, 145, 0.18), transparent 38%),
    linear-gradient(180deg, #242932, var(--ticket-inset));
  box-shadow: inset 0 2px 2px rgba(221, 227, 229, 0.1), inset 0 -3px 6px rgba(0, 0, 0, 0.48);
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-field-card {
  grid-template-rows: 24px 1fr;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 12px 8px 6px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-field-card + .cw-field-card {
  border-left: 1px solid rgba(156, 168, 178, 0.25);
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-field-top {
  font-size: 16px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-unit-tag { font-size: 14px; }
.cw-bet-card:not(.cw-bet-card--editing) .cw-stepper,
.cw-bet-card:not(.cw-bet-card--editing) .cw-stepper--display-only,
.cw-bet-card:not(.cw-bet-card--editing) .cw-auto-value:not(.is-hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  margin: 0;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-stepper-btn,
.cw-bet-card:not(.cw-bet-card--editing) .cw-preset-row { display: none; }
.cw-bet-card:not(.cw-bet-card--editing) .cw-bet-input,
.cw-bet-card:not(.cw-bet-card--editing) .cw-value-inline {
  width: 100%;
  min-height: 52px;
  font-size: 40px;
  line-height: 52px;
  transform: none;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-auto-value:not(.is-hidden) .cw-bet-input {
  font-size: 20px;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-bet-footer {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 3px;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-auto-toggle {
  order: 2;
  justify-content: center;
  min-height: 20px;
  font-size: 15px;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-bet-submit {
  order: 1;
  width: 318px;
  height: 123px;
  min-height: 0;
  flex: 0 0 123px;
  background-size: contain;
}
.cw-bet-card:not(.cw-bet-card--editing) .cw-bet-submit__label { font-size: 28px; }

@media (prefers-reduced-motion: reduce) {
  .cw-bet-card,
  .cw-chat-shell { transition: none; }
}
