:root{
    --bg:#000;
    --yellow:#FFD400;
    --blue:#1E90FF;
    --white:#F7F7F8;
    --muted:#B5B5B6;
    --glass: rgba(255,255,255,0.03);
    --accent: linear-gradient(135deg,var(--yellow),var(--blue));
}

*{
    box-sizing:border-box;
}
      
html,body{
    height:100%;
    margin:0;
    background:var(--bg);
    color:var(--white);
    font-family:Inter,system-ui,Arial; -webkit-font-smoothing:antialiased;
}

.wrap{
    max-width:980px;
    margin:28px auto;
    padding:20px;
}
      
.panel{
    display:grid;
    grid-template-columns:1fr 320px;
    gap:20px;
}

@media (max-width:900px){
    .panel{
        grid-template-columns:1fr;
    }
}

.calculator{
    background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border:1px solid rgba(255,255,255,0.03);
    padding:18px;border-radius:12px;
}

/* Display */
#cal-name {
    margin: 0 0 12px 0; 
    color: var(--yellow);
}

.spacer {
    display: flex; 
    gap: 8px; 
    align-items: center;
}

.top-ctrl {
    display: flex; 
    gap: 8px; 
    margin-bottom: 10px;
}
.display{
    background:rgba(0,0,0,0.45);
    padding:14px;
    border-radius:10px;
    color:var(--white);
    display:flex;
    flex-direction:column;
    gap:8px;
    margin-bottom:12px;
}

.expr{
    font-size:18px;
    color:var(--muted);
    min-height:28px;
    word-break:break-all;
}
      
.result{
    font-size:28px;
    font-weight:700;
    color:var(--yellow);
    min-height:36px;display:flex;
    align-items:center;
    justify-content:space-between;
}
      
.small-btn{
    background:transparent;
    border:1px solid rgba(255,255,255,0.04);
    padding:6px 10px;
    border-radius:8px;
    color:var(--muted);
    font-weight:600;
}

.opts-hist {
    display: flex; 
    gap: 8px; 
    align-items: center;
}

.input-label {
    font-size: 13px; color: var(--muted)
}

.last-result-sec {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.last-result {
    font-size: 13px; 
    color: var(--muted)
}

#last {
    font-weight: 700; 
    color: var(--yellow)
}

.hist-title, .mode-title {
    font-weight: 700; color: var(--muted)
}

.hist-btn {
    display: flex; 
    gap: 8px
}

/* keypad */
.keys{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:10px;
}
.btn{
    padding:14px;
    border-radius:10px;
    border:0;
    background:var(--glass);
    color:var(--white);
    font-weight:700;
    font-size:16px;
    cursor:pointer;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.4);
}
.btn.op{
    background:linear-gradient(180deg, rgba(30,144,255,0.12), rgba(30,144,255,0.05));
    color:var(--blue);
}
.btn.eq{
    background:var(--yellow);
    color:#000;
    grid-column:span 1;
}
.btn.func{
    background:rgba(255,255,255,0.02);
    color:var(--muted);
}
.btn.wide{
    grid-column:span 2;
}

/* right column - history & options */
.right{
    background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border:1px solid rgba(255,255,255,0.03);
    padding:14px;
    border-radius:12px;
    height:100%;
    display:flex;
    flex-direction:column;
    gap:12px;
}

.opts{
    display:flex;gap:8px;
    align-items:center;
    justify-content:space-between;
}

.toggle{
    display:inline-flex;
    align-items:center;
    gap:8px;background:rgba(255,255,255,0.02);
    padding:8px;
    border-radius:10px;
}

.history{
    overflow:auto;
    flex:1;
    border-radius:8px;
    padding:6px;
    background:rgba(0,0,0,0.35);
}

.hist-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:8px;
    border-radius:8px;
    margin-bottom:6px;
    background:rgba(255,255,255,0.01);
}

.hist-val{
    color:var(--white);
    font-weight:600;
}

.hist-exp{
    color:var(--muted);
    font-size:13px;
}

.copy-btn{
    background:var(--blue);
    color:#fff;
    padding:6px 8px;
    border-radius:6px;
    border:0;
    cursor:pointer;
}

/* footer */
.footer{
    margin-top:14px;
    color:var(--muted);
    font-size:13px;
    text-align:center;
}

/* focus */
.btn:active{
    transform:translateY(1px);
}
input{
    background:transparent;
    border:0;
    color:var(--white);
}
.kbd-hint{
    color:var(--muted);
    font-size:13px;
}