/* Cryptic Clue Helper — all rules scoped to .cch-helper. Colours match the other Wordletz games. */
.cch-helper {
	--cch-accent: #f5b301;
	--cch-accent-soft: #fff4d1;
	--cch-ink: #1d1b26;
	--cch-muted: color-mix(in srgb, var(--cch-ink) 62%, transparent);
	--cch-line: color-mix(in srgb, var(--cch-ink) 12%, transparent);
	--cch-surface: #ffffff;
	--cch-tile: #eef0f6;
	--cch-good: #1f9d55;
	--cch-bad: #d64545;

	box-sizing: border-box;
	max-width: 760px;
	margin: 1.5em auto;
	padding: clamp(16px, 3vw, 28px);
	border: 1px solid var(--cch-line);
	border-radius: 22px;
	background: var(--cch-surface);
	color: var(--cch-ink);
	font-family: inherit;
	line-height: 1.5;
	box-shadow: 0 10px 40px -20px rgba(20, 20, 50, 0.35);
}
.cch-helper *,
.cch-helper *::before,
.cch-helper *::after { box-sizing: border-box; }
.cch-helper [hidden] { display: none !important; }

.cch-helper .cch-title {
	margin: 0 0 6px;
	font-size: clamp(1.4rem, 3vw, 1.9rem);
	font-weight: 800;
	letter-spacing: -0.02em;
	text-align: center;
	color: inherit;
}
.cch-intro { margin: 0 auto 20px; max-width: 560px; text-align: center; color: var(--cch-muted); }
.cch-loading { text-align: center; color: var(--cch-muted); padding: 40px 0; margin: 0; }

/* ---------- Mode tabs ---------- */
.cch-tabs {
	display: flex;
	gap: 4px;
	max-width: 420px;
	margin: 6px auto 14px;
	padding: 4px;
	border-radius: 999px;
	background: var(--cch-tile);
}
.cch-helper .cch-tabs .cch-tab {
	flex: 1;
	min-height: 40px;
	border: 0;
	background: transparent;
	color: var(--cch-muted);
}
.cch-helper .cch-tabs .cch-tab:hover { background: transparent; color: var(--cch-ink); }
.cch-helper .cch-tabs .cch-tab.is-active { background: var(--cch-surface); color: var(--cch-ink); box-shadow: 0 2px 8px -2px rgba(20, 20, 50, 0.25); }

/* ---------- Form ---------- */
.cch-fields { display: grid; gap: 14px; }
.cch-row-parseword { grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) minmax(0, 0.75fr); }
.cch-form { display: grid; gap: 14px; }
.cch-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 14px; }
.cch-field { display: grid; gap: 6px; align-content: start; }
.cch-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cch-muted); }
.cch-helper .cch-input {
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 10px 14px;
	border: 2px solid var(--cch-line);
	border-radius: 14px;
	background: var(--cch-surface);
	color: var(--cch-ink);
	font: inherit;
	font-size: 1.05rem;
	box-shadow: none;
}
.cch-helper .cch-input:focus { outline: none; border-color: var(--cch-accent); box-shadow: 0 0 0 3px var(--cch-accent-soft); }
.cch-field-clue .cch-input { font-size: 1.15rem; font-weight: 600; }
.cch-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.12em; text-transform: uppercase; }
.cch-help { margin: 0; font-size: 0.82rem; color: var(--cch-muted); }
.cch-message { margin: 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--cch-bad) 10%, transparent); color: var(--cch-bad); font-weight: 600; }
.cch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

/* ---------- Buttons ---------- */
.cch-helper .cch-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 20px;
	border: 1px solid var(--cch-line);
	border-radius: 999px;
	background: var(--cch-surface);
	color: var(--cch-ink);
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: scale 0.08s ease, background-color 0.15s ease;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}
.cch-helper .cch-btn:hover { background: var(--cch-tile); }
.cch-helper .cch-btn:active { scale: 0.96; }
.cch-helper .cch-btn:focus-visible { outline: 3px solid var(--cch-accent); outline-offset: 2px; }
.cch-helper .cch-btn:disabled { opacity: 0.6; cursor: progress; }
.cch-helper .cch-primary { border-color: var(--cch-ink); background: var(--cch-ink); color: #fff; }
.cch-helper .cch-primary:hover { background: color-mix(in srgb, var(--cch-ink) 85%, #fff); }
.cch-helper .cch-big { min-height: 52px; padding: 0 32px; font-size: 1.05rem; }
.cch-helper .cch-small { min-height: 34px; padding: 0 14px; font-size: 0.85rem; }
.cch-helper .cch-link { min-height: 40px; padding: 0 10px; border: 0; background: transparent; color: var(--cch-muted); font-size: 0.9rem; text-decoration: underline; }
.cch-helper .cch-link:hover { background: transparent; color: var(--cch-ink); }

/* ---------- Results ---------- */
.cch-results { display: grid; gap: 12px; margin-top: 22px; }
.cch-results:empty { display: none; }
.cch-card {
	padding: 16px 18px;
	border: 1px solid var(--cch-line);
	border-radius: 16px;
	background: var(--cch-surface);
}
.cch-helper .cch-card-title {
	margin: 0 0 8px;
	font-size: 1rem;
	font-weight: 800;
	color: inherit;
}
.cch-muted { margin: 0 0 10px; color: var(--cch-muted); font-size: 0.92rem; }
.cch-warn { margin: 0 0 10px; color: var(--cch-bad); font-size: 0.92rem; }
.cch-helper .cch-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.cch-helper .cch-list li { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.cch-phrase { font-weight: 700; }
.cch-type { flex-basis: 100%; color: var(--cch-muted); font-size: 0.92rem; }
.cch-arrow { color: var(--cch-muted); }
.cch-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }

.cch-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cch-chip {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 8px;
	background: var(--cch-tile);
	font-weight: 700;
	font-size: 0.9rem;
	letter-spacing: 0.04em;
}
.cch-abbr-chip { background: var(--cch-accent-soft); }
.cch-more { color: var(--cch-muted); font-size: 0.88rem; }
.cch-reveal { flex-basis: 100%; }

/* Collapsed hint cards */
.cch-hint { padding: 0; }
.cch-hint > summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 14px 18px;
	cursor: pointer;
	list-style: none;
}
.cch-hint > summary::-webkit-details-marker { display: none; }
.cch-hint > summary::after { content: '+'; font-size: 1.3rem; line-height: 1; color: var(--cch-muted); }
.cch-hint[open] > summary::after { content: '−'; }
.cch-hint > summary:focus-visible { outline: 3px solid var(--cch-accent); outline-offset: -3px; border-radius: 16px; }
.cch-count { margin-left: auto; font-size: 0.82rem; font-weight: 700; color: var(--cch-good); white-space: nowrap; }
.cch-count.is-none { color: var(--cch-muted); font-weight: 600; }
.cch-hint-body { padding: 0 18px 16px; }

.cch-helper .cch-letters { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 10px; }
.cch-helper .cch-letters dt { margin: 0; color: var(--cch-muted); font-size: 0.9rem; }
.cch-helper .cch-letters dd { margin: 0; font-weight: 700; word-break: break-all; }

/* The answer */
.cch-answer { border-color: var(--cch-accent); background: color-mix(in srgb, var(--cch-accent-soft) 55%, var(--cch-surface)); }
.cch-solution { padding: 10px 0; }
.cch-solution + .cch-solution { border-top: 1px solid var(--cch-line); }
.cch-solution-word {
	font-size: clamp(1.4rem, 4vw, 1.9rem);
	font-weight: 800;
	letter-spacing: 0.12em;
	animation: cch-pop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.3);
}
@keyframes cch-pop { from { opacity: 0; transform: scale(0.85); } }
.cch-helper .cch-why { margin: 4px 0 0; padding-left: 1.2em; }
.cch-helper .cch-why li { margin: 2px 0; }
.cch-def-note { display: block; color: var(--cch-muted); font-size: 0.88rem; }
.cch-others { margin-top: 10px; }
.cch-others > summary { cursor: pointer; font-weight: 700; color: var(--cch-muted); }
.cch-others .cch-solution-word { font-size: 1.15rem; animation: none; }

.cch-credit { margin: 0; text-align: right; font-size: 0.78rem; color: var(--cch-muted); }

/* ---------- Parseword board (word tiles like the game itself) ---------- */
.cch-board-card { --cch-gold: #e9b949; background: #fffaf0; }
.cch-board {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 6px 0 14px;
	padding: 18px 12px;
	border: 2px solid color-mix(in srgb, var(--cch-gold) 45%, transparent);
	border-radius: 14px;
	background: #fff6e2;
}
.cch-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cch-helper .cch-tile {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	min-width: 48px;
	padding: 6px 14px;
	border: 3px solid var(--cch-gold);
	border-radius: 10px;
	background: #fffdf7;
	color: #241d10;
	font-family: Georgia, 'Times New Roman', serif;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: 0;
	box-shadow: 0 3px 0 color-mix(in srgb, var(--cch-gold) 55%, #000 10%);
	cursor: pointer;
}
.cch-helper .cch-tile:hover { background: #fff3d0; }
.cch-helper .cch-tile.is-selected { background: var(--cch-gold); }
.cch-helper .cch-tile.is-changed {
	font-family: ui-sans-serif, system-ui, sans-serif;
	letter-spacing: 0.06em;
	border-color: #8a6d1d;
}
.cch-helper .cch-tile.is-removed { min-width: 36px; padding: 6px 10px; opacity: 0.45; border-style: dashed; }
.cch-helper .cch-key { flex-direction: column; gap: 2px; }
.cch-length-badge { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #8a6d1d; }
.cch-key { cursor: default; background: #fff; border-color: #c8a24a; transition: background-color 0.3s ease; }
.cch-key.is-solved { background: var(--cch-gold); }
.cch-equals { font-size: 1.4rem; font-weight: 800; color: var(--cch-muted); }

.cch-choices { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--cch-surface); border: 1px solid var(--cch-line); }
.cch-choices-title { margin: 0 0 8px; font-weight: 700; }
.cch-helper .cch-choice {
	border: 1px solid var(--cch-line);
	font: inherit;
	font-weight: 700;
	font-size: 0.9rem;
	letter-spacing: 0.04em;
	cursor: pointer;
	color: var(--cch-ink);
	min-height: 34px;
}
.cch-helper .cch-choice:hover { background: var(--cch-accent-soft); }
.cch-helper .cch-choice.is-on { outline: 2px solid var(--cch-ink); }
.cch-helper .cch-choice-remove,
.cch-helper .cch-choice-original { background: transparent; font-weight: 600; letter-spacing: 0; color: var(--cch-muted); }
.cch-helper .cch-choice-back { background: #e8f0ff; }
.cch-helper .cch-choice.cch-abbr-chip { background: var(--cch-accent-soft); border-color: color-mix(in srgb, var(--cch-accent) 60%, transparent); }

.cch-helper .cch-choice.cch-choice-fits { border: 2px solid var(--cch-good); background: color-mix(in srgb, var(--cch-good) 10%, var(--cch-surface)); }
.cch-helper .cch-choice.cch-choice-play { background: #efe7ff; border-color: #c9b5f5; }
.cch-helper .cch-choice.cch-choice-fits { border: 2px solid var(--cch-good); }
.cch-group-tip { margin: 0 0 8px; font-size: 0.85rem; }
/* Highlighted boxes that are grouped together look joined, like one long box. */
.cch-helper .cch-tile.is-grouped { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cch-gold) 55%, transparent), 0 3px 0 color-mix(in srgb, var(--cch-gold) 55%, #000 10%); }
.cch-helper .cch-choice-more { background: transparent; border-style: dashed; letter-spacing: 0; }
.cch-fit-note { margin: 0 0 8px; font-size: 0.88rem; }
.cch-own { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.cch-own-label { font-size: 0.88rem; color: var(--cch-muted); }
.cch-helper .cch-own-input { width: 9em; min-height: 36px; padding: 4px 10px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; }

.cch-joined { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 4px; }
.cch-joined:empty { display: none; }
.cch-joined-label { color: var(--cch-muted); }
.cch-joined-note { flex-basis: 100%; color: var(--cch-muted); font-size: 0.92rem; }
.cch-joined.is-solved .cch-joined-note { color: var(--cch-good); font-weight: 700; font-size: 1rem; }

@media (max-width: 560px) {
	.cch-row,
	.cch-row-parseword { grid-template-columns: 1fr; }
	.cch-helper .cch-tile { font-size: 1.05rem; min-height: 44px; padding: 6px 10px; }
	.cch-actions .cch-big { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.cch-solution-word { animation: none; }
}
