:root {
  --bg: #06111f;
  --card: rgba(15, 23, 42, 0.88);
  --card2: rgba(30, 41, 59, 0.8);
  --text: #eaf3ff;
  --muted: #9fb2cc;
  --line: rgba(148, 163, 184, 0.22);
  --accent: #38bdf8;
  --accent2: #8b5cf6;
  --good: #22c55e;
  --bad: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
}

body.light {
  --bg: #eef5ff;
  --card: rgba(255, 255, 255, 0.92);
  --card2: rgba(241, 245, 249, 0.94);
  --text: #0f172a;
  --muted: #4b647f;
  --line: rgba(15, 23, 42, 0.13);
  --shadow: 0 18px 60px rgba(51, 65, 85, 0.16);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 8%, rgba(56, 189, 248, 0.32), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(139, 92, 246, 0.28), transparent 30%),
    radial-gradient(circle at 45% 90%, rgba(34, 197, 94, 0.13), transparent 30%),
    linear-gradient(135deg, var(--bg), #020617);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.18),
    rgba(139, 92, 246, 0.18)
  );
  transition: 0.18s ease;
}

button:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.6);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.35);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

body.light input,
body.light select,
body.light textarea {
  background: rgba(255, 255, 255, 0.86);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

textarea {
  min-height: 95px;
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(14px, 4vw, 42px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.logo {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 31px;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}

.brand h1 {
  font-size: clamp(22px, 4vw, 38px);
  letter-spacing: -0.04em;
}

.brand p {
  color: var(--muted);
  margin-top: 4px;
}

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

.pill {
  border-radius: 999px;
  background: var(--card);
  backdrop-filter: blur(18px);
}

.icon-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 25px;
  background: var(--card);
  backdrop-filter: blur(18px);
  flex: 0 0 auto;
}

.icon-btn.small {
  width: 42px;
  height: 42px;
  font-size: 26px;
}

.translate-box {
  position: relative;
}

.translate-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 190px;
  padding: 10px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  display: none;
  z-index: 50;
}

.translate-panel.open {
  display: grid;
  gap: 8px;
}

.translate-panel button {
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
}

.translate-panel button.active-lang {
  border-color: rgba(56, 189, 248, 0.7);
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.28),
    rgba(139, 92, 246, 0.2)
  );
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 350px;
  max-width: 91vw;
  background: rgba(8, 13, 24, 0.91);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  z-index: 20;
  padding: 18px;
  transform: translateX(-105%);
  transition: 0.24s ease;
  overflow: auto;
}

body.light .drawer {
  background: rgba(255, 255, 255, 0.93);
}

.drawer.open {
  transform: translateX(0);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.44);
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  transition: 0.2s;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.drawer-head strong {
  font-size: 22px;
}

.nav {
  width: 100%;
  text-align: left;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.06);
}

.nav.active {
  border-color: rgba(56, 189, 248, 0.75);
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.28),
    rgba(139, 92, 246, 0.2)
  );
}

details {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.04);
}

summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  padding: 10px;
}

.drawer-note {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.drawer-note b {
  color: var(--text);
}

.main {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto 40px;
}

.page {
  display: none;
  animation: fade 0.25s ease;
}

.page.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.hero-grid {
  min-height: calc(100vh - 130px);
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 22px;
  align-items: center;
}

.intro-card,
.calculator,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.intro-card {
  padding: 30px;
}

.badge {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 12px;
  font-weight: 800;
}

.intro-card h2,
.title h2 {
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.06em;
}

.intro-card p,
.title p {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.mini-stats {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.mini-stats div {
  flex: 1;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.mini-stats strong {
  display: block;
  font-size: 26px;
}

.mini-stats span {
  color: var(--muted);
  font-size: 13px;
}

.calculator {
  padding: 18px;
}

.display {
  padding: 16px;
  border-radius: 22px;
  background: rgba(2, 6, 23, 0.35);
  border: 1px solid var(--line);
}

#sciInput {
  font-size: 20px;
}

#sciResult {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 900;
  word-break: break-all;
}

.mode-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.chip {
  width: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.chip input {
  width: auto;
}

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

.keypad button {
  min-height: 54px;
  font-weight: 750;
  background: var(--card2);
}

.keypad .equals {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
}

.keypad .danger {
  background: linear-gradient(
    135deg,
    rgba(251, 113, 133, 0.33),
    rgba(239, 68, 68, 0.17)
  );
}

.title {
  padding: 24px 4px 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card {
  padding: 20px;
  display: grid;
  gap: 13px;
}

.card.wide {
  grid-column: 1 / -1;
}

.card h3 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row.three {
  grid-template-columns: repeat(3, 1fr);
}

.stack {
  display: grid;
  gap: 10px;
}

output {
  display: block;
  min-height: 46px;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  white-space: pre-wrap;
  line-height: 1.5;
  max-height: 370px;
  overflow: auto;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.history-item strong {
  display: block;
  margin-bottom: 5px;
}
.seo-text {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}/* ===== MOBILE TRANSLATE FIX — put at the VERY END of style.css ===== */

@media (max-width: 700px) {
  .top-actions {
    display: flex !important;
    position: fixed !important;
    right: 12px !important;
    bottom: 12px !important;
    z-index: 99999 !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 8px !important;
    pointer-events: auto !important;
  }

  .translate-box {
    display: block !important;
    position: relative !important;
    z-index: 100000 !important;
  }

  #translateBtn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 132px !important;
    height: 46px !important;
    padding: 10px 14px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #38bdf8, #8b5cf6) !important;
    color: white !important;
    font-weight: 800 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35) !important;
  }

  #translatePanel {
    display: none !important;
    position: absolute !important;
    right: 0 !important;
    bottom: 56px !important;
    top: auto !important;
    left: auto !important;
    width: 190px !important;
    padding: 10px !important;
    border-radius: 20px !important;
    background: var(--card) !important;
    border: 1px solid var(--line) !important;
    box-shadow: var(--shadow) !important;
    z-index: 100001 !important;
  }

  #translatePanel.open {
    display: grid !important;
    gap: 8px !important;
  }

  #translatePanel button {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
  }

  #themeBtn,
  #clearBtn {
    display: none !important;
  }
}/* Extra features */

.offline-badge {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto 12px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: var(--text);
  text-align: center;
  font-weight: 700;
}

body.accent-blue {
  --accent: #38bdf8;
  --accent2: #2563eb;
}

body.accent-purple {
  --accent: #a855f7;
  --accent2: #7c3aed;
}

body.accent-green {
  --accent: #22c55e;
  --accent2: #16a34a;
}

body.accent-gold {
  --accent: #f59e0b;
  --accent2: #eab308;
}

body.accent-red {
  --accent: #fb7185;
  --accent2: #ef4444;
}

@media print {
  .topbar,
  .drawer,
  .overlay,
  .top-actions,
  .offline-badge {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .bg {
    display: none !important;
  }

  .main {
    width: 100% !important;
  }

  .page {
    display: block !important;
    page-break-after: always;
  }

  .card,
  .calculator,
  .intro-card {
    box-shadow: none !important;
    border: 1px solid #999 !important;
    background: white !important;
    color: black !important;
  }
}