/* Theme:
   Main:        #0099e5
   Link:        #0099cc
   Link hover:  #006699
   Dark bg:     #222222
   Card bg:     #333333
   Accent line: #0099e5
*/

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #d5d5d5;
  background-color: #222222;
}

.page {
  min-height: 100vh;
}

.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* Header row with title + back link */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.toolbox-title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 500;
  color: #d5d5d5;
  position: relative;
  padding-bottom: 0.25rem;
}

/* Underline effect for title */
.toolbox-title::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  margin-top: 0.15rem;
  background-color: #0099e5;
}

a {
  color: #0099cc;
  text-decoration: none;
}

a:hover {
  color: #006699;
  text-decoration: underline;
}

.header-return {
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .header-return {
    white-space: normal;
  }
}

.intro {
  margin: 0 0 1.2rem;
  font-size: 0.9rem;
  color: #c0c0c0;
}

/* Calculator card */
.calc-card {
  background-color: #333333;
  border-radius: 6px;
  border: 1px solid #444444;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.display {
  background-color: #262626;
  border-radius: 4px;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.75rem;
  border: 1px solid #444444;
}

.display-expression {
  font-size: 0.85rem;
  color: #aaaaaa;
  text-align: right;
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.1rem;
}

.display-main {
  font-size: 1.8rem;
  font-weight: 500;
  text-align: right;
  color: #ffffff;
  word-wrap: break-word;
  word-break: break-all;
}

.display-status {
  font-size: 0.75rem;
  color: #888888;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.35rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #555555;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  margin-right: 0.35rem;
  display: inline-block;
}

.status-dot.active {
  background-color: #0099e5;
  box-shadow: 0 0 10px rgba(0, 153, 229, 0.8);
}

.mode-wrap {
  font-size: 0.75rem;
  color: #888888;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.mode-toggle {
  border: none;
  background: transparent;
  color: #0099cc;
  font-size: 0.78rem;
  padding: 0;
  cursor: pointer;
}

.mode-toggle:hover {
  color: #006699;
  text-decoration: underline;
}

/* Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

button {
  border: none;
  border-radius: 4px;
  padding: 0.7rem 0.5rem;
  font-family: inherit;
  font-size: 1rem;
  color: #f0f0f0;
  background-color: #444444;
  cursor: pointer;
  transition:
    background-color 0.1s ease-out,
    transform 0.08s ease-out,
    box-shadow 0.1s ease-out;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

button:focus-visible {
  outline: 2px solid #0099e5;
  outline-offset: 1px;
}

.btn-ghost {
  background-color: #3a3a3a;
  color: #e0e0e0;
}

.btn-operator {
  background-color: #005f82;
}

.btn-equals {
  background-color: #0099e5;
}

.btn-danger {
  background-color: #7a3030;
}

.btn-zero {
  grid-column: span 2;
}

.btn-func {
  background-color: #3b3b47;
  font-size: 0.9rem;
}

.btn-const {
  background-color: #3b3b47;
}

.help-text {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: #a0a0a0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.help-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
}

.help-label {
  font-weight: 500;
  color: #dddddd;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  border: 1px solid #555555;
  font-size: 0.75rem;
  font-family:
    SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  background-color: #262626;
  color: #cccccc;
}
