/*
proscuba.eu/game | Created by IT Kraft Kft. | www.itkraft.hu
*/

		:root {
			--bg1: #021b2f;
			--bg2: #043a5f;
			--hud: #ecf8ff;
			--accent: #36e2ff;
			--danger: #ff5d6c;
			--ok: #9bff8f;
		}

		* { box-sizing: border-box; }

		html, body {
			margin: 0;
			width: 100%;
			height: 100%;
			overflow: hidden;
			font-family: "Trebuchet MS", "Segoe UI", sans-serif;
			background: radial-gradient(circle at 20% 10%, #0a4d7a, var(--bg1) 50%, #010d17 100%);
			color: var(--hud);
		}

		#game {
			display: block;
			width: 100vw;
			height: 100vh;
			background: linear-gradient(to bottom, var(--bg2), var(--bg1) 55%, #010d17);
		}

		.hud {
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			padding: 12px 14px;
			display: grid;
			grid-template-columns: 1fr auto 1fr;
			gap: 8px;
			align-items: start;
			pointer-events: none;
			text-shadow: 0 2px 6px rgba(0,0,0,.6);
			z-index: 5;
		}

		.hud-col {
			display: grid;
			gap: 8px;
			font-weight: 700;
			letter-spacing: .2px;
		}

		.hud-left {
			justify-self: start;
		}

		.hud-right {
			justify-self: end;
		}

		.hud-center {
			justify-self: center;
			font-weight: 800;
			letter-spacing: .4px;
			font-size: 18px;
			margin-top: 2px;
		}

		.hud-item {
			display: flex;
			align-items: center;
			gap: 8px;
		}

		.hud-stat {
			display: inline-flex;
			align-items: center;
			gap: 6px;
			white-space: nowrap;
		}

		.hud-stat-label {
			white-space: nowrap;
		}

		.hud-icon {
			width: 28px;
			height: 28px;
			display: inline-flex;
			align-items: center;
			justify-content: center;
			border-radius: 8px;
			background: rgba(255,255,255,.12);
			outline: 1px solid rgba(255,255,255,.26);
		}

		.hud-icon svg {
			width: 22px;
			height: 22px;
			display: block;
		}

		.meter {
			width: 180px;
			height: 11px;
			border-radius: 999px;
			overflow: hidden;
			background: rgba(255,255,255,.16);
			outline: 1px solid rgba(255,255,255,.22);
			display: inline-flex;
			vertical-align: middle;
			margin-left: 6px;
		}

		.meter > span {
			display: block;
			height: 100%;
			transition: width .2s linear;
		}

		#hpFill { background: linear-gradient(90deg, #ff9f57, #ff4747); }
		#airFill { background: linear-gradient(90deg, #55f5ff, #2fb2ff); }

		.top-right {
			text-align: right;
			font-weight: 700;
		}

		.overlay {
			position: fixed;
			inset: 0;
			background: rgba(0, 15, 28, .72);
			backdrop-filter: blur(4px);
			display: grid;
			place-items: center;
			z-index: 8;
			padding: 18px;
		}

		.overlay-shell {
			width: min(740px, 100%);
			max-height: calc(100dvh - 36px);
			display: flex;
			flex-direction: column;
			gap: 10px;
		}

		.panel {
			width: 100%;
			background: rgba(1, 24, 38, .92);
			border: 1px solid rgba(100, 214, 255, .35);
			border-radius: 16px;
			padding: 20px;
			box-shadow: 0 20px 70px rgba(0,0,0,.55);
		}

		.start-panel {
			display: flex;
			flex-direction: column;
			max-height: 100%;
			overflow: hidden;
		}

		.intro-sequence {
			display: grid;
			place-items: center;
			width: 100%;
			height: min(58vh, 420px);
			overflow: hidden;
			background: radial-gradient(circle at center, rgba(24, 89, 116, .55), rgba(1, 19, 30, .9) 62%);
			border: 1px solid rgba(124, 234, 255, .45);
			border-radius: 16px;
			padding: 26px 18px;
			letter-spacing: .16em;
			text-transform: uppercase;
			text-align: center;
			box-shadow: inset 0 0 26px rgba(62, 190, 255, .18), 0 0 28px rgba(0,0,0,.35);
		}

		.intro-scroll {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: flex-end;
			gap: 18px;
			width: 100%;
			height: 100%;
			transform: translateY(52%);
			animation: introCredits 3.6s ease-in-out forwards;
			color: #dffbff;
			text-shadow: 0 0 8px rgba(130, 238, 255, .6), 0 0 18px rgba(130, 238, 255, .28);
			font-weight: 800;
		}

		.intro-scroll div {
			font-size: clamp(14px, 2vw, 28px);
			line-height: 1.2;
		}

		.intro-scroll div:first-child {
			color: #7ef8ff;
			font-size: clamp(32px, 3.2vw, 42px);
		}


		.intro-scroll div:last-child {
			color: #7ef8ff;
			font-size: clamp(24px, 3.2vw, 42px);
		}

		@keyframes introCredits {
			0% {
				transform: translateY(68%);
				opacity: 0;
			}
			15% {
				opacity: 1;
			}
			70% {
				transform: translateY(-16%);
				opacity: 1;
			}
			100% {
				transform: translateY(-58%);
				opacity: 1;
			}
		}

		.end-panel {
			display: flex;
			flex-direction: column;
			max-height: 100%;
			overflow: hidden;
		}

		.start-copy {
			flex: 1 1 auto;
			min-height: 0;
			overflow-y: auto;
			padding-right: 6px;
			overscroll-behavior: contain;
		}

		.start-copy::-webkit-scrollbar {
			width: 8px;
		}

		.start-copy::-webkit-scrollbar-thumb {
			background: rgba(129, 246, 255, .45);
			border-radius: 999px;
		}

		.end-copy {
			flex: 1 1 auto;
			min-height: 0;
			overflow-y: auto;
			padding-right: 6px;
			overscroll-behavior: contain;
		}

		.end-copy::-webkit-scrollbar {
			width: 8px;
		}

		.end-copy::-webkit-scrollbar-thumb {
			background: rgba(129, 246, 255, .45);
			border-radius: 999px;
		}

		.start-footer {
			flex: 0 0 auto;
			margin-top: 18px;
			padding-top: 14px;
			border-top: 1px solid rgba(100, 214, 255, .18);
		}

		.end-footer {
			flex: 0 0 auto;
			margin-top: 18px;
			padding-top: 14px;
			border-top: 1px solid rgba(100, 214, 255, .18);
		}

		.panel h1 {
			margin: 0 0 8px;
			color: var(--accent);
			font-size: clamp(26px, 4vw, 40px);
			letter-spacing: .7px;
			text-align: center;
		}

		.panel p {
			margin: 8px 0;
			line-height: 1.45;
		}

		.legend {
			margin-top: 10px;
			display: grid;
			gap: 6px;
		}

		.brand-logos {
			display: flex;
			justify-content: space-between;
			align-items: flex-start;
			gap: 14px;
			margin-bottom: 12px;
			width: 100%;
		}

		.brand-logo-box {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			background: #aeefff;
			border: 1px solid rgba(255, 255, 255, .6);
			border-radius: 50%;
			width: clamp(138px, 20vw, 178px);
			height: clamp(138px, 20vw, 178px);
			padding: 10px;
			overflow: hidden;
			box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
		}

		.brand-logos img {
			height: clamp(84px, 14vw, 114px);
			max-width: 100%;
			object-fit: contain;
			filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3));
		}

		.legend-item {
			display: flex;
			align-items: center;
			gap: 10px;
		}

		.legend-icon {
			width: 28px;
			height: 28px;
			display: inline-flex;
			align-items: center;
			justify-content: center;
			border-radius: 8px;
			background: rgba(255, 255, 255, .08);
			outline: 1px solid rgba(255, 255, 255, .22);
		}

		.legend-icon svg {
			width: 22px;
			height: 22px;
			display: block;
		}

		.created-by {
			margin-top: 8px;
			text-align: center;
			font-size: 12px;
			color: rgba(225, 245, 255, .94);
		}

		.created-by a {
			color: #9eefff;
			font-weight: 700;
			text-decoration: none;
		}

		.created-by a:hover,
		.created-by a:focus-visible {
			text-decoration: underline;
		}

		.overlay-credit {
			margin-top: 10px;
			text-align: center;
			font-size: 12px;
			color: rgba(225, 245, 255, .94);
		}

		.overlay-credit a {
			color: #9eefff;
			font-weight: 700;
			text-decoration: none;
		}

		.overlay-credit a:hover,
		.overlay-credit a:focus-visible {
			text-decoration: underline;
		}

		.end-summary {
			margin: 16px 0 12px;
			display: grid;
			grid-template-columns: repeat(4, minmax(0, 1fr));
			gap: 10px;
		}

		.end-stat {
			padding: 10px 12px;
			border-radius: 12px;
			background: rgba(255,255,255,.06);
			outline: 1px solid rgba(255,255,255,.12);
			text-align: center;
		}

		.end-stat strong {
			display: block;
			font-size: 20px;
			color: var(--accent);
			margin-bottom: 4px;
		}

		.end-stat span {
			font-size: 12px;
			color: rgba(225, 245, 255, .85);
			text-transform: uppercase;
			letter-spacing: .6px;
		}

		.highscore-heading {
			margin: 16px 0 8px;
			font-size: 20px;
			color: var(--accent);
		}

		.highscore-note {
			margin: 0 0 12px;
			color: rgba(225, 245, 255, .92);
		}

		.highscore-table {
			display: grid;
			gap: 6px;
		}

		.highscore-row {
			display: grid;
			grid-template-columns: 44px 70px 1fr 94px;
			gap: 10px;
			align-items: center;
			padding: 8px 10px;
			border-radius: 10px;
			background: rgba(255,255,255,.05);
			outline: 1px solid rgba(255,255,255,.1);
			font-size: 14px;
		}

		.highscore-row.header {
			background: rgba(54, 226, 255, .12);
			font-size: 12px;
			font-weight: 800;
			letter-spacing: .7px;
			text-transform: uppercase;
		}

		.highscore-row.placeholder {
			opacity: .62;
		}

		.highscore-row.is-player {
			background: rgba(155, 255, 143, .12);
			outline-color: rgba(155, 255, 143, .28);
		}

		.highscore-rank,
		.highscore-score {
			font-weight: 800;
		}

		.highscore-meta {
			font-size: 12px;
			color: rgba(225, 245, 255, .82);
		}

		.highscore-form {
			margin: 14px 0 10px;
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			gap: 10px;
		}

		.highscore-input {
			width: 110px;
			padding: 12px 14px;
			border-radius: 10px;
			border: 1px solid rgba(129, 246, 255, .42);
			background: rgba(0, 11, 20, .55);
			color: var(--hud);
			font-size: 22px;
			font-weight: 800;
			text-align: center;
			text-transform: uppercase;
			letter-spacing: 3px;
		}

		.highscore-input:focus-visible {
			outline: 2px solid rgba(129, 246, 255, .68);
			outline-offset: 2px;
		}

		.highscore-submit {
			margin-top: 0;
		}

		.highscore-status {
			margin: 8px 0 0;
			font-size: 13px;
			color: rgba(225, 245, 255, .88);
		}

		.end-actions {
			display: grid;
			grid-template-columns: repeat(3, minmax(0, 220px));
			justify-content: center;
			gap: 12px;
		}

		.start-actions > *,
		.end-actions > * {
			width: 100%;
			min-width: 0;
			min-height: 60px;
			margin-top: 0;
		}

		.start-actions button,
		.end-actions button,
		.start-actions .link-btn,
		.end-actions .link-btn {
			font-size: 22px;
		}

		.secondary-btn {
			background: linear-gradient(180deg, #dffaff, #93e8ff);
		}

		button:disabled {
			opacity: .6;
			cursor: wait;
			filter: none;
		}

		.legend span { font-weight: 700; }
		.shark { color: #ff8d8d; }
		.ray { color: #ffcf7a; }
		.jelly { color: #d9b4ff; }

		button {
			margin-top: 14px;
			border: 0;
			border-radius: 10px;
			padding: 11px 16px;
			font-size: 16px;
			font-weight: 700;
			text-transform: uppercase;
			letter-spacing: .08em;
			color: #022338;
			background: linear-gradient(180deg, #81f6ff, #36dfff);
			cursor: pointer;
			box-shadow: 0 10px 20px rgba(0,0,0,.35);
		}

		#startBtn {
			display: block;
			margin: 0;
			padding: 16px 30px;
			font-size: 22px;
			border-radius: 14px;
			min-width: 220px;
			background: linear-gradient(180deg, #81f6ff, #36dfff);
		}

		.start-actions {
			display: grid;
			grid-template-columns: repeat(3, minmax(0, 220px));
			justify-content: center;
			gap: 12px;
			margin-top: 18px;
		}

		.link-btn {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			padding: 16px 30px;
			font-size: 22px;
			font-weight: 700;
			text-transform: uppercase;
			letter-spacing: .08em;
			border-radius: 14px;
			color: #022338;
			background: linear-gradient(180deg, #ffffff, #e9f2f8);
			text-decoration: none;
			box-shadow: 0 10px 20px rgba(0,0,0,.35);
			min-width: 220px;
		}

		.link-btn:hover,
		.link-btn:focus-visible {
			filter: brightness(1.06);
		}

		button:hover { filter: brightness(1.06); }

		@media (max-width: 820px) {
			.overlay {
				padding: 12px;
			}

			.overlay-shell {
				max-height: calc(100dvh - 24px);
			}

			.panel {
				padding: 16px;
				border-radius: 14px;
			}

			.start-footer {
				margin-top: 14px;
				padding-top: 12px;
			}

			.end-footer {
				margin-top: 14px;
				padding-top: 12px;
			}

			.start-copy {
				padding-right: 2px;
			}

			.end-copy {
				padding-right: 2px;
			}

			.brand-logos {
				justify-content: center;
				flex-wrap: wrap;
				gap: 10px;
			}

			.brand-logo-box {
				width: clamp(92px, 26vw, 122px);
				height: clamp(92px, 26vw, 122px);
			}

			.brand-logos img {
				height: clamp(58px, 16vw, 82px);
			}

			.start-actions {
				grid-template-columns: 1fr;
				margin-top: 0;
				gap: 10px;
			}

			.end-actions {
				grid-template-columns: 1fr;
			}

			#startBtn,
			.link-btn {
				width: 100%;
				min-width: 0;
				padding: 15px 18px;
				font-size: 20px;
			}

			.hud {
				grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
				grid-template-areas:
					"left right"
					"center center";
				padding: 8px 10px;
				gap: 6px 10px;
			}

			.hud-left {
				grid-area: left;
				justify-self: stretch;
			}

			.hud-right {
				grid-area: right;
				justify-self: stretch;
			}

			.hud-center {
				grid-area: center;
				justify-self: center;
				font-size: 15px;
				margin-top: 0;
			}

			.hud-col {
				gap: 4px;
			}

			.hud-item {
				gap: 6px;
				font-size: 12px;
				line-height: 1.15;
			}

			.hud-left .hud-item {
				justify-content: flex-start;
			}

			.hud-right .hud-item {
				justify-content: flex-end;
				text-align: right;
				flex-direction: row-reverse;
			}

			.hud-right .meter {
				margin-left: 0;
				margin-right: 4px;
			}

			.hud-right .hud-stat {
				gap: 4px;
			}

			.hud-icon {
				width: 22px;
				height: 22px;
				border-radius: 6px;
			}

			.hud-icon svg {
				width: 17px;
				height: 17px;
			}

			.meter {
				width: 108px;
				height: 8px;
				margin-left: 4px;
			}

			.end-summary {
				grid-template-columns: repeat(2, minmax(0, 1fr));
				gap: 8px;
			}

			.highscore-row {
				grid-template-columns: 34px 56px 1fr 74px;
				gap: 8px;
				padding: 7px 8px;
				font-size: 12px;
			}

			.highscore-meta {
				font-size: 11px;
			}

			.highscore-form {
				align-items: stretch;
			}

			.highscore-input,
				.highscore-submit,
				#restartBtn {
				width: 100%;
			}

			#goalText {
				display: inline-block;
				max-width: 160px;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
		}

		/* Mobile and desktop controls are handled directly on the canvas. */
