/* TouchTypeBetter — Theme-Aware CSS */
/* All brand colors driven by --ttb-* CSS custom properties from the active Theme. */

:root {
  --ttb-page-content-max-width: 1600px;
  /* Neutral fallback also survives layout disposal after an interactive error. */
  --ttb-background: #b3b3b3;
  --ttb-surface-source: #e9e9e9;
  --ttb-surface: rgb(from color-mix(in srgb, var(--ttb-background) 85%, var(--ttb-surface-source)) r g b / 1);
  --ttb-primary: #262626;
  --ttb-primary-text: #ffffff;
  --ttb-drawer: #a6a6a6;
  --ttb-text-primary: #262626;
  --ttb-non-default-text: #7a2e00;
  --ttb-text-secondary: rgba(38, 38, 38, 0.72);
  --ttb-border: rgba(38, 38, 38, 0.18);
}

.mud-container {
  max-width: var(--ttb-page-content-max-width) !important;
}

body {
  margin: 0;
  font-family: "Rubik", Roboto, sans-serif;
  overflow-x: hidden;
  background-color: var(--ttb-background);
  color: var(--ttb-text-primary);
}

/* ===== APP LAYOUT ===== */
.app-layout {
  min-height: 100vh;
  min-height: 100dvh;
}

.app-layout .mud-drawer {
  border-right: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.1));
  backdrop-filter: blur(10px);
  transition:
    width 0.2s ease,
    min-width 0.2s ease;
}

/* Mini drawers have a viewport height but no top inset in MudBlazor. Do not
   let a page's static flow position move the header or push the footer below it. */
.app-layout .mud-drawer.mud-drawer-fixed {
  top: 0;
  bottom: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.ttb-drawer-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 0.125rem;
  padding-inline-end: 0.75rem;
  box-sizing: border-box;
  overflow: hidden;
  border-bottom: 1px solid var(--ttb-border);
  background: linear-gradient(135deg, var(--ttb-primary), var(--ttb-primary-darken));
}

.ttb-drawer-header .mud-icon-button {
  flex: 0 0 auto;
  margin-inline: 0 !important;
  color: white !important;
}

.ttb-drawer-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-family: "Roboto Condensed", sans-serif !important;
  font-size: 1.125rem !important;
  font-weight: 400 !important;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ttb-drawer-title:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.app-layout .mud-drawer-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.ttb-drawer-header,
.ttb-drawer-footer {
  flex-shrink: 0;
}

.ttb-navigation {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.ttb-navigation-primary,
.ttb-navigation-bottom {
  flex-shrink: 0;
}

.ttb-navigation-bottom {
  margin-top: auto;
}

.ttb-nav-separator {
  width: 100% !important;
  margin: 0.75rem 0 !important;
  border-color: var(--ttb-border) !important;
}

.ttb-drawer-footer {
  margin-top: auto;
  padding: 0.6rem 0.5rem;
}

.ttb-account-menu,
.ttb-account-menu .mud-menu-activator,
.ttb-guest-account {
  width: 100%;
}

.ttb-account-menu .ttb-account-activator,
.ttb-guest-account .ttb-account-activator {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 6px;
  padding: 0.5rem;
  background: transparent;
  color: var(--ttb-text-primary);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ttb-account-menu .ttb-account-activator:hover,
.ttb-guest-account .ttb-account-activator:hover {
  background-color: color-mix(in srgb, var(--ttb-primary) 10%, transparent);
}

.ttb-account-menu .ttb-account-activator:focus-visible,
.ttb-guest-account .ttb-account-activator:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: -2px;
}

.ttb-account-menu .ttb-account-activator .mud-icon-root,
.ttb-guest-account .ttb-account-activator .mud-icon-root {
  flex: 0 0 24px;
}

.ttb-account-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ttb-account-popover,
.ttb-account-popover .mud-list {
  min-width: 180px;
  background-color: var(--ttb-surface) !important;
  color: var(--ttb-text-primary) !important;
}

.ttb-account-popover {
  border: 1px solid var(--ttb-border);
  border-radius: 8px;
}

/* MudBlazor hides nav labels automatically for a closed Mini drawer. */
.app-layout .mud-drawer.mud-drawer--closed.mud-drawer-mini .ttb-drawer-header {
  justify-content: center;
  padding-inline: 0;
}

.app-layout .mud-drawer.mud-drawer--closed.mud-drawer-mini .ttb-drawer-title {
  display: none !important;
}

.app-layout .mud-drawer.mud-drawer--closed.mud-drawer-mini .ttb-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  min-height: 52px;
  padding: 0;
}

.app-layout .mud-drawer.mud-drawer--closed.mud-drawer-mini .ttb-account-menu,
.app-layout .mud-drawer.mud-drawer--closed.mud-drawer-mini .ttb-account-menu .mud-menu-activator,
.app-layout .mud-drawer.mud-drawer--closed.mud-drawer-mini .ttb-guest-account {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.app-layout .mud-drawer.mud-drawer--closed.mud-drawer-mini .ttb-account-activator {
  justify-content: center;
  gap: 0;
  height: 100%;
  padding: 0;
}

.app-layout .ttb-navigation .ttb-vim-link .mud-icon-root {
  background: url("/vimlogo.svg") center / contain no-repeat;
}

.app-layout .ttb-navigation .ttb-vim-link .mud-icon-root path {
  visibility: hidden;
}

.dashboard-start-practice {
  transform: scale(0.75);
  transform-origin: right center;
}

.app-layout .mud-nav-menu .mud-nav-link {
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.7)) !important;
  margin-bottom: 4px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.app-layout .mud-nav-menu .mud-nav-link:hover {
  background-color: color-mix(in srgb, var(--ttb-primary) 10%, transparent) !important;
  color: var(--ttb-primary) !important;
}

.app-layout .mud-nav-menu .mud-nav-link.mud-nav-link-active {
  background-color: color-mix(in srgb, var(--ttb-primary) 20%, transparent) !important;
  color: var(--ttb-primary) !important;
}

.ttb-about-nav-wrap {
    position: relative;
}

.ttb-about-badge {
    position: absolute;
    z-index: 2;
    top: 6px;
    left: 29px;
    width: 12px;
    height: 12px;
    color: #f7c948;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
    pointer-events: none;
}

.ttb-about-badge svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.main-content {
  /* Contain page margins so the gradient also paints the top/bottom gutters. */
  display: flow-root;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 0 !important;
  background: linear-gradient(135deg, var(--ttb-background, #1a1d2e) 0%, var(--ttb-drawer, #161927) 100%);
}

/* On small screens, the expanded drawer overlays rather than squeezing content. */
@media (max-width: 959.98px) {
  .app-layout .main-content {
    margin-left: var(--mud-drawer-width-mini-left, 52px) !important;
  }
}

/* ===== STATS CARDS ===== */
.stats-card {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.stats-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--ttb-primary) 30%, transparent) !important;
}

/* ===== ERROR PAGE ===== */
.error-document {
  --ttb-primary: #262626;
  --ttb-primary-hover: #3b3b3b;
  --ttb-primary-text: #ffffff;
  --ttb-background: #b3b3b3;
  --ttb-surface: color-mix(in srgb, var(--ttb-background) 85%, #e9e9e9);
  --ttb-drawer: #a6a6a6;
  --ttb-text-primary: #262626;
  --ttb-text-secondary: rgba(38, 38, 38, 0.72);
  --ttb-border: rgba(38, 38, 38, 0.18);
  min-height: 100vh;
  margin: 0;
  color: var(--ttb-text-primary);
  background: linear-gradient(135deg, var(--ttb-background) 0%, var(--ttb-drawer) 100%);
}

.error-page {
  display: grid;
  width: 100%;
  max-width: var(--ttb-page-content-max-width, 1600px);
  min-height: 100vh;
  box-sizing: border-box;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem);
  place-items: center;
}

.error-card {
  width: min(100%, 42rem);
  box-sizing: border-box;
  padding: clamp(2rem, 6vw, 4rem);
  border: 1px solid var(--ttb-border);
  border-radius: 1rem;
  background: var(--ttb-surface);
  box-shadow: 0 1.5rem 3rem rgba(38, 38, 38, 0.16);
  text-align: center;
}

.error-brand {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--ttb-text-primary);
  font-weight: 700;
  text-decoration: none;
}

.error-brand:focus-visible,
.error-home-link:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: 4px;
}

.error-mark {
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1.25rem;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ttb-primary) 10%, transparent);
  color: var(--ttb-primary);
  font-size: 1.75rem;
  font-weight: 700;
}

.error-eyebrow {
  margin: 0 0 0.5rem;
  color: var(--ttb-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.error-card h1 {
  margin: 0;
  color: var(--ttb-text-primary);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
}

.error-copy {
  max-width: 34rem;
  margin: 1rem auto 1.75rem;
  color: var(--ttb-text-secondary);
  line-height: 1.6;
}

.error-home-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: 0.4rem;
  background: var(--ttb-primary);
  color: var(--ttb-primary-text);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.error-home-link:hover {
  background: var(--ttb-primary-hover);
}

/* ===== AUTH PAGES ===== */
.auth-container {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--ttb-background, #b3b3b3) 0%, var(--ttb-drawer, #a6a6a6) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  max-width: 450px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
}

/* Login-specific neutral palette.  The fixed page wrapper prevents the
   public layout's padded flex container from collapsing into a narrow column. */
.login-page {
  position: fixed;
  inset: 0;
  z-index: 10;
  box-sizing: border-box;
  min-height: 100vh;
  width: 100%;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: var(--ttb-background);
  color: var(--ttb-text-primary);
}

.login-page .auth-card {
  background: var(--ttb-surface, #bbbbbb) !important;
  color: var(--ttb-text-primary) !important;
  box-shadow: 0 12px 30px rgba(38, 38, 38, 0.18) !important;
}

.login-brand-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.login-brand-link:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: 4px;
  border-radius: 4px;
}

.login-page h1 {
  margin: 0 0 0.5rem;
  line-height: 1;
  outline: 0 !important;
}

.login-page h4 {
  margin: 0 0 0.35rem !important;
  font-size: 1.35rem;
  line-height: 1.25;
}

.login-page .text-center p {
  margin: 0;
}

.login-page .mud-typography,
.login-page .mud-input-label,
.login-page .mud-input,
.login-page input,
.login-page .mud-input-adornment,
.login-page .text-secondary {
  color: var(--ttb-text-primary) !important;
}

/* Autofill's browser-owned background ignores normal background overrides. */
.login-page .mud-input > input:is(:autofill, :-webkit-autofill) {
  box-shadow: inset 0 0 0 1000px var(--ttb-surface) !important;
  -webkit-text-fill-color: var(--ttb-text-primary) !important;
  caret-color: var(--ttb-text-primary);
}

.login-page .mud-input-outlined-border {
  border-color: var(--ttb-text-secondary) !important;
}

.login-page .mud-input:focus-within ~ .mud-input-outlined-border,
.login-page .mud-input-root:focus-within .mud-input-outlined-border {
  border-color: var(--ttb-primary) !important;
}

.login-page form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.login-page .mud-button-filled-primary {
  margin-top: 0.35rem;
  background-color: var(--ttb-primary) !important;
  color: var(--ttb-primary-text) !important;
}

.login-page input[type="checkbox"] {
  appearance: none;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  border: 1px solid var(--ttb-text-secondary);
  border-radius: 0.15rem;
  background-color: var(--ttb-surface);
  cursor: pointer;
}

.login-page input[type="checkbox"]::before {
  content: "";
  width: 0.3rem;
  height: 0.55rem;
  border: solid var(--ttb-primary-text);
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
  opacity: 0;
}

.login-page input[type="checkbox"]:checked {
  border-color: var(--ttb-primary);
  background-color: var(--ttb-primary);
}

.login-page input[type="checkbox"]:checked::before {
  opacity: 1;
}

.login-page input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: 2px;
}

@media (forced-colors: active) {
  .login-page .mud-input > input:is(:autofill, :-webkit-autofill) {
    box-shadow: none !important;
    -webkit-text-fill-color: FieldText !important;
    caret-color: FieldText;
  }

  .login-page input[type="checkbox"] {
    appearance: auto;
  }

  .login-page input[type="checkbox"]::before {
    display: none;
  }
}

/* ===== PRACTICE PAGE ===== */
.typing-area {
  background-color: var(--ttb-drawer, #161927) !important;
  border: 2px solid color-mix(in srgb, var(--ttb-primary) 30%, transparent) !important;
  border-radius: 12px;
  position: relative;
  color: var(--ttb-primary);
}

.focus-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  width: 100%;
}

.editor-activation-message {
  display: inline-block;
  max-width: calc(100% - 2rem);
  padding: 0.5rem 0.75rem;
  background-color: var(--ttb-background);
  border: 0;
  border-radius: 8px;
  color: var(--ttb-primary);
  font-weight: 600;
}

/* ===== UTILITY CLASSES ===== */
.text-center {
  text-align: center !important;
}

.leaderboard-grid {
  align-items: stretch;
}

.leaderboard-card {
  width: 100%;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.08));
  border-radius: 1rem;
  background: color-mix(in srgb, var(--ttb-surface, #142334) 82%, var(--ttb-background, #0b1724)) !important;
}

.leaderboard-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.08));
}

.leaderboard-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.leaderboard-heading-icon {
  display: grid;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--ttb-primary) 14%, transparent);
  color: var(--ttb-primary);
}

.leaderboard-heading-icon .mud-icon-root {
  font-size: 1.3rem;
}

.leaderboard-card-title {
  font-weight: 600;
  line-height: 1.25;
}

.leaderboard-card-description {
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.58));
  line-height: 1.35;
}

.leaderboard-ranking {
  display: grid;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--ttb-background, #0b1724) 45%, transparent);
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.leaderboard-entry:hover {
  border-color: var(--ttb-border, rgba(255, 255, 255, 0.08));
  background: color-mix(in srgb, var(--ttb-primary) 7%, var(--ttb-background, #0b1724));
}

.leaderboard-self {
  border-color: color-mix(in srgb, var(--ttb-primary) 35%, transparent);
  background-color: color-mix(in srgb, var(--ttb-primary) 12%, transparent) !important;
}

.leaderboard-rank {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border-radius: 0.65rem;
  background: color-mix(in srgb, var(--ttb-surface, #142334) 78%, transparent);
}

.leaderboard-position {
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.65));
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.leaderboard-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.leaderboard-player-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-you {
  flex: 0 0 auto;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ttb-primary) 18%, transparent);
  color: var(--ttb-primary);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
}

.leaderboard-score {
  text-align: right;
  white-space: nowrap;
}

.leaderboard-score-primary {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.3rem;
}

.leaderboard-score-primary strong {
  color: var(--ttb-primary);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.leaderboard-score-primary span,
.leaderboard-score-secondary {
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.6));
  font-size: 0.72rem;
}

.leaderboard-empty {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px dashed var(--ttb-border, rgba(255, 255, 255, 0.12));
  border-radius: 0.75rem;
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.65));
  font-size: 0.9rem;
  line-height: 1.5;
}

.leaderboard-empty .mud-icon-root {
  flex: 0 0 auto;
  color: var(--ttb-primary);
}

.leaderboard-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.leaderboard-medal-gold {
  color: #d4a72c;
}

.leaderboard-medal-silver {
  color: #aab5c2;
}

.leaderboard-medal-bronze {
  color: #b87345;
}

@media (max-width: 600px) {
  .leaderboard-card {
    padding: 1rem;
  }

  .leaderboard-entry {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: 0.5rem;
    padding: 0.6rem;
  }
}

.rounded-lg {
  border-radius: 12px;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ttb-background, #1a1d2e);
}

::-webkit-scrollbar-thumb {
  background: var(--ttb-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ttb-primary-hover);
}

/* ===== MUD INPUT TEXT COLOR ===== */
.mud-input > input.mud-input-root,
div.mud-input-slot.mud-input-root {
  color: var(--ttb-text-primary, rgba(255, 255, 255, 0.87)) !important;
}

/* ===== SHARED SURFACES ===== */
.mud-paper {
  background-color: var(--ttb-surface, #bbbbbb);
}

/* Popovers must cover the content behind them, including selected/hovered rows. */
.mud-popover {
  background-color: var(--ttb-surface, #bbbbbb) !important;
  color: var(--ttb-text-primary, #262626);
}
.mud-popover .mud-list-item.mud-selected-item,
.mud-popover .mud-list-item:hover,
.mud-popover .mud-list-item:focus-visible {
  background-color: color-mix(in srgb, var(--ttb-primary, #262626) 10%, var(--ttb-surface, #bbbbbb)) !important;
}
.mud-popover .mud-list-item,
.mud-popover .mud-list-item-text .mud-typography {
  color: var(--ttb-text-primary, #262626) !important;
}
/* ===== VIM EDITOR ===== */
.vim-editor-shell {
  position: relative;
  width: 100%;
  height: 100%;
}

.vim-editor-content {
  transition:
    filter 0.2s ease,
    opacity 0.2s ease;
}

.vim-editor:not(:focus-within) .vim-editor-content {
  filter: blur(3px);
}

.vim-editor-shell.vim-editor-complete .vim-editor-content {
  filter: blur(3.6px);
  opacity: 0.35;
}

.vim-focus-overlay {
  pointer-events: none;
}

.vim-editor:focus-within .vim-focus-overlay,
.vim-editor-shell.vim-editor-complete .vim-focus-overlay {
  display: none;
}

.vim-completion-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  overflow-y: auto;
  text-align: center;
  background: rgba(12, 16, 29, 0.28);
  color: white;
  cursor: default;
}

@media (max-width: 560px) {
  .vim-completion-overlay {
    justify-content: flex-start;
    padding: 1rem;
  }
}

.vim-completion-icon {
  color: #66bb6a !important;
  font-size: 3.5rem !important;
}

.vim-completion-title {
  color: white !important;
  font-weight: 700 !important;
}

.vim-completion-message {
  color: rgba(255, 255, 255, 0.86) !important;
}

.vim-completion-message kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
}

.vim-editor {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--ttb-drawer, #161927);
  border-radius: 8px;
  overflow: hidden;
  cursor: text;
  box-sizing: border-box;
  border: 3px solid transparent;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

/* Mode frame — the border color tells you which mode you're in. */
.vim-editor.vim-mode-normal {
  border-color: #00bcd4;
  box-shadow: 0 0 14px rgba(0, 188, 212, 0.25);
}

.vim-editor.vim-mode-visual {
  border-color: #e040fb;
  box-shadow: 0 0 14px rgba(224, 64, 251, 0.3);
}

.vim-editor.vim-mode-insert {
  border-color: #66bb6a;
  box-shadow: 0 0 14px rgba(102, 187, 106, 0.3);
}

.vim-editor.vim-mode-search {
  border-color: #ffca28;
  box-shadow: 0 0 14px rgba(255, 202, 40, 0.3);
}

.vim-editor.vim-mode-command {
  border-color: #ff7043;
  box-shadow: 0 0 14px rgba(255, 112, 67, 0.3);
}

.vim-editor-hidden-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}

.vim-editor-content {
  padding: 8px 0;
  font-family: "Courier New", monospace;
  font-size: 1.25rem;
  line-height: 1.7;
  min-height: calc(100% - 32px);
  height: 100%;
  overflow: auto;
}

/* Vim-style mode status line under the text. */
.vim-status-line {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  user-select: none;
}

.vim-mode-indicator {
  font-weight: 700;
  letter-spacing: 1px;
}

.vim-mode-normal .vim-mode-indicator {
  color: #00bcd4;
}
.vim-mode-visual .vim-mode-indicator {
  color: #e040fb;
}
.vim-mode-insert .vim-mode-indicator {
  color: #66bb6a;
}
.vim-mode-search .vim-mode-indicator {
  color: #ffca28;
}
.vim-mode-command .vim-mode-indicator {
  color: #ff7043;
}

.vim-status-search {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
}

.vim-status-pending {
  margin-left: auto;
  color: #ffc107;
  font-weight: 600;
}

.vim-editor-line {
  display: flex;
  align-items: flex-start;
  min-height: 1.6em;
}

.vim-line-number {
  display: inline-block;
  width: 3em;
  text-align: right;
  padding-right: 1em;
  color: rgba(255, 255, 255, 0.25);
  user-select: none;
  flex-shrink: 0;
}

.vim-char {
  color: rgba(255, 255, 255, 0.7);
  display: inline-block;
  min-width: 0.6em;
  text-align: center;
}

.vim-char.vim-target {
  background-color: rgba(255, 193, 7, 0.4);
  border-radius: 2px;
  color: #ffc107;
}

.vim-char.vim-completed {
  color: #4caf50;
}

/* Strike-through preview of the span the current d/c/y target acts on. */
.vim-char.vim-span-del,
.vim-eol.vim-span-del,
.vim-target-anchor.vim-span-del {
  color: #ff5252;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #ff5252;
  background-color: rgba(255, 82, 82, 0.15);
}

.vim-char.vim-span-yank,
.vim-eol.vim-span-yank,
.vim-target-anchor.vim-span-yank {
  color: #00e5ff;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #00e5ff;
  background-color: rgba(0, 229, 255, 0.12);
}

/* Solid highlight of the current visual-mode selection (no strike: the
   text is not being deleted, it is being chosen). The EOL marker and the
   last-line anchor carry the span when the selection reaches the EOL
   position (v on an empty line, cross-line spans). */
.vim-char.vim-span-visual,
.vim-eol.vim-span-visual,
.vim-target-anchor.vim-span-visual {
  background-color: rgba(224, 64, 251, 0.35);
  color: #fff;
}

/* Invisible characters: spaces as ·, line ends as ↵ — kept faint on purpose. */
.vim-char.vim-space {
  color: rgba(255, 255, 255, 0.25);
  user-select: none;
}

.vim-eol {
  display: inline-block;
  min-width: 0.6em;
  text-align: center;
  color: rgba(255, 255, 255, 0.25);
  user-select: none;
}

.vim-cursor {
  background-color: var(--ttb-primary, #6c63ff) !important;
  color: white !important;
  border-radius: 2px;
  animation: vim-cursor-blink 1s step-end infinite;
}

.vim-cursor-block {
  display: inline-block;
  width: 0.6em;
  background-color: var(--ttb-primary, #6c63ff);
  animation: vim-cursor-blink 1s step-end infinite;
  border-radius: 2px;
}

@keyframes vim-cursor-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ===== REGISTRATION PAGE ===== */
.register-page {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.register-card {
  width: min(100%, 30rem);
  background: var(--ttb-surface) !important;
  border: 1px solid var(--ttb-border);
  border-radius: 1rem;
  box-shadow: 0 1.5rem 3rem color-mix(in srgb, var(--ttb-primary) 16%, transparent) !important;
}
.register-header {
  margin-bottom: 2rem;
}
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 2.5rem;
  color: var(--ttb-text-primary);
  font-weight: 700;
  text-decoration: none;
}
.auth-brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.6rem;
  color: var(--ttb-primary-text);
  background: var(--ttb-primary);
}
.register-title {
  color: var(--ttb-text-primary) !important;
  font-weight: 700 !important;
}
.register-subtitle {
  margin-top: 0.45rem;
  color: var(--ttb-text-secondary) !important;
}
.register-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.register-submit {
  width: 100%;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 0.35rem;
  color: var(--ttb-primary-text);
  background: var(--ttb-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.register-submit:hover {
  background: var(--ttb-primary-hover);
  color: var(--ttb-primary-hover-text, var(--ttb-primary-text));
  box-shadow: 0 0.5rem 1.2rem color-mix(in srgb, var(--ttb-primary) 25%, transparent);
}
.register-submit:active {
  background: var(--ttb-primary-darken);
  transform: translateY(1px);
}
.register-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2rem;
  color: var(--ttb-text-secondary);
}
.auth-link {
  color: var(--ttb-primary) !important;
  font-weight: 600;
  text-decoration: none;
}
.auth-link:hover {
  color: var(--ttb-primary-hover) !important;
  text-decoration: underline;
}

/* ===== PRACTICE CONTROLS AND RESULTS ===== */
.practice-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.practice-settings > .practice-setting {
  flex: 1 1 8.5rem;
  min-width: 0;
}

.practice-settings > .practice-core-setting {
  padding-bottom: 6px !important;
}

/* Emphasize selected values without changing the floating labels or menu items. */
.practice-setting-select .mud-input-slot[role="combobox"] {
  font-size: 1.125rem;
  font-weight: 600;
  padding-bottom: 8px !important;
}

.practice-setting-select.practice-non-default .mud-input-slot[role="combobox"] {
  color: var(--ttb-non-default-text, var(--ttb-text-primary)) !important;
}

.practice-results {
  border: 0;
  box-shadow: none;
}

.practice-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
}

.practice-result-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

@media (max-width: 599.98px) {
  .practice-result-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.practice-duration-disabled {
  opacity: 0.45;
}

.practice-source-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.practice-add-passage.mud-button {
  min-height: 0;
  padding: 0.1rem 0.4rem;
  color: var(--ttb-text-secondary) !important;
  font-size: 0.75rem;
  text-transform: none;
}

.practice-add-passage.mud-button:hover,
.practice-add-passage.mud-button:focus-visible {
  color: var(--ttb-primary) !important;
  background-color: color-mix(in srgb, var(--ttb-primary) 10%, transparent) !important;
}

.practice-settings .mud-button-outlined:hover,
.practice-settings .mud-button-outlined:focus-visible {
  background-color: color-mix(in srgb, var(--ttb-primary) 14%, transparent) !important;
  color: var(--ttb-primary) !important;
}
.practice-settings .mud-button-outlined-primary:hover,
.practice-settings .mud-button-outlined-primary:focus-visible {
  color: var(--ttb-primary) !important;
}
.practice-settings .mud-button-outlined-success:hover,
.practice-settings .mud-button-outlined-success:focus-visible {
  color: #4caf50 !important;
  background-color: rgba(76, 175, 80, 0.14) !important;
}
.practice-settings .mud-button-outlined-error:hover,
.practice-settings .mud-button-outlined-error:focus-visible {
  color: #f44336 !important;
  background-color: rgba(244, 67, 54, 0.14) !important;
}
.practice-settings .mud-button-outlined-warning:hover,
.practice-settings .mud-button-outlined-warning:focus-visible {
  color: #ffc107 !important;
  background-color: rgba(255, 193, 7, 0.14) !important;
}

.practice-result-good {
  color: #4caf50 !important;
  font-weight: 700 !important;
}
.practice-result-warning {
  color: #ffc107 !important;
  font-weight: 700 !important;
}
.practice-result-poor {
  color: #f44336 !important;
  font-weight: 700 !important;
}
.practice-source-menu,
.practice-source-menu .mud-list {
  background-color: var(--ttb-surface) !important;
  color: var(--ttb-text-primary) !important;
}
.practice-source-menu .mud-list-item:hover {
  background-color: color-mix(in srgb, var(--ttb-primary) 14%, transparent) !important;
}

.practice-source-menu,
.practice-source-menu .mud-list,
.practice-source-menu .mud-list-item {
  background-color: var(--ttb-surface, #e9e9e9) !important;
}
.practice-source-menu .mud-list-item,
.practice-source-menu .mud-list-item-text,
.practice-source-menu .mud-list-item-text .mud-typography {
  color: var(--ttb-text-primary, #262626) !important;
}
.practice-source-menu .mud-list-item:hover {
  background-color: color-mix(in srgb, var(--ttb-primary) 18%, transparent) !important;
}
/* ===== PRACTICE ACTION AND SOURCE STYLES ===== */
/* Hover backgrounds are lightened per theme, so use a foreground chosen for
   the hovered color rather than the normal button color. */
.mud-button-filled-primary:hover,
.mud-button-outlined-primary:hover,
.mud-button-text-primary:hover,
.practice-settings .mud-button-outlined-primary:hover,
.vim-layer-lesson-button:hover {
  color: var(--ttb-primary-hover-text, var(--ttb-primary-text)) !important;
}

.mud-button-filled-secondary:hover,
.mud-button-outlined-secondary:hover,
.mud-button-text-secondary:hover,
.practice-settings .mud-button-outlined-secondary:hover {
  color: var(--ttb-secondary-hover-text, var(--ttb-secondary-text)) !important;
}
.practice-source-select .mud-input-outlined-border,
.practice-setting-select .mud-input-outlined-border {
  border: 0 !important;
}
.practice-source-select .mud-input,
.practice-setting-select .mud-input {
  background-color: var(--ttb-surface) !important;
}
.practice-source-menu,
.practice-source-menu .mud-list,
.practice-source-menu .mud-list-item {
  background-color: var(--ttb-surface) !important;
}
.practice-source-menu .mud-list-item,
.practice-source-menu .mud-list-item-text,
.practice-source-menu .mud-list-item-text .mud-typography {
  color: var(--ttb-text-primary) !important;
}

.practice-source-menu,
.practice-source-menu .mud-list,
.practice-source-menu .mud-list-item {
  background-color: var(--ttb-background) !important;
}

/* ===== VIM PRACTICE WORKSPACE ===== */
/* The lesson picker has its own document layout; the active editor keeps its grid. */
.vim-practice-page.vim-practice-picker {
  display: block !important;
  height: auto;
  min-height: 0;
}

.vim-practice-page.vim-account-practice {
  padding-top: 16px !important;
}

.vim-account-practice .vim-picker {
  margin-top: 0;
}

.vim-picker {
  max-width: var(--ttb-page-content-max-width);
  margin: 1rem auto 3rem;
  color: var(--ttb-text-primary);
}

.vim-picker h1,
.vim-picker h2,
.vim-picker h3,
.vim-picker h4,
.vim-picker p {
  margin: 0;
}

.vim-picker h2 {
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.5;
}
.vim-picker h3 {
  font-size: 1.1rem;
  font-weight: 600;
}
.vim-picker h4 {
  font-size: 1rem;
  font-weight: 550;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.vim-picker p {
  color: var(--ttb-text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}
.vim-picker .vim-picker-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.vim-picker-browse-heading,
.vim-picker-topic-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.vim-picker-recommendation {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.75rem;
  margin-bottom: 2rem;
  border-radius: 16px;
  background: linear-gradient(110deg, color-mix(in srgb, var(--ttb-primary) 12%, var(--ttb-background)), var(--ttb-background));
}
.vim-picker-path-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ttb-primary) 15%, transparent);
  color: var(--ttb-primary);
}
.vim-picker-recommendation-copy {
  flex: 1;
  min-width: 0;
}
.vim-picker-recommendation-copy > p:last-child {
  margin-top: 0.6rem;
  max-width: 38rem;
}
.vim-picker-continue {
  flex-shrink: 0;
  padding: 0.7rem 1.1rem !important;
}
.vim-picker-curriculum {
  border: 1px solid var(--ttb-border);
  border-radius: 16px;
  background: var(--ttb-background);
}
.vim-picker-browse-heading {
  padding: 1.5rem;
  border-bottom: 1px solid var(--ttb-border);
  align-items: start;
}
.vim-picker-browse-heading p {
  margin-top: 0.3rem;
}
.vim-picker-topic-control {
  min-width: 220px;
}
.vim-picker-topic-control label {
  display: block;
  font-size: 0.75rem;
  color: var(--ttb-text-secondary);
  margin-bottom: 0.4rem;
}
.vim-picker-topic-control select {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ttb-text-primary);
  background-color: var(--ttb-surface) !important;
  background-image: none;
  border: 1px solid var(--ttb-border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}
.vim-picker-topic-control select option {
  color: var(--ttb-text-primary);
  background-color: var(--ttb-surface);
}
.vim-picker-topic-control select:focus {
  outline: none;
}
.vim-picker-experienced summary:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: 3px;
}
.vim-picker-topic-heading {
  padding: 1.5rem 1.5rem 1rem;
}
.vim-picker-topic-number {
  display: block;
  color: var(--ttb-text-secondary);
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}
.vim-picker-topic-progress {
  color: var(--ttb-text-secondary);
  font-size: 0.8rem;
}
.vim-picker-locked-note {
  display: flex;
  gap: 0.6rem;
  align-items: start;
  margin: 0 1.5rem 1rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: var(--ttb-background);
  color: var(--ttb-text-secondary);
}
.vim-picker-locked-note .mud-icon-root {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.vim-picker-lessons {
  list-style: none;
  padding: 0 1.5rem;
  margin: 0;
}
.vim-picker-lesson {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 0;
  border-top: 1px solid var(--ttb-border);
}
.vim-picker-lesson-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--ttb-text-secondary);
  font-size: 0.8rem;
  border: 1px solid var(--ttb-border);
  border-radius: 50%;
}
.vim-picker-lesson-copy {
  min-width: 0;
  flex: 1;
}
.vim-picker-lesson-copy p {
  font-size: 0.75rem;
  margin-top: 0.35rem;
}
.vim-picker-lesson-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  flex-shrink: 0;
}
.vim-picker-lesson-actions > .mud-button-root {
  min-height: 36px;
}
.vim-picker-more .mud-button-root {
  text-transform: none;
  font-size: 0.75rem;
  color: var(--ttb-text-secondary);
  width: 100%;
  min-height: 32px;
}
.vim-picker-mode-option {
  white-space: normal;
  max-width: min(320px, calc(100vw - 32px));
  padding: 0.65rem 1rem !important;
}
.vim-picker-mode-option strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}
.vim-picker-mode-option span {
  display: block;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ttb-text-secondary);
  margin-top: 0.2rem;
}
.vim-picker-experienced {
  margin-top: 1.5rem;
  padding: 0 0.25rem;
}
.vim-picker-experienced summary {
  width: fit-content;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ttb-text-secondary);
  padding: 0.5rem 0;
}
.vim-picker-experienced > div {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 0;
}
.vim-picker-experienced h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.vim-picker-experienced .mud-button-root {
  flex-shrink: 0;
}
.vim-picker kbd {
  display: inline-block;
  padding: 0 0.3em;
  margin: 0 0.05em;
  font:
    0.85em ui-monospace,
    monospace;
  line-height: 1.5;
  color: var(--ttb-text-primary);
  border: 1px solid var(--ttb-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--ttb-background);
  vertical-align: baseline;
}

@media (max-width: 800px) {
  .vim-picker-recommendation {
    flex-wrap: wrap;
  }
  .vim-picker-recommendation-copy {
    flex-basis: calc(100% - 70px);
  }
  .vim-picker-continue {
    margin-left: 68px !important;
  }
  .vim-picker-browse-heading {
    flex-direction: column;
    gap: 1rem;
  }
  .vim-picker-topic-control {
    width: 100%;
  }
}
@media (max-width: 560px) {
  .vim-picker {
    margin-top: 0.5rem;
  }
  .vim-picker-recommendation {
    padding: 1.1rem;
    gap: 1rem;
  }
  .vim-picker-path-icon {
    display: none;
  }
  .vim-picker-recommendation-copy {
    flex-basis: 100%;
  }
  .vim-picker-continue {
    margin-left: 0 !important;
    width: 100%;
  }
  .vim-picker-browse-heading,
  .vim-picker-topic-heading {
    padding: 1.1rem;
  }
  .vim-picker-topic-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.5rem;
  }
  .vim-picker-lessons {
    padding: 0 1.1rem;
  }
  .vim-picker-lesson {
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: start;
  }
  .vim-picker-lesson-copy {
    flex-basis: calc(100% - 44px);
  }
  .vim-picker-lesson-actions {
    flex-direction: row;
    margin-left: 44px;
    flex-wrap: wrap;
  }
  .vim-picker-locked-note {
    margin-left: 1.1rem;
    margin-right: 1.1rem;
  }
  .vim-picker-experienced > div {
    flex-direction: column;
    align-items: start;
    gap: 1rem;
  }
}

.vim-practice-page {
  display: grid !important;
  grid-template-columns: 480px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  width: 100% !important;
  max-width: var(--ttb-page-content-max-width) !important;
  margin-inline: auto;
  height: calc(100vh - 1.5rem);
  min-height: 0;
  padding: 1rem 1.25rem !important;
  box-sizing: border-box;
  /* color: var(--ttb-text-primary, #fff); */
}

.page-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mud-typography {
  color: var(--ttb-text-secondary, #fff) !important;
}

.page-header-title {
  margin: 0 !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  color: var(--ttb-primary);
}

/* Preserve navigation focus without outlining noninteractive page titles. */
.page-header-title:focus,
h1[tabindex="-1"]:focus {
  outline: 0;
}

.page-header-subtitle {
  margin-top: 0.25rem !important;
  color: var(--ttb-text-secondary) !important;
}

.vim-dashboard-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.vim-dashboard-intro-copy {
  flex: 1;
  margin: 0 !important;
  color: var(--ttb-text-secondary) !important;
  font-size: 0.8rem !important;
  font-style: italic;
  opacity: 0.8;
}

.vim-dashboard-next-row {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.vim-dashboard-next {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.vim-dashboard-continue,
.vim-dashboard-placement {
  flex: 0 0 auto;
}

.vim-next-lesson-title {
  flex: 1;
  min-width: 0;
  color: var(--ttb-text-primary);
}

.vim-dashboard-placement {
  align-self: center;
}

@media (max-width: 640px) {
  .vim-dashboard-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .vim-dashboard-next-row,
  .vim-dashboard-next {
    align-items: stretch;
    flex-direction: column;
  }

  .vim-dashboard-placement {
    align-self: stretch;
  }
}

.vim-practice-shortcuts {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.vim-practice-shortcut {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.7));
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Practice in progress: sidebar hidden, workspace takes the full row. */
.vim-practice-page.vim-practice-active {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  height: auto;
  min-height: calc(100dvh - 1.5rem);
}

.vim-practice-shortcut kbd,
.vim-next-lesson-title kbd,
.vim-current-title kbd,
.vim-current-instruction kbd,
.vim-expected-copy kbd,
.vim-guidance-panel kbd {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.18));
  border-radius: 5px;
  background: color-mix(in srgb, var(--ttb-background, #1a1d2e) 70%, transparent);
  color: var(--ttb-primary, #fff);
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Key labels keep their individual keycaps; code inherits the cap styling. */
.vim-practice-page kbd > code,
button kbd > code,
.mud-button-root kbd > code {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
}

.vim-practice-page kbd + kbd {
  margin-left: 0.15rem;
}

/* Passage references use the editor's font and unhighlighted character style,
   not keycaps or the instruction heading's purple, bold text. */
.vim-passage-reference {
  font-family: "Courier New", monospace;
  font-size: 1.1rem;
  font-weight: 400;
  white-space: pre-wrap;
  color: var(--ttb-text-primary, #fff);
}

.vim-current-instruction kbd {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.18));
  border-radius: 5px;
  background: color-mix(in srgb, var(--ttb-background, #1a1d2e) 70%, transparent);
  color: var(--ttb-primary, #fff);
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 650;
}

.vim-layer-card {
  height: 100%;
}

.vim-layer-card-locked {
  /*border: 1px solid color-mix(in srgb, var(--ttb-primary, #6c63ff) 18%, var(--ttb-border, rgba(255, 255, 255, 0.18))) !important;*/
  background: color-mix(in srgb, var(--ttb-background, #1a1d2e)) !important;
  box-shadow: none;
  position: relative;
}

.vim-layer-card-locked::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(0, 0, 0, 0.1); /* Creates the recessed border */
  border-radius: inherit;
  pointer-events: none; /* Allows clicks to pass through */
}

.vim-layer-card-locked .vim-layer-title {
  color: color-mix(in srgb, var(--ttb-primary, #6c63ff) 42%, var(--ttb-text-secondary, rgba(255, 255, 255, 0.7))) !important;
}
.vim-layer-card .mud-progress-linear.vim-metric-unstarted::before {
  background-color: #9ca3af;
  opacity: 0.35;
}

.vim-layer-lesson-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}

.vim-layer-lesson-action {
  flex: none;
}

.vim-layer-lesson-button {
  border-color: color-mix(in srgb, var(--ttb-primary, #6c63ff) 16%, transparent) !important;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 5px;
  border-radius: 6px;
}

.vim-layer-lesson-description {
  flex: 1;
  min-width: 0;
}

.vim-layer-lesson-text {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 2rem;
  font-weight: 700;
  color: var(--ttb-primary);
}

.vim-lesson-tooltip {
  max-width: min(32rem, calc(100vw - 2rem));
  white-space: normal;
  overflow-wrap: anywhere;
}

.vim-layer-lesson-text-locked {
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.5)) !important;
  opacity: 0.68;
}

.vim-layer-lesson-text-locked kbd {
  background: transparent;
}

.vim-layer-lesson-text kbd,
button kbd,
.mud-button-root kbd {
  display: inline-block;
  padding: 0.08rem 0.28rem;
  margin: 0 0.08rem;
  border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-family: monospace;
  font-size: 0.82em;
  font-weight: 700;
  line-height: 1.15;
  text-transform: none;
}

.vim-layer-lesson-button-locked,
.vim-layer-lesson-button-locked.mud-button-root:disabled {
  opacity: 1 !important;
  color: color-mix(in srgb, var(--ttb-primary, #6c63ff) 64%, var(--ttb-text-primary, #fff)) !important;
  background: color-mix(in srgb, var(--ttb-primary, #6c63ff) 10%, transparent) !important;
}

.vim-layer-lesson-button-locked .mud-button-label,
.vim-layer-lesson-button-locked .mud-icon-root {
  /* color: inherit !important; */
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.6)) !important;
}

.vim-layer-lesson-button-locked:hover {
  background: color-mix(in srgb, var(--ttb-primary, #6c63ff) 16%, transparent) !important;
}

.vim-workspace {
  min-width: 0;
  min-height: 0;
  margin: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Keep teaching material out of the editor's height budget. */
.vim-practice-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "workspace";
  align-items: start;
  gap: 1rem;
  min-width: 0;
}

.vim-practice-layout:has(.vim-practice-support) {
  grid-template-areas: "support" "workspace";
}

.vim-practice-layout > .vim-workspace {
  grid-area: workspace;
  min-height: clamp(28rem, calc(100dvh - 10rem), 52rem);
  overflow: visible;
}

.vim-practice-layout .vim-editor-container {
  flex: 1 0 auto;
  min-height: 20rem;
}

.vim-practice-layout .vim-editor-shell {
  display: flex;
  flex-direction: column;
  height: auto;
}

.vim-practice-layout .vim-editor {
  flex: 1;
  height: auto;
  min-height: 18rem;
}

.vim-practice-support {
  grid-area: support;
  display: grid;
  align-content: start;
  gap: 1rem;
  min-width: 0;
}

.vim-practice-layout .vim-practice-support .vim-coach {
  margin: 0;
}

@media (min-width: 1200px) {
  .vim-practice-layout:has(.vim-practice-support) {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    grid-template-areas: "workspace support";
  }
}

.vim-instruction-bar {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, var(--ttb-background, #1a1d2e) 28%, var(--ttb-surface, #23263a));
}

.vim-lesson-label {
  /* The former badge's type treatment, without its pill container. */
  display: inline-flex;
  align-items: center;
  color: var(--ttb-primary, #6c63ff) !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  line-height: normal;
  text-transform: uppercase;
  white-space: nowrap;
}

.vim-current-title {
  /* color: var(--ttb-text-primary, #fff) !important; */
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.7)) !important;
  font-weight: 700 !important;
}

.vim-current-title-row {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.vim-practice-guidance-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.vim-goal-button,
.vim-coach-button {
  background-color: color-mix(in srgb, var(--ttb-primary, #6c63ff) 10%, transparent) !important;
  border-color: color-mix(in srgb, var(--ttb-primary, #6c63ff) 65%, transparent) !important;
  color: var(--ttb-primary, #6c63ff) !important;
  font-weight: 700 !important;
  min-width: auto !important;
}

.vim-goal-button:hover,
.vim-coach-button:hover {
  background-color: color-mix(in srgb, var(--ttb-primary, #6c63ff) 18%, transparent) !important;
}

.vim-instruction-grid {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0 1.5rem;
}

.vim-instruction-copy {
  flex: 1 1 18rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.vim-instruction-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  max-width: 100%;
  min-width: 0;
  margin-left: auto;
}

.vim-hint-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 100%;
  min-width: 0;
  text-align: right;
}

.vim-instruction-actions > .vim-reset-target {
  flex-shrink: 0;
  white-space: nowrap;
}

.vim-current-instruction {
  /* margin-top: 0.3rem !important; */
  color: var(--ttb-primary, #6c63ff) !important;
  font-weight: 650 !important;
}

.vim-expected-copy,
.vim-progress-label {
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.7)) !important;
}
.vim-expected-copy {
  display: block;
  overflow-wrap: anywhere;
}

.vim-expected-copy kbd {
  margin-left: 0.2rem;
  padding: 0.15rem 0.4rem;
  color: var(--ttb-primary, #6c63ff);
}

.vim-progress-top {
  margin: 0.25rem 2rem 0.75rem;
  text-align: right;
}

.vim-progress-bar {
  height: 0.45rem !important;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ttb-background, #1a1d2e) 50%, transparent);
}

.vim-guidance-card { cursor: pointer; }

.vim-guidance-panel {
  padding: 0.8rem 1.15rem;
  border-bottom: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, var(--ttb-primary, #6c63ff) 5%, transparent);
}

.vim-guidance-heading {
  margin-bottom: 0.45rem;
  gap: 0.35rem;
}
.vim-guidance-heading .vim-guidance-title {
  flex: 1;
  font-weight: 500 !important;
}

.vim-guidance-title {
  margin-left: 0.5rem !important;
  /* color: var(--ttb-text-primary, #fff) !important; */
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.6));
  font-weight: 650 !important;
}

.vim-guidance-item {
  display: block;
  margin-bottom: 0.15rem !important;
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.6)) !important;
  line-height: 1.45 !important;
}

.vim-guidance-tint-filter {
  position: absolute;
  pointer-events: none;
}

.vim-guidance-tint-color {
  flood-color: rgb(from var(--ttb-primary) r g b / 1);
}

.vim-guidance-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 180px;
  margin: 0.75rem auto 0;
  object-fit: contain;
}

.vim-guidance-item span {
  margin-right: 0.35rem;
  color: var(--ttb-primary, #6c63ff);
  font-weight: 700;
}
.vim-hint-alert {
  flex: 0 0 auto;
}

.vim-editor-container {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1rem !important;
  /* background: color-mix(in srgb, var(--ttb-background, #1a1d2e) 20%, transparent); */
}

.vim-editor-shell {
  flex: 1;
  min-width: 0;
  min-height: 12rem;
}

.vim-editor {
  /* border: 2px solid var(--ttb-primary) !important; */
  /* border: 2px solid color-mix(in srgb, var(--ttb-primary, #6c63ff) 30%, transparent) !important; */
  border-radius: 10px;
  background: var(--ttb-drawer, #161927) !important;
  color: var(--ttb-text-primary, #fff);
  box-shadow: none !important;
  outline: none;
}

.vim-editor.vim-mode-normal {
  border-color: var(--ttb-primary) !important;
  box-shadow: 0 0 0 1px var(--ttb-primary) !important;
  /* box-shadow: 0 0 0 3px color-mix(in srgb, var(--ttb-primary, #6c63ff) 12%, transparent) !important; */
}

.vim-editor.vim-mode-visual {
  border-color: var(--ttb-secondary) !important;
  box-shadow: 0 0 0 1px var(--ttb-secondary) !important;
  /* box-shadow: 0 0 0 3px color-mix(in srgb, var(--ttb-secondary, #bb86fc) 12%, transparent) !important; */
}

.vim-editor.vim-mode-insert {
  border-color: #4caf50 !important;
  box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.12) !important;
}

.vim-editor.vim-mode-search {
  border-color: #ffca28 !important;
  box-shadow: 0 0 0 1px rgba(255, 202, 40, 0.12) !important;
}

.vim-editor.vim-mode-command {
  border-color: #ff7043 !important;
  box-shadow: 0 0 0 1px rgba(255, 112, 67, 0.12) !important;
}

.vim-editor {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.vim-editor-content {
  padding: 1rem 0.75rem;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  color: var(--ttb-text-primary, #fff);
  font-size: 1.1rem;
  line-height: 1.75;
  overflow-x: auto;
  overflow-y: auto;
  min-width: 0;
}

.vim-editor-line {
  width: max-content;
  min-width: 100%;
}

.vim-radar {
  color: var(--ttb-text-secondary) !important;
}

.vim-result-preview,
.vim-register-preview {
  flex: 0 0 auto;
  border-top: 1px solid color-mix(in srgb, var(--ttb-text-primary, #fff) 20%, transparent);
  padding: 0.65rem 0.75rem;
}

.vim-result-caption,
.vim-register-kind {
  font:
    0.8rem/1.4 system-ui,
    sans-serif;
  color: var(--ttb-text-secondary, #b7bfd1);
}

.vim-result-content {
  overflow-x: auto;
  font:
    1rem/1.6 ui-monospace,
    monospace;
  margin-top: 0.4rem;
}

.vim-result-line {
  white-space: pre;
}
.vim-result-target {
  display: inline-block;
  min-width: 0.65em;
}
.vim-editor .vim-status-line {
  position: static;
  flex: 0 0 auto;
}
.vim-register-text {
  display: block;
  margin-top: 0.25rem;
  max-height: 3.5rem;
  overflow: auto;
  white-space: pre;
  font-size: 0.9rem;
}

/* End-of-line and empty-line motion targets need a visible, scrollable
   element because there is no character span at that coordinate. */
.vim-target-anchor {
  display: inline-block;
  min-width: 0.72em;
  height: 1.25em;
  vertical-align: text-bottom;
}

.vim-line-number {
  color: color-mix(in srgb, var(--ttb-text-secondary, rgba(255, 255, 255, 0.7)) 62%, transparent) !important;
}

.vim-char {
  color: var(--ttb-text-primary, #fff) !important;
}

.vim-char.vim-target,
.vim-eol.vim-target,
.vim-target-anchor.vim-target,
.vim-result-target {
  background: color-mix(in srgb, var(--ttb-primary, #6c63ff) 22%, transparent) !important;
  color: var(--ttb-primary, #6c63ff) !important;
  outline: 1px solid color-mix(in srgb, var(--ttb-primary, #6c63ff) 45%, transparent);
}

/* Keep the cursor unmistakable when a valid goal lands on its coordinate. */
.vim-char.vim-cursor.vim-target {
  background: var(--ttb-primary, #6c63ff) !important;
  color: var(--ttb-primary-text, #fff) !important;
  outline: 2px solid color-mix(in srgb, var(--ttb-primary, #6c63ff) 78%, var(--ttb-text-primary, #fff));
}

.vim-target-anchor.vim-completed {
  color: #2e7d32 !important;
  background: rgba(46, 125, 50, 0.12) !important;
  outline: 1px solid rgba(46, 125, 50, 0.35);
}

.vim-char.vim-space,
.vim-eol {
  color: var(--ttb-text-secondary, rgba(255, 255, 255, 0.7)) !important;
  opacity: 0.55;
}

.vim-char.vim-completed,
.vim-eol.vim-completed {
  color: #2e7d32 !important;
  opacity: 1;
}

.vim-cursor,
.vim-cursor-block {
  background: var(--ttb-primary, #6c63ff) !important;
  color: var(--ttb-primary-text, #fff) !important;
}

.vim-status-line {
  height: 2rem;
  padding: 0 0.75rem;
  background: color-mix(in srgb, var(--ttb-primary, #6c63ff) 88%, #000) !important;
  border-top: 1px solid color-mix(in srgb, var(--ttb-primary, #6c63ff) 40%, transparent);
  color: var(--ttb-primary-text, #fff);
}

.vim-mode-indicator {
  color: var(--ttb-primary-text, #fff) !important;
}

.vim-mode-normal .vim-mode-indicator,
.vim-mode-visual .vim-mode-indicator,
.vim-mode-insert .vim-mode-indicator,
.vim-mode-search .vim-mode-indicator,
.vim-mode-command .vim-mode-indicator {
  color: var(--ttb-primary-text, #fff) !important;
}

.vim-status-pending {
  color: #ffc107;
}

.vim-status-bar {
  flex: 0 0 auto;
  min-height: 2.5rem;
  background: var(--ttb-primary, #6c63ff) !important;
}

.vim-status-copy {
  color: var(--ttb-primary-text, #fff) !important;
  font-family: "Courier New", monospace;
}

.vim-status-bar .mud-button {
  color: var(--ttb-primary-text, #fff) !important;
}

.mud-button-no-uppercase {
  text-transform: none;
}

@media (max-width: 900px) {
  .vim-practice-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(13rem, 35vh) minmax(28rem, 1fr);
    height: auto;
    min-height: calc(100vh - 1.5rem);
  }

  .vim-practice-shortcuts {
    display: none;
  }

  .vim-practice-page.vim-practice-active {
    grid-template-rows: auto auto;
  }
}

@media (max-width: 560px) {
  .vim-practice-page {
    gap: 0.7rem;
    padding: 0.7rem !important;
  }

  .page-header {
    padding: 0.85rem 1rem;
  }

  .page-header-title {
    font-size: 1.35rem !important;
    color: var(--ttb-primary);
  }
}

/* Flat dashboard containers; interactive controls retain their own styling. */
.dashboard-page .mud-paper,
.dashboard-page .history-toolbar,
.vim-dashboard-flat-panel,
.vim-dashboard-flat-panel .mud-paper {
  border: 0 !important;
  box-shadow: none !important;
  transition: none;
  transform: none;
  animation: none;
  filter: none;
  backdrop-filter: none;
}

/* ===== TOUCH TYPING HISTORY ===== */
.history-page {
  color: var(--ttb-text-primary);
}

.history-toolbar,
.history-filters,
.history-chart-heading,
.history-pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-toolbar {
  justify-content: space-between;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--ttb-border);
  font-size: 0.8rem;
}

.history-muted {
  color: var(--ttb-text-secondary) !important;
}

/* Use the header's existing gap, above the stats grid's negative gutter hit area. */
.dashboard-guest-note {
  position: relative;
  top: -0.5rem;
  z-index: 1;
}

.dashboard-guest-note a {
  color: var(--ttb-primary);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.15em;
}

.dashboard-guest-note a:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: 2px;
}

/* The accuracy scale anchor affects bounds only, never visible points or pointer targets. */
.dashboard-page .history-accuracy-chart .mud-chart-serie[stroke="transparent"] {
  display: none;
  pointer-events: none;
}

.history-filters .mud-button {
  min-width: 48px;
  padding: 0.3rem 0.6rem;
  color: var(--ttb-text-secondary);
  text-transform: none;
}

.history-filters .history-filter-selected,
.history-filters .mud-button:hover,
.history-filters .mud-button:focus-visible {
  color: var(--ttb-primary) !important;
  background-color: color-mix(in srgb, var(--ttb-primary) 12%, transparent) !important;
}

.history-filter-selected {
  font-weight: 600;
}

.history-panel.mud-paper {
  border: 1px solid var(--ttb-border);
  border-radius: 8px;
  background-color: var(--ttb-surface) !important;
}

.history-trend-summary {
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}

.history-chart-card {
  padding: 0.85rem 1rem 0.25rem;
}

.history-chart-heading {
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.history-chart-heading h2 {
  margin: 0;
  color: var(--ttb-text-primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.history-chart-host,
.history-chart-host .mud-chart {
  width: 100%;
}

.history-chart-host svg {
  display: block;
  width: 100%;
  height: 200px;
}

.history-chart-host .mud-charts-xaxis text,
.history-chart-host .mud-charts-yaxis text,
.history-chart-host text.mud-charts-yaxis {
  fill: var(--ttb-text-secondary) !important;
  font-size: 10px;
}

.history-chart-host .mud-charts-gridlines-yaxis {
  opacity: 1;
}

.history-chart-host .mud-charts-gridlines-yaxis path {
  stroke: var(--ttb-border) !important;
}

.history-sessions {
  overflow: hidden;
}

.history-table.mud-table {
  background: transparent;
  box-shadow: none;
}

.history-table .mud-table-cell {
  padding: 0.4rem 0.75rem;
  border-color: var(--ttb-border);
  color: var(--ttb-text-primary);
  font-size: 0.8rem;
}

.history-table .mud-table-head .mud-table-cell {
  background-color: color-mix(in srgb, var(--ttb-primary) 5%, var(--ttb-surface));
  color: var(--ttb-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.history-table .mud-table-body .mud-table-row:hover {
  background-color: color-mix(in srgb, var(--ttb-primary) 5%, transparent) !important;
}

.history-date,
.history-number {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.history-number {
  text-align: right !important;
}

.history-wpm {
  color: var(--ttb-primary) !important;
  font-weight: 600;
}

.history-difficulty.mud-chip {
  height: 22px;
  border-color: var(--ttb-border);
  background-color: color-mix(in srgb, var(--ttb-primary) 4%, transparent);
  color: var(--ttb-text-primary);
  font-size: 0.7rem;
}

.history-pager {
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--ttb-border);
  font-size: 0.8rem;
}

.history-page-size {
  max-width: 135px;
  margin-left: auto;
}

.history-page-size .mud-input-label {
  color: var(--ttb-text-secondary) !important;
}

.history-page-size-menu,
.history-page-size-menu .mud-list {
  background-color: var(--ttb-surface) !important;
  color: var(--ttb-text-primary) !important;
}

.history-pager .mud-pagination-item {
  color: var(--ttb-text-primary);
}

.history-pager button:disabled {
  color: var(--ttb-text-secondary) !important;
  opacity: 0.45;
}

.history-empty {
  color: var(--ttb-text-secondary);
}

@media (max-width: 600px) {
  .history-toolbar > .history-muted {
    display: none;
  }

  .history-page-size {
    margin-left: 0;
  }

  .history-pager nav {
    flex-basis: 100%;
  }

  .history-table .mud-table-cell::before {
    color: var(--ttb-text-secondary);
    font-weight: 500;
    text-align: left;
  }
}

/* ---- Dashboard daily WPM trend charts ---- */
/* MudChart renders a fixed-size SVG; stretch it to fill the card width. */
.trend-chart-host {
  width: 100%;
}

.trend-chart-host .mud-chart {
  width: 100%;
}

.trend-chart-host svg {
  width: 100%;
  height: 240px;
  display: block;
}

.trend-chart-host .mud-charts-xaxis text,
.trend-chart-host .mud-charts-yaxis text {
  font-size: 10px;
  fill: var(--ttb-text-secondary, rgba(255, 255, 255, 0.6));
}

.trend-chart-card {
  border: 1px solid var(--ttb-border, rgba(255, 255, 255, 0.08));
}

@media (max-width: 960px) {
  .trend-chart-host .mud-charts-xaxis text,
  .trend-chart-host .mud-charts-yaxis text {
    font-size: 9px;
  }
}

/* Guest Vim reuses the authenticated Vim picker and practice workspace. */
.guest-vim-page {
  width: 100%;
  min-width: 0;
}

.guest-vim-page .vim-practice-page.vim-practice-active:not(.vim-account-practice) {
  height: calc(100dvh - 4rem);
}

.guest-vim-page .guest-vim-picker-note {
  color: var(--ttb-text-secondary);
  text-align: right;
}

.guest-vim-page .guest-vim-topic-group > h3 {
  margin: 0;
  padding: 1.25rem 1.5rem 0.5rem;
  color: var(--ttb-primary);
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.guest-vim-page .guest-vim-topic-list {
  margin: 0;
  padding: 0 1.5rem;
  list-style: none;
}

.guest-vim-page .guest-vim-topic-row {
  padding: 1rem 0;
}

.guest-vim-page .guest-vim-topic-row .vim-picker-lesson-number .mud-icon-root {
  color: var(--ttb-primary);
}

.guest-vim-page .guest-vim-picker .guest-vim-topic {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ttb-text-primary);
  font: inherit;
  font-size: 1rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}

.guest-vim-page .guest-vim-topic:hover,
.guest-vim-page .guest-vim-topic:focus-visible,
.guest-vim-page .guest-vim-topic-selected {
  color: var(--ttb-primary);
}

.guest-vim-page .guest-vim-topic:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: 3px;
}

.guest-vim-page .guest-vim-topic-selected {
  font-weight: 700;
}

.guest-vim-page .guest-vim-topic-actions {
  align-items: center;
  color: var(--ttb-text-secondary);
}

.guest-vim-page .guest-vim-run .vim-progress-top {
  margin-bottom: 0.5rem;
}

.guest-vim-page .guest-vim-run-stats {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.15rem 0.75rem;
  margin-top: 0.35rem;
  color: var(--ttb-text-secondary);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.guest-vim-page .guest-vim-run .guest-vim-unsaved {
  display: block;
  margin: 0.35rem 0 0;
  color: var(--ttb-text-secondary) !important;
  font-size: 0.72rem;
  line-height: 1.5;
}

.guest-vim-page .guest-vim-task {
  margin: 0.25rem 0 0.5rem;
}

.guest-vim-page .guest-vim-task-label {
  display: block;
  color: var(--ttb-text-secondary);
  font-size: 0.72rem;
}

.guest-vim-page .guest-vim-task p {
  margin: 0.15rem 0 0;
}

.guest-vim-page .guest-vim-hint {
  margin-top: 0.25rem;
}

.guest-vim-page .guest-vim-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.guest-vim-page .guest-vim-run-footer {
  display: flex;
  flex-shrink: 0;
  width: 100%;
  justify-content: flex-end;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--ttb-border);
}

.guest-vim-page .guest-vim-run-footer .guest-vim-controls {
  flex-direction: row;
  align-items: center;
}

.guest-vim-page .guest-vim-recovery-shell {
  min-height: 18rem;
  overflow: hidden;
  border-radius: 8px;
  background: var(--ttb-drawer);
}

.guest-vim-page .guest-vim-terminal {
  background: var(--ttb-surface);
  color: var(--ttb-text-primary);
}

.guest-vim-page .guest-vim-summary {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0.35rem 1rem;
  margin: 0.75rem 0 0;
  text-align: left;
}

.guest-vim-page .guest-vim-summary dt {
  color: var(--ttb-text-secondary);
}

.guest-vim-page .guest-vim-summary dd {
  margin: 0;
  color: var(--ttb-text-primary);
  font-variant-numeric: tabular-nums;
}

.guest-vim-page .guest-vim-pending {
  margin: 1rem 0;
  color: var(--ttb-text-secondary);
}

.guest-vim-page .guest-vim-free-catalog {
  width: 100%;
  max-width: 72rem;
  margin: 1.5rem auto 0;
}

.guest-vim-page .guest-vim-free-catalog > summary {
  min-height: 44px;
  padding: 0.75rem 0;
  color: var(--ttb-text-primary);
  cursor: pointer;
}

.guest-vim-page .guest-vim-clear-confirmation {
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--ttb-border);
  border-radius: 0.65rem;
  background: var(--ttb-background);
}

.guest-vim-page .guest-vim-clear-confirmation p {
  margin-bottom: 0.75rem;
}

.guest-vim-page .guest-vim-terminal button,
.guest-vim-page .guest-vim-clear-confirmation button,
.guest-vim-page .guest-vim-retry-load {
  min-height: 44px;
  max-width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--ttb-primary);
  border-radius: 0.4rem;
  background: var(--ttb-background);
  color: var(--ttb-text-primary);
  font: inherit;
  white-space: normal;
  cursor: pointer;
}

.guest-vim-page .guest-vim-retry-load {
  justify-self: start;
}

.guest-vim-page .guest-vim-clear-confirmation button + button {
  margin-left: 0.5rem;
}

.guest-vim-page .guest-vim-terminal button:focus-visible,
.guest-vim-page .guest-vim-clear-confirmation button:focus-visible,
.guest-vim-page .guest-vim-retry-load:focus-visible,
.guest-vim-page .guest-vim-free-catalog > summary:focus-visible {
  outline: 2px solid var(--ttb-primary);
  outline-offset: 3px;
}

.guest-vim-page .guest-vim-run-footer .vim-practice-shortcut {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .guest-vim-page .vim-practice-page.vim-practice-active:not(.vim-account-practice) {
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .guest-vim-page .guest-vim-hint {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .guest-vim-page .guest-vim-topic-list {
    padding-inline: 1rem;
  }

  .guest-vim-page .guest-vim-run-stats {
    justify-content: flex-start;
  }

  .guest-vim-page .guest-vim-run-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
  }

  .guest-vim-page .guest-vim-run-footer .guest-vim-controls {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .guest-vim-page .guest-vim-recovery-shell {
    height: auto;
    overflow: visible;
  }

  .guest-vim-page .guest-vim-terminal {
    position: relative;
    inset: auto;
    overflow: visible;
  }
}
