/* =========================
   GLOBAL
========================= */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #111;
    color: #fff;
}

/* =========================
   MENU
========================= */
.menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 420px;
    background: #222;
    padding: 18px;
    border-radius: 14px;
    z-index: 20;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.menu h2 {
    text-align: center;
    margin: 0 0 12px;
    font-size: 18px;
}

.menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* LABEL */
.menu-row label {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #ffd966;
}

/* SELECT */
.menu-row select {
    flex: 1;
    padding: 8px 12px;
    font-size: 15px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #2e7d32, #43a047);
    color: #fff;
    cursor: pointer;
    outline: none;
}

.menu-row select option {
    background: #1e1e1e;
    color: #fff;
}

.menu-row select:hover,
.menu-row select:focus {
    box-shadow: 0 0 0 2px rgba(144, 238, 144, 0.6);
}

/* TIME INPUTS */
.time-inputs {
    display: flex;
    gap: 5px;
    width: 100%;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.time-inputs input {
    flex: 1 1 calc(33.33% - 3.33px);
    min-width: 50px;
    padding: 8px;
    font-size: 16px;
    text-align: center;
    border-radius: 10px;
    border: none;
    background: #333;
    color: #fff;
    box-sizing: border-box;
}

.menu button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #1b5e20;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

/* =========================
   CONTROLS
========================= */
.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: #111;
}

.controls button {
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

/* =========================
   CLOCK CONTAINER
========================= */
.clock-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* =========================
   PLAYER PANELS
========================= */
.player {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: yellow;
}

.player.active {
    border: 5px solid #1b5e20;
    background: white;
}

/* =========================
   TIMER + MOVES
========================= */
.time {
    font-size: clamp(6vh, 12vw, 15vh);
    text-align: center;
    word-wrap: break-word;
}

.moves {
    margin-top: 10px;
    font-size: clamp(3.5vh, 4vw, 5vh);
}

.game-over {
    text-align: center;
    font-size: 3vh;
    font-weight: bold;
    color: red;
}

/* =========================
   PLAYER NAME
========================= */
.name {
    font-size: clamp(2.5vh, 3vw, 4vh);
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   OPPOSITE PLAYER (VERTICAL NORMAL VIEW)
========================= */
.player.opposite {
    transform: rotate(180deg);
}

/* =========================
   SIDE VIEW MODE (DESKTOP / LANDSCAPE)
========================= */
.clock-container.side-view {
    flex-direction: row;
    width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

.clock-container.side-view .player {
    flex: 1 1 50%;
    min-width: 0;
}

.clock-container.side-view .player.opposite {
    transform: none; /* same orientation for side-view */
}

.clock-container.side-view .controls {
    flex-direction: column;
    width: 80px;
    min-width: 80px;
    justify-content: center;
}
.clock-container.side-view .moves.p1-view-only,
	.clock-container.side-view .moves.p2-view-only {
		display: none;
	}

	
	

/* =========================
   MOBILE PORTRAIT FIX (STACKED, SIDE-VIEW ONLY)
========================= */
@media (max-width: 700px) and (orientation: portrait) {
    .clock-container.side-view {
        flex-direction: row;   /* stack players vertically in side-view */
        height: auto;             /* remove full viewport height */
        width: 100%;
        overflow: hidden;
    }

    .clock-container.side-view .player {
        width: 100%;
        flex: 0 1 auto;          /* shrink to content */
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 5px;            /* spacing inside player boxes */
        box-sizing: border-box;
    }

    /* Controls below stacked players */
    .clock-container.side-view .controls {
        width: 50%;
        flex-direction: column;
        justify-content: center;
        margin-top: 5px;
        padding: 2px;
        box-sizing: border-box;
    }

    /* Scale text to fit screen width */
    .clock-container.side-view .time {
		font-size: clamp(3vh, 7vw, 6vh); /* smaller min/max so it fits in one line */
		line-height: 1;
		text-align: center;
		white-space: nowrap;       /* prevent wrapping */
		overflow: hidden;          /* hide overflow if too long */
		text-overflow: ellipsis;   /* add ellipsis if still overflowing */
	}
	
	/* =========================
	   SIDE VIEW MOBILE - PRIMARY TIMER ONLY
	========================= */
	/* .clock-container.side-view .moves.p1-view-only,
	.clock-container.side-view .moves.p2-view-only {
		font-size: clamp(2vh, 6vw, 4vh); 
		line-height: 1;
		text-align: center;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	} */
	
	/*.clock-container.side-view .moves.p1-view-only,
	.clock-container.side-view .moves.p2-view-only {
		display: none;
	}*/
	
/* Hide timer and show message for side-view */
.clock-container.side-view .moves.p1-view-only,
.clock-container.side-view .moves.p2-view-only {
    color: transparent;      /* hide timer text */
    position: relative;      /* needed for ::after */
    display: block;          /* ensure block for full width */
    height: auto;            /* allow parent to expand */
    min-height: 4em;         /* enough height for message */
    overflow: visible;       /* allow wrapped text to be shown */
    text-align: center;
}

/* Add the message */
.clock-container.side-view .moves.p1-view-only::after,
.clock-container.side-view .moves.p2-view-only::after {
    content: "AUTOROTATE - Mobile - Settings";
    color: #ff0000;
    font-size: 20px;
    font-weight: bold;
    position: absolute;
    top: 0;                  /* start from top of parent */
    left: 50%;
    transform: translateX(-50%);
    white-space: normal;     /* allow wrapping */
    max-width: 95%;          /* wrap within parent */
    text-align: center;
    line-height: 1.2em;
}









	
	 

    .clock-container.side-view .moves {
        font-size: clamp(2.5vh, 6vw, 3.5vh);
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }

    .clock-container.side-view .name {
        font-size: clamp(2vh, 5vw, 3vh);
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }
}




/* =========================
   SMALL MOBILE ADJUSTMENTS
========================= */
@media (max-width: 600px) {
    .player.active {
        border: 3px solid #1b5e20;
    }

    .controls button {
        font-size: 14px;
        padding: 10px 14px;
    }

    .menu {
        transform: translate(-50%, -50%) scale(0.9);
    }
}
