:root {
  --app-primary: #22c55e;
  --app-primary-dark: #16a34a;
  --app-primary-soft: #eafbf1;
  --app-info-soft: #f8fafc;
  --app-text: #2b2d3b;
  --app-muted: #656d9a;
  --app-border: #d9e1ec;
  --app-card: #ffffff;
  --app-focus: rgba(34, 197, 94, 0.18);
  --app-shadow: 0 3px 16px rgba(142, 134, 171, 0.08);
}

body {
  color: var(--app-text);
  font-family: "Be Vietnam Pro", Arial, Helvetica, sans-serif;
}

.btn-primary,
.auth-page-primary,
.auth-form-card .start-btn,
#bio-screen .bio-form .start-btn,
.custom-game-actions .start-btn,
.custom-game-link,
.profile-referral button {
  border-color: var(--app-primary) !important;
  background: var(--app-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(34, 197, 94, 0.35) !important;
}

.btn-primary:hover,
.auth-page-primary:hover,
.auth-form-card .start-btn:hover,
#bio-screen .bio-form .start-btn:hover,
.custom-game-actions .start-btn:hover,
.custom-game-link:hover,
.profile-referral button:hover {
  border-color: var(--app-primary-dark) !important;
  background: var(--app-primary-dark) !important;
}

.auth-page,
#bio-screen,
.custom-games-screen {
  --bs-primary: var(--app-primary);
  --bs-primary-rgb: 34, 197, 94;
  --bs-link-color: var(--app-primary);
  --bs-link-hover-color: var(--app-primary-dark);
}

.student-screen.auth-page {
  align-content: start;
  justify-items: center;
}

.run-mode-overlay {
  padding: clamp(18px, 4vw, 32px);
  background:
    radial-gradient(circle at 50% 14%, rgba(34, 197, 94, 0.12), transparent 31%),
    rgba(6, 18, 40, 0.57);
  backdrop-filter: blur(12px);
}

.run-mode-card {
  position: relative;
  width: min(700px, 100%);
  padding: clamp(25px, 4.6vw, 42px);
  border: 1px solid rgba(218, 229, 241, 0.9);
  border-radius: clamp(22px, 3vw, 30px);
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.1), transparent 32%),
    linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
  box-shadow:
    0 35px 85px rgba(6, 18, 40, 0.29),
    0 1px 0 rgba(255, 255, 255, 0.88) inset;
  overflow: hidden;
}

.run-mode-card::before {
  content: "";
  position: absolute;
  right: -65px;
  top: -78px;
  width: 215px;
  height: 215px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.06);
  box-shadow:
    0 0 0 27px rgba(34, 197, 94, 0.033),
    0 0 0 55px rgba(34, 197, 94, 0.02);
}

.run-mode-eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 15px;
  color: var(--app-primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.run-mode-eyebrow span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--app-primary);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.run-mode-card h2 {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 0 12px;
  color: #071535;
  font-size: clamp(2rem, 4.8vw, 3.05rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.run-mode-copy {
  position: relative;
  z-index: 1;
  max-width: 540px;
  margin: 0 0 clamp(22px, 3vw, 29px);
  color: #657493;
  font-size: clamp(0.92rem, 1.6vw, 1.02rem);
  font-weight: 500;
  line-height: 1.58;
}

.run-mode-options {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.run-mode-option {
  min-height: 205px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 19px 20px 17px;
  border: 1px solid #e1e9f3;
  border-radius: 20px;
  background: #fff;
  text-align: left;
  box-shadow: 0 6px 18px rgba(17, 30, 60, 0.045);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.run-mode-option:first-child {
  border-color: #d5f2e1;
  background: linear-gradient(145deg, #f2fff7 0%, #ffffff 76%);
}

.run-mode-option:last-child {
  border-color: #d8e8fc;
  background: linear-gradient(145deg, #f1f7ff 0%, #ffffff 76%);
}

.run-mode-option:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 197, 94, 0.44);
  box-shadow: 0 18px 34px rgba(19, 42, 72, 0.1);
}

.run-mode-option:last-child:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.run-mode-option:focus-visible {
  outline: 0;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.23rem var(--app-focus), 0 18px 34px rgba(19, 42, 72, 0.1);
}

.run-mode-option:last-child:focus-visible {
  border-color: #3b82f6;
  box-shadow: 0 0 0 0.23rem rgba(59, 130, 246, 0.17), 0 18px 34px rgba(19, 42, 72, 0.1);
}

.run-mode-option .run-mode-icon {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 12px;
  background: #dcfce7;
  color: #16a34a;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.run-mode-option:last-child .run-mode-icon {
  background: #dbeafe;
  color: #2563eb;
}

.run-mode-option strong {
  color: #071535;
  font-size: clamp(1.33rem, 2.6vw, 1.58rem);
  font-weight: 700;
  line-height: 1.15;
}

.run-mode-option > span:not(.run-mode-icon) {
  min-height: 44px;
  color: #657493;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.5;
}

.run-mode-option small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid rgba(217, 225, 236, 0.7);
  color: #16a34a;
  font-size: 0.76rem;
  font-weight: 700;
}

.run-mode-option:last-child small {
  color: #2563eb;
}

.run-mode-option small b {
  font-size: 1rem;
  font-weight: 600;
}

.run-mode-note {
  position: relative;
  z-index: 1;
  margin: 22px 0 0;
  color: #8592ad;
  font-size: 0.76rem;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 560px) {
  .run-mode-card {
    padding: 23px 18px 20px;
  }

  .run-mode-card h2 {
    font-size: clamp(1.75rem, 10vw, 2.25rem);
  }

  .run-mode-options {
    grid-template-columns: 1fr;
  }

  .run-mode-option {
    min-height: 157px;
  }
}

.auth-card {
  width: min(680px, 100%);
  grid-template-columns: 1fr;
}

.auth-card.student-card::before {
  display: none;
}

.auth-card.student-card,
#bio-screen .bio-card,
.custom-games-layout,
.profile-strip,
.menu-card,
.workspace-empty-card {
  border: 1px solid var(--app-border) !important;
  background: var(--app-card);
  box-shadow: var(--app-shadow) !important;
}

.auth-form-card,
.custom-game-form,
.custom-game-preview {
  background: var(--app-card);
}

.auth-form-card .form-label,
#bio-screen .bio-form .form-label,
#bio-screen .bio-label,
.custom-game-form label,
.custom-game-type legend,
.custom-game-code-output label,
.profile-referral span {
  color: var(--app-muted) !important;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.auth-form-card .form-control,
.auth-form-card .form-select,
#bio-screen .bio-form .form-control,
.custom-game-form .form-control,
.custom-game-form .form-select,
.custom-game-code-output .form-control,
.profile-referral .form-control {
  width: 100%;
  min-height: 42px;
  padding: 0.517rem 0.95rem;
  border: 1px solid var(--app-border);
  border-radius: 0.25rem;
  background-color: var(--app-card);
  color: var(--app-text);
  font-size: 0.812rem;
  font-weight: 400;
  line-height: 1.5;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.auth-form-card .form-control::placeholder,
#bio-screen .bio-form .form-control::placeholder,
.custom-game-form .form-control::placeholder,
.profile-referral .form-control::placeholder {
  color: #a8b5d1;
  opacity: 1;
}

.auth-form-card .form-control:focus,
.auth-form-card .form-select:focus,
#bio-screen .bio-form .form-control:focus,
.custom-game-form .form-control:focus,
.custom-game-form .form-select:focus,
.custom-game-code-output .form-control:focus,
.profile-referral .form-control:focus {
  border-color: var(--app-primary);
  background-color: var(--app-card);
  box-shadow: 0 0 0 0.2rem var(--app-focus);
  outline: 0;
}

.auth-form-card .form-control:disabled,
.auth-form-card .form-select:disabled,
#bio-screen .bio-form .form-control:disabled,
.custom-game-form .form-control:disabled,
.custom-game-form .form-select:disabled,
.profile-referral .form-control[readonly] {
  background-color: #f4f6f9;
  color: #7a82b1;
  opacity: 1;
}

.auth-form-card .form-select,
.custom-game-form .form-select {
  cursor: pointer;
}

.auth-form-card textarea.form-control,
.custom-game-form textarea.form-control,
.custom-game-code-output textarea.form-control {
  min-height: 160px;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  resize: vertical;
}

.custom-game-code-output textarea.form-control {
  background: #202221;
  color: #eaeff5;
  font: 400 0.812rem/1.5 Consolas, "Courier New", monospace;
}

.custom-game-pdf-tool input[type="file"].form-control,
.custom-game-form input[type="file"].form-control {
  min-height: 44px;
  padding: 0.35rem;
  background-color: var(--app-card);
  cursor: pointer;
}

.custom-game-pdf-tool input[type="file"].form-control::file-selector-button,
.custom-game-form input[type="file"].form-control::file-selector-button {
  min-height: 32px;
  margin-right: 0.75rem;
  padding: 0.35rem 0.75rem;
  border: 0;
  border-radius: 0.25rem;
  background: #f4f6f9;
  color: var(--app-text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.custom-game-pdf-tool input[type="file"].form-control:hover::file-selector-button,
.custom-game-form input[type="file"].form-control:hover::file-selector-button {
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
}

.login-tabs.nav-tabs {
  padding: 0.25rem;
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: #f4f6f9;
}

.login-tabs .nav-link {
  min-height: 38px;
  border: 0 !important;
  border-radius: 0.35rem !important;
  color: var(--app-muted);
  font-size: 0.812rem;
  font-weight: 500;
  box-shadow: none !important;
}

.login-tabs .nav-link.active {
  background: var(--app-card) !important;
  color: var(--app-primary-dark) !important;
  box-shadow: 0 1px 2px rgba(142, 134, 171, 0.12) !important;
}

.auth-switch-text {
  margin: 1rem 0 0;
  color: var(--app-muted);
  font-size: 0.875rem;
  font-weight: 400;
  text-align: center;
}

.auth-inline-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--app-primary-dark);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
}

.auth-inline-link:hover,
.auth-inline-link:focus-visible {
  color: var(--app-primary);
  text-decoration: underline;
  outline: 0;
}

.phone-row {
  grid-template-columns: minmax(110px, 0.34fr) minmax(0, 1fr);
}

.auth-field-hint,
.server-note-text,
.profile-referral small,
.custom-game-preview p:not(.eyebrow) {
  color: var(--app-muted);
  font-size: 0.812rem;
  font-weight: 400;
}

.auth-error,
#bio-screen .bio-feedback {
  border-radius: 0.5rem;
  font-size: 0.812rem;
  font-weight: 500;
}

.auth-error.is-success,
#bio-screen .bio-feedback.is-success {
  border-color: rgba(34, 197, 94, 0.28);
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
}

.custom-game-wizard-step,
.custom-game-rules,
#bio-screen .bio-student-details,
.profile-referral,
.profile-status {
  border: 1px solid var(--app-border) !important;
  border-radius: 0.5rem;
  background: var(--app-info-soft);
}

.custom-game-check {
  border: 1px solid var(--app-border) !important;
  border-radius: 0.5rem !important;
  background: var(--app-info-soft) !important;
  color: var(--app-text) !important;
  font-size: 0.812rem !important;
  font-weight: 400 !important;
}

.custom-game-check input {
  accent-color: var(--app-primary);
}

.custom-game-type span {
  min-height: 42px;
  border: 1px solid var(--app-border);
  border-radius: 0.35rem;
  background: var(--app-card);
  color: var(--app-text);
  font-size: 0.812rem;
  font-weight: 500;
  box-shadow: none;
}

.custom-game-type input:checked + span {
  border-color: rgba(34, 197, 94, 0.45);
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  box-shadow: inset 3px 0 0 var(--app-primary);
}

.custom-game-type input:focus-visible + span,
.custom-game-check input:focus-visible {
  outline: 0.2rem solid var(--app-focus);
  outline-offset: 2px;
}

.bio-option-card {
  border: 1px solid var(--app-border) !important;
  border-radius: 0.5rem !important;
  background: var(--app-card) !important;
  color: var(--app-text) !important;
  box-shadow: none !important;
}

.bio-option-card:hover,
.bio-option-card.active {
  border-color: rgba(34, 197, 94, 0.45) !important;
  background: var(--app-primary-soft) !important;
  color: var(--app-primary-dark) !important;
}

.bio-option-icon {
  background: var(--app-primary-soft) !important;
  color: var(--app-primary-dark) !important;
}

.custom-game-actions .restart-btn,
.custom-game-secondary-link,
.auth-form-card .secondary-profile-btn,
.logout-btn {
  border: 1px solid var(--app-border) !important;
  border-radius: 0.35rem !important;
  background: var(--app-card) !important;
  color: var(--app-text) !important;
  box-shadow: none !important;
}

.custom-game-actions .restart-btn:hover,
.custom-game-secondary-link:hover,
.auth-form-card .secondary-profile-btn:hover,
.logout-btn:hover {
  background: #f4f6f9 !important;
  color: var(--app-primary-dark) !important;
}

.profile-referral-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.profile-referral button {
  width: auto;
  min-height: 42px;
  padding-inline: 1rem;
  border-radius: 0.35rem;
}

.custom-game-credit-status {
  border-color: rgba(34, 197, 94, 0.28);
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
}

.game-shell:has(#game-selection:not([hidden])) {
  width: min(1520px, 100%);
  max-width: none;
  min-height: 100dvh;
  padding: clamp(12px, 2vw, 24px);
  background:
    radial-gradient(circle at 4% 9%, rgba(34, 197, 94, 0.1), transparent 25%),
    radial-gradient(circle at 95% 12%, rgba(59, 130, 246, 0.1), transparent 28%),
    #f5f8fc;
}

.game-selection {
  width: min(1472px, 100%);
  height: calc(100dvh - clamp(24px, 4vw, 48px));
  min-height: 0;
  margin: 0 auto;
  grid-template-columns: 292px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid #e5edf6;
  border-radius: 28px;
  background: #f7faff;
  box-shadow: 0 26px 72px rgba(27, 47, 84, 0.11);
  overflow: hidden;
}

.game-selection .card {
  margin-bottom: 0;
}

.dashboard-sidebar {
  position: relative;
  min-height: 0;
  height: 100%;
  align-content: start;
  gap: 22px;
  padding: 24px 20px 20px;
  border: 0 !important;
  border-right: 1px solid #e7edf6 !important;
  border-radius: 0 !important;
  background:
    radial-gradient(circle at 15% 4%, rgba(34, 197, 94, 0.12), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #fbfcff 62%, #f5f9ff 100%);
  box-shadow: none !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.dashboard-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 18px;
  border-bottom: 1px solid #edf2f8;
}

.dashboard-brand-mark {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #22c55e, #08a86a);
  color: #fff !important;
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 20px rgba(34, 197, 94, 0.28);
}

.dashboard-brand div {
  display: grid;
  gap: 2px;
}

.dashboard-brand strong {
  color: #061237;
  font-size: 1.08rem;
  font-weight: 750;
}

.dashboard-brand div span {
  color: #7a89a6;
  font-size: 0.76rem;
  font-weight: 500;
}

.dashboard-user {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 17px 14px;
  border: 1px solid rgba(34, 197, 94, 0.12);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.14), transparent 42%),
    #ffffff;
  box-shadow: 0 10px 25px rgba(32, 51, 85, 0.045);
}

.profile-avatar {
  width: 62px;
  height: 62px;
  border: 3px solid #fff;
  background: var(--app-primary-soft);
  box-shadow: 0 7px 18px rgba(28, 43, 72, 0.16);
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-copy {
  display: grid;
  gap: 4px;
}

.profile-label {
  color: var(--app-primary-dark) !important;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-copy strong {
  color: #061237;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
}

.profile-copy span:last-child {
  color: var(--app-muted);
  font-size: 0.82rem;
}

.profile-copy span:last-child:empty {
  display: none;
}

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

.dashboard-user-stats div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #edf2f8;
  border-radius: 14px;
  background: #fff;
}

.dashboard-user-stats strong {
  color: #061237;
  font-size: 1rem;
  font-weight: 700;
}

.dashboard-user-stats span {
  color: #7787a4;
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dashboard-nav {
  display: grid;
  gap: 8px;
}

.dashboard-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 49px;
  padding: 9px 12px;
  border-radius: 14px;
  color: #5d6d8b;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.dashboard-nav a span {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #f0f4fa;
  color: #7485a4;
  font-size: 0.67rem;
  font-weight: 700;
}

.dashboard-nav a:hover,
.dashboard-nav a.active {
  background: linear-gradient(90deg, #eafbf1, #f2fff8);
  color: var(--app-primary-dark);
}

.dashboard-nav a.active span {
  background: #d8f7e5;
  color: var(--app-primary-dark);
}

.dashboard-nav a.active {
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.08);
}

.profile-status,
.profile-referral {
  padding: 16px;
  border-radius: 16px !important;
}

.profile-status {
  position: relative;
  border-color: #d9f3e4 !important;
  background: linear-gradient(145deg, #edfcf3 0%, #ffffff 100%) !important;
}

.profile-status::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 18px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.11);
}

.profile-referral {
  background: linear-gradient(145deg, #f5f8ff, #ffffff) !important;
}

.profile-status span,
.profile-referral span {
  color: var(--app-muted) !important;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-status strong {
  display: block;
  margin-top: 7px;
  color: #061237;
  padding-right: 16px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
}

.profile-referral-row {
  margin-top: 10px;
  grid-template-columns: minmax(0, 1fr) 66px;
  gap: 7px;
}

.profile-referral .form-control {
  min-height: 40px;
  padding-inline: 10px;
  border-radius: 9px;
  font-size: 0.78rem;
}

.profile-referral button {
  width: 100%;
  min-height: 40px;
  padding-inline: 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.profile-referral small {
  display: block;
  margin-top: 10px;
  font-size: 0.74rem;
  line-height: 1.45;
}

.logout-btn {
  width: 100%;
  min-height: 44px;
  padding-inline: 16px;
  border-radius: 11px !important;
  font-weight: 600;
  color: #687895 !important;
  background: transparent !important;
}

.dashboard-sidebar-actions {
  display: grid;
  gap: 9px;
  margin-top: auto;
}

.website-btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px !important;
  color: #fff !important;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.website-btn::after {
  content: "->";
  margin-left: 9px;
  font-size: 0.9rem;
}

.dashboard-main {
  grid-area: games;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  align-content: start;
  gap: 24px;
  padding: clamp(22px, 2.5vw, 34px);
  background:
    radial-gradient(circle at 94% 0%, rgba(37, 99, 235, 0.06), transparent 27%),
    #f7faff;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-kicker {
  margin: 0 0 3px;
  color: #7a89a6;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dashboard-topbar h2 {
  margin: 0;
  color: #071535;
  font-size: clamp(1.45rem, 2vw, 1.78rem);
  font-weight: 700;
}

.dashboard-online {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d9f3e4;
  border-radius: 999px;
  background: #f0fdf5;
  color: #15803d;
  font-size: 0.78rem;
  font-weight: 600;
}

.dashboard-online span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 390px);
  align-items: center;
  gap: clamp(20px, 4vw, 44px);
  padding: clamp(27px, 3.2vw, 38px);
  border-radius: 25px;
  background:
    radial-gradient(circle at 92% 12%, rgba(121, 240, 170, 0.26), transparent 19%),
    radial-gradient(circle at 70% 95%, rgba(56, 189, 248, 0.22), transparent 29%),
    linear-gradient(114deg, #071635 0%, #112956 55%, #08724e 100%);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 20px 36px rgba(13, 32, 67, 0.16);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  right: -58px;
  bottom: -76px;
  width: 218px;
  height: 218px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 32px rgba(255, 255, 255, 0.035),
    0 0 0 68px rgba(255, 255, 255, 0.025);
}

.dashboard-pill {
  display: inline-flex;
  margin-bottom: 15px;
  padding: 7px 12px;
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-hero h3 {
  max-width: 580px;
  margin: 0 0 11px;
  color: #fff;
  font-size: clamp(1.7rem, 2.4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.18;
}

.dashboard-hero-copy p {
  max-width: 500px;
  margin: 0;
  color: #c5d2ea;
  font-size: 0.93rem;
  line-height: 1.6;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 21px;
}

.dashboard-hero-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border-radius: 11px;
  background: #22c55e;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.16s ease, transform 0.16s ease;
}

.dashboard-hero-actions a:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.dashboard-hero-actions a.secondary {
  border: 1px solid rgba(255, 255, 255, 0.17);
  background: rgba(255, 255, 255, 0.09);
}

.dashboard-hero-actions a.secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.dashboard-hero-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.dashboard-hero-metrics article {
  min-height: 110px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.095);
  backdrop-filter: blur(3px);
}

.dashboard-hero-metrics strong {
  color: #fff;
  font-size: 1.36rem;
  font-weight: 700;
}

.dashboard-hero-metrics span {
  color: #bfcae2;
  font-size: 0.73rem;
  font-weight: 500;
  line-height: 1.35;
}

.dashboard-panel {
  display: grid;
  gap: 15px;
  padding: 20px;
  border: 1px solid #eaf0f7;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 30px rgba(32, 51, 85, 0.035);
}

.workspace-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 0 2px;
  border: 0;
}

.workspace-section-head div {
  display: grid;
  gap: 4px;
}

.workspace-section-head span {
  color: var(--app-primary-dark) !important;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.workspace-section-head strong {
  color: #061237;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.workspace-section-head p {
  margin: 0 0 2px;
  color: #667694;
  font-size: 0.82rem;
}

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

.menu-card {
  width: 100%;
  min-width: 0;
  min-height: 158px;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px solid #e4eaf4 !important;
  border-radius: 18px;
  background: #fff !important;
  box-shadow: 0 5px 16px rgba(17, 30, 60, 0.035) !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.menu-card:hover {
  border-color: rgba(34, 197, 94, 0.38) !important;
  box-shadow: 0 13px 27px rgba(15, 23, 42, 0.07) !important;
  transform: translateY(-2px);
}

.menu-card.active {
  border-color: #b8d8ff !important;
  background: linear-gradient(145deg, #eff7ff 0%, #ffffff 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.16) !important;
  outline: 0;
}

.game-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  display: inline-grid;
  place-items: center;
  border: 0;
  margin-bottom: 8px;
  border-radius: 999px !important;
  font-size: 0.79rem;
  font-weight: 700;
  box-shadow: none;
}

.menu-card strong {
  color: #061237;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.menu-card > span:not(.game-icon) {
  color: #536487;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
}

.activity-grid .menu-card:nth-child(1) .game-icon {
  background: #ddf9e8 !important;
  color: #059669 !important;
}

.activity-grid .menu-card:nth-child(2) .game-icon {
  background: #e1f5fe !important;
  color: #0284c7 !important;
}

.activity-grid .menu-card:nth-child(3) .game-icon {
  background: #ecfdf3 !important;
  color: #16a34a !important;
}

.activity-grid .menu-card:nth-child(4) .game-icon {
  background: #fff3dc !important;
  color: #d97706 !important;
}

.activity-grid .menu-card:nth-child(5) .game-icon {
  background: #f3e8ff !important;
  color: #7c3aed !important;
}

.activity-grid .menu-card:nth-child(6) .game-icon {
  background: #e0efff !important;
  color: #2563eb !important;
}

.activity-grid .menu-card:nth-child(7) .game-icon {
  background: #edf1f7 !important;
  color: #475569 !important;
}

.activity-grid .menu-card:nth-child(8) .game-icon {
  background: #ffe6ea !important;
  color: #e11d48 !important;
}

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

.creator-card {
  min-height: 126px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 19px;
  border: 1px solid #e4eaf4 !important;
  border-radius: 19px;
  background: #fff !important;
  box-shadow: 0 5px 16px rgba(17, 30, 60, 0.035) !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.creator-game {
  background: linear-gradient(135deg, #ffffff, #effcf4) !important;
}

.creator-slides {
  background: linear-gradient(135deg, #ffffff, #fff3f4) !important;
}

.creator-card:hover {
  border-color: rgba(34, 197, 94, 0.38) !important;
  box-shadow: 0 13px 27px rgba(15, 23, 42, 0.07) !important;
}

.creator-slides:hover {
  border-color: rgba(244, 63, 94, 0.28) !important;
}

.creator-card .game-icon {
  margin: 0;
}

.creator-card div {
  display: grid;
  gap: 6px;
}

.creator-card strong {
  color: #061237;
  font-size: 1.02rem;
  font-weight: 700;
}

.creator-card div span {
  color: #657493;
  font-size: 0.8rem;
  font-weight: 500;
}

.creator-card b {
  padding: 8px 11px;
  border-radius: 999px;
  background: #f0fdf5;
  color: #16a34a;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.creator-slides b {
  background: #fff1f2;
  color: #e11d48;
}

.saved-work-panel {
  padding-bottom: 10px;
}

.workspace-empty-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  padding: 16px 18px;
  border: 1px dashed #d8e1ee !important;
  border-radius: 18px;
  background: linear-gradient(120deg, #fff 0%, #f8faff 100%) !important;
  box-shadow: none !important;
}

.workspace-empty-card .game-icon {
  margin: 0;
}

.workspace-empty-card div {
  display: grid;
  gap: 5px;
}

.workspace-empty-card strong {
  color: #061237;
  font-size: 0.92rem;
  font-weight: 700;
}

.workspace-empty-card div span {
  color: #657493;
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .game-shell:has(#game-selection:not([hidden])) {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .game-selection {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .dashboard-sidebar {
    gap: 18px;
    padding: 18px 16px;
  }

  .dashboard-brand {
    padding-bottom: 16px;
  }

  .dashboard-user {
    grid-template-columns: 56px minmax(0, 1fr);
    padding: 14px 12px;
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
  }

  .profile-referral-row,
  .phone-row {
    grid-template-columns: 1fr;
  }

  .profile-referral button {
    width: 100%;
  }

  .dashboard-main {
    gap: 20px;
    padding: 18px 16px 26px;
    overflow: visible;
  }

  .dashboard-panel {
    padding: 15px;
    border-radius: 18px;
  }

  .dashboard-topbar,
  .workspace-section-head {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .dashboard-online {
    min-height: 34px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .dashboard-hero-metrics {
    gap: 7px;
  }

  .dashboard-hero-metrics article {
    min-height: 90px;
    padding: 12px 8px;
  }

  .activity-grid,
  .creator-grid {
    grid-template-columns: 1fr;
  }

  .menu-card {
    min-height: 112px;
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 13px;
    align-content: center;
    padding: 14px 16px;
  }

  .menu-card .game-icon {
    grid-row: 1 / 3;
    margin: 0;
  }

  .creator-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .creator-card b {
    grid-column: 2;
  }
}

@media (max-width: 980px) {
  html:has(#game-selection:not([hidden])),
  body:has(#game-selection:not([hidden])) {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    overscroll-behavior: auto;
  }

  .game-shell:has(#game-selection:not([hidden])) {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .game-selection {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .dashboard-sidebar {
    height: auto;
    min-height: auto;
    border-right: 0 !important;
    border-bottom: 1px solid var(--app-border) !important;
    overflow: visible;
  }

  .dashboard-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-nav a {
    justify-content: center;
  }

  .dashboard-main {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .activity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .game-shell:has(#game-selection:not([hidden])) {
    padding: 0;
    background: #f7faff;
  }

  .game-selection {
    display: block;
    width: 100%;
  }

  .dashboard-sidebar {
    gap: 14px;
    padding: 16px 14px 18px;
  }

  .dashboard-brand {
    padding: 0 0 13px;
  }

  .dashboard-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .dashboard-user-stats {
    gap: 8px;
  }

  .dashboard-user-stats div {
    padding: 10px 12px;
  }

  .dashboard-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .dashboard-nav::-webkit-scrollbar {
    display: none;
  }

  .dashboard-nav a {
    flex: 0 0 auto;
    min-height: 43px;
    padding: 7px 11px;
    gap: 8px;
    white-space: nowrap;
  }

  .profile-status,
  .profile-referral {
    padding: 14px;
  }

  .dashboard-sidebar-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 0;
  }

  .website-btn,
  .logout-btn {
    min-height: 44px;
    font-size: 0.81rem;
  }

  .profile-referral-row {
    grid-template-columns: minmax(0, 1fr) 72px;
  }

  .dashboard-main {
    padding: 16px 12px 24px;
    gap: 14px;
  }

  .dashboard-topbar h2 {
    font-size: 1.35rem;
  }

  .dashboard-hero {
    gap: 18px;
    padding: 20px 16px;
    border-radius: 19px;
  }

  .dashboard-hero h3 {
    font-size: clamp(1.48rem, 7.7vw, 1.78rem);
  }

  .dashboard-hero-copy p {
    font-size: 0.84rem;
  }

  .dashboard-hero-actions a {
    flex: 1 1 130px;
    justify-content: center;
    padding-inline: 12px;
  }

  .dashboard-hero-metrics article {
    min-height: 74px;
  }

  .dashboard-panel {
    gap: 12px;
    padding: 13px;
    border-radius: 17px;
  }

  .workspace-section-head strong {
    font-size: 1.08rem;
  }

  .workspace-section-head p {
    font-size: 0.77rem;
  }

  .activity-grid,
  .creator-grid {
    grid-template-columns: 1fr;
  }

  .menu-card {
    min-height: 94px;
    padding: 12px;
    border-radius: 15px;
  }

  .menu-card strong {
    font-size: 0.94rem;
  }

  .creator-card {
    min-height: 105px;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
  }

  .workspace-empty-card {
    padding: 14px;
    border-radius: 15px;
  }
}

@media (min-width: 981px) and (max-width: 1180px) {
  .game-selection {
    grid-template-columns: 264px minmax(0, 1fr);
  }

  .dashboard-main {
    padding: 24px 20px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .activity-grid,
  .creator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Gameplay arena */
.game-shell:has(.board:not([hidden])) {
  --arena-blue: #1877f2;
  --arena-blue-dark: #0b55bc;
  --arena-red: #f04455;
  --arena-red-dark: #cb2035;
  --arena-surface: rgba(255, 255, 255, 0.9);
  --arena-border: #e2ebf5;
  padding: clamp(12px, 1.4vw, 20px);
  gap: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(34, 197, 94, 0.11), transparent 30%),
    radial-gradient(circle at 8% 45%, rgba(24, 119, 242, 0.08), transparent 23%),
    radial-gradient(circle at 92% 45%, rgba(240, 68, 85, 0.07), transparent 23%),
    #f5f8fd;
}

.game-shell:has(.board:not([hidden])) .board {
  grid-template-columns: clamp(248px, 18vw, 292px) minmax(480px, 1fr) clamp(248px, 18vw, 292px);
  gap: clamp(12px, 1.25vw, 20px);
  padding: clamp(64px, 8vh, 82px) 0 0;
}

body[data-mode="math"] .board::before {
  content: "Math Tug of War";
  top: clamp(9px, 1.6vh, 16px);
  color: #071535;
  font-family: "Be Vietnam Pro", Arial, sans-serif;
  font-size: clamp(1.9rem, 3.2vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  text-transform: none;
  text-shadow: none;
}

.game-shell:has(.board:not([hidden])) .team-panel,
.game-shell:has(.board:not([hidden])) .race-panel {
  border: 1px solid var(--arena-border);
  border-radius: 24px;
  background: var(--arena-surface);
  box-shadow: 0 16px 42px rgba(17, 33, 62, 0.075);
  backdrop-filter: none;
}

.game-shell:has(.board:not([hidden])) .team-panel {
  gap: 12px;
  padding: 0 14px 14px;
  background: #fff;
  scrollbar-color: #dce6f2 transparent;
}

.game-shell:has(.board:not([hidden])) .team-title {
  min-height: 64px;
  margin: 0 -14px 4px;
  padding: 13px 17px;
  border-radius: 23px 23px 0 0;
}

.game-shell:has(.board:not([hidden])) .team-one .team-title {
  background: linear-gradient(130deg, #2489ff, #1368d5);
}

.game-shell:has(.board:not([hidden])) .team-two .team-title {
  background: linear-gradient(130deg, #ff5362, #df273d);
}

.game-shell:has(.board:not([hidden])) .team-title h2 {
  font-family: "Be Vietnam Pro", Arial, sans-serif;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: 700;
}

.game-shell:has(.board:not([hidden])) .team-badge {
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(10, 25, 52, 0.1);
}

.game-shell:has(.board:not([hidden])) .question-card {
  min-height: 94px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid #e2ebf5;
  border-radius: 17px;
  background: #f8fbff;
  box-shadow: none;
}

.game-shell:has(.board:not([hidden])) .team-one .question-card {
  background: linear-gradient(145deg, #f1f8ff, #ffffff);
}

.game-shell:has(.board:not([hidden])) .team-two .question-card {
  background: linear-gradient(145deg, #fff5f6, #ffffff);
}

.game-shell:has(.board:not([hidden])) .question-card strong {
  font-family: "Be Vietnam Pro", Arial, sans-serif;
  font-size: clamp(1.8rem, 2.7vw, 2.4rem);
  font-weight: 700;
}

.game-shell:has(.board:not([hidden])) .answer-display {
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 7px;
  border: 1px solid #e3ebf5;
  border-radius: 14px;
  background: #fff;
  color: #101a34;
  font-size: 1.6rem;
  font-weight: 700;
  box-shadow: inset 0 1px 3px rgba(19, 35, 65, 0.035);
}

.game-shell:has(.board:not([hidden])) .keypad {
  grid-template-rows: repeat(4, minmax(42px, 1fr));
  gap: 8px;
  min-height: 188px;
}

.game-shell:has(.board:not([hidden])) .keypad button,
.game-shell:has(.board:not([hidden])) .option-grid button {
  min-height: 43px;
  border: 1px solid #e3ebf5;
  border-radius: 13px;
  background: #f9fbfe;
  color: #182440;
  font-size: 1rem;
  font-weight: 650;
  box-shadow: none;
}

.game-shell:has(.board:not([hidden])) .keypad button:hover,
.game-shell:has(.board:not([hidden])) .option-grid button:hover {
  border-color: #c5daf6;
  background: #eef6ff;
}

.game-shell:has(.board:not([hidden])) .panel-actions {
  gap: 8px;
}

.game-shell:has(.board:not([hidden])) .panel-actions button {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: none;
}

.game-shell:has(.board:not([hidden])) .panel-actions .secondary-btn {
  background: #f1f4f9;
  color: #60708e;
}

.game-shell:has(.board:not([hidden])) .team-one .panel-actions .submit-btn {
  background: var(--arena-blue) !important;
}

.game-shell:has(.board:not([hidden])) .team-two .panel-actions .submit-btn {
  background: var(--arena-red) !important;
  border-color: var(--arena-red-dark);
}

.game-shell:has(.board:not([hidden])) .race-panel {
  gap: 14px;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 52%, rgba(24, 119, 242, 0.06), transparent 34%),
    radial-gradient(circle at 80% 52%, rgba(240, 68, 85, 0.06), transparent 34%),
    #fff;
}

.game-shell:has(.board:not([hidden])) .score-row {
  max-width: 520px;
  gap: 9px;
}

.game-shell:has(.board:not([hidden])) .score-chip,
.game-shell:has(.board:not([hidden])) .race-goal {
  min-height: 62px;
  padding: 8px 12px;
  border: 1px solid #e1eaf5;
  border-radius: 16px;
  background: #f7faff;
  box-shadow: none;
}

.game-shell:has(.board:not([hidden])) .score-chip span {
  color: #7a89a6;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.game-shell:has(.board:not([hidden])) .score-chip strong {
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  font-weight: 700;
}

.game-shell:has(.board:not([hidden])) .team-one-score strong {
  color: var(--arena-blue-dark);
}

.game-shell:has(.board:not([hidden])) .team-two-score strong {
  color: var(--arena-red-dark);
}

.game-shell:has(.board:not([hidden])) .race-goal {
  min-height: 48px;
  align-self: center;
  border-radius: 999px;
  background: #effaf4;
  color: #16a34a;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.game-shell:has(.board:not([hidden])) .track-wrap {
  min-height: 340px;
  border: 1px solid #edf2f8;
  border-radius: 21px;
  background:
    linear-gradient(180deg, #ffffff 0%, #ffffff 73%, #f5fbf7 73%, #f5fbf7 100%);
  box-shadow: inset 0 -1px 0 #e5f1e9;
}

.game-shell:has(.board:not([hidden])) .tug-center-line {
  top: 10%;
  bottom: 16%;
  width: 4px;
  background: repeating-linear-gradient(180deg, #94a3b8 0 9px, transparent 9px 17px);
  box-shadow: none;
}

.game-shell:has(.board:not([hidden])) .tug-art {
  width: min(94%, 900px);
  filter: drop-shadow(0 13px 22px rgba(15, 23, 42, 0.12));
}

.game-shell:has(.board:not([hidden])) .status-message {
  min-height: 36px;
  display: grid;
  place-items: center;
  margin: 0;
  color: #60708e;
  font-size: 0.9rem;
  font-weight: 600;
}

.game-shell:has(.board:not([hidden])) > .game-controls {
  gap: 10px;
  padding: 4px;
}

.game-shell:has(.board:not([hidden])) > .game-controls button {
  min-width: clamp(128px, 13vw, 168px);
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid #e1eaf5;
  border-radius: 14px;
  background: #fff;
  color: #071535;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 7px 18px rgba(17, 33, 62, 0.06);
}

.game-shell:has(.board:not([hidden])) > .game-controls .start-btn {
  border-color: #1db85a;
  background: #22c55e;
  color: #fff;
  box-shadow: 0 10px 21px rgba(34, 197, 94, 0.22);
}

@media (max-width: 1100px) and (min-width: 901px) {
  .game-shell:has(.board:not([hidden])) .board {
    grid-template-columns: minmax(214px, 248px) minmax(380px, 1fr) minmax(214px, 248px);
    gap: 10px;
  }

  .game-shell:has(.board:not([hidden])) .track-wrap {
    min-height: 280px;
  }
}

@media (max-width: 900px) {
  .game-shell:has(.board:not([hidden])) {
    height: 100dvh;
    padding: 10px;
    gap: 0;
    overflow: hidden;
  }

  .game-shell:has(.board:not([hidden])) .board {
    grid-template-columns: 1fr;
    grid-template-areas:
      "race"
      "team-one"
      "team-two";
    gap: 12px;
    align-items: start;
    padding: 54px 0 calc(78px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body[data-mode="math"] .board::before {
    top: 11px;
    font-size: clamp(1.45rem, 6.7vw, 1.9rem);
  }

  .game-shell:has(.board:not([hidden])) .race-panel {
    order: 0;
    min-height: 0;
    padding: 12px;
    border-radius: 19px;
  }

  .game-shell:has(.board:not([hidden])) .score-row {
    grid-template-columns: 1fr auto 1fr;
    gap: 7px;
  }

  .game-shell:has(.board:not([hidden])) .score-chip,
  .game-shell:has(.board:not([hidden])) .race-goal {
    min-height: 50px;
    padding: 6px;
    border-radius: 12px;
  }

  .game-shell:has(.board:not([hidden])) .track-wrap {
    min-height: clamp(188px, 52vw, 280px);
    border-radius: 15px;
  }

  .game-shell:has(.board:not([hidden])) .status-message {
    min-height: 28px;
    font-size: 0.82rem;
  }

  .game-shell:has(.board:not([hidden])) .team-panel {
    min-height: 0;
    overflow: visible;
    padding: 0 12px 12px;
    border-radius: 19px;
  }

  .game-shell:has(.board:not([hidden])) .team-title {
    min-height: 56px;
    margin: 0 -12px 2px;
    padding: 10px 13px;
    border-radius: 18px 18px 0 0;
  }

  .game-shell:has(.board:not([hidden])) .question-card {
    min-height: 74px;
  }

  .game-shell:has(.board:not([hidden])) .question-card strong {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .game-shell:has(.board:not([hidden])) .keypad {
    grid-template-rows: repeat(4, 50px);
    min-height: 224px;
  }

  .game-shell:has(.board:not([hidden])) .keypad button,
  .game-shell:has(.board:not([hidden])) .option-grid button,
  .game-shell:has(.board:not([hidden])) .panel-actions button {
    min-height: 50px;
    font-size: 1rem;
  }

  .game-shell:has(.board:not([hidden])) > .game-controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid #e5edf6;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
  }

  .game-shell:has(.board:not([hidden])) > .game-controls button {
    min-width: 0;
    min-height: 48px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 0.83rem;
  }
}

@media (max-width: 480px) {
  .game-shell:has(.board:not([hidden])) {
    padding: 8px;
  }

  .game-shell:has(.board:not([hidden])) .board {
    padding-top: 48px;
  }

  .game-shell:has(.board:not([hidden])) .race-panel,
  .game-shell:has(.board:not([hidden])) .team-panel {
    border-radius: 17px;
  }

  .game-shell:has(.board:not([hidden])) .track-wrap {
    min-height: 178px;
  }
}
