/**
 * Nicehand replayer.
 *
 * The palette is the leaderboard's, reproduced under its own prefix rather
 * than inherited: the replayer has to work when it is embedded in a page that
 * does not load the board's stylesheet, and a shared hand opened from a link
 * should not depend on which of the site's pages happens to be around it.
 *
 * Everything on the table is positioned as a percentage of one
 * aspect-ratio box, so the whole thing scales from a phone to a desktop with
 * no breakpoints and no re-layout.
 *
 * Cards and chips come from one sprite each, built out of Card_Game_GFX by
 * tools/build-cards.py. Sprite cells are addressed in card-width units, not
 * with percentage background positions: a percentage in background-position
 * resolves against the difference between the image and the box, which is
 * arithmetic that happens to work at one size and drifts at every other.
 */

.nhr {
	--nhr-ground: #f4f6f5;
	--nhr-surface: #ffffff;
	--nhr-surface-2: #f8faf9;
	--nhr-ink: #0b130f;
	--nhr-ink-dim: #37453e;
	--nhr-muted: #6c7e75;
	--nhr-rule: #e9efef;
	--nhr-rule-strong: #d5e0dc;

	--nhr-accent: #072f1f;
	--nhr-accent-soft: rgba(7, 47, 31, 0.08);
	--nhr-accent-ink: #ffffff;
	--nhr-lime: #b4f105;
	--nhr-danger: #ef4444;
	--nhr-hot: #f97316;
	--nhr-win: #16a34a;

	/* The felt is darker than the board's green: white cards sit on it, and on a
	   mid green they have nowhere near enough separation. */
	--nhr-felt: #17694a;
	--nhr-felt-deep: #0a3122;
	--nhr-rail: #1b2a22;
	--nhr-rail-deep: #070d0a;
	--nhr-felt-ink: #eaf3ee;

	--nhr-red: #c2333a;
	--nhr-black: #22262b;

	/* The card cell's aspect, straight from the source art (128x173). It has to
	   stay exact or every face is subtly stretched. */
	--nhr-card-ratio: 1.3516;

	--nhr-radius: 14px;
	--nhr-shadow: 0 1px 2px rgba(11, 19, 15, .06), 0 8px 24px rgba(11, 19, 15, .07);
	--nhr-shadow-sm: 0 1px 2px rgba(11, 19, 15, .08);

	--nhr-font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	font-family: var(--nhr-font);
	color: var(--nhr-ink);
	-webkit-font-smoothing: antialiased;
}

.nhr *,
.nhr *::before,
.nhr *::after { box-sizing: border-box; }

/**
 * The page shell for the plugin's own templates.
 *
 * Defaults, not decisions: a theme that wants a different measure sets these
 * itself, and the plugin still looks deliberate on a stock theme that has no
 * opinion at all. Previously this was inline on each template, which no theme
 * could override without fighting specificity.
 */
.nhr-shell {
	width: 100%;
	max-width: 1140px;
	margin-inline: auto;
	padding-inline: 20px;
}

.nhr-h1 {
	margin: 0 0 6px;
	font-size: clamp(22px, 3.2vw, 30px);
	font-weight: 800;
	letter-spacing: -.025em;
	line-height: 1.15;
}

/* Figures line up in columns all over this UI - stacks, pots, timeline ticks -
   and Plus Jakarta Sans has a proportional 1 about half the width of its 0. */
.nhr [data-figure],
.nhr .nhr-stack,
.nhr .nhr-pot-value,
.nhr .nhr-bet,
.nhr .nhr-hand-net { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- table --- */

.nhr-table-wrap {
	position: relative;
	width: 100%;
	/* Close to the 2:1 a real table is. Squarer than this and the middle
	   becomes a field of empty felt with the cards marooned in it. */
	aspect-ratio: 16 / 8.6;
	/* Capped so the table does not swell to fill a wide screen. Past about
	   this width the cards stop growing - they hit their own maximum - and all
	   the extra goes into green. */
	max-width: 920px;
	margin-inline: auto;
	container-type: inline-size;
}

/**
 * On a phone the table has to become squarer.
 *
 * Nine seats around a 2:1 racetrack 350 pixels wide leaves each seat about
 * forty pixels of arc, and they collide and hang off the felt. Height is the
 * only axis with any give, so the table takes more of it and the name plates
 * narrow to match. A min-height would not do: it fights the aspect ratio
 * instead of replacing it, and the result is a squat pill with seats over
 * the rail.
 */
@media (max-width: 640px) {
	.nhr-table-wrap { aspect-ratio: 16 / 12.5; }
	.nhr-seat { --seat-w: clamp(58px, 18cqw, 92px); }
}

/**
 * The table is a racetrack, not an ellipse: two semicircular ends joined by a
 * straight run, which is the shape a real eight or nine handed table actually
 * is. An ellipse curves away along its whole length, so seats on the long
 * sides drift inward and the middle looks pinched.
 *
 * `border-radius: 999px` on a wide box gives exactly that - the radius clamps
 * to half the height, so the ends are true semicircles and the middle is
 * straight - and it costs nothing to scale.
 *
 * .nhr-felt is the rail. Its ::before is the playing surface, inset by the
 * rail's width; its ::after is the grain.
 */
.nhr-felt {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background:
		linear-gradient(180deg, #253630 0%, var(--nhr-rail) 42%, var(--nhr-rail-deep) 100%);
	box-shadow:
		0 26px 50px -18px rgba(4, 14, 10, .75),
		0 4px 14px rgba(4, 14, 10, .35),
		inset 0 2px 0 rgba(255, 255, 255, .13),
		inset 0 -2px 3px rgba(0, 0, 0, .5);
}

/* The rail's width. Real tables have a padded rail you rest your arms on, and
   a hairline reads as a green pill with a dark outline instead. */
.nhr-felt::before,
.nhr-felt::after {
	content: "";
	position: absolute;
	inset: clamp(10px, 2.7cqw, 26px);
	border-radius: 999px;
}

.nhr-felt::before {
	background:
		radial-gradient(70% 108% at 50% -14%, rgba(255, 255, 255, .16), transparent 60%),
		radial-gradient(120% 150% at 50% 120%, rgba(0, 0, 0, .34), transparent 58%),
		linear-gradient(172deg, var(--nhr-felt) 0%, var(--nhr-felt-deep) 100%);
	box-shadow:
		inset 0 0 0 1px rgba(0, 0, 0, .45),
		inset 0 0 0 2.5px rgba(255, 255, 255, .05),
		inset 0 6px 22px rgba(0, 0, 0, .3);
}

/**
 * Felt grain. Flat green reads as plastic at this size, and the difference
 * between a table and a green pill is mostly texture. Fractal noise from an
 * inline SVG rather than an image: a couple of hundred bytes, no request, and
 * it tiles at any scale.
 */
.nhr-felt::after {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
	background-size: 140px 140px;
	opacity: .055;
	mix-blend-mode: overlay;
	pointer-events: none;
}

/* Everything that is not the felt is placed on top of it. */
.nhr-table-wrap > *:not(.nhr-felt) { position: absolute; z-index: 1; }

/* Board and pot share the middle. The pot sits above the board because chips
   arrive there before the cards do. */
.nhr-centre {
	left: 50%;
	top: 47%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(6px, 1.4cqw, 11px);
	/* Sized by its contents rather than a share of the table: the board is five
	   cards wide at whatever the cards currently are, and a fixed percentage
	   either crops them or leaves a gap that moves as the cards grow. */
	width: max-content;
	max-width: 78%;
}

.nhr-pot {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 4px 13px 4px 9px;
	border-radius: 999px;
	background: linear-gradient(180deg, rgba(6, 28, 19, .72), rgba(4, 20, 14, .82));
	box-shadow:
		inset 0 0 0 1px rgba(255, 255, 255, .14),
		0 2px 10px rgba(0, 0, 0, .3);
	color: var(--nhr-felt-ink);
	font-size: clamp(11px, 2.4cqw, 15px);
	font-weight: 700;
	white-space: nowrap;
}

.nhr-pot-label {
	text-transform: uppercase;
	letter-spacing: .09em;
	font-size: .74em;
	opacity: .66;
	font-weight: 700;
}

/* A chip stack on the pot, so the middle of the table reads as chips rather
   than as a label. */
.nhr-pot::before {
	content: "";
	--chip-px: clamp(13px, 2.7cqw, 18px);
	width: var(--chip-px);
	height: var(--chip-px);
	background-image: url("../img/chips.png");
	background-repeat: no-repeat;
	background-size: calc(var(--chip-px) * 7) var(--chip-px);
	background-position: calc(var(--chip-px) * -4) 0;
	flex: none;
}

.nhr-board { display: flex; gap: clamp(3px, .9cqw, 7px); }

.nhr-board .nhr-card { animation: nhr-deal .28s ease-out both; }

@keyframes nhr-deal {
	from { opacity: 0; transform: translateY(-8px) scale(.9); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.nhr-board .nhr-card { animation: none; }
	.nhr * { transition-duration: .01ms !important; }
}

.nhr-street-tag {
	font-size: clamp(9px, 1.9cqw, 12px);
	text-transform: uppercase;
	letter-spacing: .12em;
	font-weight: 700;
	color: rgba(234, 243, 238, .6);
}

/* ----------------------------------------------------------------- seat --- */

.nhr-seat {
	--seat-w: clamp(80px, 17cqw, 136px);
	width: var(--seat-w);
	left: calc(var(--x) * 1%);
	top: calc(var(--y) * 1%);
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	transition: opacity .2s ease;
}

.nhr-seat[data-folded="1"] { opacity: .42; }
.nhr-seat[data-empty="1"] { opacity: .28; }

.nhr-seat-cards {
	display: flex;
	gap: 2px;
	min-height: 1px;
}

.nhr-plate {
	width: 100%;
	border-radius: 9px;
	background: linear-gradient(180deg, rgba(11, 38, 27, .9), rgba(4, 18, 13, .93));
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, .13),
		inset 0 0 0 1px rgba(255, 255, 255, .07),
		0 3px 10px rgba(0, 0, 0, .3);
	color: var(--nhr-felt-ink);
	text-align: center;
	overflow: hidden;
	transition: box-shadow .18s ease, background .18s ease;
}

/* The player to act is the single most important thing on the table, so it is
   marked with the one saturated colour nothing else on the felt uses. */
.nhr-seat[data-acting="1"] .nhr-plate {
	background: rgba(180, 241, 5, .16);
	box-shadow:
		inset 0 0 0 1px rgba(180, 241, 5, .55),
		0 0 0 3px rgba(180, 241, 5, .18);
}

.nhr-seat[data-winner="1"] .nhr-plate {
	background: rgba(22, 163, 74, .24);
	box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .7);
}

.nhr-name {
	display: block;
	padding: 3px 6px 1px;
	font-size: clamp(9px, 1.85cqw, 12px);
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nhr-stack {
	display: block;
	padding: 0 6px 4px;
	font-size: clamp(10px, 2.1cqw, 13px);
	font-weight: 700;
	letter-spacing: -.01em;
}

.nhr-seat[data-allin="1"] .nhr-stack { color: var(--nhr-hot); }

.nhr-badge {
	position: absolute;
	top: -6px;
	right: -6px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--nhr-surface);
	color: var(--nhr-accent);
	font-size: 10px;
	font-weight: 800;
	line-height: 18px;
	text-align: center;
	box-shadow: var(--nhr-shadow-sm);
}

.nhr-bounty {
	display: block;
	padding: 0 6px 4px;
	font-size: clamp(8px, 1.6cqw, 10px);
	font-weight: 700;
	color: var(--nhr-lime);
}

/* Chips a player has pushed out sit between them and the middle of the table,
   which is where they are on a real one. */
.nhr-bet {
	position: absolute;
	left: calc(var(--bx) * 1%);
	top: calc(var(--by) * 1%);
	transform: translate(-50%, -50%);
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px 2px 3px;
	border-radius: 999px;
	background: linear-gradient(180deg, rgba(9, 32, 22, .84), rgba(4, 18, 13, .9));
	color: #f2f8f4;
	font-size: clamp(9px, 1.8cqw, 12px);
	font-weight: 700;
	white-space: nowrap;
	box-shadow:
		inset 0 0 0 1px rgba(255, 255, 255, .15),
		0 2px 6px rgba(0, 0, 0, .34);
}

/**
 * A real chip stack, coloured by how big the bet is relative to the big blind.
 * --chip is the sprite column, which the renderer picks: the sprite runs white,
 * red, green, blue, black, purple, orange, low denomination to high, so the
 * colour carries a rough sense of size before the number is even read.
 */
.nhr-bet::before {
	content: "";
	--chip-px: clamp(12px, 2.5cqw, 17px);
	width: var(--chip-px);
	height: var(--chip-px);
	flex: none;
	background-image: url("../img/chips.png");
	background-repeat: no-repeat;
	background-size: calc(var(--chip-px) * 7) var(--chip-px);
	background-position: calc(var(--chip-px) * var(--chip, 1) * -1) 0;
}

/* The button, as a dealer button: a white disc with a ring, not a letter in a
   circle. */
.nhr-dealer {
	position: absolute;
	left: calc(var(--dx) * 1%);
	top: calc(var(--dy) * 1%);
	transform: translate(-50%, -50%);
	width: clamp(17px, 3.5cqw, 25px);
	height: clamp(17px, 3.5cqw, 25px);
	border-radius: 50%;
	background: radial-gradient(circle at 34% 28%, #ffffff 0%, #e7ece9 62%, #c4cfc9 100%);
	color: #0b130f;
	font-size: clamp(9px, 1.9cqw, 12px);
	font-weight: 800;
	line-height: clamp(17px, 3.5cqw, 25px);
	text-align: center;
	letter-spacing: -.02em;
	box-shadow:
		inset 0 0 0 1.5px rgba(11, 19, 15, .16),
		0 2px 5px rgba(0, 0, 0, .4);
}

/* The last thing a player did, floating by their seat. */
.nhr-said {
	position: absolute;
	left: calc(var(--sx) * 1%);
	top: calc(var(--sy) * 1%);
	transform: translate(-50%, -50%);
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--nhr-accent);
	color: var(--nhr-accent-ink);
	font-size: clamp(9px, 1.75cqw, 11px);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .07em;
	white-space: nowrap;
	box-shadow: var(--nhr-shadow-sm);
}

.nhr-said[data-kind="fold"] { background: #4b5a53; }
.nhr-said[data-kind="raise"], .nhr-said[data-kind="bet"] { background: var(--nhr-hot); }
.nhr-said[data-kind="call"] { background: #2563eb; }
.nhr-said[data-kind="check"] { background: #4b5a53; }
.nhr-said[data-kind="collect"] { background: var(--nhr-win); }

/* ---------------------------------------------------------------- cards --- */

/**
 * One cell of the card sprite. --col is the rank (ace first) and --row the
 * suit, in the order spades, hearts, diamonds, clubs, with the back on row 4.
 *
 * The art carries its own white face, rounded corners and border, so nothing
 * here paints a background or a radius of its own - only the drop shadow that
 * lifts it off the felt. Sizing in card-width units keeps the sprite maths
 * exact at every size the card is drawn at.
 */
.nhr-card {
	--card-w: clamp(22px, 5.1cqw, 40px);
	--col: 0;
	--row: 4;
	position: relative;
	flex: none;
	width: var(--card-w);
	height: calc(var(--card-w) * var(--nhr-card-ratio, 1.3516));
	background-image: url("../img/cards.png");
	background-repeat: no-repeat;
	background-size:
		calc(var(--card-w) * 13)
		calc(var(--card-w) * var(--nhr-card-ratio, 1.3516) * 5);
	background-position:
		calc(var(--card-w) * var(--col) * -1)
		calc(var(--card-w) * var(--nhr-card-ratio, 1.3516) * var(--row) * -1);
	filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .38));
	user-select: none;
}

/* Face down is simply the back cell, so nothing special is needed beyond the
   row the renderer already sets. */

/* Seat cards are smaller than board cards - the board is what a reader scans,
   and it is the thing worth making big. */
.nhr-seat-cards .nhr-card { --card-w: clamp(19px, 4.4cqw, 34px); }
.nhr-board .nhr-card { --card-w: clamp(30px, 7.4cqw, 62px); }

/* The hero's own cards get a ring. Applied as an outline on a pseudo-element
   because the face is a background image: a box-shadow would sit under the
   art, and the art's own white border would hide it. */
.nhr-seat[data-hero="1"] .nhr-seat-cards .nhr-card::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: calc(var(--card-w) * .09);
	box-shadow: 0 0 0 1.5px var(--nhr-lime);
}

/* ------------------------------------------------------------- controls --- */

.nhr-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	padding: 10px;
	margin-top: 12px;
	border-radius: var(--nhr-radius);
	background: var(--nhr-surface);
	box-shadow: var(--nhr-shadow);
}

.nhr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 38px;
	height: 38px;
	padding: 0 12px;
	border: 0;
	border-radius: 10px;
	background: var(--nhr-surface-2);
	box-shadow: inset 0 0 0 1px var(--nhr-rule-strong);
	color: var(--nhr-ink);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, box-shadow .15s ease, transform .06s ease;
}

.nhr-btn:hover:not(:disabled) { background: var(--nhr-accent-soft); }
.nhr-btn:active:not(:disabled) { transform: translateY(1px); }
.nhr-btn:disabled { opacity: .38; cursor: default; }

.nhr-btn:focus-visible {
	outline: 2px solid var(--nhr-accent);
	outline-offset: 2px;
}

.nhr-btn[data-primary] {
	background: var(--nhr-accent);
	color: var(--nhr-accent-ink);
	box-shadow: none;
}

.nhr-btn[data-primary]:hover:not(:disabled) { background: #0b4630; }

.nhr-btn svg { width: 16px; height: 16px; fill: currentColor; }

.nhr-scrub {
	flex: 1 1 160px;
	min-width: 120px;
	accent-color: var(--nhr-accent);
	cursor: pointer;
}

.nhr-step-count {
	font-size: 12px;
	font-weight: 600;
	color: var(--nhr-muted);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.nhr-spacer { flex: 1 1 auto; }

/* ------------------------------------------------------------------ log --- */

.nhr-log {
	margin-top: 12px;
	border-radius: var(--nhr-radius);
	background: var(--nhr-surface);
	box-shadow: var(--nhr-shadow);
	overflow: hidden;
}

.nhr-log-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--nhr-rule);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--nhr-muted);
}

.nhr-log-body {
	max-height: 260px;
	overflow-y: auto;
	padding: 6px 0;
}

.nhr-log-row {
	display: flex;
	gap: 10px;
	align-items: baseline;
	width: 100%;
	padding: 5px 14px;
	border: 0;
	background: none;
	font: inherit;
	font-size: 13px;
	text-align: left;
	color: var(--nhr-ink-dim);
	cursor: pointer;
}

.nhr-log-row:hover { background: var(--nhr-surface-2); }

.nhr-log-row[aria-current="true"] {
	background: var(--nhr-accent-soft);
	color: var(--nhr-ink);
	font-weight: 600;
	box-shadow: inset 3px 0 0 var(--nhr-accent);
}

.nhr-log-street {
	padding: 8px 14px 4px;
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: .1em;
	color: var(--nhr-muted);
}

.nhr-log-who { font-weight: 600; color: var(--nhr-ink); }
.nhr-log-note { color: var(--nhr-muted); font-style: italic; }

/* ------------------------------------------------------------- timeline --- */

.nhr-timeline {
	margin-top: 12px;
	padding: 12px 14px 6px;
	border-radius: var(--nhr-radius);
	background: var(--nhr-surface);
	box-shadow: var(--nhr-shadow);
}

.nhr-timeline-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--nhr-muted);
}

/* The chip graph. Height is fixed and the path is drawn in viewBox units, so
   it stretches to whatever width the page gives it without redrawing. */
.nhr-graph {
	display: block;
	width: 100%;
	height: 96px;
	overflow: visible;
}

.nhr-graph-line { fill: none; stroke: var(--nhr-accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.nhr-graph-area { fill: var(--nhr-accent-soft); }
.nhr-graph-zero { stroke: var(--nhr-rule-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }

.nhr-ticks {
	position: relative;
	height: 26px;
	margin-top: 2px;
}

/* One mark per hand that moved real money. Marks are buttons so the timeline
   is usable from the keyboard, not only by clicking. */
.nhr-tick {
	position: absolute;
	top: 0;
	left: calc(var(--p) * 1%);
	transform: translateX(-50%);
	width: 14px;
	height: 22px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	border-radius: 4px;
}

.nhr-tick::after {
	content: "";
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	width: 3px;
	border-radius: 2px;
	background: var(--nhr-muted);
}

.nhr-tick[data-dir="win"]::after { background: var(--nhr-win); top: 0; height: calc(var(--mag) * 1%); }
.nhr-tick[data-dir="loss"]::after { background: var(--nhr-danger); bottom: 0; height: calc(var(--mag) * 1%); }

.nhr-tick:hover::after { filter: brightness(1.15); }
.nhr-tick[aria-current="true"] { background: var(--nhr-accent-soft); }
.nhr-tick[aria-current="true"]::after { background: var(--nhr-accent); }
.nhr-tick:focus-visible { outline: 2px solid var(--nhr-accent); outline-offset: 1px; }

/* ------------------------------------------------------------ hand list --- */

.nhr-hands {
	border-radius: var(--nhr-radius);
	background: var(--nhr-surface);
	box-shadow: var(--nhr-shadow);
	overflow: hidden;
}

.nhr-hands-body { max-height: 420px; overflow-y: auto; }

.nhr-hand-row {
	display: grid;
	grid-template-columns: 2.6rem 1fr auto;
	gap: 10px;
	align-items: baseline;
	width: 100%;
	padding: 8px 14px;
	border: 0;
	border-bottom: 1px solid var(--nhr-rule);
	background: none;
	font: inherit;
	font-size: 13px;
	text-align: left;
	cursor: pointer;
}

.nhr-hand-row:hover { background: var(--nhr-surface-2); }
.nhr-hand-row[aria-current="true"] { background: var(--nhr-accent-soft); box-shadow: inset 3px 0 0 var(--nhr-accent); }
.nhr-hand-no { color: var(--nhr-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.nhr-hand-cards { display: flex; gap: 3px; align-items: center; }

/* Cards outside the table need an explicit size. The default is in cqw, which
   only means anything inside .nhr-table-wrap - that is the one element with a
   container-type. Everywhere else cqw falls back to the viewport and every
   card snaps to its maximum, which in a list row is four times too big. */
.nhr-hand-cards .nhr-card { --card-w: 22px; }
.nhr-hand-net { font-weight: 700; }
.nhr-hand-net[data-dir="win"] { color: var(--nhr-win); }
.nhr-hand-net[data-dir="loss"] { color: var(--nhr-danger); }
.nhr-hand-net[data-dir="flat"] { color: var(--nhr-muted); font-weight: 600; }

/* ---------------------------------------------------------------- shell --- */

.nhr-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 16px;
	align-items: start;
}

@media (max-width: 900px) {
	.nhr-layout { grid-template-columns: minmax(0, 1fr); }
}

.nhr-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
	align-items: center;
	margin-bottom: 10px;
}

.nhr-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--nhr-surface);
	box-shadow: inset 0 0 0 1px var(--nhr-rule-strong);
	font-size: 12px;
	font-weight: 600;
	color: var(--nhr-ink-dim);
}

.nhr-chip[data-tone="accent"] { background: var(--nhr-accent); color: var(--nhr-accent-ink); box-shadow: none; }
.nhr-chip[data-tone="lime"] { background: var(--nhr-lime); color: var(--nhr-accent); box-shadow: none; }

/* ---------------------------------------------------------------- input --- */

.nhr-paste {
	width: 100%;
	min-height: 220px;
	padding: 14px 16px;
	border: 0;
	border-radius: var(--nhr-radius);
	background: var(--nhr-surface);
	box-shadow: inset 0 0 0 1px var(--nhr-rule-strong);
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	font-size: 12.5px;
	line-height: 1.55;
	color: var(--nhr-ink);
	resize: vertical;
}

.nhr-paste:focus {
	outline: 0;
	box-shadow: inset 0 0 0 2px var(--nhr-accent);
}

/**
 * The tool: two halves, one per way in.
 *
 * One rounded block split down the middle rather than two separate cards: it
 * is one tool with two doors, and the slightly different tones are enough to
 * tell the halves apart without a rule between them. The file half is the
 * darker of the two because it is the heavier job.
 *
 * Both halves stretch to the same height and push their actions to the
 * bottom, so the two primary buttons sit on one line across the page.
 */
.nhr-tool {
	--nhr-pane-paste: #f3f6f4;
	--nhr-pane-file: #e7efea;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	border-radius: var(--nhr-radius);
	overflow: hidden;
	box-shadow: inset 0 0 0 1px var(--nhr-rule);
}

@media (max-width: 760px) {
	.nhr-tool { grid-template-columns: minmax(0, 1fr); }
}

.nhr-pane {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
	padding: clamp(16px, 2.4vw, 24px);
}

.nhr-pane[data-pane="paste"] { background: var(--nhr-pane-paste); }
.nhr-pane[data-pane="file"] { background: var(--nhr-pane-file); }

.nhr-pane-head {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--nhr-ink);
}

.nhr-pane-hint {
	margin: -4px 0 2px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--nhr-muted);
}

.nhr-pane-note {
	margin: 0;
	font-size: 12px;
	line-height: 1.45;
	color: var(--nhr-muted);
}

/* Inside a pane the paste box grows to fill the half, so both halves end at
   the same line whatever the hint above them wraps to. */
.nhr-pane .nhr-paste {
	flex: 1 1 auto;
	min-height: 180px;
	resize: vertical;
}

.nhr-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

/**
 * The drop zone fills the file half. A dashed edge is the one convention
 * everybody already reads as "you can drop a file here", so it is used rather
 * than invented.
 */
.nhr-dropzone {
	flex: 1 1 auto;
	min-height: 180px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 18px;
	border: 1.5px dashed rgba(7, 47, 31, .3);
	border-radius: 12px;
	background: rgba(255, 255, 255, .45);
	text-align: center;
	transition: background .15s ease, border-color .15s ease;
}

.nhr-dropzone[data-over="1"] {
	background: rgba(180, 241, 5, .16);
	border-color: var(--nhr-accent);
}

.nhr-dropzone-or { font-size: 13px; color: var(--nhr-muted); }

.nhr-dropzone-file {
	max-width: 100%;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--nhr-ink-dim);
	overflow-wrap: anywhere;
}

.nhr-dropzone-file:empty { display: none; }

/**
 * The rooms row under the tool: "Works with" and "Coming soon", each followed
 * by small logos.
 *
 * Logos are held to one height so marks with very different proportions sit
 * on one line, and to a max width so a long wordmark cannot push the row
 * around. Rooms that are not supported yet are desaturated and faded rather
 * than hidden: knowing a room is on the way is useful, but it must not read as
 * a promise. No hover effect - it is information, not a menu.
 */
.nhr-rooms {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 26px;
	margin-top: 12px;
	font-size: 12px;
}

/* A label and its logos wrap as a unit, so "Coming soon" is never left at the
   end of one line with its marks starting the next. */
.nhr-rooms-group {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 14px;
}

.nhr-rooms-label {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	font-size: 10.5px;
	color: var(--nhr-muted);
}

.nhr-rooms-list {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nhr-room {
	display: inline-flex;
	align-items: center;
	height: 22px;
}

.nhr-room img {
	display: block;
	height: 18px;
	width: auto;
	max-width: 110px;
	object-fit: contain;
}

.nhr-room-name {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--nhr-ink-dim);
}

.nhr-room[data-status="soon"] img {
	filter: grayscale(1);
	opacity: .45;
}

.nhr-room[data-status="soon"] .nhr-room-name { color: var(--nhr-muted); font-weight: 600; }

/* Hidden but still in the document, so the button can open it. Not
   display:none, which some browsers refuse to open a picker for. */
.nhr-file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.nhr-hint { margin: 6px 0 0; font-size: 13px; color: var(--nhr-muted); }

.nhr-error {
	margin-top: 10px;
	padding: 10px 14px;
	border-radius: 10px;
	background: rgba(239, 68, 68, .08);
	box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .3);
	font-size: 13px;
	color: #7f1d1d;
}

/* ---------------------------------------------------------------- share --- */

.nhr-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 10px;
	margin-top: 12px;
	border-radius: var(--nhr-radius);
	background: var(--nhr-surface);
	box-shadow: var(--nhr-shadow);
}

.nhr-jump {
	width: 74px;
	height: 34px;
	padding: 0 10px;
	border: 0;
	border-radius: 9px;
	background: var(--nhr-surface-2);
	box-shadow: inset 0 0 0 1px var(--nhr-rule-strong);
	font: inherit;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	color: var(--nhr-ink);
}

.nhr-url {
	flex: 1 1 220px;
	min-width: 0;
	height: 38px;
	padding: 0 12px;
	border: 0;
	border-radius: 10px;
	background: var(--nhr-surface-2);
	box-shadow: inset 0 0 0 1px var(--nhr-rule-strong);
	font: inherit;
	font-size: 13px;
	color: var(--nhr-ink-dim);
}

.nhr-toggle {
	display: inline-flex;
	padding: 3px;
	border-radius: 10px;
	background: var(--nhr-surface-2);
	box-shadow: inset 0 0 0 1px var(--nhr-rule-strong);
}

.nhr-toggle button {
	padding: 0 12px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: none;
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--nhr-muted);
	cursor: pointer;
}

.nhr-toggle button[aria-pressed="true"] {
	background: var(--nhr-surface);
	color: var(--nhr-ink);
	box-shadow: var(--nhr-shadow-sm);
}

.nhr-note { font-size: 12px; color: var(--nhr-muted); flex-basis: 100%; margin: 0; }

/* Announcements for screen readers and the "Copied" flash. */
.nhr-live {
	position: absolute;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------- cards
   listing on /hands/ --------------------------------------------------- */

.nhr-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 14px;
}

.nhr-card-link {
	display: block;
	padding: 14px;
	border-radius: var(--nhr-radius);
	background: var(--nhr-surface);
	box-shadow: var(--nhr-shadow);
	color: inherit;
	text-decoration: none;
	transition: transform .12s ease, box-shadow .12s ease;
}

.nhr-card-link:hover {
	transform: translateY(-2px);
	box-shadow: 0 2px 4px rgba(11, 19, 15, .07), 0 14px 32px rgba(11, 19, 15, .10);
}

.nhr-card-title { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.nhr-card-sub { margin: 0; font-size: 12.5px; color: var(--nhr-muted); }
.nhr-card-cards { display: flex; gap: 3px; margin: 10px 0 0; }
.nhr-card-cards .nhr-card { --card-w: 26px; }

/* ----------------------------------------------------------------- dark --- */

.nhr[data-skin="dark"],
[data-mttl-theme="dark"] .nhr {
	--nhr-ground: #0a1210;
	--nhr-surface: #101a16;
	--nhr-surface-2: #16221d;
	--nhr-ink: #eaf3ee;
	--nhr-ink-dim: #c3d3cb;
	--nhr-muted: #8aa096;
	--nhr-rule: #1d2a24;
	--nhr-rule-strong: #27352e;
	--nhr-accent: #b4f105;
	--nhr-accent-soft: rgba(180, 241, 5, .12);
	--nhr-accent-ink: #07150b;
	--nhr-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4);
	--nhr-shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
}

.nhr[data-skin="dark"] .nhr-error,
[data-mttl-theme="dark"] .nhr .nhr-error { color: #fecaca; }
