/* Must be at the very top of your CSS file */
@import url('https://googleapis.com');

/* ---------- Layout ---------- */

body {
  font-family: Arial, sans-serif;
  background: #e5e7eb;
  display: flex;
  justify-content: center;
  padding: 40px;
}

.container {
  display: flex;
  flex-direction: column;
}

.calculator {
  width: 314px;
  background: linear-gradient(#4a5b6d, #374452);
  border-radius: 22px;
  padding: 14px;
  border: 1px solid black;

  /* Depth + rounded edge illusion */
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.15),
    /* top highlight */ inset 0 -4px 6px rgba(0, 0, 0, 0.35),
    /* bottom curve */ inset 2px 0 4px rgba(255, 255, 255, 0.08),
    /* left edge */ inset -2px 0 4px rgba(0, 0, 0, 0.25),
    /* right edge */ 0 20px 50px rgba(0, 0, 0, 0.35); /* outer shadow */
}

.disc {
  width: 300px;
  font-size: 8px;
  padding: 16px;
  text-align: center;
}

/* ---------- Header ---------- */

.header {
  text-align: center;
  line-height: 24px;
}

.subheader {
  color: white;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
}

.model-name {
  color: white;
  font-size: 18px;
  font-weight: bold;
  margin-top: 2px;
  letter-spacing: 1px;
}

/* ---------- Display ---------- */

.display {
  background: #e7f5dd;
  color: #000;
  font-family: 'Roboto Mono', monospace;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;

  /* NEW */
  min-height: 102px;

  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.display-expression {
  font-size: 42px;
  min-height: 51px;
  line-height: 1.2;

  color: #000;
  text-align: left;

  white-space: nowrap; /* ✅ no wrapping */
  overflow: hidden; /* ✅ clip */
  text-overflow: clip; /* or ellipsis if you prefer */
  font-weight: 600;
}

.display-main {
  font-size: 42px;
  min-height: 51px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  font-weight: 600;
  color: #0000b3;
}

/* ---------- Key Grid ---------- */

.keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

/* ---------- Buttons: Base ---------- */

.keys button {
  position: relative;
  border: none;
  border-radius: 6px;
  padding: 4px 4px;
  cursor: pointer;
  font-weight: bold;

  /* Core 3D look */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 3px 0 rgba(0, 0, 0, 0.35),
    0 6px 8px rgba(0, 0, 0, 0.35);

  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.06),
    rgba(0, 0, 0, 0.08)
  );

  transition:
    box-shadow 0.06s ease,
    transform 0.02s ease,
    filter 0.08s ease,
    background-color 0.08s ease;
}

/* ---------- Button Types ---------- */

.num {
  background: #ebe5e5;
  color: #111;
  font-size: 18px;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 2px 0 rgba(0, 0, 0, 0.3),
    0 5px 6px rgba(0, 0, 0, 0.25);
}

.op {
  background: #6b7280;
  background: #38506c;
  color: #fff;
  font-size: 18px;
}

.func {
  background: #313439;
  color: #fff;
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
}

.ctrl {
  background: #fbbf24;
  color: #111;
  font-size: 12px;
  text-align: center;
}

/* ---------- Secondary Labels ---------- */

.btn-secondary {
  display: block;
  font-size: 9px;
  line-height: 1;
  margin-bottom: 2px;
  color: #fde047;
}

.num > .btn-secondary {
  color: #111;
}

/* ---------- Hover ---------- */

.keys button:hover {
  filter: brightness(1.30);
}


.keys button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 1px 0 rgba(0, 0, 0, 0.35),
    0 3px 4px rgba(0, 0, 0, 0.25);
  filter: brightness(0.85);
}

/* Prevent :active from altering 2nd key geometry */
.keys button.ctrl:active {
  transform: none;
}

/* ---------- 2nd Key: Latched State ---------- */

.keys button.second-active {
  background-color: #d97706; /* darker amber */
  color: #1f2937;

  /* Latched-down look controlled ONLY by this class */
  transform: translateY(2px);

  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.45),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ---------- Empty Spacer Buttons ---------- */

.keys button:empty {
  box-shadow: none;
  background: transparent;
  cursor: default;
}

/* ---------- Utilities ---------- */

.wide {
  grid-column: span 2;
}

.enlargeText {
  font-size: 18px;
}

span.enlargeText {
  font-size: 14px;
}

.keys button.op {
  position: relative;
  top: -20px;
}

.display {
  position: relative; /* needed for absolute positioning */
}

.display-mode {
  position: absolute;
  bottom: 6px;
  left: 90px;

  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;

  color: rgba(31, 41, 55, 0.7); /* subtle dark */
  pointer-events: none;        /* never interfere with clicks */
  user-select: none;
}

.expr-viewport {
  overflow: hidden;
  position: relative;
  width: 100%;
}

#display-expression {
  white-space: nowrap;
  position: relative;
}

.disabled {
  opacity: 0.5;                 /* Visual cue */
  pointer-events: none;         /* Prevent clicks */
  filter: grayscale(60%);       /* Optional: soften colors */
}

button.disabled {
  pointer-events: none;         /* Prevent clicks */
}

button.disabled:hover {
  cursor: default;
}

button.hyp-active {
  background-color: #ddd;
}

.display-modes {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #666;
}

.display-mode {
  min-width: 3ch;
  text-align: center;
}

#display-hyp {
  left: 42px;
}

#display-sto {
  color: #444;
  left: 138px;
}

.off {
  pointer-events: none; 
}
