/* ==========================================================================
   InstaCalc - Ultra Aesthetic Smart Calculator Stylesheet
   Themes: Insta Glass (Default), Instax Polaroid, Cyber OLED, Soft Neumorphic
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables & Base Setup
   -------------------------------------------------------------------------- */
:root {
  /* Default Theme: Insta Glass */
  --bg-gradient-start: #1a052b;
  --bg-gradient-end: #0c0214;
  --orb-1-color: rgba(255, 0, 128, 0.45);
  --orb-2-color: rgba(120, 0, 255, 0.45);
  --orb-3-color: rgba(255, 140, 0, 0.35);

  --calc-bg: rgba(25, 18, 38, 0.65);
  --calc-border: rgba(255, 255, 255, 0.18);
  --calc-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  --calc-backdrop: blur(24px) saturate(180%);
  --calc-radius: 32px;

  --display-bg: rgba(15, 10, 24, 0.55);
  --display-border: rgba(255, 255, 255, 0.12);
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-accent: #ff3b77;

  --btn-num-bg: rgba(255, 255, 255, 0.08);
  --btn-num-hover: rgba(255, 255, 255, 0.16);
  --btn-num-text: #ffffff;
  --btn-num-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);

  --btn-op-bg: linear-gradient(135deg, #8a23b1, #e94057);
  --btn-op-hover: linear-gradient(135deg, #a028cf, #f24d64);
  --btn-op-text: #ffffff;
  --btn-op-shadow: 0 8px 24px rgba(233, 64, 87, 0.4);

  --btn-equals-bg: linear-gradient(135deg, #f27121, #e94057, #8a23b1);
  --btn-equals-hover: linear-gradient(135deg, #ff7e30, #f84b63, #9d26ca);
  --btn-equals-text: #ffffff;
  --btn-equals-shadow: 0 10px 30px rgba(233, 64, 87, 0.6);

  --btn-action-bg: rgba(255, 255, 255, 0.12);
  --btn-action-hover: rgba(255, 255, 255, 0.22);
  --btn-action-text: #e0e0e0;

  --tape-bg: #fffdfa;
  --tape-text: #1f1f2e;
  --tape-border: #e0d8c8;
  --tape-accent: #e94057;

  --panel-bg: rgba(25, 18, 38, 0.92);
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;
}

/* --------------------------------------------------------------------------
   Theme Variant: Instax Polaroid Tape
   -------------------------------------------------------------------------- */
[data-theme="instax-polaroid"] {
  --bg-gradient-start: #eef2f5;
  --bg-gradient-end: #d6e0ea;
  --orb-1-color: rgba(255, 182, 193, 0.5);
  --orb-2-color: rgba(173, 216, 230, 0.5);
  --orb-3-color: rgba(255, 239, 213, 0.6);

  --calc-bg: #f8f6f0;
  --calc-border: #e2ded4;
  --calc-shadow: 0 25px 50px rgba(70, 75, 90, 0.25), 0 2px 4px rgba(0,0,0,0.05);
  --calc-backdrop: none;

  --display-bg: #2d3139;
  --display-border: #1e2127;
  --text-main: #2b2d35;
  --text-muted: #7e8594;
  --text-accent: #ff5252;

  --btn-num-bg: #ffffff;
  --btn-num-hover: #f0ede6;
  --btn-num-text: #2b2d35;
  --btn-num-shadow: 0 4px 10px rgba(0,0,0,0.06);

  --btn-op-bg: #ff6b6b;
  --btn-op-hover: #ff5252;
  --btn-op-text: #ffffff;
  --btn-op-shadow: 0 6px 15px rgba(255, 107, 107, 0.35);

  --btn-equals-bg: #4ecdc4;
  --btn-equals-hover: #36d7b7;
  --btn-equals-text: #ffffff;
  --btn-equals-shadow: 0 8px 20px rgba(78, 205, 196, 0.4);

  --btn-action-bg: #e8e4da;
  --btn-action-hover: #ded9cd;
  --btn-action-text: #4a4d57;

  --tape-bg: #ffffff;
  --tape-text: #1a1a24;
  --tape-border: #e4decb;
  --panel-bg: #f8f6f0;
}

/* --------------------------------------------------------------------------
   Theme Variant: Cyber Neon OLED
   -------------------------------------------------------------------------- */
[data-theme="cyber-oled"] {
  --bg-gradient-start: #040508;
  --bg-gradient-end: #090b10;
  --orb-1-color: rgba(0, 243, 255, 0.25);
  --orb-2-color: rgba(255, 0, 128, 0.25);
  --orb-3-color: rgba(112, 0, 255, 0.25);

  --calc-bg: rgba(12, 15, 24, 0.9);
  --calc-border: #00f3ff;
  --calc-shadow: 0 0 40px rgba(0, 243, 255, 0.25), inset 0 0 15px rgba(0, 243, 255, 0.1);
  --calc-backdrop: blur(16px);

  --display-bg: #05070c;
  --display-border: rgba(0, 243, 255, 0.3);
  --text-main: #00f3ff;
  --text-muted: #ff007f;
  --text-accent: #ffe600;

  --btn-num-bg: rgba(18, 24, 38, 0.8);
  --btn-num-hover: rgba(30, 42, 66, 0.9);
  --btn-num-text: #ffffff;
  --btn-num-shadow: 0 0 10px rgba(0, 0, 0, 0.5);

  --btn-op-bg: rgba(255, 0, 128, 0.2);
  --btn-op-hover: rgba(255, 0, 128, 0.4);
  --btn-op-text: #ff007f;
  --btn-op-shadow: 0 0 15px rgba(255, 0, 128, 0.4);

  --btn-equals-bg: linear-gradient(135deg, #00f3ff, #ff007f);
  --btn-equals-hover: linear-gradient(135deg, #33f6ff, #ff3399);
  --btn-equals-text: #000000;
  --btn-equals-shadow: 0 0 25px rgba(0, 243, 255, 0.6);

  --btn-action-bg: rgba(0, 243, 255, 0.1);
  --btn-action-hover: rgba(0, 243, 255, 0.25);
  --btn-action-text: #00f3ff;

  --tape-bg: #0d111a;
  --tape-text: #00f3ff;
  --tape-border: #ff007f;
  --panel-bg: #090c14;
}

/* --------------------------------------------------------------------------
   Theme Variant: Soft Neumorphic
   -------------------------------------------------------------------------- */
[data-theme="soft-neumorphic"] {
  --bg-gradient-start: #e0e5ec;
  --bg-gradient-end: #e0e5ec;
  --orb-1-color: transparent;
  --orb-2-color: transparent;
  --orb-3-color: transparent;

  --calc-bg: #e0e5ec;
  --calc-border: rgba(255, 255, 255, 0.6);
  --calc-shadow: 14px 14px 28px #a3b1c6, -14px -14px 28px #ffffff;
  --calc-backdrop: none;

  --display-bg: #e0e5ec;
  --display-border: transparent;
  --text-main: #3d485e;
  --text-muted: #76839a;
  --text-accent: #4d7cfe;

  --btn-num-bg: #e0e5ec;
  --btn-num-hover: #e8ecf2;
  --btn-num-text: #3d485e;
  --btn-num-shadow: 6px 6px 12px #a3b1c6, -6px -6px 12px #ffffff;

  --btn-op-bg: #e0e5ec;
  --btn-op-hover: #e8ecf2;
  --btn-op-text: #4d7cfe;
  --btn-op-shadow: 6px 6px 12px #a3b1c6, -6px -6px 12px #ffffff;

  --btn-equals-bg: #4d7cfe;
  --btn-equals-hover: #3b6be8;
  --btn-equals-text: #ffffff;
  --btn-equals-shadow: 6px 6px 14px rgba(77, 124, 254, 0.4), -4px -4px 10px #ffffff;

  --btn-action-bg: #e0e5ec;
  --btn-action-hover: #e8ecf2;
  --btn-action-text: #fa5252;

  --tape-bg: #f4f7fb;
  --tape-text: #2c3545;
  --tape-border: #c4d0e0;
  --panel-bg: #e0e5ec;
}

/* --------------------------------------------------------------------------
   2. Reset & Layout Baseline
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-gradient-start);
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--text-main);
  transition: background 0.5s ease, color 0.3s ease;
  position: relative;
  padding: 16px 12px;
  box-sizing: border-box;
}

/* Dynamic Animated Background Mesh Orbs */
.bg-gradient-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.85;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: var(--orb-1-color);
  top: -10%;
  left: 10%;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: var(--orb-2-color);
  bottom: -15%;
  right: 10%;
  animation-delay: -6s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--orb-3-color);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -12s;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(60px, -40px) scale(1.1);
  }
  100% {
    transform: translate(-40px, 50px) scale(0.95);
  }
}

/* Glass mesh subtle overlay */
.glass-mesh {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* App Outer Shell */
.app-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 460px;
  margin: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   3. Header Navigation & Toolbar
   -------------------------------------------------------------------------- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--calc-bg);
  backdrop-filter: var(--calc-backdrop);
  -webkit-backdrop-filter: var(--calc-backdrop);
  border: 1px solid var(--calc-border);
  box-shadow: var(--calc-shadow);
  border-radius: 20px;
  padding: 10px 14px;
  transition: all 0.4s ease;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--btn-op-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  white-space: nowrap;
}

.accent-text {
  color: var(--text-accent);
}

.badge {
  font-size: 0.55rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--btn-op-bg);
  color: #fff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  flex-shrink: 0;
}

.icon-btn, .pill-btn {
  background: var(--btn-num-bg);
  border: 1px solid var(--calc-border);
  color: var(--text-main);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
}

.pill-btn {
  padding: 0 8px;
  height: 34px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.icon-btn:hover, .pill-btn:hover {
  background: var(--btn-num-hover);
  transform: translateY(-2px);

}

.icon-btn.active, .pill-btn.active {
  background: var(--btn-op-bg);
  color: #fff;
  border-color: transparent;
}

/* Theme Dropdown */
.theme-picker-wrapper {
  position: relative;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--panel-bg);
  backdrop-filter: var(--calc-backdrop);
  -webkit-backdrop-filter: var(--calc-backdrop);
  border: 1px solid var(--calc-border);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  border-radius: 16px;
  padding: 8px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-dropdown.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.2s ease;
}

.theme-option:hover {
  background: var(--btn-num-hover);
}

.theme-option.active {
  background: var(--btn-op-bg);
  color: #fff;
}

.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.insta-dot { background: linear-gradient(135deg, #e94057, #8a23b1); }
.instax-dot { background: #ff6b6b; border: 1px solid #ddd; }
.cyber-dot { background: #00f3ff; box-shadow: 0 0 6px #00f3ff; }
.neu-dot { background: #4d7cfe; }

/* --------------------------------------------------------------------------
   4. Calculator Card Body
   -------------------------------------------------------------------------- */
.calc-wrapper {
  position: relative;
  display: flex;
  width: 100%;
}

.calculator-card {
  width: 100%;
  background: var(--calc-bg);
  backdrop-filter: var(--calc-backdrop);
  -webkit-backdrop-filter: var(--calc-backdrop);
  border: 1px solid var(--calc-border);
  box-shadow: var(--calc-shadow);
  border-radius: var(--calc-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s ease;
  box-sizing: border-box;
}

/* Instax Polaroid Receipt Slot */
.tape-eject-slot {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slot-line {
  width: 75%;
  height: 7px;
  background: rgba(10, 5, 18, 0.8);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.8);
}

.ejected-tape-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Authentic Polaroid Ticket Film Ejected */
.ejected-polaroid-ticket {
  width: 88%;
  background: var(--tape-bg);
  color: var(--tape-text);
  border: 1px solid var(--tape-border);
  border-radius: 14px;
  padding: 16px 18px 24px 18px; /* Extra bottom white border like real polaroids */
  margin-top: -3px;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.1);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  animation: slideDownFilm 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.25) forwards;
  z-index: 5;
  position: relative;
  transform-origin: top center;
}

/* Jagged perforations cut effect on top of ticket */
.ejected-polaroid-ticket::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
  background-image: radial-gradient(circle at 6px 0, transparent 4px, var(--tape-bg) 5px);
  background-size: 12px 6px;
  background-repeat: repeat-x;
}

@keyframes slideDownFilm {
  0% {
    opacity: 0;
    transform: translateY(-50px) scaleY(0.1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #777;
  border-bottom: 1px dashed var(--tape-border);
  padding-bottom: 8px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ticket-expr {
  color: #666;
  font-size: 0.85rem;
  text-align: right;
  word-break: break-all;
}

.ticket-res {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--tape-text);
  text-align: right;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   5. Calculator Display Screen
   -------------------------------------------------------------------------- */
.display-container {
  background: var(--display-bg);
  border: 1px solid var(--display-border);
  border-radius: 20px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.display-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.status-indicator {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.status-indicator.active {
  opacity: 1;
  background: var(--btn-op-bg);
  color: #fff;
}

.live-clock {
  margin-left: auto;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.expression-line-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-muted);
  min-height: 24px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  margin-top: 4px;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.expression-line-container::-webkit-scrollbar {
  display: none;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--text-accent);
  margin-left: 2px;
  flex-shrink: 0;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.live-preview {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-accent);
  text-align: right;
  min-height: 16px;
  opacity: 0.9;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.live-preview::-webkit-scrollbar {
  display: none;
}

.main-output-container {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  min-height: 44px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-behavior: smooth;
  width: 100%;
}

.main-output-container::-webkit-scrollbar {
  display: none;
}

.main-output {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
  word-break: keep-all;
  white-space: nowrap;
  transition: font-size 0.15s ease;
  display: inline-block;
}

/* --------------------------------------------------------------------------
   6. Subnav Bar & Memory Keys
   -------------------------------------------------------------------------- */
.calc-subnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.subnav-btn {
  flex: 1;
  background: var(--btn-action-bg);
  border: 1px solid var(--calc-border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.subnav-btn:hover {
  background: var(--btn-action-hover);
}

.subnav-btn.active {
  background: var(--btn-op-bg);
  color: #fff;
  border-color: transparent;
}

.subnav-pill {
  background: var(--btn-num-bg);
  border: 1px solid var(--calc-border);
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.subnav-pill:hover {
  background: var(--btn-num-hover);
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   7. Scientific Drawer Panel
   -------------------------------------------------------------------------- */
.scientific-panel {
  max-height: 300px;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: translateY(0);
}

.scientific-panel.hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px);
  margin: 0;
  pointer-events: none;
}

.sci-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-bottom: 6px;
}

.sci-btn {
  background: var(--btn-action-bg);
  border: 1px solid var(--calc-border);
  color: var(--btn-action-text);
  height: 38px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sci-btn:hover {
  background: var(--btn-action-hover);
  transform: scale(1.04);
}

/* --------------------------------------------------------------------------
   8. Keypad Grid & Interactive Buttons
   -------------------------------------------------------------------------- */
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.calc-btn {
  height: 58px;
  border-radius: 18px;
  border: 1px solid var(--calc-border);
  font-family: var(--font-main);
  font-size: 1.35rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.num-btn {
  background: var(--btn-num-bg);
  color: var(--btn-num-text);
  box-shadow: var(--btn-num-shadow);
}

.num-btn:hover {
  background: var(--btn-num-hover);
  transform: translateY(-2px);
}

.operator-btn {
  background: var(--btn-op-bg);
  color: var(--btn-op-text);
  box-shadow: var(--btn-op-shadow);
}

.operator-btn:hover {
  background: var(--btn-op-hover);
  transform: translateY(-2px);
}

.action-btn {
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
  font-size: 1.1rem;
}

.action-btn:hover {
  background: var(--btn-action-hover);
  transform: translateY(-2px);
}

.clear-btn {
  color: var(--text-accent);
  font-weight: 700;
}

.equals-btn {
  background: var(--btn-equals-bg);
  color: var(--btn-equals-text);
  box-shadow: var(--btn-equals-shadow);
  font-size: 1.6rem;
  font-weight: 700;
}

.equals-btn:hover {
  background: var(--btn-equals-hover);
  transform: translateY(-2px) scale(1.02);
}

.calc-btn:active, .calc-btn.pressed {
  transform: translateY(2px) scale(0.96) !important;
  box-shadow: none !important;
}

/* Button Ripple Animation */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: rippleFx 0.4s linear;
  pointer-events: none;
}

@keyframes rippleFx {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   9. History Tape Panel & Unit Converter Drawer
   -------------------------------------------------------------------------- */
.history-panel, .converter-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: var(--panel-bg);
  backdrop-filter: var(--calc-backdrop);
  -webkit-backdrop-filter: var(--calc-backdrop);
  border-radius: var(--calc-radius);
  border: 1px solid var(--calc-border);
  padding: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--calc-shadow);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  transform: translateX(0);
  opacity: 1;
}

.history-panel.hidden, .converter-panel.hidden {
  transform: translateX(105%);
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--calc-border);
}

.panel-title {
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--text-accent);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.icon-sm-btn {
  background: var(--btn-num-bg);
  border: 1px solid var(--calc-border);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.empty-history {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  text-align: center;
}

.empty-history i {
  font-size: 2.2rem;
  opacity: 0.5;
}

.history-item {
  background: var(--tape-bg);
  color: var(--tape-text);
  border: 1px solid var(--tape-border);
  border-radius: 14px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.history-time {
  font-size: 0.65rem;
  color: #888;
  text-align: right;
}

.history-expr {
  font-size: 0.85rem;
  color: #555;
  text-align: right;
}

.history-result {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: right;
  color: var(--tape-text);
}

/* --------------------------------------------------------------------------
   10. Unit Converter Controls
   -------------------------------------------------------------------------- */
.converter-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.custom-select, .custom-input {
  background: var(--display-bg);
  border: 1px solid var(--calc-border);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
}

.custom-input.readonly {
  opacity: 0.85;
}

.conversion-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.swap-icon-container {
  align-self: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--btn-op-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--btn-op-shadow);
  transition: transform 0.3s ease;
}

.swap-icon-container:hover {
  transform: rotate(180deg);
}

.primary-btn {
  background: var(--btn-equals-bg);
  color: var(--btn-equals-text);
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: var(--btn-equals-shadow);
  transition: transform 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   11. Modal & Overlay
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: var(--panel-bg);
  border: 1px solid var(--calc-border);
  border-radius: 24px;
  width: 100%;
  max-width: 380px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

kbd {
  background: var(--btn-num-bg);
  border: 1px solid var(--calc-border);
  color: var(--text-accent);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
}

/* Particle Canvas Overlay */
.particle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
}

/* --------------------------------------------------------------------------
   12. Responsive Media Queries for All Screen Sizes & Heights
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  body {
    padding: 8px 6px;
  }
  
  .app-container {
    gap: 10px;
    max-width: 100%;
  }

  .app-header {
    padding: 8px 10px;
    border-radius: 16px;
  }

  .brand {
    font-size: 0.88rem;
    gap: 6px;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    border-radius: 8px;
  }

  .badge {
    font-size: 0.5rem;
    padding: 1px 5px;
  }

  .header-actions {
    gap: 4px;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
    border-radius: 8px;
  }

  .pill-btn {
    height: 30px;
    padding: 0 6px;
    font-size: 0.65rem;
    border-radius: 8px;
  }

  .calculator-card {
    padding: 14px;
    border-radius: 24px;
    gap: 12px;
  }

  .display-container {
    padding: 12px 14px;
    border-radius: 16px;
    min-height: 105px;
  }

  .main-output {
    font-size: 2.2rem;
  }

  .calc-subnav {
    gap: 4px;
  }

  .subnav-btn {
    padding: 6px 8px;
    font-size: 0.72rem;
    border-radius: 10px;
  }

  .subnav-pill {
    padding: 6px 8px;
    font-size: 0.7rem;
    border-radius: 10px;
  }

  .sci-grid {
    gap: 6px;
  }

  .sci-btn {
    height: 34px;
    font-size: 0.75rem;
    border-radius: 8px;
  }

  .keypad-grid {
    gap: 8px;
  }

  .calc-btn {
    height: 50px;
    font-size: 1.2rem;
    border-radius: 14px;
  }

  .equals-btn {
    font-size: 1.45rem;
  }

  .history-panel, .converter-panel {
    padding: 16px;
    border-radius: 24px;
  }
}

/* Extra Small Phones (320px - 360px) */
@media (max-width: 360px) {
  .brand-title {
    font-size: 0.82rem;
  }
  
  .badge {
    display: none;
  }

  .icon-btn {
    width: 27px;
    height: 27px;
    font-size: 0.7rem;
  }

  .pill-btn {
    height: 27px;
    padding: 0 4px;
    font-size: 0.6rem;
  }

  .display-container {
    padding: 10px 12px;
    min-height: 95px;
  }

  .main-output {
    font-size: 1.85rem;
  }

  .calc-btn {
    height: 46px;
    font-size: 1.1rem;
    border-radius: 12px;
  }

  .sci-btn {
    height: 30px;
    font-size: 0.7rem;
  }
}

/* Screen Height Adjustments (Small Laptops, Landscape phones/tablets) */
@media (max-height: 750px) {
  body {
    padding: 8px;
  }

  .app-container {
    gap: 8px;
  }

  .app-header {
    padding: 6px 10px;
  }

  .calculator-card {
    padding: 12px 14px;
    gap: 10px;
  }

  .display-container {
    padding: 10px 14px;
    min-height: 90px;
  }

  .main-output {
    font-size: 2rem;
  }

  .calc-subnav {
    margin-bottom: 2px;
  }

  .subnav-btn, .subnav-pill {
    padding: 5px 8px;
  }

  .sci-btn {
    height: 30px;
    font-size: 0.72rem;
  }

  .keypad-grid {
    gap: 8px;
  }

  .calc-btn {
    height: 44px;
    font-size: 1.15rem;
    border-radius: 12px;
  }
}

@media (max-height: 620px) {
  .display-container {
    min-height: 75px;
    padding: 8px 12px;
  }

  .expression-line-container {
    font-size: 0.85rem;
    min-height: 18px;
  }

  .main-output {
    font-size: 1.65rem;
  }

  .calc-btn {
    height: 38px;
    font-size: 1rem;
  }

  .sci-btn {
    height: 26px;
    font-size: 0.65rem;
  }
}
