@font-face {
    font-family: 'playwriteMX';
    src: url("./assets/fonts/playwriteMX.ttf");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: "playwriteMX", Arial, Helvetica, sans-serif;
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background-image: url(./assets/img/5_background/background\ desert.jpg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

.headline {
    font-size: 40px;
}

.rotate-device-message {
    max-width: 320px;
    padding: 24px;
    display: none;
    color: #111;
    text-align: center;
}

.rotate-device-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.rotate-device-text {
    text-align: center;
}

.rotate-device-text h2 {
    margin-bottom: 6px;
}

.rotate-phone-icon {
    width: 50px;
    height: 90px;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    box-shadow: 0 0 12px rgba(253, 223, 119, 0.45);
    position: relative;
    transform-origin: center center;
    animation: rotate-device 1.6s ease-in-out infinite;
}

.rotate-phone-icon::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 5px;
    right: 5px;
    bottom: 13px;
    border-radius: 4px;
    background: rgba(253, 223, 119, 0.2);
}

.rotate-phone-icon::after {
    content: "";
    width: 8px;
    height: 3px;
    background: #FDDF77;
    border-radius: 2px;
    position: absolute;
    left: 50%;
    bottom: 4px;
    transform: translateX(-50%);
}

@keyframes rotate-device {
    0% { transform: rotate(0deg); }
    35% { transform: rotate(0deg); }
    65% { transform: rotate(-90deg); }
    100% { transform: rotate(-90deg); }
}

.game-shell {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

canvas {
    display: block;
    aspect-ratio: 720 / 480;
    background-color: black;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.game-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    background-color: transparent;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px;
}

button {
    font-size: 20px;
    padding:  6px;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

button:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

button:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.pause-menu {
    position: relative;
}

.pause-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    z-index: 8;
}

.bannerIcon {
    height: 28px;
    fill: #FDDF77;
}

.help-panel {
    position: fixed;
    inset: 20% 10%;
    background: #fff;
    color: #111;
    border-radius: 12px;
    padding: 16px;
    z-index: 20;
}

.d-none {
    display: none;
}

.start-screen,
.endscreen-actions {
    position: absolute;
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.start-screen {
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 720 / 480;
    height: auto;
    overflow: hidden;
    justify-content: flex-start;
    padding: 20px;
}

.endscreen-actions {
    inset: 0;
    justify-content: flex-end;
    align-items: center;
    flex-direction: column;
    padding: 0 24px 28px;
    gap: 16px;
}

.start-screen.d-none,
.endscreen-actions.d-none {
    display: none;
}

.tutorials-dialog {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.tutorials-dialog.d-none {
    display: none;
}

.tutorials-content {
    width: 90%;
    max-width: 920px;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #FDDF77;
    border-radius: 12px;
    padding: 24px;
    color: #FDDF77;
    font-family: "playwriteMX", Arial, sans-serif;
    max-height: 85%;
    overflow-y: auto;
}

.tutorials-content h2 {
    margin-top: 0;
    margin-bottom: 16px;
    text-align: center;
    font-size: 24px;
    color: #FDDF77;
}

.tutorials-text {
    font-size: 20px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tutorials-text p {
    margin: 8px 0;
}

.tutorials-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.tutorials-text li {
    margin: 4px 0;
}

.tutorials-close-btn {
    display: block;
    margin: 0 auto;
    font-family: "playwriteMX", Arial, sans-serif;
    font-size: 16px;
    padding: 8px 24px;
    background-color: rgba(0, 0, 0, 0.55);
    color: #FDDF77;
    border: 2px solid #FDDF77;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.tutorials-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.75);
}

.start-screen-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

.start-screen-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 180px));
    justify-content: center;
    gap: 16px;
    align-items: center;
}

.start-screen-btn,
.overlay-action-btn {
    font-family: "playwriteMX", Arial, sans-serif;
    font-size: clamp(14px, 2.2vw, 20px);
    padding: 8px 16px;
    background-color: rgba(0, 0, 0, 0.55);
    color: #FDDF77;
    border: 2px solid #FDDF77;
    border-radius: 12px;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: background-color 0.15s;
}

.overlay-action-btn {
    width: 200px;
}

.start-screen-btn-left {
    justify-self: stretch;
}

.start-screen-btn-center {
    justify-self: stretch;
}

.start-screen-btn-right {
    justify-self: stretch;
}

.start-screen-btn {
    width: 100%;
}

.start-screen-btn:hover,
.overlay-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.75);
}

.touch-controls {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 6;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

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

.touch-group {
    display: flex;
    gap: 16px;
    pointer-events: auto;
}

.touch-btn {
    border-radius: 14px;
    background-color: rgba(0, 0, 0, 0.35);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.touch-icon {
    width: 40px;
    height: 40px;
    display: block;
    fill: #FDDF77;
}