:root{
  --bg: #ececec;
  --panel: #f3f3f3;
  --key: #dcdcdc;
  --key2:#cfcfcf;
  --op:#bdbdbd;
  --text:#1f1f1f;
  --shadow: rgba(0,0,0,.12);
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg), #e6e6e6);
  color: var(--text);
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
}

.app{ width:min(520px, 100%); }

.calculator{
  background: var(--panel);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  box-shadow: 0 10px 30px var(--shadow);
  padding: 16px;
}

.logo{
  width: 70px;
  height: auto;
  border-radius: 90px;
  display: grid;
  place-items: center;
  display: block;
}

.display{
  background: #e9e9e9;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.08);
  padding: 12px 12px;
  min-height: 92px;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.exprWrap{ position: relative; }
.expr{
  font-size: 18px;
  line-height: 1.2;
  color: #2b2b2b;
  min-height: 26px;
  word-break: break-word;
  text-align: right;
  padding-left: 4px;
  white-space: pre-wrap;
}

.caret{
  display:inline-block;
  width: 2px;
  height: 1.2em;
  background: #2b2b2b;
  transform: translateY(2px);
  animation: blink 1s steps(2, end) infinite;
  margin: 0 1px;
  vertical-align: baseline;
}

@keyframes blink{
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.result{
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  min-height: 36px;
  word-break: break-word;
  text-align: right;
  padding-left: 4px;
}

.keys{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items:stretch;
}

.key{
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  background: var(--key);
  color: var(--text);
  padding: 14px 10px;
  font-size: 18px;
  font-weight: 700;
  cursor:pointer;
  user-select:none;
  transition: transform .04s ease, background .15s ease;
}

.key:active{ transform: translateY(1px); }
.key:focus{ outline: 3px solid rgba(0,0,0,.15); outline-offset: 2px; }

.key.op{ background: var(--op); }
.key.num{ background: var(--key2); }

.equal{
  grid-column: 1 / -1;
  background: #b0b0b0;
  font-size: 22px;
}

.hint{
  margin-top: 12px;
  font-size: 13px;
  color: rgba(0,0,0,.6);
}
