/* Mobile foundation primitives from design handoff T-60. */

.nd-card {
  background: var(--bg2);
  border: 2px solid var(--gray);
  border-radius: 4px;
  padding: 12px;
}

.nd-card--accent {
  border-color: var(--yellow);
  box-shadow: var(--glow-sm);
  background: linear-gradient(135deg, #1a1400 0%, var(--bg2) 60%);
}

.nd-eyebrow {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.6;
  letter-spacing: 0.12em;
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border: 1px solid var(--gray);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--gray2);
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.4;
}

.nd-chip--yellow {
  border-color: var(--yellow);
  background: rgba(255, 214, 0, 0.08);
  color: var(--yellow);
}

.nd-chip--green {
  border-color: var(--green);
  background: rgba(0, 255, 136, 0.08);
  color: var(--green);
}

.nd-chip--blue {
  border-color: var(--blue);
  background: rgba(68, 170, 255, 0.08);
  color: var(--blue);
}

.nd-chip--red {
  border-color: var(--red);
  background: rgba(255, 68, 85, 0.08);
  color: var(--red);
}

.nd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border: 2px solid var(--yellow);
  border-radius: 4px;
  background: var(--bg2);
  color: var(--yellow);
  box-shadow: var(--glow-sm);
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.4;
  text-decoration: none;
}

.nd-btn--primary {
  background: var(--yellow);
  color: #000;
}

.nd-btn--ghost {
  background: transparent;
  box-shadow: none;
}

.nd-btn--danger {
  border-color: var(--red);
  color: var(--red);
  box-shadow: var(--glow-red);
}

.nd-btn--green {
  border-color: var(--green);
  color: var(--green);
  box-shadow: var(--glow-green);
}

.nd-btn--sm {
  padding: 6px 8px;
  font-size: 6.5px;
}

.nd-segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  overflow: hidden;
  border: 2px solid var(--gray);
  border-radius: 4px;
}

.nd-segmented > * {
  border: none;
  border-right: 1px solid var(--gray);
  background: transparent;
  color: var(--gray2);
  padding: 9px 6px;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

.nd-segmented > *:last-child {
  border-right: none;
}

.nd-segmented > *.is-active,
.nd-segmented > *[aria-pressed="true"] {
  background: var(--bg2);
  color: var(--yellow);
  box-shadow: inset 0 0 0 2px var(--yellow);
}

.nd-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid var(--gray);
  border-radius: 4px;
  background: var(--bg2);
}

.nd-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.nd-page-header__copy {
  min-width: 0;
}

.nd-page-header__title {
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.06em;
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-page-header__sub {
  margin-top: 2px;
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.6;
  color: var(--gray2);
}

.nd-notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 45;
}

.nd-notif {
  position: relative;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: calc(100vh - 180px);
  background: var(--bg2);
  border: 2px solid var(--yellow);
  border-radius: 4px;
  box-shadow: var(--glow-md);
}

.nd-notif__head,
.nd-lk-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nd-notif__head {
  padding: 12px 14px;
  border-bottom: 2px solid var(--gray);
}

.nd-notif__title,
.nd-lk-section__title {
  font-family: var(--font-pixel);
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-notif__title {
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.08em;
}

.nd-notif__mark {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--gray2);
  font-family: var(--font-pixel);
  font-size: 6px;
}

.nd-notif__list,
.nd-lk-section__body {
  display: grid;
  gap: 8px;
}

.nd-notif__list {
  overflow-y: auto;
  padding: 8px;
}

.nd-notif-item {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #171200, var(--bg2));
  border: 2px solid var(--gray);
  border-radius: 4px;
}

.nd-notif-item--unread {
  border-color: var(--yellow);
  box-shadow: var(--glow-sm);
}

.nd-notif-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nd-notif-item__icon {
  font-size: 16px;
  line-height: 1;
}

.nd-notif-item__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 8px;
  line-height: 1.6;
  color: var(--text);
}

.nd-notif-item__time {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.4;
  color: var(--gray2);
  white-space: nowrap;
}

.nd-notif-item__body {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.8;
  color: var(--gray2);
}

.nd-notif-item__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nd-notif-btn {
  padding: 6px 10px;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.4;
}

.nd-notif-btn--ghost {
  background: transparent;
  color: var(--yellow);
}

.nd-notif__empty {
  padding: 20px 14px;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.8;
  color: var(--gray2);
}

.nd-rating-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nd-rating-head__title {
  white-space: nowrap;
}

.nd-rating-head__tabs {
  margin-left: auto;
  display: flex;
  border: 2px solid var(--gray);
  border-radius: 4px;
  overflow: hidden;
}

.nd-rating-head__tabs button:last-child {
  border-right: none;
}

.nd-month-bar {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.nd-month-bar__nav {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}

.nd-month-bar__nav:disabled {
  opacity: 0.3;
  box-shadow: none;
}

.nd-month-bar__label {
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 9px;
  line-height: 1.5;
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-month-bar__sub {
  margin-top: 2px;
  text-align: center;
}

.nd-ldr {
  display: grid;
  gap: 6px;
}

.nd-row__meta {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.nd-row__score {
  font-family: var(--font-pixel);
  font-size: 10px;
  line-height: 1.2;
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-row__streak {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.2;
  color: #ff6600;
}

.nd-tour-list,
.nd-h2h-pick-wrap,
.nd-h2h-list,
.nd-about-copy,
.nd-tab-panel {
  display: grid;
  gap: 10px;
}

.nd-tour-card--active {
  border-color: var(--yellow);
  box-shadow: var(--glow-sm);
  background: linear-gradient(135deg, #1a1400, var(--bg2));
}

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

.nd-tour-card__actions form,
.nd-tour-card__actions .nd-btn,
.nd-tour-card__actions button {
  width: 100%;
}

.nd-tour-card__actions--single {
  grid-template-columns: 1fr;
}

.nd-h2h-pick {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
  padding: 6px;
  background: var(--bg2);
  border: 2px solid var(--gray);
  border-radius: 4px;
}

.nd-h2h-pick select {
  width: 100%;
  padding: 6px 4px;
  border: 1px solid var(--gray);
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text);
  font-family: var(--font-pixel);
  font-size: 7px;
}

.nd-h2h-pick .vs {
  font-family: var(--font-pixel);
  font-size: 10px;
  line-height: 1;
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-h2h-submit {
  width: 100%;
}

.nd-h2h-hero {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg2);
  border: 2px solid var(--gray);
  border-radius: 4px;
}

.nd-h2h-hero__side {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-decoration: none;
  color: inherit;
}

.nd-h2h-hero__avatar {
  width: 48px;
  height: 48px;
  border: 2px solid var(--yellow);
  border-radius: 4px;
  background: linear-gradient(135deg, #2a2000, #4a3800);
  box-shadow: var(--glow-sm);
  object-fit: cover;
}

.nd-h2h-hero__avatar--blue {
  border-color: var(--blue);
  background: linear-gradient(135deg, #003a66, #0a5099);
  box-shadow: 0 0 10px rgba(68, 170, 255, 0.22);
}

.nd-h2h-hero__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-pixel);
  font-size: 8px;
  line-height: 1.5;
  color: var(--text);
}

.nd-h2h-hero__score {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.nd-h2h-hero__score-val {
  font-family: var(--font-pixel);
  font-size: 14px;
  line-height: 1;
  color: var(--yellow);
  text-shadow: var(--glow-md);
}

.nd-h2h-hero__score-lbl {
  font-family: var(--font-pixel);
  font-size: 5px;
  line-height: 1.4;
  color: var(--gray2);
  letter-spacing: 0.08em;
}

.nd-cmp {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg2);
  border: 2px solid var(--gray);
  border-radius: 4px;
}

.nd-cmp__head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.nd-cmp__label {
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.4;
  color: var(--gray2);
  letter-spacing: 0.08em;
}

.nd-cmp__val {
  font-family: var(--font-pixel);
  font-size: 9px;
  line-height: 1.4;
}

.nd-cmp__val--a {
  color: var(--yellow);
  text-align: left;
  text-shadow: var(--glow-sm);
}

.nd-cmp__val--b {
  color: var(--blue);
  text-align: right;
  text-shadow: 0 0 6px rgba(68, 170, 255, 0.4);
}

.nd-cmp__bar {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: var(--bg3);
  border: 1px solid var(--gray);
  border-radius: 999px;
}

.nd-cmp__bar-a,
.nd-cmp__bar-b {
  position: absolute;
  top: 0;
  bottom: 0;
}

.nd-cmp__bar-a {
  left: 0;
  background: linear-gradient(90deg, var(--yellow), #ffe867);
  box-shadow: 0 0 6px rgba(255, 214, 0, 0.4);
}

.nd-cmp__bar-b {
  right: 0;
  background: linear-gradient(90deg, #86c7ff, var(--blue));
  box-shadow: 0 0 6px rgba(68, 170, 255, 0.4);
}

.nd-cmp__bar-pct {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 4px;
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1;
}

.nd-cmp__bar-pct--a {
  left: 4px;
  color: #000;
}

.nd-cmp__bar-pct--b {
  right: 4px;
  color: #fff;
}

.nd-cmp__dominance {
  font-family: var(--font-pixel);
  font-size: 5px;
  line-height: 1.4;
  color: var(--gray2);
  text-align: center;
  letter-spacing: 0.08em;
}

.nd-cmp__dominance--blue {
  color: var(--blue);
}

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

.nd-stat {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg2);
  border: 2px solid var(--gray);
  border-radius: 4px;
}

.nd-stat__val {
  font-family: var(--font-pixel);
  font-size: 14px;
  line-height: 1;
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-stat__val--green {
  color: var(--green);
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
}

.nd-stat__val--blue {
  color: var(--blue);
  text-shadow: 0 0 6px rgba(68, 170, 255, 0.4);
}

.nd-stat__val--red {
  color: var(--red);
  text-shadow: var(--glow-red);
}

.nd-stat__lbl {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.4;
  color: var(--gray2);
  letter-spacing: 0.06em;
}

.nd-stat__sub {
  font-family: var(--font-pixel);
  font-size: 5px;
  line-height: 1.6;
  color: var(--gray2);
}

.nd-lk-hero {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 2px solid var(--gray);
  border-radius: 4px;
}

.nd-lk-hero__avatar {
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 2px solid var(--yellow);
  border-radius: 4px;
  box-shadow: var(--glow-sm);
}

.nd-lk-hero__main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.nd-lk-hero__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1.3;
  color: var(--yellow);
  text-shadow: var(--glow-sm);
}

.nd-lk-hero__row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nd-lk-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border: 2px solid transparent;
  border-radius: 4px;
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.4;
}

.nd-lk-badge--admin {
  background: #2a0006;
  border-color: var(--red);
  color: var(--red);
}

.nd-lk-badge--stuff {
  background: #1f1700;
  border-color: var(--yellow);
  color: var(--yellow);
}

.nd-lk-badge--gamer {
  background: var(--bg3);
  border-color: var(--gray);
  color: var(--text);
}

.nd-lk-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.nd-lk-action {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--bg2);
  border: 2px solid var(--gray);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 5px;
  line-height: 1.4;
}

.nd-lk-action__icon {
  font-size: 16px;
  line-height: 1;
}

.nd-lk-action:hover,
.nd-notif__mark:hover {
  color: var(--yellow);
  border-color: var(--yellow);
  box-shadow: var(--glow-sm);
}

.nd-ach {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg3);
  border: 1px solid var(--gray);
  border-radius: 4px;
}

.nd-ach--unlocked {
  border-color: var(--yellow);
  background: rgba(255, 214, 0, 0.04);
}

.nd-ach__icon {
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.nd-ach__name {
  margin-bottom: 2px;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1.5;
  color: var(--text);
}

.nd-ach__cond {
  font-family: var(--font-pixel);
  font-size: 5px;
  line-height: 1.6;
  color: var(--gray2);
}

.nd-ach__progress {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.4;
  color: var(--yellow);
}

.nd-tab-panel[hidden] {
  display: none;
}

.nd-topbar__mobile-actions {
  display: none;
}

@media (max-width: 768px) {
  html,
  body.nd-app {
    height: 100%;
  }

  body.nd-app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    overflow: hidden;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  body.nd-app .app-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 72px;
  }

  body.nd-app .app-main.nd-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    padding: 10px;
  }

  body.nd-app .nd-page-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
  }

  body.nd-app .nd-page-scroll::-webkit-scrollbar {
    width: 4px;
  }

  body.nd-app .nd-page-scroll::-webkit-scrollbar-thumb {
    background: var(--yellow);
  }

  .topbar.nd-topbar {
    height: 48px;
    padding: 0 12px;
  }

  .topbar.nd-topbar .topbar__nav {
    display: none;
  }

  .topbar.nd-topbar .topbar__logo {
    gap: 6px;
  }

  .topbar.nd-topbar .topbar__logo-icon {
    font-size: 18px;
    line-height: 1;
  }

  .topbar.nd-topbar .topbar__logo-text {
    font-size: 10px;
  }

  .topbar.nd-topbar .nd-topbar__mobile-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .topbar.nd-topbar .notifications-shell--mobile {
    display: flex;
  }

  .topbar.nd-topbar .mobile-avatar,
  .topbar.nd-topbar .nd-topbar__avatar-link,
  .topbar.nd-topbar .nd-topbar__auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar.nd-topbar .nd-bell {
    position: relative;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border: 2px solid var(--gray);
    border-radius: 4px;
    background: var(--bg2);
    color: var(--text);
    box-shadow: none;
  }

  .topbar.nd-topbar .nd-bell:hover,
  .topbar.nd-topbar .nd-bell[aria-expanded="true"] {
    border-color: var(--yellow);
    color: var(--yellow);
    box-shadow: var(--glow-sm);
  }

  .topbar.nd-topbar .nd-bell__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid var(--yellow);
    border-radius: 999px;
    background: #2a0000;
    color: var(--yellow);
    box-shadow: var(--glow-red);
    font-family: var(--font-pixel);
    font-size: 7px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar.nd-topbar .nd-topbar__avatar-link .avatar--sm,
  .topbar.nd-topbar .nd-topbar__auth-link {
    width: 32px;
    height: 32px;
  }

  .topbar.nd-topbar .nd-topbar__auth-link {
    min-width: auto;
    padding: 6px 8px;
    font-size: 7px;
  }

  .topbar.nd-topbar .notifications-dropdown {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    width: auto;
  }

  .nd-rating-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .nd-rating-head__tabs {
    width: 100%;
    margin-left: 0;
  }

  .nd-row__streak {
    display: none;
  }

  .nd-tour-card__actions,
  .nd-tour-card__actions--single {
    grid-template-columns: 1fr;
  }

  .nd-h2h-pick {
    grid-template-columns: 1fr;
  }

  .nd-h2h-pick .vs {
    justify-self: center;
  }

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

  .tournament-hero,
  .tournament-podium,
  .tournament-participants,
  .tournament-roster-forms,
  .tournament-hero__stats {
    grid-template-columns: 1fr;
  }

  .tournament-history__head,
  .tournament-section__head,
  .notifications-page__head,
  .notifications-page__pagination,
  .nd-lk-section__head {
    flex-direction: column;
    align-items: flex-start;
  }
}
