/* Connections, the host's page: the lobby and scoring, the puzzle editor,
   and the turn console. Room pieces come from /assets/css/live.css. */

.live-app[data-screen="puzzles"] .screen-puzzles,
.live-app[data-screen="game"] .screen-game {
	display: block;
	animation: screen-in 0.4s var(--ease-out);
}

.host-app select,
.host-app input:not([type="checkbox"]):not([type="radio"]) {
	font: inherit;
	color: var(--ink);
}

.btn .icon-external {
	width: 17px;
	height: 17px;
}

.btn.small .icon-external {
	width: 14px;
	height: 14px;
}

.card-row-end {
	margin-left: auto;
}

.empty-note {
	color: var(--muted);
	font-weight: 600;
}

/* ---------- Lobby ---------- */

.room-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 8px;
}

.set-pick {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.set-pick .seg span {
	padding: 7px 14px;
}

.set-select {
	flex: 1 1 200px;
	min-width: 0;
	min-height: 40px;
	padding: 6px 10px;
	border: var(--border);
	border-radius: var(--radius-control);
	background: var(--surface);
	font-weight: 600;
}

.set-summary {
	margin-top: 12px;
	color: var(--muted);
	font-weight: 600;
}

.set-summary.is-problem {
	color: #b23b1c;
}

.points {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}

.point input {
	width: 100%;
	min-height: 44px;
	padding: 6px 8px;
	border: var(--border);
	border-radius: var(--radius-control);
	background: var(--cat);
	font-weight: 800;
	font-size: 18px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.settings-card .seg span {
	min-width: 0;
}

/* ---------- Puzzle editor ---------- */

.editor-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.editor-title {
	font-size: clamp(34px, 6vw, 48px);
}

.editor-sets {
	display: grid;
	gap: 14px;
	margin-bottom: 18px;
	padding: 16px 18px;
}

.set-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.set-tools:empty {
	display: none;
}

.set-tools .btn.ghost {
	margin-left: auto;
	color: var(--muted);
}

.set-tools .btn.is-armed {
	border-color: var(--ink);
	background: var(--coral);
	color: var(--ink);
}

.library-login {
	margin-bottom: 18px;
}

.login-form {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 12px;
}

.login-form .field {
	flex: 1 1 220px;
}

.login-form .btn {
	min-height: 50px;
}

.set-name {
	margin-bottom: 18px;
}

.rounds {
	display: grid;
	gap: 18px;
	margin: 0 0 18px;
	padding: 0;
	list-style: none;
}

.round {
	padding: 16px;
}

.round-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	margin-bottom: 12px;
}

.round-head h3 {
	font-size: 22px;
}

.round-issue:empty {
	display: none;
}

.round-issue {
	padding: 1px 10px;
	border: 2px solid var(--ink);
	border-radius: 50px;
	background: var(--peach);
	font-size: 13px;
	font-weight: 700;
}

.round-tools {
	display: flex;
	gap: 2px;
	margin-left: auto;
}

.round-tools .btn {
	color: var(--muted);
}

.round-tools .btn.is-armed {
	border-color: var(--ink);
	background: var(--coral);
	color: var(--ink);
}

.cats {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* One group: a drag handle, its name, its four words */
.cat {
	display: grid;
	grid-template-columns: 22px minmax(140px, 1fr) minmax(0, 2.4fr);
	align-items: center;
	gap: 8px;
	padding: 8px;
	border: var(--border);
	border-radius: 12px;
	background: var(--cat);
	transition: transform 0.2s var(--ease-spring), opacity 0.15s;
}

.cat.is-dragging {
	opacity: 0.4;
}

.cat.is-over {
	transform: translateY(-3px);
	box-shadow: 0 4px 0 var(--ink);
}

.cat-handle {
	align-self: stretch;
	width: 22px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: radial-gradient(var(--ink) 1.6px, transparent 2px) 50% 50% / 8px 8px;
	opacity: 0.45;
	cursor: grab;
}

.cat-handle:hover,
.cat-handle:focus-visible {
	opacity: 0.9;
}

.cat-words {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 6px;
}

.cat-name,
.cat-word {
	width: 100%;
	min-width: 0;
	min-height: 40px;
	padding: 6px 9px;
	border: var(--border);
	border-radius: var(--radius-control);
	background: var(--surface);
	font-size: 16px;
}

.cat-name {
	font-weight: 700;
}

.cat-word {
	font-weight: 700;
	text-transform: uppercase;
}

.cat-word::placeholder,
.cat-name::placeholder {
	color: #9b97aa;
	font-weight: 500;
	text-transform: none;
}

.cat-word.is-dupe {
	background: var(--peach);
}

.add-round {
	width: 100%;
	border-style: dashed;
	box-shadow: none;
	background: transparent;
}

.save-note {
	min-height: 24px;
	margin-top: 10px;
	color: var(--muted);
	font-size: 14px;
	font-weight: 600;
	text-align: right;
}

@media (max-width: 720px) {
	.cat {
		grid-template-columns: 22px minmax(0, 1fr);
	}

	.cat-words {
		grid-column: 2;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------- In game ---------- */

.game-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 16px;
}

.game-where {
	display: flex;
	gap: 8px;
}

.pill {
	padding: 2px 14px;
	border: var(--border);
	border-radius: 50px;
	background: var(--surface);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

/* Where the turn is: guessing, judging, points */
.steps {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	border: var(--border);
	border-radius: 50px;
	background: var(--surface);
	overflow: hidden;
}

.step {
	padding: 3px 16px;
	color: var(--muted);
	font-weight: 700;
	font-size: 15px;
}

.step + .step {
	border-left: var(--border);
}

.step.is-done {
	color: var(--ink);
	background: var(--btn-hover);
}

.step.is-now {
	background: var(--ink);
	color: #fff;
}

.game-layout {
	display: grid;
	gap: 18px;
	align-items: start;
}

.key-card {
	padding: 16px;
}

.key-card h2 {
	font-size: 22px;
}

.key {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.key-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 10px 10px 12px;
	border: var(--border);
	border-radius: 12px;
	background: linear-gradient(90deg, var(--cat) 10px, var(--surface) 10px);
}

.key-row.is-revealed {
	background: var(--cat);
	box-shadow: 3px 3px 0 var(--ink);
}

.key-text {
	flex: 1;
	min-width: 0;
	padding-left: 6px;
}

.key-name {
	font-weight: 800;
	line-height: 1.2;
}

.key-words {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-transform: uppercase;
}

.key-side {
	display: grid;
	justify-items: end;
	gap: 6px;
}

.key-found {
	background: var(--mint);
	white-space: nowrap;
}

.key-row.is-revealed .btn.ghost {
	color: var(--ink);
}

.reveal-found {
	width: 100%;
	margin-top: 12px;
}

.guess-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.guess-card {
	display: grid;
	gap: 10px;
	padding: 12px;
	border-style: dashed;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.guess-card.is-in {
	border-style: solid;
	box-shadow: var(--shadow);
}

.guess-card.is-away {
	opacity: 0.6;
}

.guess-head {
	display: flex;
	align-items: center;
	gap: 8px;
}

.guess-head .kick {
	width: 28px;
	height: 28px;
	font-size: 18px;
}

.guess-head .kick.is-armed {
	width: auto;
	padding: 0 8px;
	border-color: var(--ink);
	border-radius: 50px;
	background: var(--coral);
	color: var(--ink);
	font-size: 13px;
	font-weight: 700;
}

.score-btn,
.score-input {
	min-width: 56px;
	padding: 1px 10px;
	border: var(--border);
	border-radius: 50px;
	background: var(--surface);
	font: inherit;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	text-align: center;
	cursor: pointer;
}

.score-input {
	width: 86px;
	cursor: text;
}

.score-btn:hover {
	background: var(--btn-hover);
}

/* The words picked, tinted by the group each really belongs to */
.guess-words {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 5px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gw {
	min-height: 32px;
	padding: 5px 6px;
	border: 2px solid var(--ink);
	border-radius: 7px;
	background: var(--cat);
	font-weight: 800;
	font-size: 13px;
	font-stretch: 85%;
	line-height: 1.1;
	text-align: center;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.gw.is-empty {
	border-style: dashed;
	border-color: #0000003d;
	background: transparent;
}

.guess-name {
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.guess-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: 34px;
}

.tag-in {
	background: var(--mint);
}

.tag-wait {
	background: var(--surface);
}

.tag-miss {
	background: var(--peach);
}

.guess-points {
	margin-left: auto;
	font-weight: 800;
	font-size: 22px;
	font-variant-numeric: tabular-nums;
}

.guess-points.is-zero {
	color: var(--muted);
}

.judge {
	display: flex;
	gap: 8px;
}

.judge-btn {
	width: 48px;
	height: 40px;
	border: var(--border);
	border-radius: 10px;
	background: var(--surface);
	box-shadow: 3px 3px 0 var(--ink);
	font: inherit;
	font-weight: 800;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out), background-color 0.15s;
}

.judge-btn:active {
	transform: translate(3px, 3px);
	box-shadow: none;
}

.judge-btn.is-yes[aria-pressed="true"] {
	background: var(--mint);
	transform: translate(3px, 3px);
	box-shadow: none;
}

.judge-btn.is-no[aria-pressed="true"] {
	background: var(--coral);
	transform: translate(3px, 3px);
	box-shadow: none;
}

/* ---------- Wider screens ---------- */

@media (min-width: 960px) {
	.live-app.host-app:not([data-screen="entry"]) {
		max-width: 1240px;
	}

	.live-app.host-app[data-screen="puzzles"] {
		max-width: 1040px;
	}

	.game-layout {
		grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
	}

	.key-card {
		position: sticky;
		top: 16px;
	}
}
