:root {
  --bg: #111111;
  --card: #1e1e1e;
  --text: #ffffff;
  --green: #28a745;
  --yellow: #ffc107;
  --red: #dc3545;
  --yellowgreen: color-mix(in srgb, var(--green) 55%, var(--yellow) 45%);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

.container {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 12px;
}

.card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
}

.title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: center;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

label {
  opacity: 0.95;
}

input {
  width: 100%;
  height: 46px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  outline: none;
}

input[readonly] {
  cursor: pointer;
  caret-color: transparent;
}

input.active-input {
  caret-color: var(--text);
  border-color: rgba(255, 255, 255, 0.38);
}

input:focus {
  border-color: rgba(255, 255, 255, 0.38);
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.keypad {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.keypad-header {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin-bottom: 8px;
}

.keypad-label {
  font-weight: 700;
  opacity: 0.95;
}

.keypad-active {
  font-size: 14px;
  opacity: 0.82;
  text-align: center;
}

.keypad-output {
  width: 100%;
  margin-top: 6px;
  padding-top: 0;
  border-top: 0;
  min-height: 0;
}

.keypad-output .error {
  min-height: 20px;
  text-align: center;
}

.keypad-output .result {
  margin-top: 4px;
  text-align: center;
}

.keypad-output .status {
  margin-top: 4px;
  text-align: center;
}

.keypad-body {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 10px;
}

.keypad-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.keypad-fractions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.key {
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  background: #2a2a2a;
  cursor: pointer;
}

.key:active {
  transform: translateY(1px);
}

.key.frac {
  font-size: 14px;
  font-weight: 800;
  background: #222222;
}

.key.key-wide {
  grid-column: span 3;
}

@media (max-width: 360px) {
  .keypad-body {
    grid-template-columns: 1fr;
  }

  .keypad-fractions {
    grid-template-columns: repeat(5, 1fr);
  }
}

button {
  height: 46px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  background: #2a2a2a;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #222222;
}

.output {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  min-height: 76px;
}

.error {
  min-height: 24px;
  color: var(--text);
  opacity: 0.95;
}

.result {
  font-size: 18px;
  margin-top: 6px;
}

.status {
  font-size: 22px;
  font-weight: 800;
  margin-top: 8px;
}

.branding {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: center;
}

.branding img {
  width: min(170px, 60%);
  height: auto;
  display: block;
  opacity: 0.95;
}
