*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root{
    --bg: #111318;
    --panel: #181b22;
    --card: #f7f8fb;
    --text: #111318;
    --light: #ffffff;
    --muted: #8a93a3;
    --line: rgba(255, 255, 255, 0.13);
    --line-dark: rgba(17, 19, 24, 0.12);
    --operator: #ff7a1a;
    --operator-dark: #d85f08;
    --accent: #39d0c5;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
    --radius: 8px;
}

body{
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 18% 18%, rgba(57, 208, 197, 0.26), transparent 28%),
        radial-gradient(circle at 84% 78%, rgba(255, 122, 26, 0.22), transparent 28%),
        linear-gradient(135deg, #0b0d12 0%, #151923 100%);
    color: var(--light);
}

a{
    color: inherit;
}

.app-shell{
    width: min(1040px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(280px, 0.95fr) minmax(330px, 410px);
    gap: 28px;
    align-items: center;
    padding: 34px 0;
}

.intro-panel{
    position: relative;
    overflow: hidden;
    min-height: 560px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(57, 208, 197, 0.2), rgba(255, 122, 26, 0.12)),
        rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow);
}

.intro-panel::before{
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(180deg, black, transparent 84%);
}

.intro-panel::after{
    content: "";
    position: absolute;
    right: -80px;
    bottom: -80px;
    width: 270px;
    height: 270px;
    border: 42px solid rgba(255, 255, 255, 0.11);
    border-radius: 50%;
}

.intro-panel > *{
    position: relative;
    z-index: 1;
}

.back-link{
    width: fit-content;
    color: var(--light);
    text-decoration: none;
    font-weight: 900;
}

.back-link::before{
    content: "";
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 9px;
    background: var(--accent);
    box-shadow: 7px 7px 0 var(--operator);
}

.eyebrow{
    width: fit-content;
    margin-top: auto;
    margin-bottom: 12px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.intro-panel h1{
    max-width: 10ch;
    color: var(--light);
    font-size: clamp(3rem, 6vw, 5.4rem);
    line-height: 0.92;
    letter-spacing: 0;
}

.intro-panel p:last-child{
    max-width: 560px;
    margin-top: 18px;
    color: rgba(255, 255, 255, 0.74);
    font-weight: 600;
}

.calculator{
    width: 100%;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(247, 248, 251, 0.96);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    animation: calculatorIn 0.55s ease both;
}

.display{
    grid-column: 1 / -1;
    min-height: 142px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
    overflow: hidden;
    margin-bottom: 8px;
    padding: 18px;
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(57, 208, 197, 0.13), transparent),
        #111827;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.history{
    min-height: 22px;
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.9rem;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.screen{
    min-height: 50px;
    color: var(--light);
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 900;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn{
    min-height: 66px;
    border: 1px solid var(--line-dark);
    border-radius: var(--radius);
    background: white;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 1.2rem;
    font-weight: 900;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.btn:hover{
    transform: translateY(-2px);
    box-shadow: 0 12px 22px rgba(17, 19, 24, 0.12);
}

.btn:active{
    transform: translateY(0);
    box-shadow: none;
}

.utility{
    background: #eef2f7;
    color: #344054;
}

.operator{
    background: #fff3e9;
    color: var(--operator-dark);
}

.equals{
    grid-row: span 2;
    background: var(--operator);
    color: white;
}

.equals:hover{
    background: var(--operator-dark);
}

.zero{
    grid-column: span 2;
}

@keyframes calculatorIn{
    from{
        opacity: 0;
        transform: translateY(18px);
    }

    to{
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce){
    *,
    *::before,
    *::after{
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 850px){
    .app-shell{
        grid-template-columns: 1fr;
        padding: 24px 0;
    }

    .intro-panel{
        min-height: 340px;
    }

    .intro-panel h1{
        max-width: 12ch;
        font-size: clamp(2.7rem, 11vw, 4.4rem);
    }
}

@media (max-width: 460px){
    .app-shell{
        width: min(100% - 24px, 1040px);
    }

    .intro-panel,
    .calculator{
        padding: 16px;
    }

    .intro-panel{
        min-height: 310px;
    }

    .btn{
        min-height: 58px;
        font-size: 1.05rem;
    }

    .display{
        min-height: 124px;
    }
}
