:root {
  --radius: 0.75rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

input, button, select, textarea {
  font-size: 16px;
}

/* Display font smoothing */
.display-text {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.025em;
}

/* Button press animation */
.calc-button {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.calc-button:active {
  transform: scale(0.95);
}

.calc-button:focus-visible {
  outline: 2px solid hsl(217 91% 60%);
  outline-offset: 2px;
}

/* Fullscreen styles */
.calculator-container:fullscreen {
  background: hsl(210 20% 98%);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
}

.calculator-container:fullscreen > div {
  max-width: none;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.calculator-container:-webkit-full-screen {
  background: hsl(210 20% 98%);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
}

.calculator-container:-webkit-full-screen > div {
  max-width: none;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.calculator-container:-moz-full-screen {
  background: hsl(210 20% 98%);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
}

.calculator-container:-moz-full-screen > div {
  max-width: none;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Mode toggle animation */
.mode-toggle {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Memory indicator pulse */
@keyframes pulse-memory {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.memory-active {
  animation: pulse-memory 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth height transition for mode switch */
.calculator-body {
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Grid gap consistency */
.calc-grid {
  gap: 0.5rem;
}

/* Responsive font scaling */
@media (max-width: 390px) {
  .display-text {
    font-size: 1.75rem;
  }
}

/* High contrast focus for accessibility */
*:focus-visible {
  outline: 2px solid hsl(217 91% 60%);
  outline-offset: 2px;
}

/* Scrollbar styling for expression display */
.scrollbar-thin {
  scrollbar-width: thin;
}

.scrollbar-thin::-webkit-scrollbar {
  height: 4px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: hsl(220 13% 91%);
  border-radius: 2px;
}
