:root {
	/* Mastery heatmap palette */
	--mastery-unseen: rgba(255, 255, 255, 0.04);
	--mastery-bad:    rgba(225, 85, 84, 0.55);
	--mastery-weak:   rgba(232, 140, 70, 0.55);
	--mastery-mid:    rgba(232, 200, 80, 0.55);
	--mastery-good:   rgba(108, 180, 130, 0.55);
	--mastery-master: rgba(80, 220, 160, 0.75);

	/* Phase 1 — teal-navy felt + brass + warm cream */
	--felt-deep:    #08231f;
	--felt-mid:     #0f3a32;
	--felt-light:   #155a4d;
	/* Legacy alias retained for any leftover internal references */
	--felt-dark:    #08231f;
	--panel:        rgba(7, 25, 22, 0.82);
	--panel-strong: rgba(5, 18, 16, 0.94);
	--panel-border: rgba(200, 164, 92, 0.22);
	--hairline:     rgba(200, 164, 92, 0.22);
	--hairline-soft: rgba(200, 164, 92, 0.12);
	--text-main:    #f4ecd8;
	--text-soft:    rgba(244, 236, 216, 0.66);
	--accent:       #c8a45c;   /* brass */
	--accent-warm:  #8a6f3a;   /* deep brass */
	--accent-strong: #e15554;
	--accent-secondary: #6cb4d6;
	--navy-deep:    #1a3640;
	--navy-mid:     #2c4f5a;
	--shadow:       0 18px 45px rgba(0, 0, 0, 0.35);
	--radius-lg: 18px;
	--radius-md: 14px;
	--radius-sm: 10px;
	--card-width: 68px;
	--card-height: 92px;
	--app-header-height: 98px;
	--action-dock-reserve: calc(166px + env(safe-area-inset-bottom, 0px));
}

* {
	box-sizing: border-box;
}

html,
body {
	min-height: 100%;
}

body {
	margin: 0;
	background:
		radial-gradient(circle at top, rgba(200, 164, 92, 0.06), transparent 38%),
		radial-gradient(circle at bottom, rgba(0, 0, 0, 0.32), transparent 38%),
		linear-gradient(135deg, var(--felt-deep) 0%, var(--felt-mid) 55%, #0a2e28 100%);
	background-attachment: scroll;
	color: var(--text-main);
	font-family: "Inter Tight", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-feature-settings: "ss01", "cv11";
	text-align: center;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	padding-left: env(safe-area-inset-left, 0px);
	padding-right: env(safe-area-inset-right, 0px);
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image:
		linear-gradient(rgba(200, 164, 92, 0.04) 1px, transparent 1px),
		linear-gradient(90deg, rgba(200, 164, 92, 0.04) 1px, transparent 1px);
	background-size: 28px 28px;
	pointer-events: none;
	opacity: 0.32;
	z-index: -1;
}

h1,
h2,
.brand-logo {
	margin: 0;
	font-family: "Cormorant Garamond", "Noto Sans JP", Georgia, serif;
	font-weight: 700;
	letter-spacing: 0.005em;
	line-height: 1.05;
}

/* When the page is set to Japanese, swap the display serif to one that
   actually has CJK glyphs (Cormorant has none — it would silently fall back
   and look mismatched). */
:lang(ja) h1,
:lang(ja) h2,
:lang(ja) .brand-logo,
:lang(ja) #game-outcome,
:lang(ja) .splash-card h1 {
	font-family: "Noto Serif JP", "Shippori Mincho", "Yu Mincho", serif;
}

h3,
h4,
h5 {
	margin: 0;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-weight: 700;
	letter-spacing: 0.01em;
}

h1 {
	font-size: clamp(2.6rem, 8.5vw, 4.8rem);
	font-weight: 600;
}

h2 {
	font-size: clamp(1.8rem, 5.5vw, 2.6rem);
	font-weight: 600;
}

h3,
h4 {
	font-size: clamp(1.3rem, 4.6vw, 1.9rem);
}

p {
	margin: 0;
	color: var(--text-soft);
	font-size: 1.08rem;
	line-height: 1.75;
}

a {
	color: inherit;
}

button,
button:focus,
.nav-control {
	/* Phase 1 — brass primary */
	border: 1px solid rgba(232, 196, 124, 0.55);
	border-radius: 999px;
	background: linear-gradient(135deg, #765c25 0%, #654b1d 55%, #493412 100%);
	box-shadow:
		0 1px 0 rgba(255, 230, 180, 0.35) inset,
		0 -1px 0 rgba(0, 0, 0, 0.18) inset,
		0 8px 22px rgba(0, 0, 0, 0.32);
	color: #fff8e6;
	cursor: pointer;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	min-height: 48px;
	padding: 0.85rem 1.3rem;
	text-shadow: 0 1px 0 rgba(74, 55, 22, 0.45);
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

button:hover,
button:focus,
.nav-control:hover,
.nav-control:focus {
	transform: translateY(-1px);
	border-color: rgba(244, 218, 156, 0.7);
	box-shadow:
		0 1px 0 rgba(255, 230, 180, 0.45) inset,
		0 -1px 0 rgba(0, 0, 0, 0.18) inset,
		0 12px 28px rgba(0, 0, 0, 0.35);
}

button:active,
.nav-control:active {
	transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
.nav-control:focus-visible {
	outline: 3px solid #f6d989;
	outline-offset: 3px;
}

button.secondary {
	/* Phase 1 — deep navy secondary */
	background: linear-gradient(135deg, var(--navy-mid) 0%, var(--navy-deep) 100%);
	border: 1px solid rgba(108, 180, 214, 0.28);
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.06) inset,
		0 8px 22px rgba(0, 0, 0, 0.32);
	color: var(--text-main);
	text-shadow: none;
}

button.secondary:hover,
button.secondary:focus {
	border-color: rgba(108, 180, 214, 0.5);
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.08) inset,
		0 12px 28px rgba(0, 0, 0, 0.36);
}

button.disabled-button,
button.secondary.disabled-button {
	background: rgba(244, 236, 216, 0.06);
	border: 1px solid rgba(200, 164, 92, 0.12);
	box-shadow: none;
	color: rgba(244, 236, 216, 0.32);
	cursor: default;
	text-shadow: none;
}

/* Note: jQuery .show()/.hide() use inline styles which override class-based display.
   But classList.add/remove("inactive") needs this to win over other class display values.
   Using [hidden] attribute approach + this class ensures both jQuery and classList work. */
.inactive {
	display: none !important;
}

.visually-hidden {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.container {
	width: min(100%, 1380px);
	margin: 0 auto;
	padding: 0 16px;
	position: relative;
}

.navbar-fixed {
	margin-bottom: 0;
	position: sticky;
	top: 0;
	z-index: 20;
}

.nav-wrapper {
	align-items: center;
	background: rgba(5, 18, 16, 0.92) !important;
	border-bottom: 1px solid var(--hairline);
	box-shadow: none !important;
	display: flex;
	justify-content: space-between;
	min-height: 50px;
	padding: calc(3px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 3px max(12px, env(safe-area-inset-left, 0px));
}

.brand-logo {
	display: inline-flex !important;
	font-size: 1.4rem !important;
	line-height: 1.2;
	padding: 0 !important;
	position: static !important;
	transform: none !important;
	white-space: nowrap;
}

.nav-actions {
	align-items: center;
	display: flex;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nav-actions li {
	float: none;
	list-style: none;
}

.nav-actions a,
.nav-control {
	align-items: center;
	display: inline-flex;
	justify-content: center;
	min-width: 40px;
	padding: 0.5rem 0.7rem;
	font-size: 0.95rem;
	min-height: 44px;
}

.nav-icon {
	width: 22px;
	height: 22px;
	display: block;
}

.nav-actions a {
	border-radius: 999px;
	color: var(--text-main);
	background: rgba(244, 236, 216, 0.05);
	border: 1px solid var(--hairline-soft);
	box-shadow: none;
}

.nav-actions a:hover {
	background: rgba(244, 236, 216, 0.09);
	border-color: var(--hairline);
}

#audio-settings-toggle.nav-control,
#language-toggle.nav-control {
	background: rgba(244, 236, 216, 0.05) !important;
	border: 1px solid var(--hairline-soft) !important;
	box-shadow: none !important;
	color: var(--text-main) !important;
	text-shadow: none !important;
	font-size: 0.95rem !important;
	font-weight: 500 !important;
}

select#language-toggle.nav-control {
	appearance: auto;
	cursor: pointer;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	line-height: 1.2;
	max-width: 8.5rem;
}

select#language-toggle.nav-control option {
	background: var(--navy-deep);
	color: var(--text-main);
}

#audio-settings-toggle.nav-control:hover,
#language-toggle.nav-control:hover {
	background: rgba(244, 236, 216, 0.09) !important;
	border-color: var(--hairline) !important;
}

/* Nav and strategy controls form one sticky, flow-sized app header. */
.gto-sub-bar {
	align-items: center;
	background: rgba(5, 18, 16, 0.94);
	/* Visible bottom edge so the bar reads as separate from the felt below. */
	border-bottom: 1px solid var(--hairline);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
	display: flex;
	gap: 10px;
	justify-content: center;
	min-height: 48px;
	padding: 2px max(12px, env(safe-area-inset-right, 0px)) 2px max(12px, env(safe-area-inset-left, 0px));
	position: static;
}

.gto-sub-label {
	color: var(--accent);
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.page-shell {
	padding-bottom: 8px;
	padding-top: 8px;
}

/* Compact inline status during gameplay */
.board-side .status-grid {
	grid-template-columns: 1fr 1fr;
	gap: 4px;
}

.board-side .summary-card {
	padding: 2px 8px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.board-side .summary-label {
	font-size: 0.72rem;
	margin-bottom: 0;
}

.board-side .summary-value {
	font-size: 1.1rem;
}

.board-side .wager {
	display: none;
}

.hero-panel,
#game-over,
.table-panel,
.settings-panel,
.rules-card {
	background: var(--panel);
	backdrop-filter: blur(10px);
	border: 1px solid var(--panel-border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	position: relative;
	overflow: hidden;
}

.table-panel::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 60%;
	background: radial-gradient(ellipse 90% 110% at 50% -20%, rgba(200, 164, 92, 0.07) 0%, transparent 70%);
	pointer-events: none;
	z-index: 0;
}

.table-panel > * {
	position: relative;
	z-index: 1;
}

.hero-panel,
#game-over {
	padding: 24px 18px;
}

.hero-copy {
	display: grid;
	gap: 12px;
}

#welcome p {
	max-width: 720px;
	margin: 0 auto;
}

#wager-options {
	display: grid;
	gap: 18px;
	margin: 24px auto 0;
	max-width: 760px;
}

.chip-row {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chip-row a {
	align-items: center;
	background: rgba(244, 236, 216, 0.04);
	border: 1px solid var(--hairline-soft);
	border-radius: var(--radius-md);
	display: flex;
	justify-content: center;
	min-height: 84px;
	padding: 8px;
	transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chip-row a:hover {
	background: rgba(244, 236, 216, 0.08);
	border-color: var(--hairline);
	transform: translateY(-2px);
}

.chip-row a.chip-selected {
	background: rgba(200, 164, 92, 0.12);
	border-color: var(--accent);
	box-shadow:
		0 0 0 1px rgba(200, 164, 92, 0.45),
		0 6px 18px rgba(200, 164, 92, 0.18);
}

/* Guide animation for first-time chip selection */
.chip-guide a {
	animation: chip-pulse 1.5s ease-in-out infinite;
}

.chip-guide a:nth-child(2) { animation-delay: 0.2s; }
.chip-guide a:nth-child(3) { animation-delay: 0.4s; }
.chip-guide a:nth-child(4) { animation-delay: 0.6s; }

@keyframes chip-pulse {
	0%, 100% { border-color: var(--hairline-soft); }
	50% {
		border-color: var(--accent);
		box-shadow: 0 0 16px rgba(200, 164, 92, 0.22);
	}
}

.wager {
	display: inline-block;
	height: 56px;
	overflow: visible;
	shape-rendering: geometricPrecision;
	width: 56px;
}

.wager-clickable {
	height: 60px;
	margin: 0;
	width: 60px;
}

.wager-small {
	display: inline-block;
	height: 36px;
	margin-left: 10px;
	overflow: visible;
	shape-rendering: geometricPrecision;
	width: 36px;
}

.bet-summary,
.status-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card {
	background: rgba(244, 236, 216, 0.04);
	border: 1px solid var(--hairline-soft);
	border-radius: var(--radius-sm);
	padding: 8px 10px;
	text-align: left;
}

.summary-label {
	color: var(--text-soft);
	display: block;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	margin-bottom: 6px;
	text-transform: uppercase;
}

.summary-value {
	align-items: center;
	display: flex;
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--text-main);
	gap: 8px;
	justify-content: space-between;
}

#start-game-button,
.new-game-button {
	width: 100%;
}

#game-board {
	margin-top: 2px;
}

.board-layout {
	display: grid;
	gap: 8px;
}

.board-main {
	display: grid;
	gap: 4px;
}

.board-side {
	display: grid;
	gap: 4px;
}

.table-panel {
	padding: 6px 12px;
	text-align: left;
}

.panel-header {
	align-items: center;
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 4px;
}

.totals-cluster {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.card-lane {
	align-items: center;
	display: flex;
	flex-wrap: nowrap;
	gap: 6px;
	min-height: 80px;
	overflow-x: hidden;
	overflow-y: visible;
	padding-bottom: 2px;
	position: relative;
}

.player-card-lane {
	align-items: flex-start;
	flex-direction: column;
}

#deck-pile,
#dealer,
#user-hand,
#user-split-hand {
	display: inline-block;
	max-width: 100%;
	position: relative;
}

#dealer,
#user-hand,
#user-split-hand {
	min-height: 80px;
}

.player-hand-slot {
	border-left: 3px solid transparent;
	max-width: 100%;
	padding: 3px 0 3px 7px;
	transition: border-color 0.2s ease, opacity 0.2s ease, background 0.2s ease;
	width: 100%;
}

.player-hand-slot.is-active {
	background: rgba(200, 164, 92, 0.08);
	border-left-color: var(--accent);
}

.player-hand-slot.is-complete:not(.is-active) {
	opacity: 0.58;
}

.split-hand-label {
	align-items: center;
	color: var(--text-soft);
	display: flex;
	font-size: 0.76rem;
	font-weight: 700;
	gap: 8px;
	letter-spacing: 0.08em;
	margin-bottom: 4px;
	text-transform: uppercase;
}

.turn-badge {
	background: #6a511f;
	border: 1px solid #e2c274;
	border-radius: 999px;
	color: #fffdf5;
	font-size: 0.68rem;
	letter-spacing: 0.02em;
	padding: 3px 8px;
	text-transform: none;
}

.card {
	background-color: transparent !important;
	border-radius: 8px;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.18) inset,
		-1px 6px 14px rgba(0, 0, 0, 0.35),
		0 12px 28px rgba(0, 0, 0, 0.18);
	display: inline-block;
	height: var(--card-height);
	transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s ease;
	width: var(--card-width);
	vertical-align: top;
}

/* Cards spread side-by-side with small gap; later cards overlap earlier slightly only when 5+ cards */
#dealer,
#user-hand,
#user-split-hand {
	display: inline-flex;
	gap: 8px;
	align-items: flex-start;
}

/* Auto-fan: when many cards, allow gentle overlap so a busted 6-card hand still fits.
   Earlier cards layer on top so up-card stays visible above the hole-card slipped behind it. */
#dealer .card,
#user-hand .card,
#user-split-hand .card {
	position: relative;
}
#dealer.has-many-cards .card:nth-child(n+2),
#user-hand.has-many-cards .card:nth-child(n+2),
#user-split-hand.has-many-cards .card:nth-child(n+2) {
	margin-left: calc(var(--card-width) * -0.44);
}
/* Newest dealt card sits on top (real casino: latest hit is visible). */
#dealer .card:nth-child(1)  { z-index: 1; }
#dealer .card:nth-child(2)  { z-index: 2; }
#dealer .card:nth-child(3)  { z-index: 3; }
#dealer .card:nth-child(4)  { z-index: 4; }
#dealer .card:nth-child(5)  { z-index: 5; }
#dealer .card:nth-child(6)  { z-index: 6; }
#user-hand .card:nth-child(1)  { z-index: 1; }
#user-hand .card:nth-child(2)  { z-index: 2; }
#user-hand .card:nth-child(3)  { z-index: 3; }
#user-hand .card:nth-child(4)  { z-index: 4; }
#user-hand .card:nth-child(5)  { z-index: 5; }
#user-hand .card:nth-child(6)  { z-index: 6; }
#user-split-hand .card:nth-child(1) { z-index: 1; }
#user-split-hand .card:nth-child(2) { z-index: 2; }
#user-split-hand .card:nth-child(3) { z-index: 3; }
#user-split-hand .card:nth-child(4) { z-index: 4; }
#user-split-hand .card:nth-child(5) { z-index: 5; }
#user-split-hand .card:nth-child(6) { z-index: 6; }

/* Cards are non-interactive in this game (Hit/Stand are the actions),
   so we don't lift on hover — that just looked like a generic dev affordance. */

/* Keyboard shortcut hint badges shown on action buttons.
   Hidden on touch devices (no keyboard) and small screens to save room. */
.kbd-hint {
	display: none;
	margin-left: 8px;
	padding: 1px 6px;
	background: rgba(0, 0, 0, 0.22);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 4px;
	font: 600 0.7rem "JetBrains Mono", "Inter Tight", monospace;
	color: rgba(255, 248, 230, 0.85);
	text-shadow: none;
	letter-spacing: 0.05em;
	vertical-align: middle;
}

@media (hover: hover) and (min-width: 1024px) {
	.kbd-hint {
		display: inline-block;
	}
}

/* Keep wrapping natural — never break inside English words, prefer CJK boundaries for JP. */
.gto-recommendation .gto-reason-line,
.gto-recommendation .gto-situation-line,
.gss-mistake-reason,
p[data-i18n] {
	overflow-wrap: break-word;
	word-break: normal;
	hyphens: none;
}

:lang(ja) .gto-recommendation .gto-reason-line,
:lang(ja) .gto-recommendation .gto-situation-line,
:lang(ja) p[data-i18n] {
	line-break: strict;
	word-break: break-strict;
}

/* Deck pile: shrink + tuck to the corner so it's clearly the source-deck,
   not mistaken for a third dealer card. */
#deck-pile {
	transform: scale(0.55);
	transform-origin: top left;
	margin: 0 -12px 0 -8px;
	opacity: 0.55;
	filter: saturate(0.6);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
	flex: 0 0 auto;
}

#deck-pile::after {
	content: attr(data-label);
	position: absolute;
	bottom: -10px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 0.55rem;
	letter-spacing: 0.16em;
	color: var(--text-soft);
	opacity: 0.6;
	pointer-events: none;
}

.pile {
	margin: 0;
}

.hand-total,
.split-hand-total,
.dealer-hand-total {
	align-items: center;
	background:
		radial-gradient(circle at 50% 30%, rgba(200, 164, 92, 0.22), rgba(200, 164, 92, 0.06) 70%);
	border: 1px solid var(--hairline);
	box-shadow:
		0 0 14px rgba(200, 164, 92, 0.1),
		0 1px 0 rgba(244, 236, 216, 0.1) inset;
	border-radius: 999px;
	color: var(--accent);
	display: inline-flex;
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
	font-size: 1.35rem;
	font-weight: 700;
	justify-content: center;
	margin: 2px;
	min-height: 44px;
	min-width: 44px;
	padding: 0 14px;
	text-align: center;
}

.game-board-totals {
	position: static;
}

.wager-gameplay {
	top: 0;
}

.wager-gameplay .summary-value {
	font-size: 1.35rem;
}

#sidebar {
	display: grid;
	gap: 5px;
	grid-template-columns: 1fr 1fr;
}

#sidebar button {
	margin: 0;
	min-height: 44px;
	padding: 6px 10px;
	width: 100%;
	font-size: 1.1rem;
}

#surrender-button {
	grid-column: 1 / -1;
}

.hint-btn {
	grid-column: 1 / -1;
}

.splithand-scaledown {
	left: 0;
	margin-right: 0;
	opacity: 0.55;
	transform: scale(0.84);
	transform-origin: top left;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

#user-hand.splithand-scaledown,
#user-split-hand.splithand-scaledown {
	transform: scale(0.78);
}

/* #rules is now a native <dialog>; default display:none is handled by the
   browser via the lack of [open] attribute. No custom rule needed. */

.rules-card {
	overflow: visible;
	padding: 20px 18px;
	text-align: left;
}

.rules-header {
	align-items: center;
	background: var(--panel-strong);
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: space-between;
	margin-bottom: 10px;
	padding: 4px 0 8px;
	position: sticky;
	top: -4px;
	z-index: 2;
}

.rules-grid {
	display: grid;
	gap: 18px;
}

.rules-grid p {
	margin-bottom: 14px;
}

.rules-grid strong {
	color: var(--accent);
	display: block;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	margin-bottom: 6px;
	text-transform: uppercase;
}

.settings-panel {
	position: fixed;
	right: 16px;
	top: calc(var(--app-header-height) + 8px);
	width: min(320px, calc(100vw - 32px));
	padding: 18px 16px;
	text-align: left;
	z-index: 25;
}

.settings-header {
	margin-bottom: 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.settings-close {
	background: none !important;
	border: none !important;
	box-shadow: none !important;
	color: var(--text-soft) !important;
	font-size: 1.6rem !important;
	font-weight: 400 !important;
	/* Native dialogs scale from .97 during entry; 46px keeps the live hit area
	   above 44px for the whole animation as well as at rest. */
	min-height: 46px !important;
	min-width: 46px !important;
	padding: 0 10px !important;
	line-height: 1 !important;
	text-shadow: none !important;
	cursor: pointer;
}

.settings-close:hover {
	color: var(--text-main) !important;
	background: rgba(255, 255, 255, 0.06) !important;
	border-radius: 8px !important;
	transform: none !important;
}

/* Native input styling — match brass theme instead of OS blue */
input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 44px;
	background: linear-gradient(
		to bottom,
		transparent 19px,
		rgba(255, 255, 255, 0.12) 19px,
		rgba(255, 255, 255, 0.12) 25px,
		transparent 25px
	);
	border-radius: 3px;
	outline: none;
}
input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: linear-gradient(135deg, #d6b46c 0%, #c8a45c 60%, #8a6f3a 100%);
	border: 1px solid rgba(0, 0, 0, 0.3);
	box-shadow: 0 1px 0 rgba(255, 230, 180, 0.45) inset, 0 2px 6px rgba(0, 0, 0, 0.4);
	cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: linear-gradient(135deg, #d6b46c 0%, #c8a45c 60%, #8a6f3a 100%);
	border: 1px solid rgba(0, 0, 0, 0.3);
	cursor: pointer;
}
input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--accent);
}

.settings-row {
	display: grid;
	gap: 8px;
	margin-bottom: 12px;
}

.settings-row span {
	color: var(--text-main);
	font-size: 0.92rem;
}

.settings-row input[type="range"] {
	margin: 0;
}

.settings-toggle {
	align-items: center;
	grid-template-columns: 1fr auto;
}

.settings-toggle input[type="checkbox"] {
	position: static;
	opacity: 1;
	pointer-events: auto;
}

/* Native <dialog> styling. Top-layer rendering avoids z-index collisions. */
.dialog {
	background: var(--panel-strong);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-lg);
	box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
	color: var(--text-main);
	max-height: calc(100vh - 48px);
	max-width: min(92vw, 520px);
	padding: 18px 24px;
}

.dialog::backdrop {
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(2px);
}

.rules-dialog {
	max-width: min(94vw, 880px);
}

.rules-dialog .rules-card {
	padding: 4px;
}

/* Polyfill fallback: when native dialog is unsupported, force visible centered modal */
.dialog-polyfill-open.dialog {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1200;
	display: block;
}
.dialog-polyfill-open.dialog::after {
	content: "";
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: -1;
}

.dialog[open] {
	animation: bj-dialog-in 0.22s cubic-bezier(.2,.8,.2,1);
}

@keyframes bj-dialog-in {
	from { opacity: 0; transform: translateY(8px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content h4,
.modal-content p {
	color: inherit;
}

/* Legacy .modal class (Materialize divs) — keep neutral until Step 3 removal. */
.modal { display: none; }

.modal-actions-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 18px 0;
	position: relative;
	z-index: 1;
}

.modal-actions-row button {
	pointer-events: auto;
	position: relative;
	z-index: 2;
}

#game-over {
	display: grid;
	gap: 10px;
	margin: 0 auto;
	max-width: 620px;
}

#game-outcome {
	margin-bottom: 0;
	font-family: "Cormorant Garamond", "Noto Sans JP", Georgia, serif;
	font-weight: 700;
	font-size: clamp(2.2rem, 7vw, 3.4rem);
	letter-spacing: 0.005em;
	color: var(--accent);
}

table {
	margin: 0 auto;
	max-width: 460px;
	width: 100%;
}

.total-label {
	padding-right: 16px;
	text-align: right;
	width: 50%;
}

.total-output {
	text-align: left;
}

.result-summary {
	display: grid;
	gap: 8px;
}

.result-summary td {
	padding-bottom: 4px;
	padding-top: 4px;
}

.result-balance {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin: 0 auto;
	max-width: 460px;
	width: 100%;
}

.result-balance .summary-label {
	margin: 0;
}

#result-wager-details {
	border: 1px solid var(--hairline-soft);
	border-radius: var(--radius-sm);
	color: var(--text-soft);
	overflow: hidden;
}

#result-wager-details summary {
	align-items: center;
	cursor: pointer;
	display: flex;
	font-size: 0.9rem;
	justify-content: center;
	min-height: 44px;
	padding: 6px 12px;
}

#result-wager-details summary::before {
	content: "+";
	margin-right: 8px;
}

#result-wager-details[open] summary::before {
	content: "−";
}

.result-wager-buttons {
	display: grid;
	gap: 6px;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	padding: 0 8px 8px;
}

.result-wager-buttons button {
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-size: 0.9rem;
	min-height: 44px;
	padding: 4px;
}

.result-wager-buttons button[aria-pressed="true"] {
	box-shadow: 0 0 0 2px #f6d989 inset;
}

.splash-overlay {
	align-items: center;
	background:
		radial-gradient(circle at top, rgba(200, 164, 92, 0.1), transparent 38%),
		linear-gradient(180deg, rgba(4, 14, 11, 0.92), rgba(3, 10, 9, 0.97));
	display: flex;
	inset: 0;
	justify-content: center;
	padding: 20px;
	position: fixed;
	z-index: 40;
}

.splash-card {
	background: rgba(7, 23, 20, 0.95);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	max-width: 520px;
	padding: 32px 24px;
	width: 100%;
	word-break: keep-all;
	overflow-wrap: break-word;
}

.splash-card h1 {
	max-width: 100%;
	overflow-wrap: anywhere;
	white-space: normal;
}

.splash-kicker {
	color: var(--accent);
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.32em;
	margin-bottom: 12px;
	text-transform: uppercase;
}

.splash-copy {
	margin: 14px auto 20px;
	max-width: 32ch;
}

/* GTO Strategy Trainer */
.gto-bar {
	align-items: center;
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: var(--radius-md);
	display: flex;
	gap: 12px;
	justify-content: center;
	margin-bottom: 12px;
	padding: 10px 16px;
}

.gto-label {
	color: var(--text-soft);
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.gto-toggle-group {
	display: flex;
	gap: 2px;
}

.gto-mode {
	background: rgba(244, 236, 216, 0.04) !important;
	border: 1px solid var(--hairline-soft) !important;
	border-radius: 999px !important;
	box-shadow: none !important;
	color: var(--text-soft) !important;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif !important;
	font-size: 0.78rem !important;
	font-weight: 600 !important;
	letter-spacing: 0.1em !important;
	min-height: 44px !important;
	padding: 0.4rem 0.85rem !important;
	text-shadow: none !important;
}

.gto-mode:hover {
	background: rgba(244, 236, 216, 0.08) !important;
	border-color: var(--hairline) !important;
}

.gto-mode.gto-active {
	background: linear-gradient(135deg, #765c25 0%, #654b1d 55%, #493412 100%) !important;
	border-color: rgba(232, 196, 124, 0.55) !important;
	color: #fff8e6 !important;
	text-shadow: 0 1px 0 rgba(74, 55, 22, 0.45) !important;
}

/* GTO recommendation - in sidebar */
.gto-recommendation {
	background: rgba(108, 180, 214, 0.08);
	border: 1px solid rgba(108, 180, 214, 0.32);
	border-radius: var(--radius-sm);
	color: var(--accent-secondary);
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-weight: 700;
	padding: 4px 10px 6px;
	text-align: center;
}

.gto-recommendation .gto-action-line {
	font-size: 1.15rem;
	margin-bottom: 2px;
	letter-spacing: 0.01em;
}

.gto-recommendation .gto-situation-line {
	color: var(--text-soft);
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
	font-size: 0.82rem;
	font-weight: 500;
}

.gto-recommendation .gto-reason-line {
	color: var(--text-main);
	font-size: 0.86rem;
	font-weight: 500;
	line-height: 1.4;
	margin-top: 3px;
}

.gto-highlight {
	animation: gto-pulse 0.42s cubic-bezier(.2,.8,.2,1) 1;
	background: linear-gradient(135deg, #27ae60, #1e8449) !important;
	box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.8), 0 0 28px rgba(39, 174, 96, 0.5) !important;
	color: #fff !important;
	position: relative;
	transform: scale(1.04);
	z-index: 2;
}

@keyframes gto-pulse {
	0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0), 0 0 0 rgba(39, 174, 96, 0); }
	60% { box-shadow: 0 0 0 7px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.4); }
	100% { box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.8), 0 0 28px rgba(39, 174, 96, 0.5); }
}

.gto-star {
	animation: gto-sparkle 0.42s cubic-bezier(.2,.8,.2,1) 1;
	color: #ffd700;
	font-size: 1.1rem;
	margin-left: 6px;
	text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
}

@keyframes gto-sparkle {
	0% { opacity: 0.4; transform: scale(0.8); }
	65% { opacity: 1; transform: scale(1.25); }
	100% { opacity: 1; transform: scale(1); }
}

.hint-btn {
	background: linear-gradient(135deg, #3a6f88, #1f4554) !important;
	border: 1px solid rgba(108, 180, 214, 0.4) !important;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.06) inset,
		0 8px 22px rgba(0, 0, 0, 0.32) !important;
	color: var(--text-main) !important;
	text-shadow: none !important;
}

.hint-btn:hover {
	border-color: rgba(108, 180, 214, 0.6) !important;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.08) inset,
		0 12px 28px rgba(0, 0, 0, 0.36) !important;
}

/* Decision feedback lives inside the action region, never over the table. */
.gto-feedback-overlay {
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	border-radius: var(--radius-md);
	display: -webkit-box;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-size: 0.86rem;
	font-weight: 700;
	grid-column: 1 / -1;
	line-height: 1.35;
	max-height: 2.7em;
	overflow: hidden;
	padding: 5px 10px;
	pointer-events: none;
	position: static;
	text-align: center;
	transition: opacity 0.2s ease;
	width: 100%;
}

.gto-feedback-overlay.inactive {
	display: none !important;
}

.gto-feedback-overlay.gto-feedback-show {
	animation: gto-feedback-pop 0.2s ease forwards;
}

@keyframes gto-feedback-pop {
	0% { opacity: 0; }
	100% { opacity: 1; }
}

.gto-feedback-right {
	background: #14532d;
	border: 1px solid #4ade80;
	box-shadow: none;
	color: #fff;
}

.gto-feedback-wrong {
	background: #7f1d1d;
	border: 1px solid #fca5a5;
	box-shadow: none;
	color: #fff;
}

.gto-feedback-correct {
	font-size: inherit;
}

.gto-feedback-wrong-text {
	font-size: inherit;
}

.gto-feedback-reason {
	color: #fff;
	font-size: inherit;
	font-weight: 500;
}

.gto-feedback-overlay br {
	display: none;
}

.gto-feedback-reason::before {
	content: " — ";
}

.dialog-strategy-panel {
	background: rgba(108, 180, 214, 0.1);
	border: 1px solid rgba(108, 180, 214, 0.3);
	border-radius: var(--radius-sm);
	color: var(--accent-secondary);
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	margin: 12px 0;
	padding: 8px 12px;
	text-align: center;
}

.dialog-strategy-hint {
	font-size: 0.9rem !important;
	min-height: 44px !important;
	width: 100%;
}

.dialog-strategy-action {
	color: var(--accent-secondary);
	font-size: 1rem;
	font-weight: 700;
}

.dialog-strategy-reason {
	color: var(--text-main);
	font-size: 0.84rem;
	font-weight: 500;
	line-height: 1.35;
	margin-top: 4px;
}

@media (min-width: 768px) {
	.container {
		padding: 0 24px;
	}

	.nav-wrapper {
		padding: 14px 24px;
	}

	.hero-panel,
	#game-over,
	.table-panel {
		padding: 26px 24px;
	}

	.rules-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.chip-row {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.wager {
		height: 60px;
		width: 60px;
	}

	.wager-clickable {
		height: 68px;
		width: 68px;
	}

	.card-lane {
		min-height: 156px;
	}

	#dealer,
	#user-hand,
	#user-split-hand {
		min-height: 142px;
	}

	#sidebar {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.container {
		padding: 0 32px;
	}

	.page-shell {
		padding-bottom: 64px;
	}

	.board-layout {
		align-items: start;
		/* Shrink the (mostly empty) table column, give the GTO column the room
		   it needs for big readable explanations. */
		grid-template-columns: minmax(0, 580fr) minmax(420px, 480fr);
		gap: 24px;
	}

	.board-main {
		gap: 22px;
	}

	.board-side {
		position: sticky;
		top: 96px;
	}

	.status-grid {
		grid-template-columns: 1fr;
	}

	#sidebar {
		grid-template-columns: 1fr;
	}

	.table-panel {
		min-height: 230px;
	}

	.card-lane {
		min-height: 200px;
		justify-content: center;
		gap: 22px;
	}

	.player-card-lane {
		align-items: center;
	}

	#dealer,
	#user-hand,
	#user-split-hand {
		min-height: 200px;
	}

	.card {
		height: 196px;
		width: 140px;
	}

	.hero-panel {
		padding: 36px 32px;
	}

	/* Desktop: GTO panel is the focal teaching surface — make text bold and legible */
	.gto-recommendation {
		padding: 14px 18px 16px;
	}

	.gto-recommendation .gto-action-line {
		font-size: 1.7rem;
		margin-bottom: 8px;
		letter-spacing: 0.02em;
	}

	.gto-recommendation .gto-situation-line {
		font-size: 1.05rem;
		margin-bottom: 6px;
	}

	.gto-recommendation .gto-reason-line {
		font-size: 1.05rem;
		line-height: 1.55;
	}

	#sidebar button {
		min-height: 56px;
		padding: 10px 14px;
		font-size: 1.3rem;
	}

	.board-side .summary-label {
		font-size: 0.8rem;
	}

	.board-side .summary-value {
		font-size: 1.4rem;
	}
}

/* Tertiary "danger" button: subtle text link, NOT a primary CTA */
.text-link {
	background: none !important;
	box-shadow: none !important;
	color: var(--text-soft) !important;
	font-size: 0.85rem !important;
	font-weight: 500 !important;
	min-height: 44px !important;
	padding: 4px 12px !important;
	margin-top: 8px !important;
	text-decoration: underline;
	text-decoration-color: rgba(245, 242, 232, 0.3);
	text-underline-offset: 3px;
}

.text-link:hover {
	color: var(--accent-strong) !important;
	text-decoration-color: var(--accent-strong);
	transform: none !important;
}

/* ---- Session stats strip + review panel ---- */
.gto-stats-strip {
	margin: 8px 0 0;
}

.gto-stats-strip.inactive {
	display: none;
}

.gto-stats-trigger {
	background: rgba(244, 236, 216, 0.04);
	border: 1px solid var(--hairline-soft);
	border-radius: var(--radius-sm);
	color: var(--text-main);
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	width: 100%;
	font-family: inherit;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.gto-stats-trigger:hover {
	background: rgba(244, 236, 216, 0.07);
	border-color: var(--hairline);
}

.gss-block {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	min-width: 48px;
}

.gss-num {
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
	font-size: 1rem;
	font-weight: 700;
	color: var(--accent);
	line-height: 1.1;
}

.gss-lbl {
	font-size: 0.62rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-soft);
}

.gss-divider {
	flex: 0 0 1px;
	align-self: stretch;
	background: var(--hairline-soft);
}

.gss-caret {
	margin-left: auto;
	color: var(--text-soft);
	font-size: 0.9rem;
}

.gto-stats-trigger[aria-expanded="true"] .gss-caret {
	transform: rotate(180deg);
}

.gto-stats-review {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	z-index: 1000;
	padding: 16px;
}

.gto-stats-review.inactive {
	display: none;
}

.gss-review-card {
	background: var(--panel-strong);
	backdrop-filter: blur(12px);
	border: 1px solid var(--panel-border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	padding: 22px 22px 18px;
	max-width: 480px;
	width: 100%;
	max-height: 86vh;
	overflow-y: auto;
	color: var(--text-main);
}

.gss-review-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.gss-review-head h3 {
	margin: 0;
	font-family: "Cormorant Garamond", "Noto Sans JP", Georgia, serif;
	font-weight: 700;
	font-size: 1.7rem;
	letter-spacing: 0.005em;
}

.gss-close {
	background: none;
	border: none;
	color: var(--text-soft);
	font-size: 1.6rem;
	cursor: pointer;
	line-height: 1;
	min-height: 44px;
	min-width: 44px;
	padding: 4px 10px;
	border-radius: 8px;
}

.gss-close:hover {
	background: rgba(244, 236, 216, 0.07);
	color: var(--text-main);
}

.gss-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 16px;
}

.gss-grid > div {
	background: rgba(244, 236, 216, 0.04);
	border: 1px solid var(--hairline-soft);
	border-radius: var(--radius-sm);
	padding: 12px;
	text-align: center;
}

.gss-big {
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
	font-size: 1.7rem;
	font-weight: 700;
	color: var(--accent);
	display: block;
	line-height: 1.1;
}

.gss-tag {
	font-size: 0.7rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-soft);
	margin-top: 4px;
}

.gss-review-card h4 {
	margin: 14px 0 8px;
	font-size: 0.78rem;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-weight: 700;
	color: var(--text-soft);
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.gss-mistake-list {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
	display: grid;
	gap: 8px;
}

.gss-mistake-item {
	background: rgba(240, 84, 84, 0.08);
	border: 1px solid rgba(240, 84, 84, 0.22);
	border-radius: var(--radius-sm);
	padding: 10px 12px;
	display: grid;
	grid-template-columns: 1fr auto;
	column-gap: 10px;
}

.gss-mistake-label {
	font-weight: 700;
	color: var(--text-main);
}

.gss-mistake-count {
	color: var(--accent-strong);
	font-weight: 700;
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
}

.gss-mistake-reason {
	grid-column: 1 / -1;
	margin-top: 6px;
	font-size: 0.85rem;
	color: var(--text-soft);
	line-height: 1.4;
}

.gss-mistake-empty {
	color: var(--text-soft);
	font-style: italic;
	padding: 12px;
	background: rgba(255, 255, 255, 0.04);
	border-radius: var(--radius-sm);
	text-align: center;
}

.gss-reset {
	width: 100%;
	background: rgba(240, 84, 84, 0.18) !important;
	color: var(--text-main);
	border: 1px solid rgba(240, 84, 84, 0.4);
	border-radius: 999px;
	padding: 10px 16px;
	font-family: inherit;
	font-size: 0.95rem;
	cursor: pointer;
	transition: background 0.15s ease;
}

.gss-reset:hover {
	background: rgba(240, 84, 84, 0.28) !important;
}

/* ---- Mastery heatmap ---- */
.bj-heatmap-section {
	margin: 18px 0 6px;
}

.bj-heatmap-section h4 {
	margin: 0 0 8px;
	font-size: 0.78rem;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
	font-weight: 700;
	color: var(--text-soft);
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.bj-heatmap-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 0.7rem;
	color: var(--text-soft);
	margin-bottom: 10px;
}

.bj-heatmap-legend span {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.bj-heatmap-legend i {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	border: 1px solid var(--hairline-soft);
}

.bj-heatmap-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 8px;
}

.bj-heat-tab {
	background: rgba(244, 236, 216, 0.04) !important;
	border: 1px solid var(--hairline-soft) !important;
	color: var(--text-soft) !important;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif !important;
	font-size: 0.74rem !important;
	font-weight: 600 !important;
	letter-spacing: 0.08em !important;
	padding: 5px 12px !important;
	min-height: 28px !important;
	border-radius: 999px !important;
	box-shadow: none !important;
	text-shadow: none !important;
}

.bj-heat-tab.is-active {
	background: rgba(200, 164, 92, 0.14) !important;
	border-color: var(--accent) !important;
	color: var(--accent) !important;
}

.bj-heatmap-grid {
	display: grid;
	gap: 2px;
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
	font-size: 0.7rem;
}

.bj-heatmap-grid.inactive {
	display: none;
}

.bj-heat-corner {
	background: transparent;
}

.bj-heat-head {
	color: var(--text-soft);
	text-align: center;
	font-weight: 700;
	padding: 4px 0;
	font-size: 0.72rem;
	letter-spacing: 0.04em;
}

.bj-heat-row-label {
	color: var(--text-soft);
	font-weight: 700;
	text-align: right;
	padding: 4px 6px 4px 0;
	font-size: 0.72rem;
}

.bj-heat-cell {
	min-width: 22px;
	min-height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.65rem;
	font-weight: 600;
	cursor: help;
	border: 1px solid rgba(0, 0, 0, 0.18);
	transition: transform 0.12s ease;
}

.bj-heat-cell:hover {
	transform: scale(1.15);
	z-index: 2;
}

.bj-drill-row {
	display: flex;
	gap: 6px;
	margin-bottom: 10px;
	flex-wrap: wrap;
	justify-content: center;
}

.bj-drill-btn {
	background: rgba(108, 180, 214, 0.14) !important;
	border: 1px solid rgba(108, 180, 214, 0.4) !important;
	color: var(--accent-secondary) !important;
	font-size: 0.78rem !important;
	padding: 5px 12px !important;
	min-height: 44px !important;
	border-radius: 999px !important;
	box-shadow: none !important;
	font-weight: 600 !important;
	text-shadow: none !important;
	letter-spacing: 0 !important;
}

.bj-drill-btn:hover {
	background: rgba(108, 180, 214, 0.22) !important;
	border-color: rgba(108, 180, 214, 0.55) !important;
	transform: none !important;
}

.bj-drill-btn.is-active {
	background: rgba(108, 180, 214, 0.3) !important;
	border-color: var(--accent-secondary) !important;
	color: #fff !important;
}

.bj-drill-stop {
	background: rgba(225, 85, 84, 0.16) !important;
	border-color: rgba(225, 85, 84, 0.45) !important;
	color: #ffb3b3 !important;
}

.bj-drill-stop:hover {
	background: rgba(225, 85, 84, 0.24) !important;
}

.bj-heat-tab {
	letter-spacing: 0 !important;
	text-shadow: none !important;
}

/* ---- Full-screen learning progress ---- */
.gto-stats-review {
	align-items: stretch;
	background: rgba(2, 10, 9, 0.98);
	justify-content: stretch;
	padding: 0;
}

.gss-review-card {
	border: 0;
	border-radius: 0;
	display: flex;
	flex-direction: column;
	height: 100dvh;
	max-height: none;
	max-width: none;
	overflow: hidden;
	padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
	width: 100%;
}

.gss-review-head {
	flex: 0 0 auto;
	margin: 0 auto 8px;
	max-width: 1100px;
	width: 100%;
}

.progress-tabs {
	display: grid;
	flex: 0 0 auto;
	gap: 6px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0 auto 10px;
	max-width: 1100px;
	width: 100%;
}

.progress-tabs [role="tab"] {
	background: rgba(244, 236, 216, 0.04) !important;
	border: 1px solid var(--hairline-soft) !important;
	border-radius: 999px !important;
	box-shadow: none !important;
	color: var(--text-soft) !important;
	font-family: "Inter Tight", "Noto Sans JP", system-ui, sans-serif !important;
	font-size: clamp(0.7rem, 2.7vw, 0.86rem) !important;
	font-weight: 700 !important;
	letter-spacing: 0 !important;
	line-height: 1.15 !important;
	min-height: 44px !important;
	min-width: 0;
	padding: 6px 8px !important;
	text-shadow: none !important;
	white-space: normal;
}

.progress-tabs [role="tab"][aria-selected="true"] {
	background: rgba(200, 164, 92, 0.18) !important;
	border-color: var(--accent) !important;
	color: var(--accent) !important;
}

.progress-tabs [role="tab"]:focus-visible,
.gss-close:focus-visible,
.progress-practice-btn:focus-visible {
	outline: 3px solid var(--accent-secondary);
	outline-offset: 2px;
}

.progress-panel {
	margin: 0 auto;
	max-width: 1100px;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 2px 2px 24px;
	width: 100%;
}

.progress-panel.inactive,
.progress-panel[hidden] {
	display: none !important;
}

.progress-metrics {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.progress-empty,
.progress-since,
.progress-legacy,
.progress-schedule,
.bj-heatmap-precision-note {
	color: var(--text-soft);
	font-size: 0.86rem;
	line-height: 1.45;
	margin: 8px 0 14px;
}

.progress-legacy {
	background: rgba(108, 180, 214, 0.08);
	border: 1px solid rgba(108, 180, 214, 0.22);
	border-radius: var(--radius-sm);
	padding: 10px 12px;
}

.progress-legacy:empty {
	display: none;
}

.progress-scenario-list,
.progress-evidence-list {
	grid-template-columns: minmax(0, 1fr);
}

.progress-evidence-item {
	background: rgba(244, 236, 216, 0.04);
	border: 1px solid var(--hairline-soft);
	border-radius: var(--radius-sm);
	display: grid;
	gap: 5px;
	min-width: 0;
	padding: 12px;
}

.progress-evidence-item strong,
.progress-evidence-item p {
	margin: 0;
	min-width: 0;
	overflow-wrap: anywhere;
}

.progress-scenario-actions {
	color: var(--text-main) !important;
	font-size: 0.78rem !important;
}

.progress-practice-unavailable {
	color: var(--text-muted) !important;
	font-size: 0.75rem !important;
	line-height: 1.3 !important;
}

.progress-evidence-item strong {
	color: var(--text-main);
	font-size: 0.96rem;
}

.progress-evidence-item p {
	color: var(--text-soft);
	font-size: 0.82rem;
	line-height: 1.4;
}

.progress-evidence-meta {
	font-family: "JetBrains Mono", "Inter Tight", monospace;
	font-feature-settings: "tnum";
}

.progress-due-time {
	color: var(--accent-secondary) !important;
}

.progress-practice-btn {
	justify-self: start;
	margin-top: 4px;
}

.gss-reset-overall {
	background: rgba(240, 84, 84, 0.18) !important;
	border: 1px solid rgba(240, 84, 84, 0.4) !important;
	border-radius: 999px !important;
	color: var(--text-main) !important;
	min-height: 44px;
	width: 100%;
}

@media (min-width: 600px) {
	.progress-tabs {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.progress-metrics {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	[data-progress-panel="session"] .progress-metrics {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.progress-scenario-list,
	.progress-evidence-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 960px) {
	.progress-scenario-list,
	.progress-evidence-list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* ---- Toast (replaces Materialize.toast) ---- */
#bj-toast-host {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	z-index: 1100;
	pointer-events: none;
}

.bj-toast {
	background: rgba(7, 23, 20, 0.94);
	border: 1px solid var(--hairline);
	border-radius: 999px;
	color: var(--text-main);
	padding: 10px 18px;
	font-size: 0.95rem;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.bj-toast--show {
	opacity: 1;
	transform: translateY(0);
}

/* Mobile gameplay keeps legal actions in the thumb zone while reserving the
   exact worst-case height (two action rows + two-line feedback + safe area). */
@media (max-width: 767px) {
	:root {
		--app-header-height: calc(98px + env(safe-area-inset-top, 0px));
		--card-width: clamp(54px, 18vw, 68px);
		--card-height: calc(var(--card-width) * 1.3529);
	}

	.container {
		padding-left: max(12px, env(safe-area-inset-left, 0px));
		padding-right: max(12px, env(safe-area-inset-right, 0px));
	}

	.nav-actions {
		flex: 0 0 auto;
		gap: 4px;
	}

	.brand-logo {
		flex: 1 1 auto;
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	#language-toggle.nav-control {
		padding-left: 8px;
		padding-right: 8px;
	}

	#audio-settings-toggle.nav-control,
	.nav-actions a {
		min-width: 44px;
		padding-left: 8px;
		padding-right: 8px;
	}

	.gto-sub-bar {
		gap: 6px;
		justify-content: space-between;
	}

	.gto-sub-label {
		font-size: 0.68rem;
		letter-spacing: 0.12em;
	}

	.gto-mode {
		font-size: 0.7rem !important;
		letter-spacing: 0.04em !important;
		padding-left: 0.65rem !important;
		padding-right: 0.65rem !important;
	}

	#game-board:not(.inactive) {
		padding-bottom: var(--action-dock-reserve);
	}

	#gto-recommendation:not(.inactive) {
		scroll-margin-bottom: calc(var(--action-dock-reserve) + 8px);
	}

	#sidebar {
		background: rgba(5, 18, 16, 0.97);
		border: 1px solid var(--panel-border);
		border-radius: var(--radius-md) var(--radius-md) 0 0;
		bottom: 0;
		box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.42);
		gap: 5px;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		left: max(8px, env(safe-area-inset-left, 0px));
		padding: 7px 7px calc(7px + env(safe-area-inset-bottom, 0px));
		position: fixed;
		right: max(8px, env(safe-area-inset-right, 0px));
		z-index: 18;
	}

	#sidebar button {
		font-size: 0.88rem;
		line-height: 1.1;
		min-height: 44px;
		padding: 5px 4px;
	}

	#surrender-button,
	.hint-btn {
		grid-column: auto;
	}

	.table-panel {
		padding-left: 10px;
		padding-right: 10px;
	}

	.card-lane {
		width: 100%;
	}

	#deck-pile {
		position: absolute;
		right: -8px;
		top: 0;
	}

	#dealer {
		padding-right: 28px;
	}

	#game-over {
		padding: 14px 12px;
	}

	#game-outcome {
		font-size: clamp(1.9rem, 10vw, 2.5rem);
	}

	.text-link {
		min-height: 44px !important;
	}
}

@media (max-width: 767px) and (max-height: 600px) {
	#game-board:not(.inactive) {
		padding-bottom: calc(var(--action-dock-reserve) + 8px);
	}

	.board-layout,
	.board-main {
		gap: 0;
	}

	.table-panel {
		padding-bottom: 0;
		padding-top: 0;
	}

	.game-board-totals {
		font-size: 1rem;
		margin: 0;
		min-height: 32px;
		min-width: 32px;
		padding: 0 8px;
	}

	.table-panel:nth-child(2) .panel-header {
		margin-bottom: 0;
	}

	.player-hand-slot {
		padding-bottom: 0;
		padding-top: 0;
	}

	.player-card-lane {
		padding-bottom: 0;
	}

	.dialog {
		max-height: calc(100vh - 20px);
		overflow-y: auto;
		padding: 12px 14px;
	}

	.dialog .modal-content > h4,
	.dialog .modal-content > p {
		margin-bottom: 8px;
		margin-top: 8px;
	}

	.dialog-strategy-panel {
		margin: 8px 0;
		padding: 6px 8px;
	}

	.dialog .modal-actions-row {
		margin: 10px 0;
	}
}

@media (max-width: 360px) {
	.brand-logo {
		font-size: 0 !important;
		max-width: 32px;
	}

	.brand-logo::after {
		content: attr(data-label);
		font-size: 1.2rem;
		letter-spacing: 0.04em;
	}

	select#language-toggle.nav-control {
		font-size: 0.82rem !important;
		max-width: 9.25rem;
		padding-left: 4px;
		padding-right: 4px;
	}
}

/* Short landscape: table and action rail stay side-by-side. */
@media (orientation: landscape) and (max-height: 600px) and (min-width: 768px) {
	:root {
		--app-header-height: calc(98px + env(safe-area-inset-top, 0px));
	}

	.nav-wrapper {
		padding: calc(3px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 3px max(16px, env(safe-area-inset-left, 0px));
	}

	.page-shell {
		padding-bottom: 8px;
		padding-top: 6px;
	}

	#welcome.hero-panel {
		align-items: center;
		display: grid;
		gap: 16px;
		grid-template-columns: minmax(190px, 0.7fr) minmax(0, 1.3fr);
		padding: 8px 18px;
	}

	#welcome .hero-copy h1 {
		font-size: 2rem;
	}

	#welcome .hero-copy p {
		font-size: 0.9rem;
		line-height: 1.35;
	}

	#welcome #wager-options {
		gap: 6px;
		margin-top: 0;
		max-width: none;
	}

	#welcome .chip-row {
		gap: 6px;
	}

	#welcome .chip-row a {
		min-height: 52px;
		padding: 2px;
	}

	#welcome .wager-clickable {
		height: 48px;
		width: 48px;
	}

	#welcome .summary-card {
		padding-bottom: 4px;
		padding-top: 4px;
	}

	#welcome .summary-label {
		margin-bottom: 2px;
	}

	.board-layout {
		align-items: start;
		gap: 10px;
		grid-template-columns: minmax(0, 1fr) minmax(292px, 36vw);
	}

	.board-main {
		gap: 5px;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.board-side {
		gap: 4px;
		max-height: calc(100vh - var(--app-header-height) - 8px);
		overflow-y: auto;
		position: sticky;
		top: calc(var(--app-header-height) + 4px);
	}

	.table-panel {
		min-height: 0;
		padding: 6px 10px;
	}

	.card-lane,
	#dealer,
	#user-hand,
	#user-split-hand {
		min-height: 78px;
	}

	#sidebar {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	#sidebar button {
		font-size: 0.92rem;
		min-height: 44px;
		padding: 5px 6px;
	}

	#surrender-button,
	.hint-btn {
		grid-column: auto;
	}

	#game-over {
		align-items: center;
		grid-template-areas:
			"outcome summary"
			"replay summary"
			"wager reset";
		grid-template-columns: minmax(0, 1.25fr) minmax(230px, 0.75fr);
		padding: 10px 18px;
	}

	#game-outcome {
		font-size: clamp(1.65rem, 4.2vw, 2.2rem);
		grid-area: outcome;
		line-height: 1.1;
	}

	.result-summary {
		grid-area: summary;
	}

	.new-game-button {
		grid-area: replay;
	}

	#result-wager-details {
		grid-area: wager;
	}

	#game-over > .text-link {
		grid-area: reset;
		margin-top: 0 !important;
		min-height: 44px !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	button,
	.nav-control,
	.player-hand-slot,
	.gto-feedback-overlay,
	.bj-toast {
		transition: none !important;
	}

	.gto-highlight,
	.gto-star,
	.gto-feedback-overlay.gto-feedback-show,
	.chip-guide a,
	.dialog[open] {
		animation: none !important;
	}
}
