@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap");

:root {
  --f: rgb(250, 251, 212);
  --f-t: rgba(250, 251, 212, 0.5);
  --f-e: rgb(0, 0, 0);
  --bg: rgb(6, 39, 67);
  --e:  rgb(178, 62, 62);
  --bt-bg: rgb(106, 116, 192);
  --bt-bg-c: rgb(17, 63, 103);
  --bt-bg-2: rgb(56, 89, 139);
  --bt-bg-3: rgb(178, 235, 249);
  --bt-bg-3-h: rgb(174, 161, 234);
  --bt-bg-3-c: rgb(140, 84, 161);
}

* {
  font-family: 'Roboto', Arial, Helvetica, sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg);
  gap: 15px;
  flex-wrap: wrap;
}

.credits-section {
  width: 100%;
  text-align: center;
}

.credits-section > h3 {
  color: var(--f);
}

.credits-section > h3 > a {
  color: var(--f-t);
  text-decoration: underline;
}

.credits-section > h3 > a:hover {
  color: var(--f);
}


.body {
  width: 50%;
}

.display-area {
  width: 100%;
  display: flex;
  justify-content: end;
  flex-wrap: wrap;
  margin: 1rem 0;
}

input {
  text-align: end;
  width: 100%;
  background-color: transparent;
  border: none;
  color: var(--f);
  font-size: xx-large;
  margin: 0px 10px;
}

input:invalid {
  color: var(--e);
}

input:focus {
  border: none;
  outline: none;
}

.error {
  min-height: 32px;
  font-size: x-large;
  color: var(--e);
  margin: 0;
}

#history {
  color: var(--f-t);
  font-size: larger;
}

.btn-area {
  display: grid;
  grid-gap: 0.15rem;
  grid-template-columns: auto auto auto auto;
  grid-template-rows: auto auto auto auto auto;
}

.reset {
  grid-area: 1 / span 2;
}

.btn {
  padding: 1rem;
  color: var(--f);
  border: 0.25rem solid transparent;
  border-radius: 1rem;
  font-size: large;
}

.btn-1 {
  background-color: var(--bt-bg);
}

.btn-1:hover {
  background-color: var(--bt-bg-2);
}

.btn-1:active {
  background-color: var(--bt-bg-c);
}

.btn-2 {
  background-color: var(--bt-bg-2);
}

.btn-2:hover {
  background-color: var(--bt-bg);
}

.btn-2:active {
  background-color: var(--bt-bg-2);
}

.btn-3 {
  color: var(--f-e);
  background-color: var(--bt-bg-3);
}

.btn-3:hover {
  background-color: var(--bt-bg-3-h);
}

.btn-3:active {
  background-color: var(--bt-bg-3-c);
}

.erase {
  grid-row: 1;
  grid-column: 3;
}

.calc {
  grid-column: 4;
}

.add {
  grid-row: 1;
}

.sub {
  grid-row: 2;
}

.mul {
  grid-row: 3;
}

.div {
  grid-row: 4;
}

.result {
  grid-column: 4;
  grid-row: 5;
}

.long {
  grid-column: span 3;
}

.history-section.hidden {
  width: 0;
  visibility: hidden;
}

.history-section {
  width: 20%;
  transition: all .30s ease-in-out;
}

.history-list {
  height: 415px;
  overflow-y: scroll;
}

.history-reset {
  text-align: end;
}

.history-item {
  text-align: end;
  padding: 10px 20px;
  margin: 5px 0px;
  transition: .25s all;
}

.history-item > h2, .history-item > h3, .history-list > p {
  margin: 5px 0px;
  font-weight: 400;
}

.history-list > p {
  margin: 35px 15px;
}

.history-item > h2, .history-list > p, .history-btn {
  color: var(--f);
}

.history-item > h3 {
  color: var(--f-t)
}

.history-btn {
  background: none;
  border: none;
  font-size: xx-large;
  margin: 10px;
  padding: 5px 5px 0px 5px;
  transition: .25s all;
}

.history-btn:hover, .history-item:hover  {
  background-color: var(--bt-bg-c);
  border-radius: 5px;
}

@media screen and (max-width : 500px) {
  body {
    flex-wrap: wrap;
    overflow: hidden;
  }
  .body {
    width: 100%;
  }
  .history-section.hidden {
    height: 0;
    width: 100%;
    transform: translateY(600px);
  }
  .history-section {
    background-color: var(--bg);
    position: absolute;
    top: 180px;
    width: 100%;
    height: 600px;
    border-top: 1px solid var(--bt-bg-c);
    transform: translateY(0);
    border-radius: 15px;
  }
  .history-list {
    margin-top: 15px;
    max-height: 300px;
  }
}