/**
 * The hand you can play on /blackjack/ — styles for #btf-bj-play.
 *
 * The look is the Basic Strategy Trainer's (blackjack-trainer.css, the owner's
 * mock): a tinted panel holding a paper shell, a felt table with playing
 * cards, bordered play buttons with key hints, a tinted result card and a
 * folded rules line. Every rule those parts need is repeated here under this
 * root, measure for measure, so a change to the trainer's look belongs here
 * too. Two departures: the three 11px labels are .7rem (the site's floor for
 * text), and under 520px the dealer sits above your hand instead of beside
 * it, because a hand here can grow to six cards or split in two.
 *
 * New to the game, and kept in the same materials: a face-down card, cards
 * that overlap from the third one on (.bj-fan), two hands side by side after
 * a split (.bj-two) and a plain list in the rules fold.
 */

#btf-bj-play {
	--bj-page: var( --bg2 ); --bj-paper: var( --surface ); --bj-ink: var( --ink ); --bj-muted: var( --ink3 ); --bj-line: var( --bg3 ); --bj-soft: var( --bg2 );
	--bj-brand: var( --felt ); --bj-brand-ink: var( --on-dark ); --bj-felt: #1B4535; --bj-felt-ink: #F8F5E9;
	--bj-ok-bg: #E9F3EB; --bj-ok: #266342; --bj-error-bg: #FBEFEA; --bj-error: #9B4832;
	--bj-card-w: 68px; --bj-card-h: 94px;
	color: var( --bj-ink );
}
#btf-bj-play .bj-study { background: var( --bj-page ); padding: 28px; border-radius: 20px; font: 400 15px/1.5 'Outfit', sans-serif; color: var( --bj-ink ); }
#btf-bj-play .bj-study * { box-sizing: border-box; }
#btf-bj-play button, #btf-bj-play select { font: inherit; cursor: pointer; }
#btf-bj-play button:disabled { cursor: default; }
#btf-bj-play button, #btf-bj-play select, #btf-bj-play summary { -webkit-tap-highlight-color: transparent; }
#btf-bj-play [hidden] { display: none !important; }
#btf-bj-play button:focus-visible, #btf-bj-play select:focus-visible, #btf-bj-play summary:focus-visible { outline: 2px solid var( --bj-brand ); outline-offset: 2px; }

/* ── before the script runs, and where it cannot ────────────────────────── */
/* Where scripts run (the theme marks <html class="js"> in the head) the stage holds its height from the first
   paint, so the page below does not jump when the table arrives. Without scripts it is only as tall as its note. */
.js #btf-bj-play .bj-stage { min-height: 520px; }
#btf-bj-play .bj-nojs { margin: 0; background: var( --bj-paper ); border: 1px solid var( --bj-line ); border-radius: 18px; padding: 20px 22px; font-size: 14px; line-height: 1.55; color: var( --bj-muted ); }

/* ── toolbar ────────────────────────────────────────────────────────────── */
#btf-bj-play .bj-hand-count { color: var( --bj-muted ); font-size: 13px; font-variant-numeric: tabular-nums; }
#btf-bj-play .bj-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
#btf-bj-play .bj-filter { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var( --bj-muted ); }
#btf-bj-play .bj-filter select {
	color: var( --bj-ink ); border: 1px solid var( --bj-line ); border-radius: 8px; padding: 8px 26px 8px 10px; font-size: 13px; height: 38px;
	-webkit-appearance: none; appearance: none;   /* WebKit ignores min-height on a native select; drawing it ourselves keeps the 44px tap target on phones */
	background: var( --bj-paper ) url( "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%236B6258' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>" ) no-repeat right 10px center;
}

/* ── the shell and the table ────────────────────────────────────────────── */
#btf-bj-play .bj-shell { background: var( --bj-paper ); border: 1px solid var( --bj-line ); border-radius: 18px; overflow: hidden; }
#btf-bj-play .bj-table { background: var( --bj-felt ); color: var( --bj-felt-ink ); padding: 26px 26px 24px; text-align: center; display: grid; grid-template-columns: minmax( 0, 1fr ) minmax( 0, 1.3fr ); align-items: start; gap: 20px; }
#btf-bj-play .bj-table-label { font-family: 'JetBrains Mono', monospace; font-size: .7rem; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; opacity: .8; margin-bottom: 9px; }
#btf-bj-play .bj-cards { display: flex; justify-content: center; gap: 9px; min-height: var( --bj-card-h ); }
#btf-bj-play .bj-playing-card { flex: none; width: var( --bj-card-w ); height: var( --bj-card-h ); border-radius: 7px; background: #FFFDF6; color: #24382D; position: relative; box-shadow: 0 3px 5px rgba( 6, 29, 37, .14 ); text-align: left; font-family: 'Instrument Serif', Georgia, serif; }
#btf-bj-play .bj-playing-card.bj-red-suit { color: #AC493D; }
#btf-bj-play .bj-corner { position: absolute; left: 9px; top: 6px; font-size: 20px; line-height: 1; }
#btf-bj-play .bj-corner small { display: block; font-size: 13px; text-align: center; margin-top: 3px; }
#btf-bj-play .bj-bottom { left: auto; top: auto; bottom: 6px; right: 9px; transform: rotate( 180deg ); }
#btf-bj-play .bj-pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; }
#btf-bj-play .bj-pip, #btf-bj-play .bj-corner small { font-family: 'Times New Roman', Georgia, serif; }   /* Instrument Serif has no suit glyphs; pin the fallback so pips look the same everywhere */
#btf-bj-play .bj-dealer-group { border-right: 1px solid rgba( 163, 181, 168, .3 ); padding-right: 20px; min-width: 0; }
#btf-bj-play .bj-player-cards > .bj-playing-card:first-child { transform: rotate( -4deg ); }
#btf-bj-play .bj-player-cards > .bj-playing-card:last-child { transform: rotate( 4deg ); }
#btf-bj-play .bj-hand-title { margin-top: 11px; font-size: 17px; font-weight: 500; }
#btf-bj-play .bj-hand-kind { opacity: .75; font-size: 12px; margin-left: 6px; font-weight: 400; }

/* the card the dealer keeps face down: the same card, turned over */
#btf-bj-play .bj-card-back::after { content: ''; position: absolute; inset: 6px; border-radius: 4px; background: repeating-linear-gradient( 45deg, #1B4535 0 3px, #2A5A45 3px 6px ); }

/* from the third card on, cards overlap: each earlier one keeps its corner showing and gives way when the row runs out of room */
#btf-bj-play .bj-fan { gap: 0; }
#btf-bj-play .bj-slot { display: block; flex: 0 1 46px; min-width: 16px; height: var( --bj-card-h ); }
#btf-bj-play .bj-slot:last-child { flex: 0 0 var( --bj-card-w ); }
#btf-bj-play .bj-slot + .bj-slot .bj-playing-card { box-shadow: -2px 3px 5px rgba( 6, 29, 37, .2 ); }
#btf-bj-play .bj-slot:not( :last-child ) .bj-pip,
#btf-bj-play .bj-slot:not( :last-child ) .bj-bottom { display: none; }   /* a covered card shows its corner, as in a hand of cards */

/* before the first hand: the button that deals, where your cards will be. Cream on felt, as the cards are. */
#btf-bj-play .bj-empty { align-items: center; }
#btf-bj-play .bj-deal { display: inline-flex; align-items: center; gap: 12px; border: 0; border-radius: 10px; background: var( --bj-felt-ink ); color: var( --bj-felt ); padding: 12px 22px; min-height: 48px; font-size: 16px; font-weight: 500; white-space: nowrap; box-shadow: 0 3px 5px rgba( 6, 29, 37, .14 ); transition: background 140ms; }
#btf-bj-play .bj-deal:hover { background: #fff; }
#btf-bj-play .bj-deal:focus-visible { outline: 2px solid #E6CC8A; outline-offset: 3px; }
#btf-bj-play .bj-deal span { opacity: .7; }

/* your seat: one hand, or the two a split makes */
#btf-bj-play .bj-seat { display: flex; justify-content: center; gap: 14px; min-width: 0; }
#btf-bj-play .bj-hand { flex: 1 1 0; min-width: 0; }
#btf-bj-play .bj-two .bj-hand.is-active .bj-table-label { opacity: 1; color: #E6CC8A; }
#btf-bj-play .bj-two .bj-hand.is-active .bj-table-label::before { content: '▸ '; }
#btf-bj-play .bj-two .bj-hand-kind { display: block; margin: 0; }

/* ── the decision ───────────────────────────────────────────────────────── */
#btf-bj-play .bj-decision { padding: 20px 22px 0; }
#btf-bj-play .bj-decision-title { font-size: 13px; line-height: 1.5; color: var( --bj-muted ); margin: 0 0 9px; }
#btf-bj-play .bj-actions { display: grid; grid-template-columns: repeat( var( --bj-cols, 3 ), minmax( 0, 1fr ) ); gap: 8px; }
#btf-bj-play .bj-action { min-height: 60px; border-radius: 10px; border: 1px solid var( --bj-line ); background: var( --bj-paper ); color: var( --bj-ink ); padding: 8px; display: flex; align-items: center; justify-content: center; gap: 12px; transition: background 140ms, border-color 140ms; }
#btf-bj-play .bj-action:hover:enabled { background: var( --bj-soft ); border-color: var( --bj-muted ); }
#btf-bj-play .bj-action-name { font-size: 16px; font-weight: 500; }
#btf-bj-play kbd { font: 400 .7rem/1.4 'JetBrains Mono', monospace; color: var( --bj-muted ); border: 1px solid var( --bj-line ); border-radius: 4px; padding: 2px 5px; }
#btf-bj-play .bj-action small { display: block; font-size: .7rem; font-weight: 400; margin-top: 2px; }
#btf-bj-play .bj-action.bj-correct { background: var( --bj-ok-bg ); border-color: var( --bj-ok ); color: var( --bj-ok ); }
#btf-bj-play .bj-action.bj-incorrect { background: var( --bj-error-bg ); border-color: var( --bj-error ); color: var( --bj-error ); }
#btf-bj-play .bj-action.bj-other { color: var( --bj-muted ); background: var( --bj-soft ); }

/* ── the result ─────────────────────────────────────────────────────────── */
#btf-bj-play .bj-feedback-slot { min-height: 153px; padding: 14px 22px 20px; }
#btf-bj-play .bj-result { min-height: 118px; border-radius: 10px; padding: 13px 15px; background: var( --bj-soft ); display: flex; flex-direction: column; gap: 6px; }
#btf-bj-play .bj-result[data-verdict="correct"] { background: var( --bj-ok-bg ); }
#btf-bj-play .bj-result[data-verdict="incorrect"] { background: var( --bj-error-bg ); }
#btf-bj-play .bj-result-title { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 500; color: var( --bj-ink ); }
#btf-bj-play .bj-mark { font: 400 .9em/1 system-ui, sans-serif; margin-right: .35em; }
#btf-bj-play .bj-result[data-verdict="correct"] .bj-result-title { color: var( --bj-ok ); }
#btf-bj-play .bj-result[data-verdict="incorrect"] .bj-result-title { color: var( --bj-error ); }
#btf-bj-play .bj-result-copy { margin: 0; font-size: 13px; line-height: 1.5; color: var( --bj-muted ); }
#btf-bj-play .bj-result-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#btf-bj-play .bj-detail-button { color: var( --bj-ink ); background: transparent; border: 0; padding: 6px 0; font-size: 12px; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
#btf-bj-play .bj-next { border: 0; background: var( --bj-brand ); color: var( --bj-brand-ink ); padding: 9px 13px; border-radius: 7px; font-size: 13px; white-space: nowrap; min-height: 38px; margin-left: auto; }
#btf-bj-play .bj-next:focus-visible { outline: 2px solid var( --bj-brand-ink ); outline-offset: -4px; }   /* focused after every keyboard answer: an inner ring, not a second border */
#btf-bj-play .bj-next:hover { background: var( --felt2 ); }
#btf-bj-play .bj-next span { margin-left: 10px; opacity: .8; }
#btf-bj-play .bj-waiting { display: flex; align-items: center; justify-content: center; height: 118px; color: var( --bj-muted ); font-size: 13px; text-align: center; }
#btf-bj-play .bj-details { border-top: 1px solid var( --bj-line ); margin-top: 10px; padding-top: 10px; font-size: 12px; color: var( --bj-ink ); }
#btf-bj-play .bj-details p { margin: 0 0 5px; font-size: 12px; line-height: 1.5; color: var( --bj-ink ); }   /* base.css styles bare <p> directly, so inheritance is not enough */
#btf-bj-play .bj-details p:last-child { margin-bottom: 0; }
#btf-bj-play .bj-price { white-space: nowrap; }

/* ── the rules, folded ──────────────────────────────────────────────────── */
#btf-bj-play .bj-rule-footer { margin-top: 14px; }
#btf-bj-play .bj-rule-footer summary { cursor: pointer; color: var( --bj-muted ); font-size: 12px; padding: 4px 0; }
#btf-bj-play .bj-rule-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); gap: 6px 22px; }
#btf-bj-play .bj-rule-list li { margin: 0; padding: 0; font-size: 13px; line-height: 1.5; color: var( --bj-muted ); }
#btf-bj-play .bj-rule-list b { color: var( --bj-ink ); font-weight: 500; }

/* ── narrow ─────────────────────────────────────────────────────────────── */
@media ( max-width: 520px ) {
	#btf-bj-play { --bj-card-w: 58px; --bj-card-h: 82px; }
	.js #btf-bj-play .bj-stage { min-height: 745px; }
	#btf-bj-play .bj-study { padding: 17px 12px; border-radius: 12px; }
	#btf-bj-play .bj-decision { padding: 16px 12px 0; }
	#btf-bj-play .bj-feedback-slot { padding: 12px; }
	/* the dealer above, you below: a long hand or a split needs the whole width */
	#btf-bj-play .bj-table { padding: 20px 12px; gap: 14px; grid-template-columns: minmax( 0, 1fr ); }
	#btf-bj-play .bj-dealer-group { border-right: 0; padding-right: 0; border-bottom: 1px solid rgba( 163, 181, 168, .3 ); padding-bottom: 14px; }
	#btf-bj-play .bj-slot { flex-basis: 40px; }
	#btf-bj-play .bj-actions { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); min-height: 116px; align-content: start; }   /* room for two rows, so the result card does not move when a play drops out */
	#btf-bj-play .bj-actions.bj-odd .bj-action:last-child { grid-column: 1 / -1; }
	#btf-bj-play .bj-action { min-height: 54px; }
	#btf-bj-play .bj-result-footer { flex-wrap: wrap; }
	#btf-bj-play .bj-rule-list { grid-template-columns: minmax( 0, 1fr ); }
}
@media ( pointer: coarse ) {
	#btf-bj-play .bj-next, #btf-bj-play .bj-detail-button { min-height: 44px; }
	#btf-bj-play .bj-filter select { height: 44px; font-size: 16px; }   /* under 16px iOS zooms into the control */
	#btf-bj-play .bj-rule-footer summary { padding: 13px 0; }          /* 44px tall with the text centred */
}
@media ( max-width: 360px ) {
	#btf-bj-play .bj-action { gap: 8px; padding: 8px 6px; }
	#btf-bj-play .bj-table-label { letter-spacing: .09em; }
}
@media ( prefers-reduced-motion: reduce ) {
	#btf-bj-play .bj-action, #btf-bj-play .bj-deal { transition: none; }
}
