/*
 * Shared cashdrop widget styles.
 *
 * Everything is scoped under #cdw-root / .cdw-* so it cannot collide with a
 * host game's stylesheet (Unity TemplateData/style.css is very greedy).
 * Per-game skinning happens through the custom properties on #cdw-root only --
 * add a new theme in themes.js, never edit the rules below.
 */

@font-face {
	font-family: "TT Interphases Pro";
	src: url("../assets/cashdrop/font/TTInterphasesPro-Regular.ttf") format("truetype");
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: "TT Interphases Pro";
	src: url("../assets/cashdrop/font/TTInterphasesPro-DemiBold.ttf") format("truetype");
	font-weight: 600 700;
	font-display: swap;
}
@font-face {
	font-family: "TT Interphases Pro";
	src: url("../assets/cashdrop/font/TTInterphasesPro-Black.ttf") format("truetype");
	font-weight: 800 900;
	font-display: swap;
}

#cdw-root {
	/*
	 * Theme surface -- overridden per game from themes.js. Defaults below are the
	 * approved coin-pusher values from the Figma spec, so an unskinned game still
	 * renders coherently.
	 */
	--cdw-card-bg: linear-gradient(180deg, #0383db 0%, #005498 100%);
	--cdw-card-edge: #003d72;                      /* outer top/bottom lip */
	--cdw-card-inset: rgba(50, 196, 242, 0.4);     /* inner highlight */
	--cdw-glow: #40b1f0;                           /* blurred accent ellipses */
	--cdw-body: #07336d;                           /* dark panel behind blocks */
	--cdw-panel: #022757;                          /* blocks: tabs/period/list */
	--cdw-panel-border: rgba(255, 255, 255, 0.05);
	--cdw-panel-edge: #002545;                      /* 1px bottom lip on blocks */
	--cdw-tab-bg: #011e45;                          /* inactive tab */
	--cdw-tab-active: #0455bd;
	--cdw-plate: linear-gradient(180deg, #3d95e3 0%, #1e72d2 42%, #0f4f9e 100%);
	--cdw-plate-border: #6fd0ff;
	--cdw-accent: #0455bd;
	--cdw-text: #ffffff;
	--cdw-text-dim: rgba(207, 227, 255, 0.72);
	--cdw-footer: #0455bd;
	--cdw-close: #e8302f;                           /* close button square */
	--cdw-countdown-cell: rgba(0, 0, 0, 0.2);        /* counter cell fill */
	--cdw-countdown-border: rgba(255, 255, 255, 0.08);
	--cdw-cta: radial-gradient(34.37% 85.71% at 49.87% 8.57%, #d1930a 0%, #fdb51a 100%);
	--cdw-neutral: linear-gradient(360deg, #716f6f 0%, #dbd9d9 100%);
	/* Row tints: two-layer gradients straight from the spec. */
	--cdw-rank1: linear-gradient(90deg, rgba(214, 151, 12, 0.3) 0%, rgba(253, 182, 27, 0.3) 100%), rgba(255, 195, 64, 0.1);
	--cdw-rank2: linear-gradient(90deg, rgba(53, 53, 53, 0.3) 0%, rgba(116, 116, 116, 0.3) 100%), rgba(210, 210, 210, 0.1);
	--cdw-rank3: linear-gradient(90deg, rgba(87, 33, 2, 0.3) 0%, rgba(189, 91, 4, 0.3) 100%), rgba(253, 109, 20, 0.1);

	/*
	 * Layout constants -- shared by every theme.
	 * The spec's fonts are Altone (body) and Product Sans (buttons); neither is
	 * licensed here, so TT Interphases Pro stands in.
	 */
	--cdw-font: "TT Interphases Pro", "Segoe UI", system-ui, sans-serif;

	position: fixed;
	inset: 0;
	z-index: 2147483000;
	pointer-events: none;
	/*
	 * The header art deliberately bleeds wider than the card. Clip it to the
	 * viewport so the bleed can never become a horizontal scroll.
	 */
	overflow: hidden;
	font-family: var(--cdw-font);
	color: var(--cdw-text);
	-webkit-font-smoothing: antialiased;
}

/*
 * Reset inside the widget so host styles cannot leak in (Unity's
 * TemplateData/style.css is greedy).
 *
 * The id sits inside :where() ON PURPOSE. Written plainly as `#cdw-root *` these
 * rules carry id-level specificity (1,0,0) and silently beat every class rule
 * below -- which zeroed every padding/margin in the widget and stripped the
 * background off every button. :where() contributes zero specificity, so this
 * behaves as a true default any class can override. Do not "simplify" it back.
 *
 * Note the pseudo-elements are OUTSIDE the :where(): pseudo-elements are invalid
 * inside :where(), and one invalid selector in a comma list drops the whole rule.
 */
:where(#cdw-root) *,
:where(#cdw-root) *::before,
:where(#cdw-root) *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: inherit;
	line-height: normal;
	text-transform: none;
	letter-spacing: normal;
}

:where(#cdw-root) button {
	font: inherit;
	color: inherit;
	background: none;
	border: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

:where(#cdw-root) img {
	display: block;
	max-width: 100%;
	border: none;
}

/* box-sizing must not be overridable by the cascade above. */
#cdw-root,
#cdw-root *,
#cdw-root *::before,
#cdw-root *::after {
	box-sizing: border-box;
}

/* Only the actual chrome takes pointer events, never the full-screen root. */
#cdw-root > * {
	pointer-events: auto;
}

/* ---------------------------------------------------------------- floating */

.cdw-float {
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px 6px 6px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.62);
	border: 2px solid var(--cdw-glow);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
	animation: cdw-slide-in 320ms ease;
}

.cdw-float__logo {
	/* 210x102 artwork, so ~47px tall at this width. */
	width: 96px;
	height: auto;
	flex-shrink: 0;
}

.cdw-float__meta {
	display: flex;
	flex-direction: column;
	gap: 1px;
	text-align: left;
}

.cdw-float__label {
	font-size: 9px;
	font-weight: 400;
	opacity: 0.8;
	white-space: nowrap;
}

.cdw-float__time {
	font-size: 13px;
	font-weight: 900;
	white-space: nowrap;
	letter-spacing: 0.3px;
}

.cdw-float__hide {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.7);
	display: grid;
	place-items: center;
}

/* hide.svg's arrow points right; the pill hides to the left, so flip it. */
.cdw-float__hide img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transform: rotate(180deg);
}

/*
 * Hidden state: the same floating artwork as a tab pinned to the left edge, so
 * tapping it brings the widget back. Shown upright, not flipped.
 */
.cdw-peek {
	position: absolute;
	top: 10px;
	left: 0;
	width: 62px;
	padding: 4px 6px 4px 4px;
	border-radius: 0 8px 8px 0;
	background: rgba(0, 0, 0, 0.62);
	border: 1px solid var(--cdw-glow);
	border-left: none;
	line-height: 0;
}

.cdw-peek img {
	width: 100%;
	height: auto;
}

/* ----------------------------------------------------------------- overlay */

/*
 * Geometry below is transcribed from the approved Figma spec, which is authored
 * at a 411px viewport. Fixed px values are kept where the design is fixed, but
 * anything that would overflow a narrower phone is made flexible instead --
 * noted inline where that differs from the spec.
 */

.cdw-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.58);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
	/*
	 * overflow-y:auto alone computes overflow-x to 'auto' as well, which let the
	 * header's bleed be scrolled sideways. Pin the x axis shut explicitly.
	 */
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.cdw-card {
	position: relative;
	width: min(348px, 100vw - 32px);
	max-width: 100%;
	/*
	 * Reserve room for the part of the header art that rises above the card.
	 * Mirrors --cdw-header-lift (39.63% of card width), which cannot be used here
	 * because a card margin resolves against the overlay, not the card.
	 */
	margin-top: calc(min(138px, 39.6vw) - 7px);
	padding: 0 8px 14px;
	border-radius: 12px;
	background: var(--cdw-card-bg);
	box-shadow:
		0 -4px 0 var(--cdw-card-edge),
		0 6px 1px var(--cdw-card-edge),
		inset 0 -4px 2px var(--cdw-card-inset),
		inset 0 4px 2px var(--cdw-card-inset);
	animation: cdw-pop-in 260ms ease;
	/*
	 * NOT overflow:hidden -- the header art overhangs the top edge and the close
	 * button floats above it; clipping here would cut both off. The glow gets its
	 * own clipping layer instead.
	 */
}

/* Decorative glow, lower left, clipped to the card's rounded box. */
.cdw-card__glow {
	position: absolute;
	inset: 0;
	border-radius: 12px;
	overflow: hidden;
	pointer-events: none;
	z-index: 0;
}

/*
 * A radial-gradient, not filter: blur(100px). The blur is a huge convolution
 * repainted over the host game's WebGL canvas; this looks equivalent for
 * essentially no GPU cost.
 */
.cdw-card__glow::before {
	content: "";
	position: absolute;
	left: -111px;
	bottom: -89px;
	width: 400px;
	height: 400px;
	background: radial-gradient(circle closest-side,
		var(--cdw-glow) 0%, rgba(64, 177, 240, 0.35) 45%, rgba(64, 177, 240, 0) 100%);
	opacity: 0.55;
}

.cdw-card__inner {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding-top: 12px;
}

.cdw-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	padding: 12px;
	border-radius: 12px;
	background: var(--cdw-body);
}

/*
 * Header artwork.
 *
 * The theme's headerArt is the ENTIRE header illustration: the character in its
 * upper part and the banner plate the title is written on filling the lower part
 * at full width (see themes.js). So it renders at full card width and the title
 * is overlaid on the plate -- there is no separate CSS plate for such a theme.
 *
 * The negative margin lifts the character above the card and collapses the space
 * it would otherwise occupy inside it. --cdw-header-lift is set from JS: the
 * fraction of the art above the plate, folded through the art's aspect ratio so
 * it resolves correctly against the card's width.
 *
 * Stacking, bottom to top: glow, art, title, close button.
 */
.cdw-card__header {
	position: relative;
	z-index: 2;
	/*
	 * Overhangs the card's border box so the plate caps its top edge. These exact
	 * values are the approved placement -- slightly asymmetric (24px left, 23px
	 * right) on purpose, because the artwork itself is not perfectly centred.
	 * margin-right stays 0: with an explicit width the browser derives it.
	 */
	width: calc(100% + 47px);
	margin-left: -24px;
	margin-right: 0;
	/*
	 * Nudge, applied on top of the themed lift: positive pushes the plate DOWN
	 * over the card, negative pulls it further up. Keep .cdw-card's margin-top in
	 * sync -- it reserves (lift - nudge) worth of space above the card.
	 */
	margin-top: calc(-1 * var(--cdw-header-lift, 39.63%) + 15px);
	pointer-events: none;
}

.cdw-card__art {
	width: 100%;
	height: auto;
}

/* Centred on the plate baked into the artwork. */
.cdw-card__title {
	position: absolute;
	left: 7%;
	right: 7%;
	top: var(--cdw-header-title-y, 79%);
	transform: translateY(-50%);
	font-size: clamp(17px, 5.6vw, 24px);
	font-weight: 900;
	font-style: italic;
	line-height: 1.1;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-shadow: 0 3px 5px rgba(0, 0, 0, 0.65);
}

/* Fallback for themes with no header art: draw the plate in CSS instead. */
.cdw-card__title--plate {
	position: relative;
	left: auto;
	right: auto;
	top: auto;
	transform: none;
	z-index: 2;
	margin: 0 -8px;
	padding: 14px 16px 16px;
	border-radius: 12px 12px 0 0;
	background: var(--cdw-plate);
	box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.32);
}

/* Red rounded square floating above the card's top-right. */
.cdw-card__close {
	position: absolute;
	top: -58px;
	right: 6px;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	background: var(--cdw-close);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
	display: grid;
	place-items: center;
	z-index: 5;
}

.cdw-card__close img {
	width: 100%;
	height: 100%;
}

/* ------------------------------------------------------------------- intro */

/*
 * First page inside the card: dates + countdown, then the event description.
 * No tabs and no league selector -- Next moves to the tabbed page.
 */
.cdw-intro {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 7px;
	min-height: 0;
}

/*
 * Segmented counter, sized from the approved spec: a 198x46.08 strip of four
 * 47.74x42.05 cells, each carrying its own fill and border (the strip itself is
 * transparent). Only the outer two cells are rounded, so it reads as one
 * control. Decimals are the spec's own -- kept rather than rounded so the four
 * cells plus gaps and padding still total exactly 198px.
 */
.cdw-countdown {
	display: flex;
	align-items: center;
	/* Hug the cells instead of stretching to the meta column's full width. */
	align-self: flex-start;
	gap: 1.01px;
	padding: 2.01px;
	width: 198px;
	max-width: 100%;
	height: 46.08px;
	border-radius: 8.05px;
}

.cdw-countdown__box {
	flex: 1 1 0;
	min-width: 0;
	height: 42.05px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 4.03px 0;
	background: var(--cdw-countdown-cell);
	border: 0.8px solid var(--cdw-countdown-border);
	box-shadow: inset -2px 2px 4px rgba(0, 0, 0, 0.1);
	text-align: center;
}

.cdw-countdown__box:first-child {
	border-radius: 6.04px 0 0 6.04px;
}

.cdw-countdown__box:last-child {
	border-radius: 0 6.04px 6.04px 0;
}

/* Vertical gradient fill on the digits, per the spec. */
.cdw-countdown__value {
	font-size: 18.12px;
	font-weight: 600;
	line-height: 22px;
	background: linear-gradient(180deg, #ffffff 0%, #aac6e7 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
}

.cdw-countdown__label {
	font-size: 7.05px;
	font-weight: 400;
	line-height: 10px;
	color: var(--cdw-text);
}

.cdw-intro__body {
	min-height: 0;
	max-height: min(42vh, 340px);
	overflow-y: auto;
	overscroll-behavior-y: contain;
	-webkit-overflow-scrolling: touch;
}

/* Fades the scrolling text into the body panel's bottom edge. */
.cdw-intro__fade {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 50px;
	background: linear-gradient(180deg, rgba(7, 51, 109, 0) 0%, var(--cdw-body) 100%);
	pointer-events: none;
}

.cdw-intro .cdw-rules {
	padding: 2px 2px 12px;
	font-size: 14px;
	line-height: 1.55;
}

/* -------------------------------------------------------------------- tabs */

.cdw-tabs {
	padding: 8px 10px;
	border-radius: 12px;
	background: var(--cdw-panel);
	border: 0.8px solid var(--cdw-panel-border);
	box-shadow: 0 1px 0 var(--cdw-panel-edge), inset 0 1px 20px rgba(0, 0, 0, 0.08);
}

.cdw-tabs__row {
	display: flex;
	gap: 7.37px;
}

.cdw-tab {
	flex: 1 1 0;
	min-width: 0;
	height: 30.21px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 2.95px;
	border-radius: 2.95px;
	background: var(--cdw-tab-bg);
	font-size: 14px;
	font-weight: 400;
	line-height: 20px;
	color: var(--cdw-text);
	white-space: nowrap;
	transition: background 160ms ease;
}

.cdw-tab img {
	width: 27.35px;
	height: 22.84px;
	object-fit: contain;
	flex-shrink: 0;
}

/* The label shrinks before the icon does on narrow screens. */
.cdw-tab__label {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cdw-tab[aria-selected="true"] {
	background: var(--cdw-tab-active);
	font-weight: 600;
}

/* ------------------------------------------------------------------ period */

.cdw-period {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px;
	border-radius: 12px;
	background: var(--cdw-panel);
	border: 0.8px solid var(--cdw-panel-border);
	box-shadow: 0 1px 0 var(--cdw-panel-edge), inset 0 1px 20px rgba(0, 0, 0, 0.08);
}

.cdw-period__logo {
	width: 82px;
	height: auto;
	object-fit: contain;
	flex-shrink: 0;
}

.cdw-period__meta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.cdw-period__value {
	font-size: 15px;
	font-weight: 600;
	line-height: 22px;
}

/* --------------------------------------------------------- league selector */

.cdw-league {
	position: relative;
}

.cdw-league__toggle {
	position: relative;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 10px;
	border-radius: 10px;
	background: var(--cdw-panel);
	border: 0.7px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 1px 0 var(--cdw-panel-edge);
	text-align: left;
}

.cdw-league__current {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-width: 0;
}

.cdw-league__badge {
	width: 32.23px;
	height: 28.58px;
	object-fit: contain;
	flex-shrink: 0;
}

.cdw-league__name {
	min-width: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 24px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cdw-league__caret {
	position: relative;
	z-index: 1;
	flex-shrink: 0;
	font-size: 11px;
	line-height: 1;
	transition: transform 200ms ease;
}

.cdw-league[data-open="true"] .cdw-league__caret {
	transform: rotate(180deg);
}

.cdw-league__list {
	display: none;
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 6;
	padding: 4px;
	border-radius: 10px;
	background: var(--cdw-panel);
	border: 0.7px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.cdw-league[data-open="true"] .cdw-league__list {
	display: block;
}

.cdw-league__option {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 8px;
	border-radius: 6px;
	text-align: left;
	opacity: 0.6;
}

.cdw-league__option[aria-selected="true"] {
	opacity: 1;
	background: var(--cdw-tab-active);
}

/* -------------------------------------------------------------- list panel */

/*
 * Fixed height on purpose: the prize table, the standings and the rules all have
 * different content lengths, and letting the panel size to its content made the
 * whole card jump every time the tab changed. The head stays put and the rows
 * scroll inside the remaining space.
 */
.cdw-list {
	position: relative;
	display: flex;
	flex-direction: column;
	height: min(26vh, 176px);
	padding: 4px;
	border-radius: 10px;
	background: var(--cdw-panel);
	box-shadow: 0 1px 0 var(--cdw-panel-edge);
	overflow: hidden;
}

.cdw-list__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	height: 32px;
	padding: 0 8px;
	border-radius: 8px 8px 0 0;
	font-size: 12px;
	font-weight: 600;
	line-height: 17px;
}

.cdw-list__rows {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow-y: auto;
	overscroll-behavior-y: contain;
	-webkit-overflow-scrolling: touch;
}

/* Spec pins the footer to the panel's bottom edge; reserve room for it. */
.cdw-list--has-footer .cdw-list__rows {
	padding-bottom: 34px;
}

.cdw-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex-shrink: 0;
	height: 32px;
	padding-right: 8px;
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.16);
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
}

.cdw-row[data-rank="1"] { background: var(--cdw-rank1); }
.cdw-row[data-rank="2"] { background: var(--cdw-rank2); }
.cdw-row[data-rank="3"] { background: var(--cdw-rank3); }

/*
 * Spec column widths are 61 / 139 / 125 px, which overflow a 360px phone once
 * gaps are added. Position and value keep their intent; the player column
 * absorbs the difference.
 */
.cdw-cell {
	display: flex;
	align-items: center;
	padding: 0 8px;
	min-width: 0;
}

.cdw-cell--pos {
	flex: 0 0 auto;
	min-width: 61px;
	gap: 6px;
}

.cdw-cell--player {
	flex: 1 1 auto;
	gap: 10px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cdw-cell--value {
	flex: 0 0 auto;
	justify-content: flex-end;
	margin-left: auto;
	white-space: nowrap;
}

.cdw-cell__rank--dim {
	opacity: 0.8;
}

/* Fixed slot so ranks stay aligned whether or not a crown is present. */
.cdw-cell__medal {
	width: 18.27px;
	height: 9.58px;
	flex-shrink: 0;
	display: inline-block;
}

.cdw-cell__medal img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cdw-empty {
	padding: 18px 12px;
	text-align: center;
	font-size: 12px;
	opacity: 0.7;
}

.cdw-error {
	padding: 8px 12px;
	font-size: 12px;
	color: #ffd2d2;
	text-align: center;
}

/* ------------------------------------------------------------------- rules */

.cdw-rules {
	padding: 10px 12px;
	font-size: 13px;
	line-height: 1.6;
	word-break: break-word;
}

.cdw-rules table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	margin: 8px 0;
}

.cdw-rules th,
.cdw-rules td {
	padding: 6px 8px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid rgba(255, 255, 255, 0.18);
	font-size: 12px;
	line-height: 1.45;
}

.cdw-rules th {
	font-weight: 600;
	background: rgba(255, 255, 255, 0.08);
}

.cdw-rules tr:last-child td {
	border-bottom: none;
}

.cdw-rules ul,
.cdw-rules ol {
	padding-left: 18px;
	margin: 6px 0;
}

.cdw-rules li {
	margin-bottom: 4px;
}

/* ------------------------------------------------------------------ footer */

/* Pinned to the bottom of the list panel, per the spec. */
.cdw-mystats {
	position: absolute;
	left: 4px;
	right: 4px;
	bottom: 4px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 32px;
	padding: 0 8px;
	border-radius: 0 0 6px 6px;
	background: var(--cdw-footer);
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
}

.cdw-mystats__score {
	opacity: 0.8;
	padding: 0 8px;
}

.cdw-mystats__rank {
	padding: 0 8px;
}

/* ----------------------------------------------------------------- actions */

.cdw-actions {
	display: flex;
	gap: 8px;
	height: 35px;
}

.cdw-btn {
	flex: 1 1 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 5.22px;
	font-size: 16px;
	font-weight: 600;
	line-height: 19px;
	color: var(--cdw-text);
	text-align: center;
	transition: filter 140ms ease;
}

.cdw-btn:active {
	filter: brightness(0.94);
}

.cdw-btn--back {
	background: var(--cdw-neutral);
	box-shadow:
		0 3.48px 3.48px rgba(0, 0, 0, 0.18),
		0 3.48px 3.48px rgba(118, 118, 118, 0.25),
		inset 0 -1.74px 0 #5a5959;
}

.cdw-btn--close {
	background: var(--cdw-cta);
	box-shadow:
		0 3.48px 3.48px rgba(0, 0, 0, 0.18),
		inset 0 -1.74px 0 #7f5f31;
}

/* -------------------------------------------------------------- win popup */

.cdw-win {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(360px, calc(100vw - 32px));
	padding: 26px 20px 22px;
	border-radius: 18px;
	border: 3px solid var(--cdw-glow);
	background: var(--cdw-card-bg);
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
	text-align: center;
	animation: cdw-pop-in 300ms ease;
}

.cdw-win__title {
	font-size: 15px;
	font-weight: 900;
	letter-spacing: 1px;
	opacity: 0.9;
	margin-bottom: 8px;
}

.cdw-win__amount {
	font-size: 40px;
	font-weight: 900;
	line-height: 1.05;
	letter-spacing: -1.5px;
	background: linear-gradient(180deg, #f7e336 0%, #f9bc23 35%, #fff38d 61%, #fde833 71%, #f79e20 86%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
	animation: cdw-glow 1.6s ease-in-out infinite;
}

.cdw-win__amount small {
	font-size: 22px;
	font-weight: 600;
	vertical-align: super;
	margin-right: 4px;
}

.cdw-win__game {
	margin-top: 10px;
	font-size: 12px;
	opacity: 0.8;
}

.cdw-win__close {
	position: absolute;
	top: -14px;
	right: -14px;
	width: 34px;
	height: 34px;
}

/* -------------------------------------------------------------- animations */

@keyframes cdw-pop-in {
	from { opacity: 0; transform: translate(-50%, -50%) scale(0.94); }
	to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* The card is centred by flexbox, not transforms, so it needs its own. */
.cdw-card {
	animation-name: cdw-card-in;
}

@keyframes cdw-card-in {
	from { opacity: 0; transform: scale(0.94); }
	to   { opacity: 1; transform: scale(1); }
}

@keyframes cdw-slide-in {
	from { opacity: 0; transform: translateX(-40px); }
	to   { opacity: 1; transform: translateX(0); }
}

@keyframes cdw-glow {
	0%, 100% { filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45)); }
	50%      { filter: drop-shadow(0 2px 16px rgba(255, 210, 60, 0.65)); }
}

/* --------------------------------------------------------------- landscape */

/*
 * Coin pusher runs portrait, so this is a safety net rather than a tuned layout:
 * on a short viewport keep the card and its header art on screen.
 */
@media (max-height: 520px) {
	.cdw-card {
		margin-top: calc(min(96px, 26vw) + 8px);
	}
	.cdw-card__header {
		width: 62%;
		margin-left: auto;
		margin-right: auto;
		/* Lift scales with the narrowed art, or it would rise too far. */
		margin-top: calc(-0.62 * var(--cdw-header-lift, 39.63%) + 15px);
	}
	.cdw-card__close {
		top: -42px;
	}
	.cdw-list {
		height: 22vh;
	}
}
