html{
    background-color: #05060b;
}

*{
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body{
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle, #1e1f29 0%, #11121a 100%);
    color: #f5f5f5;
}

header{
    text-align: center;
    padding: 2rem 1rem;
}

.back-link{
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    padding: 0.45rem 1.15rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(120deg, rgba(90, 200, 250, 0.18), rgba(90, 200, 250, 0.05));
    color: #d7f2ff;
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible{
    border-color: rgba(90, 200, 250, 0.5);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

header h1{
    margin: 0;
    font-size: clamp(2rem, 5vw, 3rem);
}

header p{
    margin: 0.5rem 0 0;
    color: #b0b5c0;
}

main{
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.calc{
    width: min(90vw, 360px);
    background: #0f1018;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calc_display{
    background: #1b1c27;
    border-radius: 1rem;
    padding: 1rem;
    text-align: right;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.calc_expression{
    font-size: 0.95rem;
    color: #7f8597;
    min-height: 1.2em;
    overflow: hidden;
}

.calc_display input{
    background: transparent;
    border: none;
    color: #f7f7f7;
    font-size: 2.5rem;
    text-align: right;
    width: 100%;
    outline: none;
}

.calc_keys{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.key{
    border: none;
    border-radius: 0.8rem;
    padding: 0.9rem;
    font-size: 1.25rem;
    color: #f5f5f5;
    background: #2a2c3d;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s;
}

.key:active{
    transform: translateY(2px);
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25);
}

.key:focus-visible{
    outline: 2px solid #5ac8fa;
    outline-offset: 2px;
}

.key--operator{
    background: #ff8f1f;
    color: #11121a;
}

.key--equal{
    background: #5ac8fa;
    color: #0f1018;
    font-weight: 600;
}

.key--function{
    background: #3a3d52;
    color: #e0e2ec;
}

.key--zero{
    grid-column: span 2;
}

footer{
    text-align: center;
    padding: 1rem;
    color: #7f8597;
}
