*, *::before, *::after {
    box-sizing: border-box;
    font-family:  'Montserrat', sans-serif;
    font-weight: normal;
    color: aliceblue;
}

body {
    padding: 0;
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #23243a 0%, #181926 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
}

.main-app-container {
    display: flex;
    flex-direction: row;
    gap: 32px;
    width: 100vw;
    max-width: 100vw;
    justify-content: center;
    align-items: flex-start;
    margin-top: 40px;
}

.Calculator-grid {
    display: grid;
    justify-content: center;
    align-content: center;
    min-height: 60vh;
    grid-template-columns: repeat(4, minmax(60px, 1fr)); /* 4 columns for calculator layout */
    grid-template-rows: minmax(100px, auto) repeat(5, minmax(60px, 1fr));
    background: rgba(255, 255, 255, 0.10);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    padding: 20px 12px 24px 12px;
    border-radius: 28px;
    max-width: 420px;
    width: 95vw;
    margin: 0 auto;
    transition: box-shadow 0.3s;
}

.Calculator-grid > button {
    font-size: 1.5rem;
    padding: 0.7em 0;
    border-radius: 16px;
    margin: 4px;
    border: none;
    background: rgba(255,255,255,0.13);
    color: #222a35;
    font-weight: 600;
    box-shadow: 0 2px 8px 0 rgba(31,38,135,0.10);
    transition: background 0.2s, box-shadow 0.2s;
}

.Calculator-grid > button:active {
    background: rgba(255,255,255,0.25);
    box-shadow: 0 4px 16px 0 rgba(31,38,135,0.18);
}

.output {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.30);
    border-radius: 20px;
    box-shadow: 0 4px 32px 0 rgba(31, 38, 135, 0.12);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-direction: column;
    padding: 18px 12px;
    font-size: 1.1rem;
    margin-bottom: 12px;
    word-wrap: break-word;
    word-break: break-all;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

#clear-history-btn {
    background: rgba(255,255,255,0.18);
    color: #e0e6ed;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 12px;
    padding: 12px 0;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px 0 rgba(31,38,135,0.10);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.3s, box-shadow 0.3s, color 0.3s;
    margin-bottom: 12px;
    width: 100%;
}

#clear-history-btn:hover {
    background: rgba(255,255,255,0.28);
    color: #222a35;
    box-shadow: 0 4px 16px 0 rgba(31,38,135,0.18);
}

.history-panel {
    background: rgba(255,255,255,0.13);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31,38,135,0.18);
    border: 1.5px solid rgba(255,255,255,0.18);
    padding: 20px 16px;
    color: #fff;
    width: 320px;
    max-width: 90vw;
    margin: 0 auto 24px auto;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: max-height 0.4s, padding 0.4s;
    overflow: hidden;
}

.history-panel h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: #e0e6ed;
    letter-spacing: 1px;
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
}

#history-list li {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #e0e6ed;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 6px 10px;
    word-break: break-all;
}

#toggle-history-btn {
    display: none;
    margin: 0 auto 12px auto;
    background: rgba(255,255,255,0.22);
    color: #23243a;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.7rem;
    box-shadow: 0 4px 16px 0 rgba(31,38,135,0.18);
    cursor: pointer;
    transition: background 0.3s;
    position: static;
}

#toggle-history-btn:active {
    background: rgba(255,255,255,0.32);
}

@media (max-width: 900px) {
    .main-app-container {
        flex-direction: column;
        align-items: center;
        gap: 0;
        margin-top: 16px;
    }
    .history-panel {
        width: 98vw;
        max-width: 98vw;
        margin: 0 0 16px 0;
    }
    .Calculator-grid {
        margin-left: 0;
        width: 98vw;
        max-width: 98vw;
    }
}

@media (max-width: 600px) {
    .main-app-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-top: 0;
    }
    .history-panel {
        max-height: 0;
        padding: 0 16px;
        margin-bottom: 0;
    }
    .history-panel.open {
        max-height: 400px;
        padding: 20px 16px;
        margin-bottom: 16px;
    }
#toggle-history-btn {
    display: none;
    margin: 12px auto 12px auto;
    background: rgba(255,255,255,0.22);
    color: #23243a;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.7rem;
    box-shadow: 0 4px 16px 0 rgba(31,38,135,0.18);
    cursor: pointer;
    transition: background 0.3s;
    position: static;
    display: flex;                /* Add flexbox */
    align-items: center;          /* Center vertically */
    justify-content: center;      /* Center horizontally */
    padding: 0;                   /* Remove default padding */
}

.clock-icon {
    width: 28px;                  /* Adjust as needed */
    height: 28px;
    display: block;
    margin: 0;
    padding: 0;
}

}

@media (max-width: 500px) {
    .Calculator-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 columns for calculator layout */
        grid-template-rows: minmax(60px, auto) repeat(5, minmax(40px, 1fr));
        padding: 8px;
        max-width: 100vw;
    }
    .output {
        font-size: 0.95rem;
        padding: 8px;
    }
    .history-panel {
        font-size: 0.95rem;
    }
    #clear-history-btn {
        font-size: 0.9rem;
        padding: 8px 0;
    }
    .Calculator-grid > button {
        font-size: 1.1rem;
        padding: 0.3em 0;
    }
}