:root {
	--bg: #10141f;
	--bg-soft: #151b2a;
	--surface: rgba(255, 255, 255, 0.92);
	--surface-dark: rgba(19, 25, 38, 0.86);
	--ink: #172033;
	--paper: #f8f6ef;
	--paper-ink: #172033;
	--muted: #768196;
	--line: rgba(255, 255, 255, 0.16);
	--primary: #19a974;
	--primary-strong: #0d7d57;
	--accent: #f7bd4b;
	--blue: #54a8ff;
	--rose: #ff6b8a;
	--violet: #8b7cf6;
	--shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

body {
	margin: 0;
	min-height: 100vh;
	background:
		radial-gradient(circle at 18% 18%, rgba(84, 168, 255, 0.18), transparent 30%),
		radial-gradient(circle at 84% 8%, rgba(247, 189, 75, 0.14), transparent 26%),
		linear-gradient(145deg, #10141f 0%, #182032 48%, #0f2f28 100%);
	color: var(--paper);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
	background-size: 42px 42px;
	mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 88%);
}

.shell {
	position: relative;
	width: min(1540px, calc(100% - 32px));
	margin: 0 auto;
	padding: 36px 0;
}

.home-shell {
	min-height: 100vh;
	display: grid;
	align-content: center;
	gap: 28px;
}

.help-shell {
	display: grid;
	gap: 28px;
}

.language-switch {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
}

.language-switch a {
	border: 1px solid var(--line);
	border-radius: 999px;
	color: #e7edf8;
	font-size: 0.78rem;
	font-weight: 900;
	padding: 7px 10px;
	text-decoration: none;
}

.language-switch a:hover {
	background: rgba(255, 255, 255, 0.12);
}

.intro {
	max-width: 820px;
}

.eyebrow {
	margin: 0 0 8px;
	color: var(--accent);
	font-size: 0.78rem;
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0;
}

h1,
h2,
p {
	margin-top: 0;
}

h1 {
	margin-bottom: 10px;
	font-size: clamp(3.2rem, 8vw, 6.4rem);
	line-height: 0.9;
}

h2 {
	color: inherit;
	font-size: 1.02rem;
}

.intro p:last-child {
	color: #c6d1e4;
	font-size: 1.13rem;
	max-width: 620px;
}

.home-create {
	display: grid;
	max-width: 680px;
}

.home-create-card {
	backdrop-filter: blur(18px);
}

.form-pair {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.help-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
}

.help-section {
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05)),
		rgba(13, 19, 31, 0.72);
	box-shadow: var(--shadow);
	color: #dbe5f5;
	padding: 22px;
}

.help-section h2 {
	color: #fff;
	font-size: 1.18rem;
}

.help-section p,
.help-section li {
	color: #dbe5f5;
	font-weight: 750;
	line-height: 1.55;
}

.help-section ol {
	display: grid;
	gap: 8px;
	margin: 0;
	padding-left: 22px;
}

.help-back {
	justify-self: start;
}

.split {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
}

.panel {
	background: var(--surface);
	border: 1px solid rgba(255, 255, 255, 0.48);
	border-radius: 8px;
	box-shadow: var(--shadow);
	color: var(--ink);
	padding: 22px;
}

.home-shell .panel {
	position: relative;
	overflow: hidden;
}

.home-shell .panel::after {
	content: "";
	position: absolute;
	right: 20px;
	top: 18px;
	width: 46px;
	height: 64px;
	border: 2px solid rgba(23, 32, 51, 0.14);
	border-radius: 8px;
	background:
		linear-gradient(135deg, rgba(25, 169, 116, 0.18), rgba(84, 168, 255, 0.12)),
		var(--paper);
	transform: rotate(7deg);
}

label {
	display: grid;
	gap: 7px;
	margin-bottom: 14px;
	color: #536074;
	font-size: 0.9rem;
	font-weight: 800;
}

input,
select {
	width: 100%;
	border: 1px solid rgba(23, 32, 51, 0.16);
	border-radius: 8px;
	background: #fff;
	color: var(--ink);
	font: inherit;
	padding: 11px 12px;
}

.code-input {
	text-transform: uppercase;
}

button,
.secondary-link {
	border: 0;
	border-radius: 8px;
	background: var(--primary);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font: inherit;
	font-weight: 900;
	min-height: 44px;
	padding: 0 16px;
	text-decoration: none;
	transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover,
.secondary-link:hover {
	background: var(--primary-strong);
}

button.secondary,
.secondary-link {
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid var(--line);
	color: #fff;
}

button.secondary.copied {
	background: rgba(25, 169, 116, 0.28);
	border-color: rgba(25, 169, 116, 0.82);
	box-shadow: 0 0 0 4px rgba(25, 169, 116, 0.16);
	transform: translateY(-1px);
}

button:disabled,
select:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.status {
	min-height: 22px;
	color: #c8d2e4;
	font-weight: 800;
}

.room-shell {
	display: grid;
	gap: 18px;
}

.room-shell-guest {
	align-content: start;
	min-height: 100vh;
}

.room-header {
	align-items: center;
	display: flex;
	justify-content: space-between;
	gap: 18px;
}

.header-actions {
	display: grid;
	gap: 12px;
	justify-items: end;
}

.current-user {
	display: grid;
	justify-items: end;
	gap: 2px;
	margin: 0;
	color: #c6d1e4;
	font-size: 0.78rem;
	font-weight: 800;
	text-align: right;
}

.current-user strong {
	color: #fff;
	font-size: 0.96rem;
	max-width: min(260px, 70vw);
	overflow-wrap: anywhere;
}

.room-header h1 {
	font-size: clamp(2.5rem, 6vw, 5rem);
	letter-spacing: 0.04em;
	overflow-wrap: anywhere;
}

.room-header .secondary-link {
	min-width: 84px;
}

.room-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
}

.share-panel {
	align-items: center;
	display: flex;
	justify-content: space-between;
	gap: 18px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 8px;
	background:
		linear-gradient(135deg, rgba(25, 169, 116, 0.14), rgba(84, 168, 255, 0.08)),
		rgba(13, 19, 31, 0.52);
	padding: 12px 14px;
}

.share-panel h2 {
	margin: 0;
	color: #fff;
	font-size: clamp(1rem, 2vw, 1.25rem);
}

.share-panel .eyebrow {
	margin-bottom: 4px;
}

.share-panel button {
	min-width: 150px;
	background: rgba(255, 255, 255, 0.92);
	color: #172033;
}

.share-panel button:hover {
	background: #fff;
}

.toolbar,
.session-actions {
	align-items: end;
	background: rgba(13, 19, 31, 0.72);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow);
	display: grid;
	grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto auto auto;
	gap: 12px;
	padding: 14px;
}

.session-actions {
	align-items: center;
	grid-template-columns: minmax(0, 1fr) auto;
}

.session-actions h2 {
	margin: 0;
	color: #fff;
	font-size: 1.08rem;
}

.session-action-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
}

.session-action-buttons button {
	min-width: 138px;
}

.reveal-action {
	background: linear-gradient(135deg, var(--primary), #39c794);
	box-shadow: 0 14px 32px rgba(25, 169, 116, 0.24);
}

.new-round-action {
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.22);
}

.toolbar label {
	color: #c8d2e4;
	margin: 0;
	min-width: 0;
}

.toolbar select {
	background: rgba(255, 255, 255, 0.92);
}

.join-panel {
	width: min(620px, 100%);
	justify-self: center;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08)),
		rgba(13, 19, 31, 0.76);
	border: 1px solid rgba(255, 255, 255, 0.22);
	color: var(--paper);
	backdrop-filter: blur(18px);
}

.join-panel h2 {
	color: var(--paper);
	font-size: clamp(1.8rem, 4vw, 2.7rem);
	margin-bottom: 18px;
}

.inline-form {
	display: grid;
	grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) auto;
	gap: 12px;
	align-items: end;
}

.inline-form label {
	color: #dbe5f5;
	margin: 0;
}

.join-card-form {
	display: grid;
	gap: 14px;
}

.join-card-form label {
	color: #dbe5f5;
	margin: 0;
}

.join-card-form button {
	min-height: 52px;
}

.grid {
	display: grid;
	grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
	grid-template-areas:
		"table hand"
		"table result";
	gap: 18px;
}

.grid > article {
	background: transparent;
	border: 0;
	box-shadow: none;
	color: var(--paper);
	padding: 0;
}

.grid > article:nth-child(1) {
	grid-area: table;
}

.grid > article:nth-child(2) {
	grid-area: hand;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)),
		rgba(13, 19, 31, 0.7);
	box-shadow: var(--shadow);
	padding: 18px;
}

.grid > article:nth-child(3) {
	grid-area: result;
}

.participant-list {
	position: relative;
	min-height: clamp(460px, 58vh, 760px);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 8px;
	overflow: hidden;
	background:
		radial-gradient(ellipse at center, rgba(31, 138, 94, 0.82) 0%, rgba(13, 105, 75, 0.82) 48%, rgba(8, 57, 51, 0.96) 70%, rgba(8, 13, 24, 0.98) 100%);
	box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.38), var(--shadow);
}

.participant-list::before {
	content: "";
	position: absolute;
	inset: 17% 12%;
	border: 16px solid rgba(85, 43, 20, 0.46);
	border-radius: 999px;
	box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.24);
}

.participant-list::after {
	content: "STIMO";
	position: absolute;
	left: 50%;
	top: 50%;
	color: rgba(255, 255, 255, 0.2);
	font-size: clamp(2rem, 6vw, 4rem);
	font-weight: 900;
	letter-spacing: 0;
	transform: translate(-50%, -50%);
	white-space: nowrap;
}

.participant-list-crowded {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
	align-content: start;
	gap: 12px;
	min-height: 0;
	padding: 18px;
}

.participant-list-crowded::before {
	inset: 12px;
	border-width: 8px;
	opacity: 0.45;
}

.participant-list-crowded::after {
	content: "";
}

.participant {
	--seat-x: 50%;
	--seat-y: 50%;
	position: absolute;
	left: var(--seat-x);
	top: var(--seat-y);
	width: 118px;
	display: grid;
	justify-items: center;
	gap: 5px;
	text-align: center;
	transform: translate(-50%, -50%);
	z-index: 2;
}

.participant-list-crowded .participant {
	position: relative;
	left: auto;
	top: auto;
	width: 100%;
	min-width: 0;
	grid-template-columns: 38px minmax(36px, auto) minmax(0, 1fr);
	grid-template-areas:
		"avatar card info"
		"badge badge badge";
	align-items: center;
	justify-items: start;
	gap: 8px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 8px;
	background: rgba(8, 13, 24, 0.58);
	padding: 10px;
	text-align: left;
	transform: none;
}

.avatar {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border: 3px solid rgba(255, 255, 255, 0.78);
	border-radius: 50%;
	background: linear-gradient(135deg, var(--accent), var(--rose));
	color: #172033;
	font-weight: 900;
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.participant-list-crowded .avatar {
	grid-area: avatar;
	width: 38px;
	height: 38px;
	border-width: 2px;
}

.seat-card {
	align-items: center;
	width: 50px;
	height: 70px;
	border: 2px solid rgba(255, 255, 255, 0.9);
	border-radius: 8px;
	background:
		linear-gradient(45deg, rgba(255, 255, 255, 0.12) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.12) 50% 75%, transparent 75%),
		linear-gradient(160deg, #2477de, #54a8ff);
	background-size: 14px 14px, auto;
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
	color: transparent;
	display: flex;
	font-size: 1.5rem;
	font-weight: 900;
	justify-content: center;
}

.participant-list-crowded .seat-card {
	grid-area: card;
	width: 36px;
	height: 50px;
	font-size: 1.05rem;
}

.participant.voted .seat-card {
	background: linear-gradient(160deg, #f7f3ea, #dbeafe);
	border-color: #93c5fd;
}

.participant.voted .seat-card:not(:empty) {
	color: var(--primary-strong);
}

.participant.observer .seat-card {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.34);
}

.participant-info {
	min-width: 0;
	max-width: 100%;
}

.participant-list-crowded .participant-info {
	grid-area: info;
}

.participant strong {
	color: #fff;
	display: block;
	font-size: 0.86rem;
	line-height: 1.1;
	max-width: 100%;
	overflow-wrap: anywhere;
}

.participant span {
	color: #c6d1e4;
	display: block;
	font-size: 0.66rem;
	font-weight: 800;
	line-height: 1.1;
	max-width: 100%;
	overflow-wrap: anywhere;
}

.badge {
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.38);
	color: #fff;
	font-size: 0.7rem;
	font-style: normal;
	font-weight: 900;
	padding: 5px 8px;
	white-space: nowrap;
}

.participant-list-crowded .badge {
	grid-area: badge;
	justify-self: start;
	white-space: normal;
}

.vote-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
	gap: 12px;
}

.vote-grid button {
	min-height: 126px;
	border: 2px solid rgba(255, 255, 255, 0.92);
	background: linear-gradient(180deg, #fffaf0, #e7edf8);
	color: var(--paper-ink);
	font-size: 2rem;
	box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
	transform: translateY(0);
	transition: transform 140ms ease, box-shadow 140ms ease;
}

.vote-grid button:hover {
	background: linear-gradient(180deg, #fff, #dff3ec);
	transform: translateY(-6px);
	box-shadow: 0 24px 44px rgba(0, 0, 0, 0.32);
}

.results {
	display: grid;
	gap: 12px;
	min-height: 100%;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: rgba(13, 19, 31, 0.8);
	box-shadow: var(--shadow);
	padding: 18px;
}

.results-waiting {
	align-content: center;
	justify-items: center;
	min-height: 240px;
}

.result-hero {
	display: grid;
	gap: 8px;
	place-items: center;
	min-height: 250px;
	border: 1px solid rgba(255, 255, 255, 0.26);
	border-radius: 8px;
	background:
		linear-gradient(160deg, rgba(247, 189, 75, 0.2), rgba(25, 169, 116, 0.16)),
		radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.18), transparent 44%),
		rgba(255, 255, 255, 0.07);
	box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.22);
}

.result-hero em {
	color: #dbe5f5;
	font-style: normal;
	font-weight: 900;
}

.result-hero span {
	color: #c6d1e4;
	font-size: 0.84rem;
	font-weight: 900;
	text-transform: uppercase;
}

.result-hero strong {
	display: grid;
	place-items: center;
	width: min(170px, 70%);
	aspect-ratio: 0.72;
	border: 2px solid rgba(255, 255, 255, 0.92);
	border-radius: 8px;
	background: linear-gradient(180deg, #fffaf0, #dff3ec);
	color: var(--primary-strong);
	font-size: clamp(3.6rem, 10vw, 5rem);
	font-weight: 900;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.result-summary {
	display: grid;
	gap: 10px;
}

.result-chip {
	align-items: center;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid var(--line);
	border-radius: 8px;
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 12px;
}

.result-chip strong {
	color: #fff;
}

.result-chip span {
	color: var(--accent);
	font-size: 1.2rem;
	font-weight: 900;
}

.result-chip.total {
	background: rgba(25, 169, 116, 0.16);
}

.role-result {
	display: grid;
	gap: 12px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.07);
	padding: 14px;
}

.role-result header {
	align-items: center;
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.role-result header strong {
	color: #fff;
	display: block;
	font-size: 1rem;
}

.role-result header span {
	color: #c6d1e4;
	display: block;
	font-size: 0.78rem;
	font-weight: 800;
}

.role-result header em {
	display: grid;
	place-items: center;
	min-width: 54px;
	aspect-ratio: 0.78;
	border: 2px solid rgba(255, 255, 255, 0.88);
	border-radius: 8px;
	background: linear-gradient(180deg, #fffaf0, #dff3ec);
	color: var(--primary-strong);
	font-size: 1.5rem;
	font-style: normal;
	font-weight: 900;
}

.role-result-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.role-result-meta span {
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.18);
	color: #dbe5f5;
	font-size: 0.74rem;
	font-weight: 850;
	padding: 6px 8px;
}

.vote-distribution {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
	gap: 8px;
}

.vote-count {
	display: grid;
	place-items: center;
	gap: 2px;
	border: 1px solid rgba(255, 255, 255, 0.13);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.08);
	padding: 8px 6px;
}

.vote-count strong {
	color: #fff;
	font-size: 0.9rem;
}

.vote-count span {
	color: var(--accent);
	font-size: 1rem;
	font-weight: 900;
}

.muted {
	color: #c6d1e4;
}

@media (max-width: 940px) {
	.toolbar,
	.session-actions,
	.inline-form,
	.split,
	.form-pair,
	.help-grid,
	.grid {
		grid-template-columns: 1fr;
	}

	.grid {
		grid-template-areas:
			"table"
			"hand"
			"result";
	}

	.toolbar button,
	.session-action-buttons,
	.toolbar label,
	.inline-form {
		width: 100%;
	}

	.session-action-buttons {
		justify-content: stretch;
	}

	.session-action-buttons button {
		flex: 1;
	}

	.participant-list {
		min-height: 520px;
	}

	.participant {
		width: 108px;
	}

	.vote-grid button {
		min-height: 112px;
	}
}

@media (max-width: 620px) {
	.shell {
		width: min(100% - 22px, 1180px);
		padding: 22px 0;
	}

	.room-header {
		align-items: stretch;
		flex-direction: column;
	}

	.header-actions,
	.language-switch {
		justify-items: start;
		justify-content: flex-start;
	}

	.current-user {
		justify-items: start;
		text-align: left;
	}

	.share-panel {
		align-items: stretch;
		flex-direction: column;
	}

	.share-panel button {
		width: 100%;
	}

	.join-panel {
		padding: 18px;
	}

	.participant-list {
		min-height: 620px;
	}

	.participant {
		width: 92px;
	}

	.vote-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.vote-grid button {
		min-height: 96px;
		font-size: 1.65rem;
	}
}
