* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  overflow-x: hidden;
  width: 100vw;
  max-width: 100%;
  font-size: 16px;
}

img { max-width: 100%; height: auto; }

svg, canvas {
  max-width: 100%;
  height: auto;
  transform-origin: top left;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper > table {
  width: 100%;
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 49;
  padding-top: 80px;
  padding-left: 24px;
  padding-right: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu-dark {
  background: rgba(26, 15, 10, 0.95);
  backdrop-filter: blur(14px);
}

.mobile-menu-light {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.mobile-menu-nav a {
  display: block;
  font-size: 20px;
  font-weight: 700;
  padding: 10px 0;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-menu-dark .mobile-menu-nav a {
  color: #ffffff;
}

.mobile-menu-light .mobile-menu-nav a {
  color: #111827;
}

.mobile-menu-light .mobile-menu-nav a {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.auto-menu-toggle {
  padding: 8px;
  border: 0;
  background: transparent;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 768px) {
  .table-wrapper > table {
    font-size: clamp(10px, 2.5vw, 14px);
  }

  h1 { font-size: 24px !important; }
  h2 { font-size: 20px !important; }
  h3 { font-size: 18px !important; }

  button,
  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  button {
    min-width: 44px;
    padding: 12px 20px;
  }

  input,
  select,
  textarea {
    width: 100%;
    max-width: 100%;
  }

  #chart-container-main,
  #chart-container-navamsa,
  #chart-container-tech,
  #varga-chart-container,
  #chalit-chart-container {
    width: min(95vw, 100%);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  #custom-modal-box,
  [role="dialog"] {
    max-width: 95vw;
  }
}
