/*
 * Rollcall — Game Night theme
 *
 * Design language: warm cream surfaces, bold teal accents,
 * friendly typography. A sunny tabletop, not a smoky bar.
 *
 * Inspired by MotherDuck (warm beige + vibrant accents) and
 * Fishwife (playful serif headings + full-color energy).
 *
 * Three type layers:
 *   Display (Playfair Display) — game names, headings, personality
 *   Body (DM Sans) — clean readable text, UI elements
 *   Data (IBM Plex Mono) — labels, metadata, counters
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
	/* Surfaces — warm cream, clean white cards */
	--surface-0: #F5F0EA;
	--surface-1: #FFFFFF;
	--surface-2: #EDE8E1;
	--surface-3: #E2DAD1;
	--surface-hover: #D8CFC5;

	/* Accent — playful teal, game-night energy */
	--accent: #0EA595;
	--accent-bright: #12BBA9;
	--accent-muted: #0B8A7D;
	--accent-deep: #076B61;
	--accent-glow: rgba(14, 165, 149, 0.10);
	--accent-glow-strong: rgba(14, 165, 149, 0.20);

	/* Danger — warm coral */
	--danger: #E54D42;

	/* Text — warm darks on light backgrounds */
	--text-primary: #2A2622;
	--text-secondary: #5F584F;
	--text-muted: #9C948A;

	/* Borders */
	--border: rgba(42, 38, 34, 0.10);
	--border-hover: rgba(42, 38, 34, 0.22);

	/* Radii — friendlier, rounder */
	--radius-sm: 4px;
	--radius-md: 8px;
	--radius-lg: 12px;

	/* Typography */
	--font-display: 'Playfair Display', Georgia, serif;
	--font-body: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
	--font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

html {
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

body {
	font-family: var(--font-body);
	background: var(--surface-0);
	color: var(--text-primary);
	line-height: 1.7;
	min-height: 100vh;
}

/* Image containers — position context for rounded corners */
.game-card-img,
.game-detail-image-wrapper {
	position: relative;
	overflow: hidden;
}

/* === NAV === */
.nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.6rem 2rem;
	border-bottom: 1px solid var(--border);
	background: var(--surface-1);
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-logo {
	font-family: var(--font-display);
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--text-primary);
	text-decoration: none;
	letter-spacing: 0.01em;
	position: relative;
	isolation: isolate;
	padding: 0.3em 0.6em;
}

.nav-logo span {
	color: var(--accent);
}

.nav-logo .logo-kanji {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 2.4em;
	color: var(--accent);
	opacity: 0.07;
	z-index: -1;
	pointer-events: none;
	white-space: nowrap;
	letter-spacing: 0.15em;
	font-weight: 400;
}

.nav-logo::before,
.nav-logo::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	height: 1px;
	background: var(--accent-muted);
	opacity: 0.35;
}

.nav-logo::before { top: 0; }
.nav-logo::after { bottom: 0; }

.nav-links {
	display: flex;
	gap: 2rem;
	list-style: none;
}

.nav-link {
	font-family: var(--font-body);
	font-size: 0.85rem;
	color: var(--text-muted);
	text-decoration: none;
	padding: 0.25rem 0;
	border-bottom: 2px solid transparent;
	transition: all 0.3s ease;
}

.nav-link:hover {
	color: var(--text-primary);
	border-bottom-color: var(--surface-3);
}

.nav-link.active {
	color: var(--accent-deep);
	border-bottom-color: var(--accent);
}

.nav-right {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.nav-user {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding-left: 1.5rem;
	border-left: 1px solid var(--border);
}

.nav-username {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
}

.nav-logout-form {
	display: inline;
}

.nav-logout {
	font-family: var(--font-body);
	font-size: 0.75rem;
	color: var(--text-muted);
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	transition: color 0.3s ease;
}

.nav-logout:hover {
	color: var(--text-secondary);
}

/* === MAIN LAYOUT === */
.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 3rem 2rem 5rem;
}

/* === PAGE HEADER === */
.page-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 2.5rem;
	gap: 1rem;
}

.page-title {
	font-family: var(--font-display);
	font-size: 2rem;
	font-weight: 700;
	color: var(--text-primary);
	letter-spacing: 0.01em;
}

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-muted);
	text-decoration: none;
	margin-bottom: 2rem;
	transition: color 0.3s ease;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.back-link:hover {
	color: var(--accent);
}

/* === BUTTONS === */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-family: var(--font-body);
	font-size: 0.8rem;
	font-weight: 700;
	padding: 0.6rem 1.4rem;
	border-radius: var(--radius-sm);
	border: none;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.3s ease;
	white-space: nowrap;
}

.btn-primary {
	background: var(--accent);
	color: #FFFFFF;
}

.btn-primary:hover {
	background: var(--accent-muted);
}

.btn-ghost {
	background: transparent;
	color: var(--text-secondary);
	border: 1px solid var(--border-hover);
}

.btn-ghost:hover {
	color: var(--text-primary);
	border-color: var(--text-muted);
	background: var(--surface-2);
}

/* === GAME FILTER BAR === */
.game-filter-bar {
	display: flex;
	gap: 0.35rem;
	margin-bottom: 1.25rem;
}

/* === SEARCH === */
.search-bar {
	position: relative;
	margin-bottom: 2rem;
}

.search-bar svg {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-muted);
	pointer-events: none;
}

.search-input {
	width: 100%;
	font-family: var(--font-body);
	font-size: 0.9rem;
	padding: 0.8rem 1rem 0.8rem 2.75rem;
	background: var(--surface-1);
	color: var(--text-primary);
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-md);
	outline: none;
	transition: all 0.3s ease;
}

.search-input::placeholder {
	color: var(--text-muted);
	font-style: italic;
}

.search-input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

/* === GAME CARDS === */
.game-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1rem;
	list-style: none;
}

.game-card {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1rem;
	text-decoration: none;
	color: inherit;
	display: block;
	transition: all 0.3s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.game-card:hover {
	border-color: var(--border-hover);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.game-card-name {
	font-family: var(--font-display);
	font-size: 1rem;
	font-weight: 700;
	margin-bottom: 0.4rem;
	color: var(--text-primary);
}

.game-card-tagline {
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-bottom: 0.6rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-style: italic;
}

.game-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	font-size: 0.8rem;
	color: var(--text-secondary);
	margin-top: 0.75rem;
}

.meta-tag {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-secondary);
	background: var(--surface-2);
	padding: 0.2rem 0.5rem;
	border-radius: var(--radius-sm);
}

.game-card:hover .meta-tag {
	background: var(--surface-3);
}

/* === GAME CARD IMAGE === */
.game-card-img {
	margin-bottom: 0.75rem;
	border-radius: var(--radius-sm);
}

.game-card-image {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: var(--radius-sm);
	display: block;
}

.game-card-image-placeholder {
	width: 100%;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2rem;
	background: var(--surface-2);
	border-radius: var(--radius-sm);
	margin-bottom: 0.75rem;
	opacity: 0.35;
}

.game-card:hover .game-card-image-placeholder {
	background: var(--surface-3);
}

.complexity-dots {
	display: inline-flex;
	gap: 3px;
	align-items: center;
}

.complexity-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--surface-3);
}

.complexity-dot.filled {
	background: var(--accent);
}

/* === GAME DETAIL === */
.game-detail {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2rem;
	margin-bottom: 2.5rem;
	position: relative;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.game-detail::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}

.game-detail-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

/* === GAME DETAIL IMAGE === */
.game-detail-image-wrapper {
	margin-bottom: 1.5rem;
}

.game-detail-image {
	max-width: 300px;
	width: 100%;
	border-radius: var(--radius-md);
	object-fit: cover;
}

/* === FILE INPUT === */
.file-input {
	padding: 0.5rem;
}

.file-input::file-selector-button {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-primary);
	background: var(--surface-2);
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-sm);
	padding: 0.4rem 0.8rem;
	margin-right: 0.75rem;
	cursor: pointer;
	transition: all 0.2s ease;
	letter-spacing: 0.02em;
}

.file-input::file-selector-button:hover {
	background: var(--surface-3);
	border-color: var(--text-muted);
}

.edit-image-preview {
	max-width: 200px;
	border-radius: var(--radius-sm);
	margin-bottom: 0.5rem;
}

.game-detail-name {
	font-family: var(--font-display);
	font-size: 2rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	margin-bottom: 0.75rem;
}

.game-detail-tagline {
	font-size: 1rem;
	color: var(--text-secondary);
	font-style: italic;
	margin-bottom: 1rem;
}

.game-detail-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-bottom: 1.5rem;
}

.detail-tag {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-secondary);
	background: var(--surface-0);
	padding: 0.35rem 0.75rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
}

.game-description {
	color: var(--text-secondary);
	line-height: 1.8;
	font-size: 0.9rem;
}

/* Markdown-rendered description content */
.markdown-body p { margin-bottom: 0.75em; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
	font-family: var(--font-display);
	color: var(--text-primary);
	margin: 1em 0 0.5em;
}
.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child { margin-top: 0; }
.markdown-body h1 { font-size: 1.3em; }
.markdown-body h2 { font-size: 1.15em; }
.markdown-body h3 { font-size: 1em; }
.markdown-body ul, .markdown-body ol {
	padding-left: 1.5em;
	margin-bottom: 0.75em;
}
.markdown-body li { margin-bottom: 0.25em; }
.markdown-body strong { color: var(--text-primary); }
.markdown-body em { font-style: italic; }
.markdown-body code {
	font-family: var(--font-mono);
	font-size: 0.85em;
	background: var(--surface-2);
	padding: 0.15em 0.4em;
	border-radius: var(--radius-sm);
}
.markdown-body pre {
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.75em 1em;
	margin-bottom: 0.75em;
	overflow-x: auto;
}
.markdown-body pre code {
	background: none;
	padding: 0;
}
.markdown-body blockquote {
	border-left: 3px solid var(--accent);
	padding-left: 1em;
	margin: 0.75em 0;
	color: var(--text-muted);
	font-style: italic;
}

/* === DETAIL SECTIONS === */
.expansions-section,
.plays-section,
.reviews-section {
	margin-top: 1.5rem;
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1.25rem 1.5rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
	gap: 1rem;
}

.section-title {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

.play-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.play-row {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 0.85rem 1rem;
	background: var(--surface-0);
	border: 1px solid var(--border);
	border-bottom: none;
	transition: background 0.2s ease;
}

.play-row:first-child {
	border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.play-row:last-child {
	border-bottom: 1px solid var(--border);
	border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.play-row:only-child {
	border-radius: var(--radius-md);
	border-bottom: 1px solid var(--border);
}

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

.play-date {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	white-space: nowrap;
	min-width: 7rem;
}

.play-players {
	font-size: 0.9rem;
	color: var(--text-secondary);
}

.play-player-count {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--accent-deep);
	background: var(--accent-glow);
	padding: 0.15rem 0.5rem;
	border-radius: var(--radius-sm);
	margin-left: auto;
	white-space: nowrap;
}

.play-expansions {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-muted);
	font-style: italic;
}

/* === EXPANSIONS === */

.expansion-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.expansion-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.5rem 0.75rem;
	font-size: 0.9rem;
	color: var(--text-secondary);
	border-bottom: 1px solid var(--border);
}

.expansion-item:last-child {
	border-bottom: none;
}

.expansion-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: inherit;
	text-decoration: none;
}

.expansion-link:hover {
	color: var(--accent-deep);
}

.expansion-thumb {
	width: 100px;
	height: 100px;
	object-fit: cover;
	object-position: center;
	border-radius: var(--radius-sm);
}

/* === REVIEWS === */

.review-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.review-row {
	background: var(--surface-0);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1rem 1.25rem;
	transition: background 0.2s ease;
}

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

.review-row-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.review-author {
	font-family: var(--font-display);
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--text-primary);
}

.review-stars {
	display: inline-flex;
	gap: 1px;
}

.review-star {
	font-size: 0.8rem;
	color: var(--surface-3);
	line-height: 1;
}

.review-star.filled {
	color: #F0A830;
}

.review-date {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-muted);
	margin-left: auto;
	white-space: nowrap;
}

.review-comment {
	margin-top: 0.5rem;
	font-size: 0.85rem;
	font-style: italic;
	color: var(--text-secondary);
	line-height: 1.7;
}

.review-form-container {
	margin-bottom: 1.25rem;
}

/* Star rating selector — CSS-only interactive stars */
.rating-group {
	flex: 0 0 auto !important;
	min-width: auto !important;
}

.rating-select {
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 2px;
	padding-top: 0.25rem;
}

.rating-select input[type="radio"] {
	display: none;
}

.rating-select label {
	cursor: pointer;
	font-size: 1.4rem;
	color: var(--surface-3);
	line-height: 1;
	transition: color 0.15s ease;
}

.rating-select label:hover,
.rating-select label:hover ~ label,
.rating-select input[type="radio"]:checked ~ label {
	color: #F0A830;
}

/* Review form — comment spans full width */
.review-comment-group {
	flex-basis: 100% !important;
}

.review-comment-group .form-textarea {
	min-height: auto;
}

.review-row {
	animation: fadeIn 0.25s ease forwards;
}

/* === FORMS === */
.form-card {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.25rem;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.form-group.full-width {
	grid-column: 1 / -1;
}

.form-label {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	font-weight: 500;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.form-input,
.form-textarea {
	font-family: var(--font-body);
	font-size: 0.9rem;
	padding: 0.65rem 0.85rem;
	background: var(--surface-0);
	color: var(--text-primary);
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-sm);
	outline: none;
	transition: all 0.3s ease;
}

.form-textarea {
	resize: vertical;
	min-height: 100px;
	line-height: 1.7;
}

.form-input:focus,
.form-textarea:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
	color: var(--text-muted);
	font-style: italic;
}

.form-hint {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	color: var(--text-muted);
}

.form-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

/* Inline play form */
.play-form-container {
	margin-bottom: 1.25rem;
}

.inline-form {
	background: var(--surface-0);
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-md);
	padding: 1.25rem;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-end;
}

.inline-form .form-group {
	flex: 1;
	min-width: 180px;
}

.inline-form .form-actions {
	margin-top: 0;
}

/* === PLAYER PICKER (token/pill input) === */
[data-player-picker],
[data-item-picker] {
	position: relative;
	background: var(--surface-0);
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-sm);
	padding: 0.35rem 0.5rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: center;
	cursor: text;
	transition: border-color 0.3s ease;
}

[data-player-picker]:focus-within,
[data-item-picker]:focus-within {
	border-color: var(--accent);
}

.pp-pills {
	display: contents;
}

.pp-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	background: var(--accent-glow-strong);
	color: var(--accent-deep);
	font-family: var(--font-mono);
	font-size: 0.78rem;
	padding: 0.2rem 0.5rem;
	border-radius: var(--radius-sm);
	white-space: nowrap;
}

.pp-pill-remove {
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	font-size: 0.9rem;
	line-height: 1;
	padding: 0 0.15rem;
}
.pp-pill-remove:hover {
	color: var(--danger);
}

.pp-input {
	flex: 1;
	min-width: 100px;
	background: transparent;
	border: none;
	outline: none;
	color: var(--text-primary);
	font-family: var(--font-body);
	font-size: 0.9rem;
	padding: 0.3rem 0.35rem;
}

.pp-input::placeholder {
	color: var(--text-muted);
}

.pp-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 10;
	background: var(--surface-1);
	border: 1px solid var(--border-hover);
	border-top: none;
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
	max-height: 180px;
	overflow-y: auto;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pp-option {
	padding: 0.5rem 0.85rem;
	font-family: var(--font-body);
	font-size: 0.9rem;
	color: var(--text-primary);
	cursor: pointer;
}

.pp-option:hover {
	background: var(--accent-glow);
	color: var(--accent-deep);
}

/* === EMPTY STATE === */
.empty-state {
	text-align: center;
	padding: 4rem 2rem;
	color: var(--text-muted);
}

.empty-state-icon {
	font-size: 2rem;
	margin-bottom: 1rem;
	opacity: 0.4;
}

.empty-state-text {
	font-family: var(--font-display);
	font-size: 1rem;
	font-style: italic;
	margin-bottom: 1.5rem;
	color: var(--text-muted);
}

/* === COMPLEXITY SELECTOR === */
.complexity-select {
	display: flex;
	gap: 0.5rem;
}

.complexity-option {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
}

.complexity-option input[type="radio"] {
	display: none;
}

.complexity-option label {
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-mono);
	font-size: 0.8rem;
	color: var(--text-muted);
	background: var(--surface-1);
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all 0.2s ease;
}

.complexity-option label:hover {
	border-color: var(--accent);
	color: var(--text-primary);
}

.complexity-option input[type="radio"]:checked + label {
	background: var(--accent-glow-strong);
	border-color: var(--accent);
	color: var(--accent-deep);
}

/* === HTMX STATES === */
.htmx-indicator {
	display: none;
}

.htmx-request .htmx-indicator {
	display: inline-block;
}

.htmx-request.htmx-indicator {
	display: inline-block;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.game-card {
	animation: fadeIn 0.4s ease forwards;
}

.play-row {
	animation: fadeIn 0.25s ease forwards;
}

.game-card:nth-child(1)  { animation-delay: 0s; }
.game-card:nth-child(2)  { animation-delay: 0.04s; }
.game-card:nth-child(3)  { animation-delay: 0.08s; }
.game-card:nth-child(4)  { animation-delay: 0.12s; }
.game-card:nth-child(5)  { animation-delay: 0.16s; }
.game-card:nth-child(6)  { animation-delay: 0.20s; }
.game-card:nth-child(7)  { animation-delay: 0.24s; }
.game-card:nth-child(8)  { animation-delay: 0.28s; }
.game-card:nth-child(9)  { animation-delay: 0.30s; }
.game-card:nth-child(10) { animation-delay: 0.32s; }

/* === AUTH === */
.auth-body {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 2rem;
}

.auth-wrapper {
	width: 100%;
	max-width: 380px;
}

.auth-logo {
	font-family: var(--font-display);
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--text-primary);
	text-decoration: none;
	text-align: center;
	display: block;
	margin-bottom: 2.5rem;
	position: relative;
	isolation: isolate;
	padding: 0.5em 1em;
}

.auth-logo span {
	color: var(--accent);
}

.auth-logo .logo-kanji {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 2.8em;
	color: var(--accent);
	opacity: 0.07;
	z-index: -1;
	pointer-events: none;
	white-space: nowrap;
	letter-spacing: 0.2em;
	font-weight: 400;
}

.auth-logo::before,
.auth-logo::after {
	content: '';
	position: absolute;
	left: 10%;
	right: 10%;
	height: 1px;
	background: var(--accent);
	opacity: 0.3;
}

.auth-logo::before { top: 0; }
.auth-logo::after { bottom: 0; }

.auth-card {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2rem;
	position: relative;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.auth-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}

.auth-title {
	font-family: var(--font-display);
	font-size: 1.25rem;
	font-weight: 700;
	margin-bottom: 1.5rem;
	color: var(--text-primary);
}

.auth-error {
	font-size: 0.85rem;
	color: var(--danger);
	background: rgba(229, 77, 66, 0.08);
	border: 1px solid rgba(229, 77, 66, 0.2);
	border-radius: var(--radius-sm);
	padding: 0.6rem 0.9rem;
	margin-bottom: 1.25rem;
}

.auth-footer {
	text-align: center;
	margin-top: 1.5rem;
	font-size: 0.85rem;
	color: var(--text-muted);
}

.auth-footer a {
	color: var(--accent-muted);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.3s ease;
}

.auth-footer a:hover {
	border-bottom-color: var(--accent);
}

.auth-card .form-group {
	margin-bottom: 1.25rem;
}

.auth-card .form-input {
	width: 100%;
}

.auth-card .btn-primary {
	width: 100%;
	justify-content: center;
	padding: 0.75rem;
}

/* === STATS === */
.stats-filter-bar {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 2rem;
	flex-wrap: wrap;
}

.filter-group {
	display: flex;
	gap: 0.35rem;
}

.filter-btn {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	font-weight: 500;
	color: var(--text-muted);
	background: transparent;
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-sm);
	padding: 0.4rem 0.85rem;
	cursor: pointer;
	transition: all 0.3s ease;
	letter-spacing: 0.02em;
}

.filter-btn:hover {
	color: var(--text-secondary);
	border-color: var(--text-muted);
}

.filter-btn.active {
	color: var(--accent-deep);
	background: var(--accent-glow);
	border-color: var(--accent);
}

.filter-select {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--text-secondary);
	background: var(--surface-1);
	border: 1px solid var(--border-hover);
	border-radius: var(--radius-sm);
	padding: 0.4rem 0.75rem;
	cursor: pointer;
	outline: none;
	transition: all 0.3s ease;
}

.filter-select:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

.stats-period-label {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom: 1.5rem;
}

.stats-summary-row {
	display: flex;
	gap: 1rem;
	margin-bottom: 2rem;
}

.stats-summary-card {
	flex: 1;
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1.25rem;
	text-align: center;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stats-summary-value {
	font-family: var(--font-mono);
	font-size: 2rem;
	font-weight: 600;
	color: var(--accent);
}

.stats-summary-label {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-top: 0.25rem;
}

.stats-section {
	margin-bottom: 2rem;
}

.stats-section-title {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	font-weight: 500;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom: 1rem;
}

/* H-Index Divider */
.hindex-divider {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 1rem;
}

.hindex-divider-line {
	flex: 1;
	height: 1px;
	background: var(--accent);
}

.hindex-divider-label {
	font-family: var(--font-mono);
	font-size: 0.6rem;
	font-weight: 500;
	color: var(--accent-deep);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	white-space: nowrap;
}

/* Chart — clean white canvas */
.chart-card {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1.5rem;
	height: 300px;
	position: relative;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chart-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: var(--text-muted);
	font-family: var(--font-display);
	font-style: italic;
	font-size: 0.9rem;
}

/* Play Counts Table */
.play-counts-table {
	display: flex;
	flex-direction: column;
}

.play-count-row {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.75rem 1rem;
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-bottom: none;
	text-decoration: none;
	color: inherit;
	transition: background 0.2s ease;
}

.play-count-row:first-child {
	border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.play-count-row:last-child {
	border-bottom: 1px solid var(--border);
	border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.play-count-row:only-child {
	border-radius: var(--radius-md);
	border-bottom: 1px solid var(--border);
}

.play-count-row:hover {
	background: var(--surface-0);
}

.play-count-rank {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-muted);
	min-width: 1.75rem;
	text-align: right;
}

.play-count-name {
	flex: 1;
	font-family: var(--font-display);
	font-size: 0.9rem;
	color: var(--text-primary);
}

.play-count-value {
	font-family: var(--font-mono);
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--accent-deep);
	background: var(--accent-glow);
	padding: 0.15rem 0.6rem;
	border-radius: var(--radius-sm);
}

/* === PAGE HEADER ACTIONS === */
.page-header-actions {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

/* === BGG IMPORT === */
.bgg-search-form {
	margin-bottom: 2rem;
	position: relative;
}

.bgg-search-spinner {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-muted);
	margin-top: 0.5rem;
}

.bgg-results-summary {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-muted);
	margin-bottom: 1rem;
	letter-spacing: 0.02em;
}

.bgg-result-list {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin-bottom: 2rem;
}

.bgg-result-item {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.85rem 1rem;
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-bottom: none;
	transition: background 0.2s ease;
	cursor: pointer;
}

.bgg-result-entry:first-child .bgg-result-item {
	border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.bgg-result-entry:last-child .bgg-result-item {
	border-bottom: 1px solid var(--border);
	border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.bgg-result-entry:only-child .bgg-result-item {
	border-radius: var(--radius-md);
	border-bottom: 1px solid var(--border);
}

.bgg-result-item:hover {
	background: var(--surface-0);
}

/* Inline accordion preview — expands below the clicked result row */
.bgg-inline-preview:empty {
	display: none;
}

.bgg-inline-preview {
	background: var(--surface-0);
	border: 1px solid var(--border);
	border-top: none;
	border-bottom: none;
	padding: 1.5rem;
	animation: fadeIn 0.25s ease forwards;
}

/* Last entry's preview needs its own bottom border and radius since
   there's no subsequent row to provide a visual bottom edge. */
.bgg-result-entry:last-child .bgg-inline-preview:not(:empty) {
	border-bottom: 1px solid var(--border);
	border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* When the last row's preview is open, the row itself should lose its
   bottom radius and border — the preview now provides the bottom edge. */
.bgg-result-entry:last-child .bgg-result-item:has(+ .bgg-inline-preview:not(:empty)) {
	border-radius: 0;
	border-bottom: none;
}

/* Preview card inside inline container drops standalone card styling */
.bgg-inline-preview .bgg-preview-card {
	background: transparent;
	border: none;
	border-radius: 0;
	padding: 0;
}

.bgg-inline-preview .bgg-preview-card::before {
	display: none;
}

.bgg-result-info {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	min-width: 0;
}

.bgg-result-name {
	font-family: var(--font-display);
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--text-primary);
}

.bgg-result-year {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-muted);
}

.bgg-type-badge {
	display: inline-flex;
	align-items: center;
	font-family: var(--font-mono);
	font-size: 0.6rem;
	color: var(--accent-deep);
	background: var(--accent-glow);
	padding: 0.15rem 0.5rem;
	border-radius: var(--radius-sm);
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
}

.bgg-type-badge.expansion {
	color: var(--text-secondary);
	background: var(--surface-2);
}

.bgg-preview-card {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2rem;
	position: relative;
	overflow: hidden;
	animation: fadeIn 0.3s ease forwards;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.bgg-preview-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}

.bgg-preview-header {
	display: flex;
	gap: 1.5rem;
	margin-bottom: 1.25rem;
}

.bgg-preview-image {
	width: 150px;
	border-radius: var(--radius-md);
	object-fit: cover;
	flex-shrink: 0;
}

.bgg-preview-title-block {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.bgg-preview-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-bottom: 1.25rem;
}

.bgg-complexity-value {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	color: var(--text-muted);
	margin-left: 0.25rem;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
	.nav { padding: 1rem 1.25rem; }
	.container { padding: 2rem 1.25rem 3rem; }
	.page-header { flex-direction: column; align-items: flex-start; }
	.game-grid { grid-template-columns: 1fr; }
	.form-grid { grid-template-columns: 1fr; }
	.game-detail { padding: 1.5rem; }
	.game-detail-name { font-size: 1.5rem; }
	.play-row { flex-wrap: wrap; gap: 0.5rem; }
	.play-player-count { margin-left: 0; }
	.inline-form { flex-direction: column; }
	.review-row-header { flex-wrap: wrap; gap: 0.4rem; }
	.review-date { margin-left: 0; }
	.stats-summary-row { flex-direction: column; }
	.stats-filter-bar { flex-direction: column; align-items: flex-start; }
	.game-filter-bar { flex-wrap: wrap; }
	.page-header-actions { flex-wrap: wrap; }
	.bgg-result-item { flex-wrap: wrap; gap: 0.5rem; }
	.bgg-inline-preview { padding: 1rem; }
	.bgg-preview-header { flex-direction: column; }
	.bgg-preview-image { width: 100%; max-width: 200px; }
}
