@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Cinzel+Decorative:wght@400;700&display=swap');

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: 'Cinzel', serif;
  background: #0a0608;
  overflow-x: hidden;
}

/* ── Background ── */
.papyrus-bg {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%, #3d1c08 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, #1a0a02 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, #0d1a2a 0%, transparent 50%),
    linear-gradient(180deg, #0d0507 0%, #140b04 40%, #0a0d1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* ── Starfield ── */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--dur, 3s) infinite ease-in-out var(--delay, 0s);
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.4); }
}

/* ── Header ── */
.temple-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}
.eye-of-ra {
  font-size: 3rem;
  color: #f0c040;
  filter: drop-shadow(0 0 12px #f0c04088);
  animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px #f0c04066); }
  50%       { filter: drop-shadow(0 0 24px #f0c040cc); }
}
h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.1rem, 3vw, 2rem);
  color: #f0c040;
  letter-spacing: 0.12em;
  text-shadow: 0 0 20px #f0c04066, 0 2px 4px #000;
  margin: 0.5rem 0;
}
.hieroglyph-strip {
  font-size: 1.1rem;
  color: #b87333;
  letter-spacing: 0.3em;
  opacity: 0.7;
  margin-top: 0.4rem;
}

/* ── Calculator wrapper ── */
.calculator-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 2rem 0 1.5rem;
}

/* ── Pillars ── */
.pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
}
.cartouche {
  font-size: 1.8rem;
  color: #f0c040;
  text-shadow: 0 0 8px #f0c04066;
}
.pillar-body {
  flex: 1;
  width: 18px;
  background: linear-gradient(180deg,
    #b87333 0%, #f0c040 20%, #8b5e1a 40%,
    #f0c040 60%, #b87333 80%, #8b5e1a 100%);
  border-radius: 4px;
  box-shadow: 0 0 12px #b8733366, inset 0 0 6px #00000066;
  margin: 6px 0;
  position: relative;
}
.pillar-body::before {
  content: '';
  position: absolute;
  inset: 4px 2px;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px, transparent 8px,
    #00000022 8px, #00000022 10px
  );
  border-radius: 3px;
}

/* ── Calculator box ── */
.calculator {
  background: linear-gradient(145deg, #1e0e04 0%, #2a1508 50%, #1a0c06 100%);
  border: 2px solid #b87333;
  border-radius: 8px;
  padding: 20px;
  width: 340px;
  box-shadow:
    0 0 40px #b8733344,
    0 0 80px #f0c04022,
    inset 0 0 30px #00000066;
  position: relative;
}
.calculator::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  background: linear-gradient(135deg,
    #f0c04088 0%, transparent 30%,
    transparent 70%, #b8733366 100%);
  pointer-events: none;
  z-index: -1;
}

/* ── Display ── */
.display-area {
  background: linear-gradient(135deg, #0d1a08 0%, #0a1505 100%);
  border: 1.5px solid #4a7c20;
  border-radius: 6px;
  padding: 14px 16px 10px;
  margin-bottom: 18px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow:
    inset 0 0 20px #00000088,
    0 0 10px #4a7c2044;
  position: relative;
  overflow: hidden;
}
.display-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, #4a7c2011 0%, transparent 70%);
  pointer-events: none;
}
.display-hieroglyph {
  font-size: 0.7rem;
  color: #4a7c2088;
  letter-spacing: 0.2em;
  min-height: 1.2em;
  text-align: right;
  transition: opacity 0.3s;
}
.display-expression {
  font-size: 1.6rem;
  color: #a8d060;
  text-align: right;
  word-break: break-all;
  text-shadow: 0 0 8px #6ab03044;
  line-height: 1.3;
}
.display-result {
  font-size: 1rem;
  color: #6ab030;
  text-align: right;
  min-height: 1.4em;
  opacity: 0.75;
  letter-spacing: 0.05em;
}

/* ── Button grid ── */
.button-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* ── Buttons ── */
.btn {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  padding: 16px 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.05em;
  user-select: none;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.btn:active {
  transform: scale(0.94);
  filter: brightness(0.85);
}

/* Number buttons */
.btn-num {
  background: linear-gradient(145deg, #2c1a0a, #3d2510);
  color: #f5e6c0;
  border: 1px solid #6b3f1a;
  box-shadow: 0 3px 8px #00000066, 0 0 4px #b8733322;
  text-shadow: 0 1px 2px #000;
}
.btn-num:hover {
  background: linear-gradient(145deg, #3d2510, #4e3018);
  border-color: #b87333;
  box-shadow: 0 3px 12px #00000088, 0 0 8px #b8733344;
}

/* Operator buttons */
.btn-op {
  background: linear-gradient(145deg, #3d2200, #5a3300);
  color: #f0c040;
  border: 1px solid #b87333;
  box-shadow: 0 3px 8px #00000066, 0 0 8px #b8733344;
  text-shadow: 0 0 8px #f0c04066;
  font-size: 0.85rem;
}
.btn-op:hover {
  background: linear-gradient(145deg, #5a3300, #7a4800);
  border-color: #f0c040;
  box-shadow: 0 3px 12px #00000088, 0 0 16px #f0c04044;
}

/* Function buttons (AC, +/-, %) */
.btn-fn {
  background: linear-gradient(145deg, #1e2d1a, #2a3d24);
  color: #a8d060;
  border: 1px solid #4a7c20;
  box-shadow: 0 3px 8px #00000066;
  text-shadow: 0 0 6px #6ab03044;
}
.btn-fn:hover {
  background: linear-gradient(145deg, #2a3d24, #3a5430);
  border-color: #6ab030;
  box-shadow: 0 3px 12px #00000088, 0 0 10px #4a7c2044;
}

/* Equals button */
.btn-equals {
  background: linear-gradient(145deg, #5a3300, #8b5000);
  color: #f0c040;
  border: 1px solid #f0c040;
  box-shadow: 0 3px 12px #00000088, 0 0 16px #f0c04066;
  text-shadow: 0 0 10px #f0c040aa;
  font-size: 0.9rem;
}
.btn-equals:hover {
  background: linear-gradient(145deg, #8b5000, #c07000);
  box-shadow: 0 3px 16px #00000099, 0 0 24px #f0c04088;
}

/* Wide zero button */
.btn-zero {
  grid-column: span 2;
}

/* ── Footer ── */
.temple-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1rem 1rem 2.5rem;
  color: #7a5020;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}
.scarab {
  font-size: 2rem;
  color: #b87333;
  opacity: 0.6;
}
.temple-footer p { margin: 0.3rem 0; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .calculator { width: 300px; padding: 14px; }
  .pillar { width: 28px; }
  .pillar-body { width: 12px; }
  .btn { padding: 13px 4px; font-size: 0.9rem; }
  h1 { font-size: 1rem; }
}
