/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: whitesmoke;
    overflow-x: hidden;
    min-height: 100vh;
}

/* === Container === */
.frame {
    position: relative;
    min-height: 100vh;
    width: 100%;
    text-align: center;
    padding: clamp(10px, 2vw, 20px);
}

/* === MENU SCREEN === */
.menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: clamp(20px, 4vw, 40px);
    animation: fadeIn 0.5s ease-in;
}

.logo {
    margin-bottom: clamp(30px, 6vh, 60px);
}

.logo img {
    max-width: min(300px, 70vw);
    height: auto;
}

.menuBtn {
    background-color: #a2b9c2;
    color: whitesmoke;
    border: none;
    border-radius: 20px;
    font-family: 'Roboto', sans-serif;
    font-size: clamp(1.2rem, 3vw + 0.5rem, 2.5rem);
    font-weight: 900;
    padding: clamp(12px, 2vh, 20px) clamp(25px, 5vw, 50px);
    margin-bottom: clamp(15px, 2vh, 25px);
    width: min(400px, 85vw);
    cursor: pointer;
    transition: all 0.3s ease;
}

.menuBtn:hover {
    background-color: #7c8f96;
    transform: translateY(-2px);
}

.menuBtn:active {
    transform: translateY(2px);
}

/* === MAIN INTERFACE === */
.mainInterface {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: clamp(10px, 2vw, 20px);
    transition: opacity 0.3s ease-in;
}

.mainInterface.visible {
    visibility: visible;
    opacity: 1;
}

/* === HEADER === */
.header {
    background-color: #ccd8dd;
    border-radius: 15px;
    padd22g: clamp(15px, 2.5vh, 25px) clamp(10px, 2vw, 20px);
    margin-bottom: clamp(20px, 3vh, 40px);
    width: 100%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
}

.header.compact {
    height: 55px;
    padding: clamp(8px, 1.5vh, 12px) clamp(8px, 1.5vw, 12px);
    margin-bottom: clamp(0px, 1.5vh, 15px);
}

/* Stats display */
.header > span {
    display: inline-block;
    font-size: clamp(0.75rem, 1.5vw + 0.3rem, 1.2rem);
    font-weight: bold;
    color: #698e9c;
    margin: clamp(3px, 0.5vh, 8px) clamp(5px, 1vw, 15px);
    white-space: nowrap;
    transition: all 0.3s ease;
}

.header.compact > span {
    font-size: clamp(0.65rem, 1.2vw + 0.2rem, 0.9rem);
    margin: clamp(2px, 0.3vh, 4px) clamp(3px, 0.7vw, 8px);
}

.score, .good, .wrong, .level, .timer {
    display: inline-block;
}

/* === OPERATION BUTTONS (+, -, ×) === */
.btnHeaderGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 1.5vw, 20px);
    max-width: min(600px, 220vw);
    margin: clamp(15px, 2vh, 25px) auto;
    padding: 0 clamp(5px, 1vw, 10px);
}

.btnPSM {
    background-color: #f9c675;
    color: whitesmoke;
    border: none;
    border-radius: 10px;
    font-family: 'Roboto', sans-serif;
    font-size: clamp(1rem, 2vw + 0.2rem, 1.5rem);
    font-weight: 600;
    padding: clamp(6px, 1vh, 10px);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
}

.btnPSM.inactive {
    background-color: #bfbfbf;
}

.btnPSM:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.btnPSM:active {
    transform: scale(0.98);
}

/* === START BUTTON === */
.startBTN {
    background-color: #a2b9c2;
    color: whitesmoke;
    border: none;
    border-radius: 20px;
    font-family: 'Roboto', sans-serif;
    font-size: clamp(1.1rem, 2vw + 0.4rem, 1.8rem);
    font-weight: 600;
    padding: clamp(12px, 2vh, 18px) clamp(25px, 5vw, 50px);
    margin: clamp(10px, 2vh, 20px) auto;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    max-width: 300px;
}

.startBTN:hover {
    background-color: #7c8f96;
}

.startBTN:active {
    transform: translateY(3px);
}

/* === CALCULATION DISPLAY === */
.calc {
    display: inline-block;
    font-size: clamp(1.8rem, 4vw + 0.8rem, 3.5rem);
    font-weight: 600;
    color: #698e9c;
    margin: clamp(20px, 4vh, 40px) clamp(10px, 2vw, 20px);
    text-align: center;
    transition: all 0.3s ease;
}

.calc.compact {
    font-size: clamp(1.4rem, 3vw + 0.5rem, 2.5rem);
    margin: clamp(10px, 2vh, 20px) clamp(5px, 1vw, 10px);
}

.resultatInput {
    display: inline-block;
    min-width: clamp(80px, 12vw, 150px);
    font-size: clamp(1.8rem, 4vw + 0.8rem, 3.5rem);
    font-weight: 600;
    color: #698e9c;
    text-align: center;
    border-bottom: 3px solid #698e9c;
    padding: clamp(3px, 0.5vh, 8px);
    margin-left: clamp(5px, 1vw, 15px);
    transition: all 0.3s ease;
}

.resultatInput.compact {
    font-size: clamp(1.4rem, 3vw + 0.5rem, 2.5rem);
    border-bottom-width: 2px;
    padding: clamp(2px, 0.3vh, 5px);
}

/* === NUMBER PAD === */
.btnGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(6px, 1.2vw, 12px);
    max-width: min(700px, 200vw);
    margin: clamp(20px, 4vh, 40px) auto;
    padding: clamp(10px, 2vw, 20px);
}

.btn {
    background-color: #a2b9c2;
    color: whitesmoke;
    border: none;
    border-radius: 10px;
    font-family: 'Roboto', sans-serif;
    font-size: clamp(1.2rem, 2.5vw + 0.3rem, 2rem);
    font-weight: 900;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
}

.btn:hover {
    background-color: #7c8f96;
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.95);
}

.btn i {
    font-size: clamp(1rem, 2vw + 0.2rem, 1.6rem);
}

/* === FOOTER === */
.footer {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #4b7b8e;
    font-size: clamp(0.65rem, 1.2vw, 0.9rem);
    text-align: center;
    padding: 8px;
    max-width: 90vw;
}

.footer a {
    color: #698e9c;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* === Extra Small Mobile (320px - 374px) === */
@media screen and (max-width: 374px) {
    .header > span {
        font-size: 0.7rem;
        margin: 2px 3px;
    }
    
    .btnGrid {
        gap: 3px;
        padding: 5px;
        max-width: 240px;
    }
    
    .btn {
        min-height: 40px;
        font-size: 1.2rem;
    }
    
    .btnHeaderGrid {
        max-width: 240px;
    }
    
    .btnPSM {
        min-height: 35px;
    }
}

/* === Small Mobile (375px - 480px) === */
@media screen and (min-width: 375px) and (max-width: 480px) {
    .btnGrid {
        max-width: 260px;
    }
    
    .btnHeaderGrid {
        max-width: 260px;
    }
    
    .calc, .resultatInput {
        display: block;
        margin: 15px auto;
    }
}

/* === Mobile Landscape (481px - 767px) === */
@media screen and (min-width: 481px) and (max-width: 767px) {
    .header {
        padding: 20px 15px;
    }
    
    .btnGrid {
        max-width: 280px;
        gap: 6px;
    }
    
    .btnHeaderGrid {
        max-width: 320px;
    }
}

/* === Tablet Portrait (768px - 1023px) === */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .frame {
        padding: 30px;
    }
    
    .header {
        padding: 25px 20px;
    }
    
    .btnGrid {
        max-width: 300px;
        gap: 8px;
    }
    
    .btnHeaderGrid {
        max-width: 350px;
    }
    
    .calc, .resultatInput {
        display: inline-block;
    }
}

/* === Tablet Landscape / Small Desktop (1024px - 1279px) === */
@media screen and (min-width: 1024px) and (max-width: 1279px) {
    .frame {
        padding: 40px;
    }
    
    .header {
        padding: 25px;
        max-width: 900px;
    }
    
    .btnGrid {
        max-width: 320px;
        gap: 8px;
    }
    
    .btnHeaderGrid {
        max-width: 360px;
    }
    
    .menuBtn {
        width: 420px;
    }
}

/* === Desktop (1280px - 1919px) === */
@media screen and (min-width: 1280px) and (max-width: 1919px) {
    .header {
        max-width: 1000px;
    }
    
    .btnGrid {
        max-width: 320px;
        gap: 8px;
    }
    
    .btnHeaderGrid {
        max-width: 380px;
        gap: 15px;
    }
}

/* === Large Desktop / 4K (1920px+) === */
@media screen and (min-width: 1920px) {
    .header {
        max-width: 1200px;
    }
    
    .btnGrid {
        max-width: 360px;
        gap: 10px;
    }
    
    .btnHeaderGrid {
        max-width: 400px;
    }
    
    .menuBtn {
        width: 500px;
        font-size: 2.8rem;
    }
}

/* === Landscape Mode Optimization === */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .menu {
        padding: 15px;
    }
    
    .menuBtn {
        margin-bottom: 10px;
        padding: 10px 30px;
    }
    
    .logo {
        margin-bottom: 15px;
    }
    
    .logo img {
        max-width: 200px;
    }
    
    .header {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .btnGrid {
        margin: 15px auto;
        padding: 10px;
    }
    
    .footer {
        display: none;
    }
}

/* === Print Styles === */
@media print {
    .menuBtn, .btn, .btnPSM, .startBTN {
        border: 1px solid #333;
    }
    
    .footer {
        position: relative;
        transform: none;
    }
}
