@import url('https://fonts.googleapis.com/css2?family=Chewy&display=swap');

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	outline: none !important;
}

*:focus,
*:active,
*:focus-visible {
	outline: none !important;
}

input {
	background-image: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('/assets/wallpaper.png');
	background-size: 256px 256px;
	background-repeat: repeat;
}

body {
	font-family: 'Chewy', 'Chewy', serif;
	background-image: url('/assets/wallpaper.png');
	background-size: 256px 256px;
	background-repeat: repeat;
	color: #f4e8d8;
	overflow: hidden;
}

.landing-container {
	width: 100vw;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background-image: url('/assets/wallpaper.png');
	background-size: 256px 256px;
	background-repeat: repeat;
}

.landing-content {
	text-align: center;
	padding: 40px;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 20px;
	border: 3px solid #d4af37;
}

.game-title {
	font-size: 4rem;
	color: #d4af37;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
	margin-bottom: 20px;
}

.game-subtitle {
	font-size: 1.5rem;
	color: #f4e8d8;
	margin-bottom: 40px;
}

.button-container {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.main-button {
	font-family: 'Chewy', serif;
	font-size: 1.5rem;
	padding: 20px 40px;
	background: #d4af37;
	color: #2c1810;
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.3s;
	font-weight: bold;
}

.main-button:hover {
	background: #f4c542;
	transform: scale(1.05);
}

#layout-wrapper {
	width: 1920px;
	height: 1080px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	transform-origin: center;
	background-image: url('/assets/wallpaper.png');
	background-size: 256px 256px;
	background-repeat: repeat;
	overflow: hidden;
}

body:has(#drawing-screen:not([style*="display: none"])) #layout-wrapper {
	width: 100vw !important;
	height: 100vh !important;
}

.screen {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40px;
}

#drawing-screen {
	padding: 0;
	transform: scale(var(--drawing-scale, 1));
	transform-origin: center;
}

#throne-room-screen {
	padding: 0;
	position: relative;
}

#throne-room-screen canvas {
	display: block;
}

#lobby-code-display {
	position: absolute;
	top: 20px;
	left: 20px;
	z-index: 100;
	transition: all 0.3s ease;
}

#lobby-code {
	font-weight: bold;
	font-size: 2.5rem;
	letter-spacing: 5px;
	color: #d4af37;
	padding: 15px 40px;
	padding-top: 25px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-style: solid;
	border-width: 0 80px;
	border-image-source: url('/assets/ribbon_ui_green.png');
	border-image-slice: 0 80 fill;
	border-image-repeat: repeat stretch;
	image-rendering: pixelated;
	transition: all 0.3s ease;
}

@media (max-width: 1400px) {
	#lobby-code {
		font-size: 2rem;
		padding: 12px 35px;
		padding-top: 22px;
		letter-spacing: 4px;
		border-width: 0 70px;
		border-image-slice: 0 70 fill;
	}
}

@media (max-width: 1200px) {
	#lobby-code {
		font-size: 1.8rem;
		padding: 10px 30px;
		padding-top: 20px;
		letter-spacing: 3px;
		border-width: 0 60px;
		border-image-slice: 0 60 fill;
	}
}

@media (max-width: 1000px) {
	#lobby-code {
		font-size: 1.5rem;
		padding: 8px 25px;
		padding-top: 18px;
		letter-spacing: 2px;
		border-width: 0 50px;
		border-image-slice: 0 50 fill;
	}
}

@media (max-width: 768px) {
	#lobby-code-display {
		top: 10px;
		left: 10px;
	}
	
	#lobby-code {
		font-size: 1.2rem;
		padding: 6px 20px;
		padding-top: 15px;
		letter-spacing: 2px;
		border-width: 0 40px;
		border-image-slice: 0 40 fill;
	}
}

@media (max-width: 768px) and (orientation: portrait) {
	#lobby-code-display {
		top: 10px;
		left: 10px;
		transform: none;
	}
	
	#lobby-code {
		font-size: 1rem;
		padding: 5px 15px;
		padding-top: 12px;
		letter-spacing: 1px;
		border-width: 0 30px;
		border-image-slice: 0 30 fill;
	}
}

#settings-button {
	position: absolute;
	top: 20px;
	right: 20px;
	background: none;
	border: none;
	width: 60px;
	height: 60px;
	cursor: pointer;
	transition: transform 0.3s;
	z-index: 100;
	padding: 0;
}

#settings-button img {
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	transition: transform 0.6s ease;
}

#settings-button:hover img {
	transform: rotate(360deg);
}

.modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.modal-content {
	background-image: url('/assets/wallpaper.png');
	background-size: 256px 256px;
	background-repeat: repeat;
	padding: 40px;
	border-radius: 15px;
	border: 3px solid #d4af37;
	min-width: 500px;
}

.modal-content h2 {
	color: #d4af37;
	margin-bottom: 30px;
	text-align: center;
}

.setting-group {
	margin-bottom: 20px;
}

.setting-group label {
	display: block;
	margin-bottom: 8px;
	color: #f4e8d8;
	font-size: 1.2rem;
}

.setting-group input:not([type="range"]),
.setting-group select {
	width: 100%;
	padding: 10px;
	font-size: 1rem;
	background-image: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('/assets/wallpaper.png');
	background-size: 256px 256px;
	background-repeat: repeat;
	color: #f4e8d8;
	border: 2px solid #d4af37;
	border-radius: 5px;
	font-family: 'Chewy', serif;
}

.setting-group input[type="range"] {
	width: 100%;
	padding: 0;
	background: transparent;
	border: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	cursor: pointer;
}

.setting-group input[type="range"]::-webkit-slider-track {
	width: 100%;
	height: 8px;
	background: #d4af37;
	border-radius: 4px;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 20px;
	height: 20px;
	background: #f4e8d8;
	border: 2px solid #d4af37;
	border-radius: 50%;
	cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-track {
	width: 100%;
	height: 8px;
	background: #d4af37;
	border-radius: 4px;
}

.setting-group input[type="range"]::-moz-range-thumb {
	width: 20px;
	height: 20px;
	background: #f4e8d8;
	border: 2px solid #d4af37;
	border-radius: 50%;
	cursor: pointer;
}

.setting-group option {
	color: #000;
}


.drawing-container {
	display: flex;
	gap: 30px;
	align-items: flex-start;
}

.canvas-wrapper {
	position: relative;
	width: 844px;
	height: 844px;
	flex-shrink: 0;
	background: url('/assets/portrait.png') no-repeat center center;
	background-size: contain;
}

.canvas-ribbon {
	position: absolute;
	top: 100%;
	margin-top: 10px;
	left: 50%;
	transform: translateX(-50%);
	color: #d4af37;
	font-family: 'Chewy', serif;
	font-size: clamp(1rem, 2.5vw, 1.4rem);
	padding: clamp(8px, 2vw, 14px) clamp(16px, 4vw, 32px);
	padding-top: clamp(12px, 3vw, 22px);
	border-style: solid;
	border-width: 0 clamp(36px, 9vw, 80px);
	border-image-source: url('/assets/ribbon_ui.png');
	border-image-slice: 0 80 fill;
	border-image-repeat: stretch;
	image-rendering: pixelated;
	white-space: nowrap;
	display: none;
	z-index: 5;
	width: auto;
	max-width: 90%;
	box-sizing: border-box;
}

.canvas-wrapper canvas {
	position: absolute;
	top: 2.61%;
	left: 2.61%;
	width: 94.78%;
	height: 94.78%;
	image-rendering: pixelated;
}

#background-canvas {
	z-index: 1;
	pointer-events: none;
	background: transparent;
}

#highlighter-canvas {
	z-index: 2;
	pointer-events: none;
	background: transparent;
}

#king-canvas {
	z-index: 3;
	background: transparent;
}

.portrait-border {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: url('/assets/portrait_border.png') no-repeat center center;
	background-size: contain;
	z-index: 4;
	pointer-events: none;
}

#throne-room-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 1920px;
	height: 1080px;
	cursor: default;
}

.drawing-tools {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.color-palette {
	display: grid;
	grid-template-columns: repeat(7, 70px);
	gap: 8px;
}

@media (max-width: 768px) {
	#drawing-screen {
		padding: 10px;
	}

	.drawing-container {
		flex-direction: column;
		align-items: center;
		gap: 20px;
		width: 100%;
	}

	.canvas-wrapper {
		width: 90vw;
		height: 90vw;
		max-width: 800px;
		max-height: 800px;
	}

	.drawing-tools {
		width: 90vw;
		max-width: 800px;
	}

	.color-palette {
		grid-template-columns: repeat(7, 1fr);
	}

	.tool-buttons {
		justify-content: center;
	}

	.tool-button {
		padding: 8px 12px;
		font-size: 0.9rem;
	}

	.brush-size-container {
		width: 100%;
	}
}

@media (max-width: 768px) and (orientation: portrait) {
	#drawing-screen {
		padding: 0;
		overflow: hidden;
		transform: none !important;
	}

	#drawing-screen h2 {
		display: none;
	}

	#drawing-screen .canvas-ribbon {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	#drawing-screen .drawing-container {
		flex-direction: column;
		width: 100vw;
		height: 100vh;
		position: relative;
		gap: 0;
	}

	#drawing-screen .canvas-and-slider {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	#drawing-screen .canvas-wrapper {
		width: 90vmin;
		height: 90vmin;
		max-width: none;
		max-height: none;
		position: relative;
		touch-action: none;
	}

	#drawing-screen .brush-size-container {
		position: fixed;
		left: 5px;
		top: 50%;
		transform: translateY(-50%);
		width: 42px;
		height: 300px;
		background: transparent;
		border: none;
		border-radius: 8px;
		padding: 4px;
		z-index: 90;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	#drawing-screen .brush-size-container label {
		display: none;
	}

	#drawing-screen .brush-size-container input[type="range"] {
		width: 280px;
		height: 14px;
		transform: rotate(-90deg);
		transform-origin: center;
		-webkit-appearance: none;
		appearance: none;
		background: #2c1810;
		border: none;
		border-radius: 10px;
		padding: 0;
	}

	#drawing-screen .brush-size-container input[type="range"]::-webkit-slider-thumb {
		-webkit-appearance: none;
		appearance: none;
		width: 30px;
		height: 30px;
		border-radius: 50%;
		background: #d4af37;
		border: 2px solid #2c1810;
		box-shadow: none;
		cursor: pointer;
	}

	#drawing-screen .brush-size-container input[type="range"]::-moz-range-thumb {
		width: 30px;
		height: 30px;
		border-radius: 50%;
		background: #d4af37;
		border: 2px solid #2c1810;
		box-shadow: none;
		cursor: pointer;
	}

	#drawing-screen .brush-size-container input[type="range"]::-moz-range-track {
		background: #2c1810;
		border: none;
		border-radius: 10px;
		height: 14px;
		box-shadow: none;
	}

	#drawing-screen .drawing-tools {
		position: fixed;
		right: 5px;
		top: 80px;
		bottom: 80px;
		width: 54px;
		background: transparent;
		border: none;
		border-radius: 8px;
		padding: 4px;
		z-index: 90;
		overflow-x: hidden;
		overflow-y: auto;
		gap: 4px;
	}

	#drawing-screen .tool-buttons {
		position: fixed;
		top: 5px;
		left: 50%;
		transform: translateX(-50%);
		display: flex;
		flex-wrap: nowrap;
		gap: 6px;
		background: transparent;
		border: none;
		border-radius: 8px;
		padding: 6px;
		z-index: 90;
	}

	#drawing-screen .tool-button {
		width: 45px;
		height: 45px;
		flex-shrink: 0;
	}

	#drawing-screen .color-palette {
		display: flex;
		flex-direction: column;
		gap: 4px;
		width: 100%;
	}

	#drawing-screen .color-swatch {
		width: 46px !important;
		height: 46px !important;
		min-width: 46px !important;
		min-height: 46px !important;
		max-width: 46px !important;
		max-height: 46px !important;
		flex-shrink: 0;
	}

	#drawing-screen .undo-redo-buttons {
		position: fixed;
		bottom: 5px;
		left: 50%;
		transform: translateX(-50%);
		display: flex;
		flex-wrap: nowrap;
		gap: 6px;
		background: transparent;
		border: none;
		border-radius: 8px;
		padding: 6px;
		z-index: 90;
	}

	#drawing-screen .icon-tool-button {
		width: 45px;
		height: 45px;
		flex-shrink: 0;
	}

	#drawing-screen #confirm-king-button {
		width: 64px;
		height: 45px;
		margin-left: 10px;
	}

	#drawing-screen .portrait-border {
		width: 100% !important;
		height: 100% !important;
	}
}

.color-swatch {
	width: 70px !important;
	height: 70px !important;
	min-width: 70px !important;
	min-height: 70px !important;
	max-width: 70px !important;
	max-height: 70px !important;
	border: none !important;
	cursor: pointer;
	position: relative;
	transition: all 0.2s;
	outline: none !important;
	box-sizing: border-box;
}

.color-swatch:focus,
.color-swatch:active,
.color-swatch:focus-visible {
	outline: none !important;
	border: none !important;
}

.color-swatch:hover {
	transform: scale(1.1);
}

.color-swatch.selected {
	transform: scale(1.15);
	background: #f4c542 !important;
	box-shadow: 0 0 0 3px #d4af37;
}

.tool-button, .action-button {
	font-family: 'Chewy', serif;
	padding: 12px 24px;
	font-size: 1.2rem;
	background: #d4af37;
	color: #2c1810;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.3s;
	font-weight: bold;
}

.tool-button:hover, .action-button:hover {
	background: #f4c542;
	transform: translateY(-2px);
}

.tool-button:disabled, .action-button:disabled {
	background: #666;
	cursor: not-allowed;
	transform: none;
}

.brush-size-container {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.brush-size-container label {
	color: #f4e8d8;
	font-size: 1rem;
}

.brush-size-container input[type="range"] {
	width: 100%;
	height: 14px;
	-webkit-appearance: none;
	appearance: none;
	background: #2c1810;
	border: none;
	border-radius: 10px;
	padding: 0;
}

.brush-size-container input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #d4af37;
	border: 2px solid #2c1810;
	box-shadow: none;
	cursor: pointer;
}

.brush-size-container input[type="range"]::-moz-range-thumb {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #d4af37;
	border: 2px solid #2c1810;
	box-shadow: none;
	cursor: pointer;
}

.brush-size-container input[type="range"]::-moz-range-track {
	background: #2c1810;
	border: none;
	border-radius: 10px;
	height: 14px;
	box-shadow: none;
}

.brush-size-container {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.brush-size-container label {
	color: #f4e8d8;
	font-size: 1rem;
}

.brush-size-container input[type="range"] {
	width: 100%;
}

#stats-panel {
	display: none;
}

.stat-item {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 10px;
	font-size: 1.5rem;
}

.stat-label {
	color: #d4af37;
}

.stat-value {
	color: #f4e8d8;
	font-weight: bold;
	min-width: 80px;
	text-align: right;
}

#queue-bubble-container {
	position: absolute;
	left: 560px;
	top: 150px;
	width: 296px;
	height: 141px;
	z-index: 50;
	pointer-events: auto;
}

#queue-bubble-container.has-queue {
	cursor: pointer;
}

#decision-bubble-container {
	position: absolute;
	left: 560px;
	top: 150px;
	width: 140px;
	height: 108px;
	z-index: 60;
	cursor: pointer;
	pointer-events: auto;
}

#response-panel {
	position: absolute;
	bottom: 150px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 60;
	text-align: center;
}

#response-bubble {
	background: white;
	color: #2d3c6c;
	padding: 30px;
	border-radius: 20px;
	border: 3px solid #2d3c6c;
	max-width: 600px;
	margin-bottom: 20px;
	font-size: 1.3rem;
}

#resource-changes {
	display: flex;
	gap: 20px;
	justify-content: center;
	margin-bottom: 20px;
}

.resource-change {
	padding: 10px 20px;
	border-radius: 8px;
	font-size: 1.5rem;
	font-weight: bold;
}

.positive {
	color: #4caf50;
}

.negative {
	color: #f44336;
}

.round-summary {
	background: rgba(0, 0, 0, 0.8);
	padding: 60px;
	border-radius: 20px;
	border: 3px solid #d4af37;
	text-align: center;
}

.round-summary h2 {
	color: #d4af37;
	font-size: 3rem;
	margin-bottom: 40px;
}

.summary-stats, .final-stats {
	margin-bottom: 30px;
}

.summary-item, .stat-display {
	display: flex;
	justify-content: space-between;
	font-size: 1.5rem;
	margin-bottom: 15px;
	gap: 40px;
}

.join-container, .request-container, .waiting-container, .presenting-container, .result-container {
	text-align: center;
	max-width: 600px;
}

#lobby-code-input {
	font-family: 'Chewy', serif;
	font-size: 2rem;
	padding: 15px;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 10px;
	background-image: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('/assets/wallpaper.png');
	background-size: 256px 256px;
	background-repeat: repeat;
	color: #f4e8d8;
	border: 3px solid #d4af37;
	border-radius: 10px;
	margin-bottom: 20px;
	width: 100%;
}



#join-button {
	font-size: 2rem;
	padding: 15px 30px;
	height: auto;
}

#request-input {
	font-family: 'Chewy', serif;
	width: 100%;
	max-width: 600px;
	height: 200px;
	padding: 20px;
	font-size: 1.2rem;
	background: #2d3c6c;
	color: #f4e8d8;
	border: 3px solid #d4af37;
	border-radius: 10px;
	resize: none;
	margin-bottom: 10px;
	box-sizing: border-box;
}

.character-count {
	text-align: right;
	color: #d4af37;
	margin-bottom: 20px;
}

#character-display {
	margin: 30px 0;
}

#character-image {
	max-width: 300px;
	border: 3px solid #d4af37;
	border-radius: 10px;
}

.error-message {
	color: #f44336;
	margin-top: 10px;
	font-size: 1.2rem;
}

.waiting-message, .presenting-message {
	font-size: 1.5rem;
	color: #f4e8d8;
	margin: 20px 0;
}

#decision-result {
	font-size: 2rem;
	font-weight: bold;
	margin-bottom: 20px;
}

#ai-response {
	background: rgba(255, 255, 255, 0.1);
	padding: 20px;
	border-radius: 10px;
	margin-bottom: 30px;
	font-size: 1.3rem;
}

.result-actions {
	display: flex;
	gap: 20px;
	justify-content: center;
}

.icon-button {
	background: transparent;
	border: none;
	cursor: pointer;
}

h2 {
	color: #d4af37;
	font-size: 2.5rem;
	margin-bottom: 30px;
	padding: 20px 40px;
	padding-top: 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-style: solid;
	border-width: 0 80px;
	border-image-source: url('/assets/ribbon_ui.png');
	border-image-slice: 0 80 fill;
	border-image-repeat: repeat stretch;
	image-rendering: pixelated;
}

.color-swatch {
	width: 40px;
	height: 40px;
	border: 3px solid #d4af37;
	border-radius: 5px;
	cursor: pointer;
	display: inline-block;
	margin: 5px;
	transition: transform 0.1s;
}

.color-swatch:hover {
	transform: scale(1.1);
}

.eraser-swatch {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
}

.tool-buttons {
	display: flex;
	gap: 10px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.tool-button {
	padding: 0;
	width: 70px;
	height: 70px;
	background: transparent;
	border: none !important;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	outline: none !important;
	box-sizing: border-box;
}

.tool-button img {
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	pointer-events: none;
}

.tool-button:focus,
.tool-button:active,
.tool-button:focus-visible {
	outline: none !important;
}

.tool-button:hover {
	transform: scale(1.1);
}

.tool-button.active {
	transform: scale(1.15);
	background: #f4c542 !important;
	box-shadow: 0 0 0 3px #d4af37;
}

.icon-tool-button {
	padding: 0;
	width: 70px;
	height: 70px;
	background: transparent;
	border: none !important;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	outline: none !important;
	font-family: 'Chewy', serif;
	font-size: 1rem;
	color: #f4e8d8;
	box-sizing: border-box;
}

.icon-tool-button img {
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	pointer-events: none;
}

.icon-tool-button:focus,
.icon-tool-button:active,
.icon-tool-button:focus-visible {
	outline: none !important;
}

.icon-tool-button:hover {
	transform: scale(1.1);
}

.undo-redo-buttons {
	display: flex;
	gap: 10px;
	margin-top: 15px;
	justify-content: flex-start;
}

#confirm-king-button {
	width: auto;
	height: 70px;
}

#confirm-king-button img {
	width: auto;
	height: 100%;
}

.canvas-and-slider {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 15px;
}

.brush-size-container {
	width: 556px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.brush-size-container label {
	font-size: 1.1rem;
	color: #d4af37;
}

.brush-size-container input[type="range"] {
	width: 100%;
}
