/* =========================================================
   Základní proměnné a safe area
   ========================================================= */

:root {
	color-scheme: dark;
	--bg: #07131b;
	--panel: #0b1b25;
	--text: #f4fbff;
	--muted: #8c9ca8;
	--cyan: #00e5ff;
	--green: #00ff7a;
	--red: #ff526c;
	--gold: #ffd75e;
	--line: rgba(174,218,228,.18);
	--cols: 40;
	--rows: 30;
	--cell: 18px;
	--safe-t: env(safe-area-inset-top,0px);
	--safe-r: env(safe-area-inset-right,0px);
	--safe-b: env(safe-area-inset-bottom,0px);
	--safe-l: env(safe-area-inset-left,0px);
}

/* =========================================================
   Reset a globální prvky
   ========================================================= */

* {
	box-sizing: border-box;
}

[hidden] {
	display: none!important;
}

html,body {
	width: 100%;
	height: 100%;
	margin: 0;
	overflow: hidden;
	overscroll-behavior: none;
}

body {
	background: radial-gradient(circle at 50% 16%,#10313d 0,#07131b 48%,#03090d 100%);
	color: var(--text);
	font-family: "Segoe UI",system-ui,sans-serif;
	user-select: none;
	touch-action: none;
}

button,input,select {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

button:focus-visible,input:focus-visible,select:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

/* =========================================================
   Hlavní kontejner a herní scéna
   ========================================================= */

#game-container {
	position: relative;
	width: 100vw;
	height: 100dvh;
	min-height: 100vh;
	overflow: hidden;
}

.game-scene {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-rows: calc(clamp(62px,8.5dvh,72px) + var(--safe-t)) minmax(0,1fr);
}

body.orientation-portrait .game-scene {
	grid-template-rows: calc(clamp(64px,8.5dvh,74px) + var(--safe-t)) minmax(0,1fr);
}

body.orientation-landscape .game-scene {
	grid-template-rows: calc(clamp(56px,11dvh,66px) + var(--safe-t)) minmax(0,1fr);
}

/* =========================================================
   Herní HUD a pauza
   ========================================================= */

.hud {
	z-index: 20;
	display: none;
	align-items: start;
	padding: calc(9px + var(--safe-t)) max(7px,var(--safe-r)) 13px max(7px,var(--safe-l));
	background: linear-gradient(#000 0,rgba(0,0,0,.65) 65%,transparent);
}

.hud.visible {
	display: grid;
	grid-template-columns: minmax(0,1.3fr) minmax(42px,.7fr) minmax(58px,.75fr) minmax(42px,.7fr) minmax(0,1.3fr);
}

body.orientation-landscape .hud {
	padding-bottom: 8px;
}

.hud-block,.pause-hotspot {
	min-width: 0;
	min-height: 47px;
	text-align: center;
}

.hud-block {
	padding: 2px 3px;
	border-bottom: 2px solid transparent;
}

.hud-label {
	display: block;
	overflow: hidden;
	color: var(--muted);
	font-size: clamp(7px,2.25vw,10px);
	font-weight: 800;
	letter-spacing: .06em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

.hud-value {
	display: block;
	margin-top: 5px;
	overflow: hidden;
	color: var(--cyan);
	font-size: clamp(11px,3.5vw,18px);
	font-weight: 900;
	text-overflow: ellipsis;
	text-shadow: 0 0 12px var(--cyan);
	white-space: nowrap;
}

.player-hud.active {
	border-bottom-color: var(--gold);
}

.player-hud.active .hud-value {
	color: #fff;
	text-shadow: 0 0 12px var(--gold);
}

.pause-hotspot {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--cyan);
}

.pause-icon {
	font-size: 22px;
	font-weight: 950;
}

/* =========================================================
   Hrací plocha a políčka
   ========================================================= */

.board-stage {
	position: relative;
	grid-row: 2;
	display: grid;
	min-width: 0;
	min-height: 0;
	place-items: center;
	padding: 86px max(6px,var(--safe-r)) max(clamp(14px,6dvh,56px),var(--safe-b)) max(6px,var(--safe-l));
	overflow: hidden;
}

body.orientation-landscape .board-stage {
	padding-top: 82px;
}

body.orientation-portrait .board-stage {
	padding-inline: max(8px,var(--safe-l)) max(8px,var(--safe-r));
}

.turn-status {
	position: absolute;
	top: 2px;
	left: 50%;
	max-width: calc(100% - 20px);
	overflow: hidden;
	color: #c8d6dd;
	font-size: clamp(10px,2.7vw,13px);
	font-weight: 800;
	letter-spacing: .06em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	transform: translateX(-50%);
	white-space: nowrap;
}

.board {
	display: grid;
	grid-template-columns: repeat(var(--cols),var(--cell));
	grid-template-rows: repeat(var(--rows),var(--cell));
	width: calc(var(--cols)*var(--cell));
	height: calc(var(--rows)*var(--cell));
	overflow: hidden;
	border: 1px solid rgba(0,229,255,.3);
	border-radius: 8px;
	background: rgba(3,12,17,.8);
	box-shadow: 0 0 24px rgba(0,229,255,.1);
	touch-action: none;
}

.cell {
	position: relative;
	width: var(--cell);
	height: var(--cell);
	padding: 0;
	border: 0;
	border-right: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	background: transparent;
	cursor: default;
	touch-action: manipulation;
}

.cell::before,.cell::after {
	content: "";
	position: absolute;
	pointer-events: none;
}

.cell.x::before,.cell.x::after,.cell.preview-x::before,.cell.preview-x::after {
	inset: 13% 43%;
	border-radius: 99px;
	background: var(--red);
	box-shadow: 0 0 min(7px,calc(var(--cell)*.25)) rgba(255,82,108,.6);
}

.cell.x::before,.cell.preview-x::before {
	transform: rotate(45deg);
}

.cell.x::after,.cell.preview-x::after {
	transform: rotate(-45deg);
}

.cell.o::before,.cell.preview-o::before {
	inset: 15%;
	border: max(1px,calc(var(--cell)*.12)) solid var(--cyan);
	border-radius: 50%;
	box-shadow: 0 0 min(7px,calc(var(--cell)*.25)) rgba(0,229,255,.55);
}

.cell.preview-x::before,.cell.preview-x::after,.cell.preview-o::before {
	opacity: .42;
}

.cell.placed {
	animation: place .18s ease-out;
}

.cell.computer-last-move {
	z-index: 1;
	background: rgba(0,229,255,.18);
	box-shadow: inset 0 0 0 max(1px,calc(var(--cell)*.1)) rgba(89,245,255,.95),0 0 min(18px,calc(var(--cell)*.65)) rgba(0,229,255,.9);
}

.cell.computer-last-move-fading:not(.winner):not(.winning-last-move) {
	animation: computer-last-move-fade var(--computer-highlight-fade-duration,1s) linear forwards;
}

.cell.winner {
	z-index: 2;
	background: rgba(255,215,94,.23);
	box-shadow: inset 0 0 0 max(1px,calc(var(--cell)*.1)) var(--gold),0 0 14px var(--gold);
	animation: winner .7s ease-in-out infinite alternate;
}

.cell.winning-last-move {
	outline: max(1px,calc(var(--cell)*.08)) solid rgba(255,255,255,.9);
	outline-offset: calc(max(1px,calc(var(--cell)*.08))*-1);
}

.board.locked .cell {
	pointer-events: none;
}

.touch-magnifier {
	--magnifier-size: clamp(216px,68vmin,270px);
	position: fixed;
	z-index: 100;
	width: var(--magnifier-size);
	height: var(--magnifier-size);
	padding: 5px;
	overflow: hidden;
	border: 2px solid rgba(89,245,255,.92);
	border-radius: 12px;
	background: #02090e;
	box-shadow: 0 0 0 2px rgba(0,0,0,.72),0 0 24px rgba(0,229,255,.42),0 12px 28px rgba(0,0,0,.55);
	opacity: 1;
	pointer-events: none;
	transition: opacity .1s ease-out;
}

.touch-magnifier[hidden] {
	display: none;
}

.touch-magnifier-grid {
	display: grid;
	position: absolute;
	top: -11.1111%;
	left: -11.1111%;
	width: 122.2222%;
	height: 122.2222%;
	grid-template-columns: repeat(11,1fr);
	grid-template-rows: repeat(11,1fr);
	border-top: 1px solid rgba(112,153,166,.42);
	border-left: 1px solid rgba(112,153,166,.42);
	will-change: transform;
}

.touch-magnifier-cell {
	position: relative;
	min-width: 0;
	min-height: 0;
	border-right: 1px solid rgba(112,153,166,.42);
	border-bottom: 1px solid rgba(112,153,166,.42);
	background: rgba(3,12,17,.96);
}

.touch-magnifier-cell.outside-board {
	border-color: rgba(58,77,84,.22);
	background: #010508;
}

.touch-magnifier-cell.target-cell {
	z-index: 2;
	background: rgba(255,215,94,.14);
	box-shadow: inset 0 0 0 2px var(--gold),0 0 10px rgba(255,215,94,.48);
}

.touch-magnifier-cell::before,.touch-magnifier-cell::after {
	content: "";
	position: absolute;
	pointer-events: none;
}

.touch-magnifier-cell.x::before,.touch-magnifier-cell.x::after,
.touch-magnifier-cell.preview-x::before,.touch-magnifier-cell.preview-x::after {
	inset: 13% 43%;
	border-radius: 99px;
	background: var(--red);
	box-shadow: 0 0 5px rgba(255,82,108,.66);
}

.touch-magnifier-cell.x::before,.touch-magnifier-cell.preview-x::before {
	transform: rotate(45deg);
}

.touch-magnifier-cell.x::after,.touch-magnifier-cell.preview-x::after {
	transform: rotate(-45deg);
}

.touch-magnifier-cell.o::before,.touch-magnifier-cell.preview-o::before {
	inset: 15%;
	border: max(2px,calc(var(--magnifier-size)*.007)) solid var(--cyan);
	border-radius: 50%;
	box-shadow: 0 0 5px rgba(0,229,255,.62);
}

.touch-magnifier-cell.preview-x::before,.touch-magnifier-cell.preview-x::after,
.touch-magnifier-cell.preview-o::before {
	opacity: .48;
}

.touch-magnifier-target {
	position: absolute;
	top: 50%;
	left: 50%;
	width: calc(100%/9);
	height: calc(100%/9);
	border: 1px solid rgba(255,255,255,.82);
	transform: translate(-50%,-50%);
	pointer-events: none;
}

/* =========================================================
   Indikátor přemýšlení počítače
   ========================================================= */

.brain-bubble {
	position: absolute;
	top: 25px;
	left: 50%;
	z-index: 30;
	display: flex;
	width: min(92vw,560px);
	min-height: clamp(42px,6.5dvh,54px);
	gap: 7px;
	align-items: center;
	justify-content: center;
	padding: 7px 11px;
	border: 1px solid rgba(255,215,94,.5);
	border-radius: 18px;
	background: #0b1b25;
	color: var(--gold);
	font-size: clamp(11px,2.8vw,15px);
	font-weight: 800;
	line-height: 1.25;
	text-align: center;
	box-shadow: 0 0 16px rgba(255,215,94,.18);
	opacity: 0;
	pointer-events: none;
	transform: translateX(-50%);
	visibility: hidden;
	transition: opacity .16s ease;
}

.brain-bubble.visible {
	opacity: 1;
	visibility: visible;
}

.undo-move-bar {
	position: absolute;
	top: 27px;
	left: 50%;
	z-index: 31;
	width: 75%;
	transform: translateX(-50%);
}

.undo-move-button {
	width: 100%;
	min-height: 57px;
	padding: 10px 18px;
	border: 1px solid rgba(255,215,94,.72);
	border-radius: 999px;
	background: #17220f;
	color: #fff2a6;
	font-size: clamp(11px,2.7vw,13px);
	font-weight: 900;
	letter-spacing: .04em;
	text-transform: uppercase;
	box-shadow: 0 0 16px rgba(255,215,94,.22);
	white-space: nowrap;
}

.brain-bubble.is-thinking span:first-child {
	animation: think 1.1s ease-in-out infinite;
}

.brain-bubble.is-winning {
	border-color: rgba(255,215,94,.88);
	background: #17220f;
	color: #fff2a6;
	box-shadow: 0 0 20px rgba(255,215,94,.3);
}

#computer-status-text {
	display: -webkit-box;
	max-width: 100%;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

/* =========================================================
   Pravé horní menu
   ========================================================= */

.game-menu {
	position: absolute;
	top: calc(13px + var(--safe-t));
	right: calc(13px + var(--safe-r));
	z-index: 1000;
	display: none;
	gap: 10px;
}

.game-menu.visible {
	display: flex;
}

.menu-btn {
	display: grid;
	width: 45px;
	height: 45px;
	padding: 0;
	place-items: center;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: #091820;
	color: var(--cyan);
	box-shadow: 0 0 11px rgba(0,229,255,.1);
}

.menu-btn:hover {
	background: #10313d;
	transform: scale(1.06);
}

.menu-btn span {
	font-size: 22px;
	font-weight: 900;
}

/* =========================================================
   Overlay obrazovky a menu
   ========================================================= */

.overlay {
	position: absolute;
	inset: 0;
	z-index: 100;
	display: none;
	align-items: center;
	justify-content: center;
	padding: max(clamp(62px,8dvh,76px),calc(56px + var(--safe-t))) max(16px,var(--safe-r)) max(clamp(42px,10dvh,88px),calc(24px + var(--safe-b))) max(16px,var(--safe-l));
	overflow: hidden;
	background: #050e14;
	text-align: center;
}

.overlay.visible {
	display: flex;
}

.result-overlay {
	background: #050e14;
}

.overlay-content {
	width: min(100%,620px);
	max-height: 100%;
	animation: show .18s ease-out;
}

.menu-content {
	margin: 0;
}

.scroll-content {
	overflow: auto;
	overscroll-behavior: contain;
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
}

.eyebrow {
	margin: 0 0 6px;
	color: var(--muted);
	font-size: .72rem;
	font-weight: 900;
	letter-spacing: .28em;
	text-transform: uppercase;
}

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

h1,h2 {
	color: var(--cyan);
	font-weight: 950;
	line-height: 1.04;
	letter-spacing: .045em;
	text-transform: uppercase;
	text-shadow: 0 0 22px rgba(0,229,255,.7);
}

h1 {
	margin-bottom: 10px;
	font-size: clamp(2.35rem,9vmin,5rem);
}

#main-title .title-brand,
#main-title .title-game {
	display: block;
	max-width: 100%;
	line-height: 1.03;
}

#main-title .title-game {
	margin-top: 2px;
	font-size: clamp(1.7rem,7vw,3.4rem);
	letter-spacing: .025em;
	white-space: nowrap;
}

#main-title .title-brand {
	font-size: clamp(1.9rem,6.2vw,3.15rem);
	letter-spacing: .055em;
}

#main-title small {
	display: block;
	margin-top: 7px;
	color: var(--muted);
	font-size: clamp(.68rem,1.2vw,.86rem);
	letter-spacing: .35em;
	text-shadow: none;
}

h2 {
	margin-bottom: 22px;
	font-size: clamp(2rem,8vmin,4rem);
}

.tagline,.series-score {
	color: #b8c8d1;
}

.menu-symbols {
	display: flex;
	justify-content: center;
	gap: 22px;
	margin: 12px 0 20px;
	font-size: 2.4rem;
	font-weight: 950;
}

.menu-symbols span:nth-child(odd) {
	color: var(--red);
}

.menu-symbols span:nth-child(even) {
	color: var(--cyan);
}

.main-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
}

.main-actions .btn {
	width: min(86vw,280px);
	font-size: clamp(1.1rem,3.8vw,1.35rem);
	line-height: 1.15;
}

/* =========================================================
   Tlačítka a dialogy
   ========================================================= */

.btn {
	display: block;
	width: min(86vw,280px);
	max-width: 100%;
	min-height: 60px;
	margin: 10px auto 0;
	padding: 11px 18px;
	border: 1px solid rgba(255,255,255,.18);
	border-radius: 21px;
	background:
		linear-gradient(to bottom,rgba(255,255,255,.15),rgba(255,255,255,.025) 48%,rgba(0,0,0,.12)),
		rgba(8,28,39,.76);
	color: var(--text);
	font-weight: 900;
	letter-spacing: .035em;
	box-shadow: inset 0 1px 0 rgba(255,255,255,.2),inset 0 -1px 0 rgba(0,0,0,.38),0 8px 22px rgba(0,0,0,.25);
	backdrop-filter: blur(8px);
	transition: filter .16s ease,transform .16s ease,box-shadow .16s ease;
}

.btn.primary {
	border-color: rgba(0,255,122,.5);
	background: linear-gradient(to bottom,rgba(255,255,255,.14),rgba(0,255,122,.035)),rgba(0,83,49,.46);
	color: var(--green);
	box-shadow: inset 0 1px 0 rgba(255,255,255,.2),inset 0 -1px 0 rgba(0,0,0,.4),0 8px 22px rgba(0,0,0,.25),0 0 15px rgba(0,255,122,.16);
}

.btn.info {
	border-color: rgba(0,229,255,.52);
	background: linear-gradient(to bottom,rgba(255,255,255,.14),rgba(0,229,255,.035)),rgba(0,59,75,.5);
	color: var(--cyan);
	box-shadow: inset 0 1px 0 rgba(255,255,255,.2),inset 0 -1px 0 rgba(0,0,0,.4),0 8px 22px rgba(0,0,0,.25),0 0 15px rgba(0,229,255,.16);
}

.btn.danger {
	border-color: rgba(255,82,108,.5);
	background: linear-gradient(to bottom,rgba(255,255,255,.13),rgba(255,82,108,.035)),rgba(83,14,29,.58);
	color: #ff8b9c;
	box-shadow: inset 0 1px 0 rgba(255,255,255,.18),inset 0 -1px 0 rgba(0,0,0,.42),0 8px 22px rgba(0,0,0,.28),0 0 15px rgba(255,82,108,.16);
}

.btn:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

.btn:active {
	filter: brightness(1.08);
	transform: translateY(1px);
}

.btn:disabled {
	cursor: default;
	filter: grayscale(.55);
	opacity: .38;
	transform: none;
}

.btn.small {
	display: inline-block;
	width: min(42%,200px);
}

.confirm-actions {
	display: flex;
	justify-content: center;
	gap: 12px;
}

/* =========================================================
   Nastavení
   ========================================================= */

.overlay.utility-screen-overlay {
	height: 100vh;
	height: 100dvh;
	align-items: stretch;
	justify-content: center;
	padding: 0 max(var(--safe-r),0px) 0 max(var(--safe-l),0px);
}

.utility-screen-layout {
	display: grid;
	grid-template-rows: auto minmax(0,1fr);
	align-content: stretch;
	width: 100%;
	max-width: 620px;
	height: 100%;
	overflow: hidden;
}

.overlay-content.utility-screen-layout {
	margin: 0;
}

.utility-screen-header {
	display: grid;
	grid-template-columns: 48px minmax(0,1fr) 48px;
	align-items: center;
	min-height: calc(62px + var(--safe-t));
	padding: calc(8px + var(--safe-t)) 8px 8px;
	background: linear-gradient(to bottom,#050e14 72%,rgba(5,14,20,.96));
}

.utility-screen-title {
	min-width: 0;
	text-align: center;
}

.utility-screen-header h2 {
	margin: 0;
	font-size: clamp(1.45rem,5vw,2.15rem);
	line-height: 1.08;
	overflow-wrap: anywhere;
}

.utility-screen-header .eyebrow {
	margin: 0 0 2px;
	font-size: .66rem;
}

.utility-back-button {
	display: grid;
	width: 48px;
	height: 48px;
	padding: 0;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--cyan);
	cursor: pointer;
	transition: background .16s ease,color .16s ease,transform .16s ease;
}

.utility-back-button svg {
	width: 28px;
	height: 28px;
	fill: currentColor;
}

.utility-back-button:hover {
	background: rgba(0,229,255,.12);
	color: #fff;
}

.utility-back-button:active {
	transform: translateX(-1px);
}

.utility-screen-scroll {
	min-height: 0;
	height: 100%;
	max-height: none;
	padding: 10px clamp(8px,2vw,16px) max(24px,calc(18px + var(--safe-b)));
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
	border-block: 0;
	background: #050e14;
	box-shadow: none;
	scrollbar-color: rgba(0,229,255,.46) rgba(255,255,255,.05);
	scrollbar-width: thin;
}

.utility-screen-scroll::-webkit-scrollbar {
	width: 7px;
}

.utility-screen-scroll::-webkit-scrollbar-track {
	background: rgba(255,255,255,.05);
}

.utility-screen-scroll::-webkit-scrollbar-thumb {
	border-radius: 999px;
	background: rgba(0,229,255,.46);
}

.settings-list {
	width: min(100%,500px);
	margin: 0 auto;
	display: grid;
	gap: 10px;
	padding: 2px 4px;
	text-align: left;
}

.setting-row {
	display: grid;
	grid-template-columns: minmax(0,1fr) auto;
	align-items: center;
	gap: 12px;
}

.setting-panel {
	min-height: 54px;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: linear-gradient(to bottom,rgba(255,255,255,.065),rgba(255,255,255,.025)),rgba(6,23,32,.72);
	box-shadow: inset 0 1px 0 rgba(255,255,255,.08),0 8px 18px rgba(0,0,0,.16);
}

.setting-panel.is-disabled {
	opacity: .46;
	filter: saturate(.35);
}

.setting-panel.is-disabled .setting-help-button {
	opacity: .8;
}

.setting-title {
	min-width: 0;
	color: #dce9ee;
	font-size: .84rem;
	font-weight: 800;
	text-transform: uppercase;
}

.symbol-choice {
	display: flex;
	justify-self: end;
	gap: 6px;
}

.symbol-option {
	display: inline-flex;
	min-width: 58px;
	min-height: 44px;
	padding: 7px 12px;
	border: 1px solid rgba(148,163,184,.42);
	border-radius: 9px;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: rgba(0,0,0,.24);
	color: var(--muted);
	font-weight: 950;
	cursor: pointer;
}

.symbol-option input {
	width: 18px;
	height: 18px;
	min-height: 0;
	margin: 0;
	accent-color: var(--cyan);
	flex: 0 0 auto;
}

.symbol-option:has(input:checked) {
	border-color: var(--cyan);
	background: rgba(0,229,255,.17);
	color: #fff;
	box-shadow: inset 0 0 0 1px rgba(0,229,255,.25),0 0 10px rgba(0,229,255,.2);
}

.symbol-option:has(input:focus-visible) {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.setting-expandable {
	display: grid;
	gap: 0;
}

.setting-title-with-help {
	display: flex;
	min-width: 0;
	gap: 7px;
	align-items: center;
}

.setting-help-button {
	display: inline-grid;
	width: 28px;
	height: 28px;
	flex: 0 0 auto;
	padding: 0;
	place-items: center;
	border: 1px solid rgba(0,229,255,.44);
	border-radius: 50%;
	background: rgba(0,229,255,.08);
	color: var(--cyan);
	font-size: .8rem;
	font-weight: 950;
}

.setting-help-popover {
	max-width: 100%;
	margin: 9px 0 0;
	padding: 9px 10px;
	border: 1px solid rgba(0,229,255,.24);
	border-radius: 8px;
	background: rgba(0,0,0,.3);
	color: #bfd0d8;
	font-size: .76rem;
	line-height: 1.4;
	overflow-wrap: anywhere;
}

.undo-delay-row {
	display: grid;
	grid-template-columns: minmax(0,1fr) auto;
	gap: 10px;
	align-items: center;
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid rgba(174,218,228,.12);
}

.undo-delay-control {
	display: flex;
	gap: 8px;
	align-items: center;
}

.undo-delay-stepper {
	display: grid;
	grid-template-columns: 40px 48px 40px;
	height: 40px;
	overflow: hidden;
	align-items: center;
	border: 1px solid rgba(0,229,255,.32);
	border-radius: 9px;
	background: rgba(0,0,0,.28);
}

#undo-delay-value {
	color: var(--cyan);
	font-weight: 950;
	text-align: center;
}

.undo-delay-unit {
	color: var(--muted);
	font-size: .72rem;
	font-weight: 900;
	text-transform: uppercase;
}

@media (max-height: 760px) {
	.utility-screen-layout {
		grid-template-rows: auto minmax(0,1fr);
		align-content: stretch;
	}
}

input,select {
	width: min(210px,48vw);
	max-width: 100%;
	min-height: 34px;
	padding: 5px 8px;
	border: 1px solid rgba(148,163,184,.38);
	border-radius: 8px;
	background: #07131b;
	color-scheme: dark;
}

.setting-note {
	margin: 0 8px 4px;
	padding: 0 5px 5px;
	color: var(--muted);
	font-size: .74rem;
	text-align: center;
}

.players-stepper {
	display: grid;
	grid-template-columns: 40px 44px 40px;
	align-items: center;
	height: 40px;
	overflow: hidden;
	border: 1px solid rgba(0,229,255,.32);
	border-radius: 9px;
	background: rgba(0,0,0,.28);
}

.seconds-stepper {
	display: grid;
	grid-template-columns: 40px 58px 40px;
	align-items: center;
	height: 40px;
	overflow: hidden;
	border: 1px solid rgba(0,229,255,.32);
	border-radius: 9px;
	background: rgba(0,0,0,.28);
}

#last-move-highlight-value {
	color: var(--cyan);
	font-weight: 950;
	text-align: center;
}

.stepper-button {
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	background: rgba(255,255,255,.055);
	color: var(--cyan);
	font-size: 1.25rem;
	font-weight: 900;
}

.stepper-button:disabled {
	cursor: default;
	opacity: .3;
}

#players-value {
	color: var(--cyan);
	font-weight: 950;
	text-align: center;
}

.player-name-panel {
	display: grid;
	gap: 8px;
}

.player-name-title {
	color: var(--cyan);
	font-size: .78rem;
	font-weight: 900;
	text-transform: uppercase;
}

.player-name-row {
	display: grid;
	grid-template-columns: minmax(0,1fr) 40px;
	align-items: center;
	gap: 8px;
}

.player-name-input {
	width: 100%;
	min-width: 0;
	min-height: 40px;
}

.player-name-clear {
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid rgba(255,255,255,.15);
	border-radius: 9px;
	background: rgba(255,255,255,.055);
	color: var(--red);
	font-size: 1.25rem;
	font-weight: 900;
}

.player-name-clear:disabled {
	cursor: default;
	opacity: .3;
}

.settings-action-button {
	width: min(100%,260px);
	min-width: 190px;
	min-height: 50px;
	margin-top: 0;
	font-size: .9rem;
}

.utility-inline-action {
	width: min(100%,500px);
	margin: 14px auto 0;
	padding: 4px;
	text-align: center;
}

.utility-inline-action .btn {
	margin-top: 0;
}

.settings-inline-action {
	padding-top: 8px;
}

.setting-switch-control {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	min-width: 132px;
}

.setting-switch-state {
	min-width: 68px;
	color: var(--muted);
	text-align: right;
	font-size: 12px;
	font-weight: 900;
	text-transform: uppercase;
}

.setting-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	width: 52px;
	height: 44px;
	flex: 0 0 auto;
	cursor: pointer;
}

.setting-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	min-height: 0;
	opacity: 0;
	pointer-events: none;
}

.setting-switch-track {
	position: absolute;
	inset: 8px 0;
	border: 2px solid rgba(148,163,184,.42);
	border-radius: 999px;
	background: rgba(148,163,184,.12);
	transition: background .18s ease,border-color .18s ease,box-shadow .18s ease;
}

.setting-switch-track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 4px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #8b96a8;
	box-shadow: 0 2px 5px rgba(0,0,0,.45);
	transition: transform .18s ease,background .18s ease;
}

.setting-switch input:checked + .setting-switch-track {
	border-color: var(--cyan);
	background: rgba(0,229,255,.2);
	box-shadow: 0 0 12px rgba(0,229,255,.34);
}

.setting-switch input:checked + .setting-switch-track::after {
	transform: translateX(22px);
	background: #fff;
}

.setting-switch input:focus-visible + .setting-switch-track {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

.setting-row.is-on .setting-switch-state {
	color: var(--green);
}

.setting-row.is-off .setting-switch-state {
	color: var(--muted);
}

/* =========================================================
   Statistiky a nápověda
   ========================================================= */

.statistics-tabs,.difficulty-tabs {
	display: grid;
	grid-template-columns: repeat(2,minmax(0,1fr));
	gap: 7px;
	margin: 0 auto 12px;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: rgba(0,0,0,.24);
}

.difficulty-tabs {
	grid-template-columns: repeat(4,minmax(0,1fr));
}

.statistics-tab,.difficulty-tab {
	min-height: 42px;
	padding: 7px 9px;
	border: 1px solid transparent;
	border-radius: 9px;
	background: transparent;
	color: var(--muted);
	font-weight: 900;
	text-transform: uppercase;
}

.difficulty-tab {
	height: 54px;
	min-height: 54px;
	line-height: 1.15;
	overflow-wrap: anywhere;
}

.statistics-tab[aria-selected="true"],.difficulty-tab[aria-selected="true"] {
	border-color: rgba(0,229,255,.5);
	background: rgba(0,229,255,.14);
	color: var(--cyan);
	box-shadow: inset 0 1px 0 rgba(255,255,255,.12),0 0 13px rgba(0,229,255,.16);
}

.statistics-tabpanel {
	width: min(100%,560px);
	margin: 0 auto;
}

.stat-panel {
	padding: 10px 14px 12px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: #0b1b25;
}

.stat-panel h3 {
	color: var(--cyan);
}

.legacy-panel {
	margin-top: 10px;
	padding-top: 12px;
	opacity: .88;
}

.statistics-last-game {
	width: min(72vw,280px);
	margin-bottom: 2px;
}

.statistics-actions {
	width: min(100%,560px);
}

.statistics-actions .btn {
	width: min(100%,280px);
	min-width: 0;
}

.last-game-content {
	display: grid;
	grid-template-rows: auto auto minmax(0,1fr) auto;
	width: min(96vw,900px);
	height: min(92dvh,820px);
}

.last-game-meta {
	max-width: none;
	color: var(--muted);
	text-align: center;
}

.last-game-stage {
	display: grid;
	min-height: 0;
	place-items: center;
	overflow: hidden;
}

.last-game-board {
	--cell: var(--last-cell);
	display: grid;
	grid-template-columns: repeat(var(--last-cols),var(--last-cell));
	grid-template-rows: repeat(var(--last-rows),var(--last-cell));
	width: calc(var(--last-cols)*var(--last-cell));
	height: calc(var(--last-rows)*var(--last-cell));
	overflow: hidden;
	border: 1px solid rgba(0,229,255,.3);
	border-radius: 8px;
	background: rgba(3,12,17,.86);
	box-shadow: 0 0 24px rgba(0,229,255,.1);
}

.last-game-board .cell {
	pointer-events: none;
}

.last-game-board .cell.winner {
	animation: none;
	background: rgba(255,215,94,.28);
	box-shadow: inset 0 0 0 max(1px,calc(var(--last-cell)*.1)) var(--gold),0 0 10px var(--gold);
}

.last-game-board .cell.last-move {
	box-shadow: inset 0 0 0 2px rgba(255,255,255,.7);
}

.last-game-board .cell.replay-current {
	background: rgba(0,229,255,.3);
	box-shadow: inset 0 0 0 2px var(--cyan),0 0 10px rgba(0,229,255,.7);
}

.last-game-actions {
	display: flex;
	width: min(100%,620px);
	gap: 14px;
	margin: 0 auto;
}

.last-game-actions .btn {
	width: calc(50% - 7px);
	margin-top: 8px;
}

.saved-games-list {
	display: grid;
	gap: 10px;
	align-content: start;
}

.saved-games-empty {
	margin: auto;
	padding: 30px 12px;
	color: var(--muted);
	text-align: center;
}

.saved-game-card {
	display: grid;
	grid-template-columns: minmax(0,1fr) auto;
	gap: 10px;
	align-items: stretch;
	padding: 10px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: #0b1b25;
}

.saved-game-open,.saved-game-delete {
	border: 1px solid rgba(0,229,255,.25);
	border-radius: 8px;
	background: rgba(0,0,0,.24);
	color: var(--text);
}

.saved-game-open {
	display: grid;
	gap: 5px;
	min-width: 0;
	padding: 10px 12px;
	text-align: left;
}

.saved-game-open strong {
	color: var(--cyan);
}

.saved-game-open span {
	color: var(--muted);
	font-size: .78rem;
	overflow-wrap: anywhere;
}

.saved-game-delete {
	padding: 8px 12px;
	color: #ffb1be;
	font-weight: 850;
}

dl {
	margin: 0;
}

dl div {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 5px 0;
	border-bottom: 1px solid var(--line);
	font-size: .85rem;
}

dd {
	margin: 0;
	color: var(--green);
	font-weight: 900;
}

.help-content {
	width: min(100%,500px);
	margin: auto;
	color: #c4d1d8;
	text-align: left;
}

.controls-help {
	margin-top: 18px;
	padding-top: 12px;
	border-top: 1px solid var(--line);
}

.controls-help h3 {
	margin: 0 0 8px;
	color: var(--cyan);
	font-size: .92rem;
	text-transform: uppercase;
}

.controls-help p {
	margin: 7px 0;
}

body.no-animations .touch-magnifier,
body.reduce-motion .touch-magnifier {
	transition: none;
}

/* =========================================================
   Animace
   ========================================================= */

@keyframes show {
	from {
		opacity: 0;
		transform: scale(.98);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes place {
	from {
		transform: scale(.4);
		opacity: .2;
	}
	to {
		transform: none;
		opacity: 1;
	}
}

@keyframes computer-last-move-fade {
	from {
		background: rgba(0,229,255,.18);
		box-shadow: inset 0 0 0 max(1px,calc(var(--cell)*.1)) rgba(89,245,255,.95),0 0 min(18px,calc(var(--cell)*.65)) rgba(0,229,255,.9);
	}
	to {
		background: rgba(0,229,255,0);
		box-shadow: inset 0 0 0 max(1px,calc(var(--cell)*.1)) rgba(89,245,255,0),0 0 min(18px,calc(var(--cell)*.65)) rgba(0,229,255,0);
	}
}

@keyframes winner {
	to {
		background: rgba(255,215,94,.4);
		filter: brightness(1.35);
	}
}

@keyframes think {
	50% {
		transform: translateY(-2px) scale(1.08);
	}
}

.no-animations *,.reduce-motion * {
	animation: none!important;
	transition: none!important;
}

.no-animations .cell.computer-last-move-fading:not(.winner):not(.winning-last-move),
.reduce-motion .cell.computer-last-move-fading:not(.winner):not(.winning-last-move) {
	background: rgba(0,229,255,0);
	box-shadow: inset 0 0 0 max(1px,calc(var(--cell)*.1)) rgba(89,245,255,0),0 0 min(18px,calc(var(--cell)*.65)) rgba(0,229,255,0);
}

/* =========================================================
   Responzivní pravidla
   ========================================================= */

@media(max-width:620px) {
	.difficulty-tabs {
		grid-template-columns: repeat(2,minmax(0,1fr));
	}
	.statistics-grid {
		grid-template-columns: 1fr;
	}
	.overlay {
		align-items: flex-start;
	}
	.overlay-content {
		margin: auto;
	}
	.setting-row {
		font-size: .88rem;
	}
}

@media(max-width:420px) {
	#main-title .title-brand {
		font-size: clamp(1.7rem,7.8vw,2.15rem);
	}
	#main-title .title-game {
		font-size: clamp(1.25rem,6.5vw,2rem);
		letter-spacing: 0;
	}
	.main-actions .btn {
		width: min(86vw,280px);
		padding-inline: 14px;
	}
	.setting-row {
		gap: 7px;
	}
	.setting-panel.setting-row {
		padding-inline: 8px;
	}
	.setting-expandable {
		padding-left: 8px;
	}
	.setting-expandable > .setting-row {
		padding-right: 8px;
	}
	.setting-title {
		overflow-wrap: break-word;
	}
	.setting-title-with-help {
		gap: 5px;
	}
	.setting-help-button {
		width: 26px;
		height: 26px;
	}
	.setting-switch-control {
		min-width: 116px;
		gap: 7px;
	}
	.setting-switch-state {
		min-width: 56px;
		font-size: 10px;
	}
	input,select {
		width: min(170px,46vw);
	}
	.players-stepper {
		justify-self: end;
	}
	.settings-action-button {
		width: min(76vw,260px);
		min-width: 0;
	}
	.undo-delay-row {
		gap: 6px;
	}
	.undo-delay-stepper {
		grid-template-columns: 36px 44px 36px;
	}
	.undo-delay-stepper .stepper-button {
		width: 36px;
	}
}

@media(max-width:300px) {
	.setting-panel.setting-row:has(>select) {
		grid-template-columns: 1fr;
	}
	.setting-panel.setting-row>select {
		width: 100%;
	}
}

@media(max-height:650px) {
	h1:not(#main-title) {
		font-size: 2.3rem;
	}
	#main-title .title-brand {
		font-size: clamp(1.7rem,7vmin,2.45rem);
	}
	#main-title .title-game {
		font-size: clamp(1.55rem,7.5vmin,2.65rem);
	}
	.menu-symbols {
		margin: 5px 0 8px;
	}
	.btn {
		min-height: 42px;
		margin-top: 7px;
	}
	.overlay {
		padding-top: max(60px,calc(54px + var(--safe-t)));
		padding-bottom: max(18px,calc(14px + var(--safe-b)));
	}
}

/* =========================================================
   Omezení pohybu
   ========================================================= */

@media(prefers-reduced-motion:reduce) {
	* {
		animation: none!important;
		transition: none!important;
	}
}
