/* Family Crossword — scoped styles. Everything lives under .fcw-app. */

.fcw-app {
	--fcw-accent: #e2571e;
	--fcw-accent-deep: #9c3a10;
	--fcw-paper: #faf6ef;
	--fcw-ink: #24201c;
	--fcw-line: #b9b0a2;
	--fcw-block: #1d1a17;
	--fcw-good: #2e7d43;
	--fcw-bad: #c62828;
	--fcw-radius: 10px;
	max-width: 980px;
	margin: 0 auto;
	padding: 8px 4px 40px;
	color: inherit;
	line-height: 1.45;
}
.fcw-app *, .fcw-app *::before, .fcw-app *::after { box-sizing: border-box; }

.fcw-boot { text-align: center; opacity: .8; padding: 32px 0; }
.fcw-error { text-align: center; padding: 24px; border: 1px solid var(--fcw-bad); border-radius: var(--fcw-radius); }

/* ---------- Buttons ---------- */
.fcw-btn {
	appearance: none;
	font: inherit;
	font-size: 15px;
	border: 1px solid var(--fcw-line);
	background: var(--fcw-paper);
	color: var(--fcw-ink);
	border-radius: 8px;
	padding: 8px 14px;
	cursor: pointer;
	transition: background .15s, transform .1s;
}
.fcw-btn:hover { background: #fff; }
.fcw-btn:active { transform: translateY(1px); }
.fcw-btn:focus-visible { outline: 3px solid var(--fcw-accent); outline-offset: 1px; }
.fcw-btn--primary { background: var(--fcw-accent); border-color: var(--fcw-accent-deep); color: #fff; font-weight: 600; }
.fcw-btn--primary:hover { background: var(--fcw-accent-deep); }
.fcw-btn--ghost { background: transparent; }

/* ---------- Picker ---------- */
.fcw-picker h2 { margin: 4px 0 2px; font-size: 26px; }
.fcw-picker .fcw-sub { margin: 0 0 18px; opacity: .75; }
.fcw-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 14px;
	padding: 0;
	margin: 0;
	list-style: none;
}
.fcw-card {
	position: relative;
	text-align: left;
	width: 100%;
	border: 1px solid var(--fcw-line);
	border-radius: var(--fcw-radius);
	background: var(--fcw-paper);
	color: var(--fcw-ink);
	padding: 14px 14px 12px;
	cursor: pointer;
	font: inherit;
	transition: border-color .15s, box-shadow .15s;
}
.fcw-card:hover, .fcw-card:focus-visible { border-color: var(--fcw-accent); box-shadow: 0 3px 14px rgba(0,0,0,.12); outline: none; }
.fcw-card__title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.fcw-card__meta { font-size: 13px; opacity: .7; }
.fcw-card__badge {
	position: absolute;
	top: 12px;
	right: 12px;
	font-size: 12px;
	font-weight: 700;
	border-radius: 99px;
	padding: 3px 9px;
	background: rgba(0,0,0,.07);
}
.fcw-card__badge--done { background: var(--fcw-good); color: #fff; }
.fcw-card__badge--progress { background: var(--fcw-accent); color: #fff; }

/* ---------- Game header / toolbar ---------- */
.fcw-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.fcw-head h2 { font-size: 20px; margin: 0; flex: 1; min-width: 140px; }
.fcw-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.06); }
.fcw-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.fcw-menu { position: relative; }
.fcw-menu__list {
	position: absolute;
	z-index: 30;
	top: calc(100% + 4px);
	left: 0;
	min-width: 170px;
	background: var(--fcw-paper);
	color: var(--fcw-ink);
	border: 1px solid var(--fcw-line);
	border-radius: 8px;
	box-shadow: 0 8px 22px rgba(0,0,0,.18);
	padding: 4px;
	margin: 0;
	list-style: none;
}
.fcw-menu__list button {
	display: block;
	width: 100%;
	text-align: left;
	font: inherit;
	font-size: 14px;
	background: none;
	border: 0;
	border-radius: 6px;
	padding: 8px 10px;
	cursor: pointer;
	color: inherit;
}
.fcw-menu__list button:hover, .fcw-menu__list button:focus-visible { background: rgba(0,0,0,.08); outline: none; }

/* ---------- Current clue bar ---------- */
.fcw-cluebar {
	display: flex;
	align-items: stretch;
	gap: 0;
	border: 1px solid var(--fcw-accent-deep);
	border-left: 6px solid var(--fcw-accent);
	background: var(--fcw-paper);
	color: var(--fcw-ink);
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 10px;
	min-height: 52px;
}
.fcw-cluebar__text { flex: 1; padding: 8px 12px; display: flex; align-items: center; font-size: 16px; }
.fcw-cluebar__text b { margin-right: 8px; color: var(--fcw-accent-deep); }
.fcw-cluebar__nav {
	font: inherit;
	font-size: 20px;
	border: 0;
	border-left: 1px solid var(--fcw-line);
	background: transparent;
	color: inherit;
	width: 46px;
	cursor: pointer;
}
.fcw-cluebar__nav:hover { background: rgba(0,0,0,.06); }
.fcw-cluebar__nav:focus-visible { outline: 3px solid var(--fcw-accent); outline-offset: -3px; }

/* ---------- Layout ---------- */
.fcw-board { display: grid; grid-template-columns: minmax(0, 560px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .fcw-board { grid-template-columns: 1fr; } }

/* ---------- Grid ---------- */
.fcw-gridwrap { position: relative; }
.fcw-grid {
	display: grid;
	width: 100%;
	max-width: 560px;
	border: 2px solid var(--fcw-ink);
	background: var(--fcw-ink);
	gap: 1px;
	border-radius: 4px;
	touch-action: manipulation;
	user-select: none;
	-webkit-user-select: none;
}
.fcw-cell {
	position: relative;
	aspect-ratio: 1;
	background: var(--fcw-paper);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.fcw-cell--block { background: #1d1a17; cursor: default; }
.fcw-cell__num {
	position: absolute;
	top: 1px;
	left: 3px;
	font-size: calc(var(--fcw-fs, 20px) * .42);
	line-height: 1;
	color: rgba(0,0,0,.55);
	pointer-events: none;
}
.fcw-cell__letter {
	font-size: var(--fcw-fs, 20px);
	font-weight: 700;
	color: var(--fcw-ink);
	text-transform: uppercase;
	line-height: 1;
	pointer-events: none;
}
.fcw-cell--word { background: #ffe3d2; }
.fcw-cell--active { background: var(--fcw-accent); }
.fcw-cell--active .fcw-cell__letter, .fcw-cell--active .fcw-cell__num { color: #fff; }
.fcw-cell--wrong::after {
	content: "";
	position: absolute;
	inset: 12% auto auto 12%;
	width: 76%;
	height: 76%;
	background: linear-gradient(to top right, transparent 46%, var(--fcw-bad) 46%, var(--fcw-bad) 54%, transparent 54%);
	pointer-events: none;
}
.fcw-cell--revealed .fcw-cell__letter { color: var(--fcw-accent-deep); }
.fcw-app.fcw--large .fcw-cell__letter { font-weight: 800; }

/* Hidden input that summons the mobile keyboard */
.fcw-hidden-input {
	position: absolute;
	opacity: 0.01;
	width: 1px;
	height: 1px;
	border: 0;
	padding: 0;
	top: 0;
	left: 0;
	font-size: 16px; /* prevents iOS zoom-on-focus */
}

/* Pause overlay */
.fcw-pause {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: rgba(29,26,23,.92);
	color: #fff;
	border-radius: 4px;
	z-index: 10;
	font-size: 18px;
}

/* ---------- Clue lists ---------- */
.fcw-clues { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 500px) { .fcw-clues { grid-template-columns: 1fr; } }
.fcw-clues h3 {
	font-size: 14px;
	letter-spacing: .08em;
	text-transform: uppercase;
	margin: 0 0 6px;
	border-bottom: 2px solid var(--fcw-accent);
	padding-bottom: 4px;
}
.fcw-clues ol { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.fcw-clues li { margin: 0; }
.fcw-clues button {
	display: flex;
	gap: 8px;
	width: 100%;
	text-align: left;
	font: inherit;
	font-size: 15px;
	background: none;
	border: 0;
	border-radius: 6px;
	padding: 6px 8px;
	cursor: pointer;
	color: inherit;
}
.fcw-clues button b { min-width: 22px; opacity: .7; }
.fcw-clues button:hover { background: rgba(0,0,0,.07); }
.fcw-clues button:focus-visible { outline: 3px solid var(--fcw-accent); outline-offset: -2px; }
.fcw-clues li.fcw-clue--active button { background: var(--fcw-accent); color: #fff; }
.fcw-clues li.fcw-clue--active button b { opacity: .9; }
.fcw-clues li.fcw-clue--done button { text-decoration: line-through; opacity: .55; }

/* ---------- Win modal ---------- */
.fcw-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,.55);
	padding: 16px;
}
.fcw-modal__box {
	background: var(--fcw-paper);
	color: var(--fcw-ink);
	border-radius: 14px;
	padding: 26px 28px;
	max-width: 380px;
	width: 100%;
	text-align: center;
	box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.fcw-modal__box h3 { margin: 0 0 6px; font-size: 24px; }
.fcw-modal__stats { margin: 10px 0 18px; font-size: 16px; }
.fcw-modal__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Confetti canvas */
.fcw-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 10000; }

/* ---------- Large print mode ---------- */
.fcw-app.fcw--large { font-size: 18px; }
.fcw-app.fcw--large .fcw-cluebar__text { font-size: 19px; }
.fcw-app.fcw--large .fcw-clues button { font-size: 18px; }
.fcw-app.fcw--large .fcw-btn { font-size: 17px; padding: 10px 16px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.fcw-app * { transition: none !important; animation: none !important; }
}

/* Screen-reader-only helper */
.fcw-sr {
	position: absolute;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
