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

body {
font-family: Arial, sans-serif;
background-image: url("img/elpollo.png");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}

* {
box-sizing: border-box;
}

.screen-wrapper {
width: 100%;
height: 100vh;
position: relative;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
padding: 20px 16px;
}

#startscreen,
#game-container,
#game-over-screen,
#you-win-screen {
width: 100%;
max-width: 820px;
max-height: 100%;
overflow: hidden;
}

canvas {
background-color: transparent;
display: block;
width: 100%;
height: 100%;
}

/* ---------- GAME AREA ---------- */

.canvas-wrapper {
position: relative;
width: 100%;
max-width: 720px;
aspect-ratio: 3 / 2;
margin: 0 auto;
overflow: hidden;
border-radius: 12px;
box-shadow:
0 0 70px rgba(0, 0, 0, 0.9),
0 0 20px rgba(255, 200, 0, 0.4);
border: 3px solid rgba(255, 255, 255, 0.15);
}

/* ---------- MUTE BUTTON ---------- */

#mute-btn {
position: absolute;
top: 10px;
right: 10px;
z-index: 50;
width: 44px;
height: 44px;
border: none;
border-radius: 50%;
background: rgba(0, 0, 0, 0.6);
color: white;
font-size: 20px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}

#mute-btn:hover {
background: rgba(0, 0, 0, 0.8);
}

/* ---------- PAUSE SCREEN ---------- */

#pauseScreen {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.65);
display: flex;
justify-content: center;
align-items: center;
z-index: 30;
}

.pause-box {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
min-width: 280px;
padding: 32px 24px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.96);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.pause-box h2 {
margin: 0 0 8px 0;
font-size: 32px;
color: #222;
text-align: center;
}

.pause-box .start-btn {
position: static;
transform: none;
width: 100%;
min-width: 220px;
}

/* ---------- START SCREEN ---------- */

#startscreen {
position: relative;
animation: fadeInGame 1s ease;
}

#startscreen img {
width: 100%;
display: block;
border-radius: 12px;
}

.start-btn,
.info-btn,
.sound-btn {
font-weight: bold;
border: none;
border-radius: 10px;
background: linear-gradient(180deg, #ffd84d 0%, #ffcc00 100%);
color: #1a1a1a;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
box-shadow:
0 6px 18px rgba(0, 0, 0, 0.25),
inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.start-btn:hover,
.info-btn:hover,
.sound-btn:hover {
background: linear-gradient(180deg, #ffe37a 0%, #ffb700 100%);
transform: translateY(-2px) scale(1.03);
box-shadow:
0 10px 22px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.start-btn {
padding: 15px 42px;
font-size: 22px;
}

#startscreen .start-btn {
position: absolute;
bottom: 26px;
left: 50%;
transform: translateX(-50%);
min-width: 220px;
animation: pulseGame 2s infinite;
z-index: 3;
}

.info-btn {
position: absolute;
right: 24px;
bottom: 24px;
padding: 12px 24px;
font-size: 18px;
z-index: 3;
}

.sound-btn {
position: absolute;
left: 24px;
bottom: 24px;
padding: 12px 24px;
font-size: 18px;
z-index: 3;
}

#game-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
width: 100%;
}

#game-container h1 {
color: white;
margin: 0;
text-align: center;
}

/* ---------- END SCREENS ---------- */

.end-screen {
position: relative;
overflow: hidden;
}

.end-screen img {
width: 100%;
display: block;
border-radius: 12px;
}

.end-screen-buttons {
position: absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 20px;
}

.end-screen-buttons .start-btn {
position: static;
transform: none;
}

/* ---------- MOBILE CONTROLS ---------- */

#mobile-controls {
position: absolute;
left: 0;
right: 0;
bottom: 26px;
display: none;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 0 18px;
z-index: 5;
pointer-events: none;
}

.mobile-left,
.mobile-right {
display: flex;
gap: 12px;
pointer-events: auto;
flex: 1;
}

.mobile-left {
justify-content: flex-start;
}

.mobile-right {
justify-content: flex-end;
}

.mobile-btn {
width: 56px;
height: 56px;
border: 2px solid rgba(255, 255, 255, 0.7);
border-radius: 50%;
font-size: 14px;
font-weight: bold;
background: rgba(0, 0, 0, 0.48);
color: #ffffff;
cursor: pointer;
user-select: none;
}

/* ---------- LEGAL LINKS ---------- */

.legal-links {
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
gap: 24px;
margin: 0;
padding: 0;
z-index: 10;
}

.legal-links a {
color: white;
font-size: 14px;
text-decoration: none;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.legal-links a:hover {
text-decoration: underline;
}

/* ---------- ROTATE DEVICE ---------- */

#rotate-device {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: black;
color: white;
display: none;
justify-content: center;
align-items: center;
font-size: 28px;
text-align: center;
z-index: 100;
padding: 20px;
}

/* ---------- INFO OVERLAY ---------- */

#info-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.75);
display: flex;
justify-content: center;
align-items: center;
z-index: 120;
padding: 20px;
overflow: hidden;
}

#info-box {
position: relative;
width: 420px;
max-width: 90vw;
max-height: 85vh;
overflow-y: auto;
background: white;
color: black;
border-radius: 12px;
padding: 25px;
}

#close-info-btn {
position: sticky;
top: 0;
float: right;
width: 36px;
height: 36px;
border: none;
border-radius: 50%;
background: #ffcc00;
font-weight: bold;
cursor: pointer;
z-index: 2;
}

/* ---------- HIDDEN ---------- */

.d-none {
display: none !important;
}

/* ---------- TOUCH DEVICES ---------- */

@media (pointer: coarse) {
#mobile-controls {
display: flex;
}
}

@media (pointer: fine) {
#mobile-controls {
display: none;
}
}

/* ---------- TABLET ---------- */

@media (max-width: 1024px) {

html,
body {
width: 100%;
height: 100%;
overflow: hidden;
}

body {
background-image: none;
background-color: #000;
background-attachment: scroll;
}

.screen-wrapper {
width: 100%;
height: 100vh;
padding: 0;
justify-content: center;
align-items: center;
overflow: hidden;
}

#game-container {
width: 100%;
max-width: 100%;
height: 100%;
justify-content: center;
gap: 0;
overflow: hidden;
}

#game-container h1 {
display: none;
}

#game-container .canvas-wrapper {
width: min(100vw, calc(100vh * 1.5));
max-width: 100vw;
max-height: 100vh;
aspect-ratio: 3 / 2;
border-radius: 0;
border: none;
box-shadow: none;
overflow: hidden;
}

#game-container canvas {
width: 100%;
height: 100%;
display: block;
}

#mobile-controls {
bottom: 30px;
padding: 0 20px;
}

.mobile-btn {
width: 58px;
height: 58px;
font-size: 13px;
}

#mute-btn {
width: 50px;
height: 50px;
font-size: 22px;
top: 8px;
right: 8px;
}

.pause-box {
width: calc(100% - 32px);
max-width: 340px;
padding: 24px 18px;
}

.pause-box h2 {
font-size: 26px;
}

.pause-box .start-btn {
width: 100%;
font-size: 18px;
padding: 12px 20px;
}
}

/* ---------- MOBILE START / END SCREENS ---------- */

@media (max-width: 760px) {

#startscreen,
#game-over-screen,
#you-win-screen,
.end-screen {
width: 100%;
max-width: 100%;
overflow: hidden;
}

#startscreen img,
.end-screen img {
border-radius: 0;
}

#startscreen .start-btn {
bottom: 54px;
min-width: 180px;
padding: 12px 24px;
font-size: 18px;
}

.info-btn {
bottom: 54px;
right: 14px;
padding: 10px 16px;
font-size: 15px;
}

.sound-btn {
bottom: 54px;
left: 14px;
padding: 10px 16px;
font-size: 15px;
}

.end-screen-buttons {
bottom: 20px;
gap: 10px;
}

.end-screen-buttons .start-btn {
padding: 10px 20px;
font-size: 16px;
border-radius: 6px;
}
}

/* ---------- SMALL MOBILE ---------- */

@media (max-width: 480px) {

.start-btn {
padding: 10px 22px;
font-size: 16px;
}

#startscreen .start-btn {
bottom: 52px;
min-width: 160px;
}

.info-btn {
bottom: 52px;
right: 10px;
padding: 8px 12px;
font-size: 13px;
}

.sound-btn {
bottom: 52px;
left: 10px;
padding: 8px 12px;
font-size: 13px;
}

#mobile-controls {
bottom: 24px;
padding: 0 14px;
}

.mobile-left,
.mobile-right {
gap: 10px;
}

.legal-links a {
font-size: 13px;
}

.mobile-btn {
width: 52px;
height: 52px;
font-size: 12px;
}

#mute-btn {
width: 46px;
height: 46px;
font-size: 20px;
top: 8px;
right: 8px;
}
}

/* ---------- KLEINE LANDSCAPE GERÄTE ---------- */

@media (max-width: 760px) and (max-height: 430px) and (orientation: landscape) {

.screen-wrapper {
height: 100vh;
padding: 0;
}

#startscreen,
#game-over-screen,
#you-win-screen {
width: 100%;
max-width: 100%;
height: 100vh;
max-height: 100vh;
}

#startscreen img {
width: 100%;
height: 100%;
object-fit: cover;
}

.end-screen {
display: flex;
justify-content: center;
align-items: center;
}

.end-screen img {
width: 100%;
height: 100%;
object-fit: contain;
}

#startscreen .start-btn {
bottom: 82px;
min-width: 150px;
padding: 9px 18px;
font-size: 14px;
}

.info-btn {
bottom: 82px;
right: 12px;
padding: 8px 12px;
font-size: 12px;
}

.sound-btn {
bottom: 82px;
left: 12px;
padding: 8px 12px;
font-size: 12px;
}

.end-screen-buttons {
bottom: 26px;
gap: 10px;
z-index: 25;
}

.end-screen-buttons .start-btn {
padding: 8px 16px;
font-size: 13px;
min-width: 100px;
}

.legal-links {
position: absolute;
left: 0;
right: 0;
bottom: 6px;
height: auto;
gap: 14px;
z-index: 20;
}

.legal-links a {
font-size: 11px;
line-height: 1;
}

#game-container {
height: 100vh;
}

#game-container .canvas-wrapper {
width: min(100vw, calc(100vh * 1.5));
height: auto;
max-width: 100vw;
max-height: 100vh;
aspect-ratio: 3 / 2;
}

#mobile-controls {
bottom: 14px;
padding: 0 10px;
}

.mobile-btn {
width: 46px;
height: 46px;
font-size: 11px;
}

#mute-btn {
top: 8px;
right: 8px;
width: 40px;
height: 40px;
font-size: 18px;
}

#info-overlay {
padding: 8px;
align-items: center;
}

#info-box {
width: 92vw;
max-width: 92vw;
max-height: 88vh;
padding: 14px 16px 16px 16px;
border-radius: 8px;
font-size: 14px;
line-height: 1.35;
}

#info-box h2 {
margin: 0 0 10px 0;
font-size: 20px;
}

#info-box p {
margin: 0 0 8px 0;
}

#close-info-btn {
width: 32px;
height: 32px;
font-size: 14px;
margin-bottom: 8px;
}
}

/* ---------- PORTRAIT BLOCK ---------- */

@media (max-width: 760px) and (orientation: portrait) {

#rotate-device {
display: flex;
}

.legal-links {
display: none;
}
}

/* ---------- ANIMATIONS ---------- */

@keyframes fadeInGame {
from {
opacity: 0;
transform: scale(0.96);
}

to {
opacity: 1;
transform: scale(1);
}
}

@keyframes pulseGame {
0% {
transform: translateX(-50%) scale(1);
}

50% {
transform: translateX(-50%) scale(1.06);
}

100% {
transform: translateX(-50%) scale(1);
}
}