* {
    box-sizing: border-box;
} 

:root {
    --player-size: clamp(36px, 7.5vw, 72px);
    --court-side-space: calc(var(--player-size) * 1.35);
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #719a6d;
    color: white;
    overflow: auto;
}

.app {
    height: 100dvh;
    display: grid;
    grid-template-rows: 1fr 90px;
}

.court-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 0;
    overflow: auto;
}

.court-wrapper {
    position: relative;
    width: min(calc(100vw - (var(--court-side-space) * 2) - 32px), calc((100dvh - 122px) / 2));
    aspect-ratio: 1 / 2;
    min-width: 150px;
}

.court {
    position: absolute;
    inset: 2% 0;
    background: #dea35d;
    border: 4px solid white;
}

.center-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    background: white;
    transform: translateY(-50%);
}

.attack-line-top {
    position: absolute;
    left: 0;
    right: 0;
    top: 33.333%;
    height: 4px;
    background: white;
}

.attack-line-bottom {
    position: absolute;
    left: 0;
    right: 0;
    top: 66.666%;
    height: 4px;
    background: white;
}

.position {
    position: absolute;
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 400;
    transform: translate(-50%, -50%);
}

.p4 {
    left: 14%;
    top: 58%;
}

.p3 {
    left: 50%;
    top: 58%;
}

.p2 {
    left: 86%;
    top: 58%;
}

.p5 {
    left: 14%;
    top: 83%;
}

.p6 {
    left: 50%;
    top: 83%;
}

.p1 {
    left: 86%;
    top: 83%;
}

.p7 {
    left: calc(var(--player-size) * -1.70);
    top: 69%;
}

.player {
    position: absolute;
    cursor: grab;
    touch-action: none;
    transform: translate(-50%, -50%);
    text-align: center;

    transition: left 0.5s ease, top 0.5s ease;
}

.player.arrastrando {
    cursor: grabbing;
    transition: none;
    z-index: 10;
}

.player-circle {
    width: var(--player-size);
    height: var(--player-size);

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: white;
    color: #333;

    font-weight: bold;
    font-size: clamp(11px, 2vw, 18px);

    border: 3px solid #333;
}

.player span {
    display: block;
    margin-top: clamp(2px, 0.8vw, 5px);

    font-size: clamp(9px, 1.5vw, 14px);
    color: white;
}

.mark {
    position: absolute;
    width: 15%;
    border-top: 4px dotted white;
}

.mark.left {
    right: 102%;
}

.mark.right {
    left: 102%;
}

.mark.net {
    top: 50%;
}

.mark.attack {
    top: 66.666%;
}

.corner-mark.tl {
    left: 0;
    top: 0;
}

.corner-mark.tr {
    right: 0;
    top: 0;
}

.corner-mark.bl {
    left: 0;
    bottom: 0;
}

.corner-mark.br {
    right: 0;
    bottom: 0;
}

.submenu {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(30, 50, 30, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.submenu button {
    flex: 1;
    max-width: 160px;
    padding: 12px 8px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.submenu button.active {
    background: #dea35d;
    color: #222;
}

.submenu button:hover {
    background: rgba(255, 255, 255, 0.22);
}

@media (orientation: landscape) and (max-height: 600px) {

    :root {
        --player-size: clamp(32px, 8vh, 52px);
    }

    .app {
        grid-template-rows: 1fr 64px;
    }

    .court-area {
        padding: 8px;
    }

    .court-wrapper {
        width: min(calc(100vw - (var(--court-side-space) * 2) - 24px), calc((100dvh - 80px) / 2));
    }

    .submenu button {
        padding: 8px;
    }
}

