:root {
  --bs-bg: #f8fafc;
  --bs-text: #111827;
  --bs-card: #ffffff;
  --bs-border: #e5e7eb;
  --bs-focus: #2563eb;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bs-bg);
  color: var(--bs-text);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

a {
  text-decoration-thickness: from-font;
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--bs-focus);
  outline-offset: 2px;
}

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

.container,
main,
section {
  min-width: 0;
}

.card,
.panel,
.content-box {
  background: var(--bs-card);
  border: 1px solid var(--bs-border);
  border-radius: 0.75rem;
}

@media (max-width: 768px) {
  h1 { font-size: clamp(1.5rem, 7vw, 2rem); }
  h2 { font-size: clamp(1.25rem, 5.5vw, 1.5rem); }

  :root {
    --bs-mobile-radius: 0.9rem;
    --bs-mobile-shadow: 0 10px 30px -20px rgba(15, 23, 42, 0.65);
    --bs-mobile-shadow-strong: 0 14px 24px -16px rgba(37, 99, 235, 0.55);
    --bs-mobile-border: rgba(148, 163, 184, 0.25);
    --bs-mobile-tab-bg: #f1f5f9;
    --bs-mobile-tab-text: #475569;
    --bs-mobile-tab-active-bg: linear-gradient(135deg, #2563eb, #4f46e5);
  }

  .card,
  .panel,
  .content-box {
    border-radius: 0.6rem;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  button,
  .btn,
  [role="button"],
  a.nav-button,
  .join-button {
    min-height: 44px;
    max-width: 100%;
    border-radius: var(--bs-mobile-radius);
    box-shadow: var(--bs-mobile-shadow);
    border: 1px solid var(--bs-mobile-border);
    padding-inline: clamp(0.72rem, 2.2vw, 0.95rem);
    padding-block: 0.65rem;
    line-height: 1.2;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  button:active,
  .btn:active,
  [role="button"]:active,
  a.nav-button:active,
  .join-button:active {
    transform: translateY(1px) scale(0.99);
    filter: saturate(1.05);
  }

  .tab-button,
  [role="tab"],
  .active-tab,
  .tab-active,
  .tab-inactive {
    border-radius: 999px;
    min-height: 42px;
    max-width: 100%;
    padding: 0.62rem 0.95rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  }

  .tab-button,
  [role="tab"],
  .tab-inactive {
    background: var(--bs-mobile-tab-bg);
    color: var(--bs-mobile-tab-text);
    border-color: var(--bs-mobile-border);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.4);
  }

  .active-tab,
  .tab-active {
    background: var(--bs-mobile-tab-active-bg);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--bs-mobile-shadow-strong);
  }

  .tab-button:active,
  [role="tab"]:active {
    transform: scale(0.98);
  }

  button,
  .btn,
  .tab-button,
  [role="tab"],
  [role="button"] {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
