:root {
  color-scheme: light;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e2e8f0;
  --text-soft: #64748b;
  --accent: #0891b2;
  --accent-strong: #0e7490;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, 0.1), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #0f172a;
  overflow-x: hidden;
}

.site-shell {
  position: relative;
}

.hero-glow {
  pointer-events: none;
  position: absolute;
  height: 18rem;
  width: 18rem;
  border-radius: 9999px;
  filter: blur(80px);
  opacity: 0.35;
}

.hero-glow-left {
  left: -4rem;
  top: 2rem;
  background: rgba(34, 211, 238, 0.2);
}

.hero-glow-right {
  right: -3rem;
  top: 5rem;
  background: rgba(14, 165, 233, 0.15);
}

.glass-card,
.tool-card,
.about-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.result-box {
  border: 1px solid #bae6fd;
  background: linear-gradient(180deg, #ecfeff 0%, #f8fdff 100%);
  box-shadow: 0 16px 36px rgba(8, 145, 178, 0.08);
}

.tool-layout {
  position: relative;
  z-index: 1;
}

.calculator-showcase {
  position: relative;
  z-index: 1;
}

.calculator-shell {
  border-radius: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background:
    radial-gradient(circle at top left, rgba(147, 197, 253, 0.08), transparent 32%),
    linear-gradient(180deg, #242428 0%, #1f1f22 100%);
  padding: 1.1rem;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.2);
}

.calculator-tabs {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  padding: 0 0.5rem 0.875rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  overflow-x: auto;
}

.calculator-tab {
  border: 0;
  background: transparent;
  color: #9ca3af;
  font: inherit;
  font-weight: 700;
  padding: 0;
  white-space: nowrap;
}

.calculator-tab.is-active {
  color: #f8fafc;
  text-decoration: underline;
  text-decoration-color: #93c5fd;
  text-decoration-thickness: 3px;
  text-underline-offset: 10px;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.calculator-display {
  margin-bottom: 1.1rem;
  border-radius: 1.6rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.9rem 0.9rem 1rem;
  min-height: 9.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.calculator-display-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.calculator-badge,
.calculator-angle-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  border-radius: 9999px;
  padding: 0.25rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calculator-badge {
  background: rgba(34, 211, 238, 0.14);
  color: #67e8f9;
}

.calculator-angle-toggle {
  border: 1px solid rgba(196, 181, 253, 0.38);
  background: rgba(196, 181, 253, 0.14);
  color: #ede9fe;
  cursor: pointer;
}

.calculator-angle-toggle[hidden] {
  display: none;
}

.calculator-expression {
  display: flex;
  width: 100%;
  min-height: 4.5rem;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 1.25rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(103, 232, 249, 0.24);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.55), rgba(30, 41, 59, 0.36));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 3px rgba(34, 211, 238, 0.06);
  color: #f8fafc;
  font: inherit;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: right;
  word-break: break-word;
  white-space: nowrap;
}

.calculator-status-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 0.9rem;
}

.calculator-result {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}

.calculator-key {
  min-height: 44px;
  border: 0;
  border-radius: 0.7rem;
  background: linear-gradient(180deg, #3a3b42 0%, #2f3137 100%);
  color: #f8fafc;
  border: 1px solid #42444c;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 1px 0 rgba(15, 23, 42, 0.28);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  padding: 0.6rem 0.45rem;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.calculator-key:hover,
.calculator-key:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #43464e 0%, #373a42 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 8px 18px rgba(15, 23, 42, 0.16);
}

.calculator-key-accent {
  background: linear-gradient(180deg, #40424a 0%, #353740 100%);
  border-color: #4a4d56;
  color: #f8fafc;
}

.calculator-key-accent:hover,
.calculator-key-accent:focus-visible {
  background: linear-gradient(180deg, #494c55 0%, #3c3f48 100%);
}

.calculator-key-function {
  background: linear-gradient(180deg, #31402a 0%, #263222 100%);
  color: #f8fafc;
  border-color: #415339;
}

.calculator-key-function:hover,
.calculator-key-function:focus-visible {
  background: linear-gradient(180deg, #384a31 0%, #2d3b28 100%);
}

.calculator-key-primary {
  background: linear-gradient(180deg, #8db8a5 0%, #739b89 100%);
  color: #0f172a;
  border-color: #7b9f8f;
}

.calculator-key-primary:hover,
.calculator-key-primary:focus-visible {
  background: linear-gradient(180deg, #9ac3b1 0%, #81a797 100%);
}

.btn-number {
  background: linear-gradient(180deg, #3a3b42 0%, #2f3137 100%);
  border-color: #42444c;
  color: #f8fafc;
}

.btn-operator {
  background: linear-gradient(180deg, #40424a 0%, #353740 100%);
  border-color: #4a4d56;
  color: #f8fafc;
}

.btn-scientific {
  background: linear-gradient(180deg, #31402a 0%, #263222 100%);
  border-color: #415339;
  color: #f8fafc;
}

.btn-action {
  background: linear-gradient(180deg, #40424a 0%, #353740 100%);
  border-color: #4a4d56;
  color: #f8fafc;
}

.btn-equals {
  background: linear-gradient(180deg, #8db8a5 0%, #739b89 100%);
  border-color: #7b9f8f;
  color: #0f172a;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.14),
    0 8px 18px rgba(115, 155, 137, 0.2);
}

.btn-constant {
  background: linear-gradient(180deg, #31402a 0%, #263222 100%);
  border-color: #415339;
  color: #f8fafc;
}

.calculator-key:active {
  transform: translateY(0);
}

.tool-card {
  min-height: 15rem;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: #bae6fd;
  box-shadow: 0 18px 40px rgba(8, 145, 178, 0.1);
}

.toolhub-seo-section {
  padding: 0;
}

.toolhub-seo-content {
  max-width: 72rem;
  margin: 0 auto;
}

.toolhub-seo-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #0e7490;
}

.toolhub-seo-content h2 {
  margin: 0.85rem 0 1rem;
  font-size: clamp(1.85rem, 3vw, 2.4rem);
  line-height: 1.15;
  font-weight: 800;
  color: #0f172a;
}

.toolhub-seo-content h3 {
  margin: 1.85rem 0 0.7rem;
  font-size: 1.2rem;
  line-height: 1.3;
  font-weight: 800;
  color: #0f172a;
}

.toolhub-seo-content p {
  margin: 0.9rem 0 0;
  font-size: 1rem;
  line-height: 1.8;
  color: #475569;
}

.icon-badge {
  display: inline-flex;
  height: 3rem;
  width: 3rem;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background: linear-gradient(135deg, #ecfeff, #e0f2fe);
  color: #0e7490;
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nav-link,
.footer-link {
  position: relative;
  transition: color 180ms ease;
}

.nav-link:hover,
.footer-link:hover,
.nav-link:focus-visible,
.footer-link:focus-visible {
  color: #0f172a;
}

.nav-link::after,
.footer-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: transform 180ms ease;
}

.nav-link:hover::after,
.footer-link:hover::after,
.nav-link:focus-visible::after,
.footer-link:focus-visible::after {
  transform: scaleX(1);
}

@media (max-width: 767px) {
  .hero-glow {
    height: 12rem;
    width: 12rem;
    filter: blur(60px);
  }

  .calculator-shell {
    padding: 1rem;
    border-radius: 1.5rem;
  }

  .calculator-tabs {
    gap: 1rem;
    margin-bottom: 0.875rem;
  }

  .calculator-grid {
    gap: 0.42rem;
  }

  .calculator-display {
    border-radius: 1.25rem;
    padding: 0.85rem;
    min-height: 8.5rem;
  }

  .calculator-expression {
    min-height: 4rem;
    border-radius: 1rem;
    padding: 0.75rem 0.85rem;
    font-size: 1.45rem;
  }

  .calculator-key {
    min-height: 40px;
    border-radius: 0.85rem;
    font-size: 0.88rem;
  }

  .calculator-status-row {
    align-items: flex-end;
    flex-direction: row;
  }

  .calculator-result {
    width: 100%;
    text-align: right;
  }

  .toolhub-seo-section {
    padding: 0;
  }

  .toolhub-seo-content {
    max-width: 100%;
  }

  .toolhub-seo-content p {
    font-size: 0.95rem;
    line-height: 1.75;
  }
}

@media (max-width: 639px) {
  .calculator-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
