*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif, "Segoe MDL2 Assets", "Calculator Fluent Icons";
  height: 100%;
  font-size: 15px;
}

body {
  height: 100%;
  margin: 0;
  font-weight: 500;
  background-color: #202020;
  color: white;
}

.row {
  display: flex;
  flex-direction: row;
}

.fluid {
  width: 100%;
  height: 100%;
}

.fluid-x {
  width: 100%;
}

.fluid-yb6 {
  height: 16.66666666667%;
}

button {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
  background-color: transparent;
  border: none;
  color: white;
}

button.active {
  background-color: #404040 !important;
}

button:active {
  background-color: #404040 !important;
}

button:active,
button:focus {
  outline: none;
  border: none;
}

button:hover {
  outline: none;
  border: none;
  background-color: #404040;
}

button.disabled {
  opacity: 0.3;
}

button.disabled:hover,
button.disabled:active,
button.disabled:focus {
  background-color: transparent;
}

.container {
  width: 100%;
  height: 100%;
  min-height: 300px;
  margin: 0;
  padding: 0.5em;
  overflow: hidden;
  background-color: #202020;
}

#calc {
  width: 60%;
  height: 100%;
  float: left;
  user-select: none;
}

#sidebar {
  width: 40%;
  background-color: #202020;
  transition: all 0.2s ease-in-out;
}

/*Top Bar*/
#topbar {
  height: 5%;
}

#topbar button {
  padding: 1em;
  color: white;
}

#topbar .title {
  display: flex;
  align-items: center;
}

#topbar .title > div {
  padding: 0 0.5em;
  font-size: larger;
  font-weight: 450;
  color: white;
}

#topbar .history {
  display: none;
}

/*Display*/
#display {
  word-wrap: break-word;
  text-align: right;
  height: 20%;
  width: 100%;
  padding: 1.5em;
  background-color: #202020;
  color: white;
}

#display > #expression {
  font-weight: 300;
  color: #cccccc;
  font-size: 0.9em;
}

#display > #primary {
  user-select: text;
  font-size: 2.5em;
  font-weight: 400;
  color: white;
}

/*Memory Functions*/
#funcs {
  height: 7.5%;
}

#funcs .memory {
  display: none;
}

#funcs button {
  font-size: 0.75em;
  font-weight: 550;
  padding: 0.5em;
  width: 20%;
  color: white;
}

#funcs button:hover {
  background-color: #323232;
}

#funcs button.disabled:hover {
  background-color: transparent;
}

#funcs button:focus {
  background-color: transparent;
}

/*Input Buttons*/
#inp {
  height: 67.5%;
  background-color: #202020;
}

#inp button {
  font-family: "Calculator Fluent Icons", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif, "Segoe MDL2 Assets";
  font-weight: 400;
  font-size: 1em;
  border: 1.5px solid #202020;
  padding: 0.5em;
  height: 100%;
  width: 25%;
  background-color: #323232;
  color: white;
}

#inp button:hover {
  background-color: #3c3c3c;
}

#inp button:focus {
  background-color: #323232;
}

/* Number buttons */
#inp button.w {
  background-color: #3c3c3c;
  color: white;
}

#inp button.w.b {
  font-weight: 600;
  font-size: 1.2em;
}

#inp button.w.b:focus {
  background-color: #3c3c3c;
}

#inp button.w:hover {
  background-color: #454545;
}

#inp button.w:focus {
  background-color: #3c3c3c;
}

/* Primary/Equals button */
#inp button.p {
  background-color: #0078d4;
  color: white;
}

#inp button.p:hover {
  background-color: #106ebe;
}

#inp button.p:focus {
  background-color: #0078d4;
}

/*Sidebar*/
#sidebar {
  height: 100%;
  width: 40%;
  display: flex;
  flex-direction: column;
  padding-left: 1em;
}

#sidebar > #nav {
  margin-top: 5%;
  user-select: none;
  height: 7.5%;
  display: flex;
  flex-direction: row;
}

#sidebar > #nav > .nav-item {
  padding: 1em;
  margin: auto 0;
  color: #cccccc;
}

#sidebar > #nav > .nav-item:nth-child(1) {
  padding-left: 0px;
}

#sidebar > #nav > .nav-item:hover {
  color: white;
}

#sidebar > #nav > .nav-item.active {
  color: white;
}

#sidebar > #nav > .nav-item.active .barbelow {
  position: relative;
  top: 0.25em;
  left: 0;
  width: 100%;
  height: 0.25em;
  background-color: #0078d4;
}

#sidebar > #panel {
  user-select: text;
  overflow: hidden;
  height: 92.5%;
  color: white;
}

#panel > * {
  height: 100%;
  width: 100%;
  overflow-y: scroll;
}

#panel > *::-webkit-scrollbar {
  display: none;
}

#panel::-webkit-scrollbar {
  display: none;
}

#panel > .hspanel > .history-item {
  padding: 0.4em 0.8em;
  width: 100%;
  text-align: right;
  margin: 0.5em 0;
  background-color: transparent;
  border: none;
  color: white;
}

#panel > .hspanel > .history-item:hover {
  background-color: #323232;
}

#panel > .hspanel > .history-item > .expression {
  word-spacing: 0.6em;
  font-weight: 350;
  color: #cccccc;
}

#panel > .hspanel > .history-item > .result {
  font-weight: 600;
  font-size: 1.8em;
  color: white;
}

#panel > .hspanel > .del {
  font-size: 1.2em;
  font-weight: 550;
  padding: 0.8em;
  position: absolute;
  bottom: 0;
  right: 0;
  color: white;
}

#panel > .mempanel > .memory-item {
  padding: 0.4em 1.4em;
  width: 100%;
  text-align: right;
  margin: 0.5em 0;
  background-color: transparent;
  color: white;
}

#panel > .mempanel > .memory-item:hover {
  background-color: #282828;
}

#panel > .mempanel > .memory-item > .value {
  font-size: 1.6em;
  color: white;
}

#panel > .mempanel > .memory-item > .btns {
  opacity: 0;
  display: flex;
  flex-direction: row-reverse;
}

#panel > .mempanel > .memory-item > .btns > * {
  margin: 1px;
  padding: 0.5em 0.6em;
  font-weight: 500;
  font-size: 0.8em;
  background-color: #3c3c3c;
  color: white;
}

#panel > .mempanel > .memory-item:hover .btns {
  opacity: 1;
}

#panel > .mempanel > .memory-item > .btns > *:hover {
  background-color: #0078d4;
}

#panel > .mempanel > .del {
  font-size: 1.2em;
  font-weight: 550;
  padding: 0.8em;
  position: absolute;
  bottom: 0;
  right: 0;
  color: white;
}

@media (max-width: 325px) {
  /*Feature Phones*/
  #calc {
    width: 100%;
  }

  #sidebar {
    width: 100%;
  }

  #topbar .history {
    display: block;
  }

  #funcs .memory {
    display: block;
  }

  #display > #primary {
    font-size: 1em;
  }
}

@media (min-width: 325px) and (max-width: 615px) {
  /*phones*/
  #calc {
    width: 100%;
  }

  #sidebar {
    width: 100%;
  }

  #topbar .history {
    display: block;
  }

  #funcs .memory {
    display: block;
  }

  #display > #primary {
    font-size: 1.8em;
  }
}

@media (min-width: 576px) and (max-width: 1024px) {
  /*Tablets*/
  #display > #primary {
    font-size: 2.2em;
  }

  @media (max-height: 615px) and (min-height: 525px) {
    #display > #primary {
      font-size: 1.8em;
    }
  }
}

@media (max-height: 615px) and (min-height: 525px) {
  #display > #primary {
    font-size: 2em;
  }
}

@media (max-height: 525px) and (min-height: 400px) {
  #display > #primary {
    font-size: 1.2em;
  }
}

@media (max-height: 400px) {
  #display > #primary {
    font-size: 1em;
  }
}
