/* ===== Reset & Variables ===== */
* { box-sizing: border-box; }
:root{
  --bg1:#000000;
  --bg2:#8B0000;
  --panel:#111214;
  --panel-2:#1a1c1f;
  --text:#f5f7fb;
  --muted:#a1a7b3;
  --accent:#e50914;   /* red */
  --accent-2:#ff3b30; /* brighter red */
  --btn:#2a2d32;
  --btn-hover:#3a3f46;
  --shadow: 0 18px 50px rgba(0,0,0,.55);
}

/* ===== Page Layout (center everything) ===== */
html, body { height: 100%; }
body{
  margin:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(255,0,0,.15), transparent 60%),
    radial-gradient(1000px 500px at 90% 90%, rgba(255,0,0,.12), transparent 60%),
    linear-gradient(135deg, var(--bg1), var(--bg2));
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Calculator Card ===== */
.calculator{
  width:min(92vw, 480px);         /* larger */
  padding:28px 24px;
  border-radius:22px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  gap:16px;
  border:1px solid rgba(255,255,255,.05);
}

/* ===== Display ===== */
.display input{
  width:100%;
  height:96px;                     /* taller display */
  border:none;
  outline:none;
  border-radius:14px;
  background:#1b1e22;
  padding:16px 18px;
  text-align:right;
  font-size:2.6rem;                /* bigger text */
  line-height:1;
  letter-spacing:.5px;
  color:var(--text);
  box-shadow: inset 0 6px 14px rgba(0,0,0,.55);
  transition: background .25s, transform .2s;
}

/* make disabled input keep our colors (Chrome/Safari) */
.display input:disabled{
  -webkit-text-fill-color: var(--text);
  opacity:1;
}

/* ===== Rows & Buttons ===== */
.row{
  display:flex;
  gap:12px;
}

button{
  -webkit-appearance:none;
  appearance:none;
  flex:1;
  height:78px;                     /* larger buttons */
  border:none;
  border-radius:14px;
  background:var(--btn);
  color:var(--text);
  font-size:1.6rem;
  font-weight:700;
  cursor:pointer;
  letter-spacing:.2px;
  transition: transform .08s ease, background .2s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 8px 18px rgba(0,0,0,.45);
}

button:hover{ background:var(--btn-hover); box-shadow: 0 0 18px rgba(229,9,20,.35); }
button:active{ transform: scale(.95); }

/* Operator buttons */
button.opr{
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color:#fff;
  box-shadow: 0 10px 20px rgba(229,9,20,.45), inset 0 -2px 0 rgba(0,0,0,.25);
}
button.opr:hover{ filter: brightness(1.05); }

/* Equal button */
#eqBtn{
  background: linear-gradient(180deg, #b90710, #8f070c);
  color:#fff;
  box-shadow: 0 12px 24px rgba(229,9,20,.55), inset 0 -2px 0 rgba(0,0,0,.25);
}
#eqBtn:hover{ filter: brightness(1.08); }

/* +/- button subtle variation */
#plusMinus{ background:#383c43; }

/* ===== Click/JS-driven animations ===== */
.button-click{ transform: scale(.9) !important; filter: brightness(.95); }

.new-result{ animation: flashResult .5s ease; }
.error-animation{ animation: shake .5s ease; }
.number-change{ animation: pulse .28s ease; }

@keyframes flashResult{
  0%{ background-color:#1b1e22; }
  45%{ background-color:#203126; }  /* deep green flash to signal success */
  100%{ background-color:#1b1e22; }
}
@keyframes shake{
  0%,100%{ transform: translateX(0); }
  20%,60%{ transform: translateX(-8px); }
  40%,80%{ transform: translateX(8px); }
}
@keyframes pulse{
  0%{ transform: scale(1); }
  50%{ transform: scale(1.07); }
  100%{ transform: scale(1); }
}

/* ===== Focus (keyboard users) ===== */
button:focus-visible, .display input:focus-visible{
  outline: 3px solid rgba(229,9,20,.85);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(229,9,20,.25);
}

/* ===== Small screens ===== */
@media (max-width: 380px){
  .calculator{ padding:20px 16px; border-radius:18px; }
  .display input{ height:84px; font-size:2.2rem; }
  button{ height:68px; font-size:1.4rem; border-radius:12px; }
}
