@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200");

:root {
  /* Material 3 – light scheme */
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;

  --md-sys-color-secondary: #625b71;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e8def8;
  --md-sys-color-on-secondary-container: #1d192b;

  --md-sys-color-surface: #fffbfe;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container-high: #ede6f4;
  --md-sys-color-on-surface: #1c1b1f;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  --md-sys-color-error: #b3261e;
  --md-sys-color-on-error: #ffffff;

  /* Legacy tokens mapped for backwards compatibility */
  --bg: var(--md-sys-color-surface);
  --fg: var(--md-sys-color-on-surface);
  --card: var(--md-sys-color-surface-container);
  --muted: var(--md-sys-color-on-surface-variant);
  --border: var(--md-sys-color-outline-variant);

  /* Breakpoints */
  --bp-s: 480px; /* Mobile */
  --bp-m: 768px; /* Tablet */
  --bp-l: 1024px; /* Small desktop / tablets */
  --bp-xl: 1366px; /* Large desktops */
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font-family:
    system-ui,
    Roboto,
    Segoe UI,
    Arial,
    sans-serif;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
}
.page--admin-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page--admin-layout .app-header {
  height: 56px;
  min-height: 56px;
  padding: 0 16px;
}
.page--admin-layout .app-shell {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 56px);
  background: var(--md-sys-color-surface);
}
.page--admin-layout .app-content {
  flex: 1;
  overflow-x: hidden;
  background: var(--md-sys-color-surface);
}
.app-sidebar {
  width: 72px;
  flex: 0 0 72px;
  background: var(--md-sys-color-surface-container-lowest);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 56px;
  align-self: flex-start;
  height: calc(100vh - 56px);
  display: flex;
  justify-content: center;
}
.app-sidebar__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
}
.app-sidebar__item {
  width: 64px;
  min-height: 64px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition:
    background-color 0.18s ease,
    transform 0.12s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}
.app-sidebar__item:hover {
  background: var(--md-sys-color-surface-container);
  border-color: var(--border);
}
.app-sidebar__item:active {
  transform: translateY(1px);
}
.app-sidebar__icon {
  font-size: 26px;
  line-height: 1;
}
.app-sidebar__label {
  font-size: 11px;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.2;
}
.app-sidebar__item:hover .app-sidebar__label {
  color: var(--md-sys-color-on-surface);
}
.dashboard-stats {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.dashboard-stats__item {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.dashboard-stats__icon {
  font-size: 26px;
  color: var(--md-sys-color-primary);
}
.dashboard-stats__value {
  font-size: 28px;
  font-weight: 650;
  color: var(--md-sys-color-on-surface);
  line-height: 1.2;
}
.dashboard-stats__label {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}
/* Generic container used in games and student */
.container {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 12px;
}
/* App header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.app-header__left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.app-header .brand {
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
}
.app-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.app-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  width: auto;
  margin: 0;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
.app-nav__link .material-symbols-outlined {
  font-size: 18px;
}
.app-nav__link:hover,
.app-nav__link:focus-visible {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  outline: none;
}
.app-nav__link.is-active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}
.app-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.auth-login {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-lowest);
}
.auth-login__fields {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.auth-login__fields input {
  width: auto;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--md-sys-color-surface);
}
.auth-login__fields input:focus {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 1px;
}
.auth-login__fields .btn {
  margin: 0;
}
.auth-login__fields button {
  width: auto;
}
.auth-login__status {
  text-align: right;
  color: var(--muted);
}
.auth-user {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.auth-user .btn {
  margin: 0;
}
.app-header .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}
.packs-filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
  margin-bottom: 12px;
}
.packs-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.packs-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.packs-group__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.packs-group__grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.pack-cat {
  border: 0;
  padding: 0;
}
.pack-cat summary {
  list-style: none;
  cursor: pointer;
  display: block;
}
.pack-cat summary::-webkit-details-marker {
  display: none;
}
.pack-cat summary {
  outline: none;
}
.pack-cat summary:focus-visible .pack-cat-card {
  box-shadow: 0 0 0 3px rgba(103, 80, 164, 0.35);
}
.pack-cat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
  text-align: left;
  color: var(--md-sys-color-on-surface);
}
.pack-cat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.pack-cat-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.pack-cat-card__title {
  font-size: 18px;
  font-weight: 650;
  color: var(--md-sys-color-on-surface);
}
.pack-cat-card__badge {
  font-size: 12px;
  font-weight: 600;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pack-cat-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}
.pack-cat-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pack-cat-card__cta {
  margin-top: auto;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--md-sys-color-primary);
}
.pack-cat-card .material-symbols-outlined {
  font-size: 20px;
}
.pack-cat[open] .pack-cat-card__cta .material-symbols-outlined {
  transform: rotate(180deg);
}
.pack-cat-card__cta .material-symbols-outlined {
  transition: transform 0.2s ease;
}
.pack-cat__body {
  margin-top: 14px;
  border-left: 2px solid var(--md-sys-color-outline-variant);
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pack-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pack-tree__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
}
.pack-tree__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pack-tree__name {
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}
.pack-tree__meta {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}
.pack-tree__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pack-tree__actions {
  display: flex;
  gap: 8px;
}
.pack-tree__actions button {
  width: auto;
  padding: 6px 10px;
  margin: 0;
}
.pack-tree__empty {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-style: italic;
}
.pack-card {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
.pack-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}
.pack-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.pack-card__name {
  font-weight: 650;
  font-size: 16px;
  color: var(--md-sys-color-on-surface);
}
.pack-card__category {
  font-size: 12px;
  font-weight: 600;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pack-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}
.pack-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pack-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
}
.pack-card__actions button {
  width: auto;
  padding: 6px 10px;
  margin: 0;
}
.pack-card .material-symbols-outlined {
  font-size: 18px;
}
.packs-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  border: 1px dashed var(--md-sys-color-outline-variant);
  border-radius: 14px;
  background: var(--md-sys-color-surface-container-lowest);
}
.app-footer {
  margin-top: 48px;
  padding: 18px 16px;
  background: var(--md-sys-color-surface-container-high);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
}
.app-footer__inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.app-footer__brand {
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}
.app-footer__version,
.app-footer__updated {
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 18px;
  margin: 12px 0;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.2);
  position: relative;
}
#packsArea {
  margin-bottom: 42px;
}
#assignCreateArea {
  margin-bottom: 42px;
}
/* Spacing between card head and body */
.card__body {
  margin-top: 24px;
}
.grid {
  display: grid;
  gap: 12px;
}
.g2 {
  grid-template-columns: 1fr 1fr;
}
.field--full {
  grid-column: 1 / -1;
}
/* Generic 2-col grid helper used in games */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.btn {
  /* MD3 filled button */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-weight: 600;
  border: 0;
  margin: 4px;
  transition:
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
  letter-spacing: 0.03em;
}
.btn.outline {
  /* MD3 outlined button */
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
}
/* White outlined variant for action links */
.btn.outline.btn--white {
  color: #ffffff;
  border-color: #ffffff;
}

/* Size variants */
.btn.btn--xs {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 10px;
  letter-spacing: 0.04em;
}

/* Hover / active states */
.btn:hover {
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.22),
    0 6px 18px rgba(0, 0, 0, 0.18);
}
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.btn.outline:hover {
  background: rgba(103, 80, 164, 0.12);
  border-color: var(--md-sys-color-primary);
}
.btn.outline.btn--white:hover,
.btn.outline.btn--white:focus {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: #ffffff;
}

/* Compatibility: if older markup still uses md-outlined-button.btn-xs, style it to match */
md-outlined-button.btn-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--md-sys-color-outline);
  background: transparent;
  color: var(--md-sys-color-primary);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 4px;
  cursor: pointer;
}
md-outlined-button.btn-xs:hover {
  background: rgba(103, 80, 164, 0.12);
  border-color: var(--md-sys-color-primary);
}
input,
textarea,
select,
button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  margin: 4px;
}
button {
  cursor: pointer;
  font-weight: 600;
  background: var(--md-sys-color-primary);
  border: 0;
  margin: 4px;
}
/* Secondary variant */
.btn.btn--secondary {
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
}
label {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
}
small,
.muted {
  color: var(--md-sys-color-on-surface-variant);
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.table-wrap {
  width: 100%;
  overflow: auto;
}
th,
td {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  padding: 8px;
  text-align: left;
}
.small {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}
code {
  background: var(--md-sys-color-surface-container-low);
  padding: 2px 6px;
  border-radius: 6px;
}
.hidden {
  display: none;
}
.hidden {
  display: none !important;
}
.is-view-hidden {
  display: none !important;
}

/* Volitelné: efekt „srolované“ karty po přihlášení */
.card--collapsed {
  max-height: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
  transition:
    max-height 0.25s ease,
    padding 0.25s ease;
}

/* Badges (used in games) */
.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}
.calendar-embed {
  border: 1px dashed var(--md-sys-color-outline-variant);
  border-radius: 16px;
  padding: 12px;
  background: var(--md-sys-color-surface-container-low);
  min-height: 260px;
}
.calendar-embed iframe {
  width: 100%;
  min-height: 600px;
  border: 0;
}

/* Admin: inline edit row highlight + input error */
.assign-editing {
  background: var(--md-sys-color-surface-container-high);
}
.input--error {
  border-color: var(--md-sys-color-error) !important;
  box-shadow: 0 0 0 2px rgba(179, 38, 30, 0.15);
}

/* Game typography defaults */
h1 {
  font-size: 24px;
  line-height: 1.2;
}
.btn {
  font-size: 14px;
}
/* Common question badge across games */
.badge#q {
  font-size: 28px;
  padding: 8px 14px; /* unified padding */
  margin: 12px 0 24px 0; /* unified spacing above/below */
  display: inline-block;
}

/* ===== UI primitives for games (unified naming) ===== */
/* Chip: small rounded button-like token for words/items */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap; /* override global button width */
  margin: 4px; /* keep slight spacing for legacy layouts */
}
.chip:hover {
  border-color: var(--md-sys-color-primary);
  background: rgba(103, 80, 164, 0.08);
}
.chip:disabled {
  opacity: 0.6;
  cursor: default;
}
.chip.active {
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
  background: rgba(103, 80, 164, 0.1);
}
.chip.done {
  background: #e6f4ea;
  border-color: #16a34a;
  color: #14532d;
}
.chip.wrong {
  background: #fde7e9;
  border-color: #b3261e;
  color: #7a1a15;
}

/* Bank/container holding chips */
.chip-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Common controls row within games */
.game-controls {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}
.game-controls .btn {
  width: auto;
}

/* Common actions row alias (kept with ml-actions for backward compat) */
.game-actions,
.ml-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ===== Utility helpers ===== */
.text-center {
  text-align: center;
}
.flex {
  display: flex;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.align-center {
  align-items: center;
}
.align-end {
  align-self: flex-end;
}
.gap-10 {
  gap: 10px;
}
.gap-12 {
  gap: 12px;
}
.mt-6 {
  margin-top: 6px;
}
.mt-18 {
  margin-top: 18px;
}
.mt-24 {
  margin-top: 24px;
}
.mt-32 {
  margin-top: 32px;
}
.mt-36 {
  margin-top: 36px;
}
.mt-42 {
  margin-top: 42px;
}
.mt-48 {
  margin-top: 48px;
}
.mb-6 {
  margin-bottom: 6px;
}
.min-h-20 {
  min-height: 20px;
}
.card__head--center {
  text-align: center;
}
.card__body--spacious {
  margin-top: 32px;
}
.card__body--roomy {
  margin-top: 36px;
}
.card__body--xl {
  margin-top: 48px;
}

/* ===== Modal (prompt generator) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 31, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  width: min(420px, 100%);
  padding: 24px 24px 28px 24px;
  position: relative;
  max-height: 90vh;
  overflow: auto;
}
.modal.modal--wide {
  width: min(720px, 100%);
  max-width: 720px;
}
.modal__close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: block;
  margin-left: auto;
}
.game-tip-anchor {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 10;
}
.game-tip-button {
  border: none;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: 999px;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
  margin: 0;
  flex: 0 0 auto;
}
.game-tip-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.game-tip-bubble {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(260px, 86vw);
  background: #655ad0;
  color: #ffffff;
  padding: 16px 18px;
  border-radius: 12px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
  font-size: 0.92rem;
  line-height: 1.4;
  z-index: 5;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}
.game-tip-bubble::after {
  content: "";
  position: absolute;
  top: -8px;
  right: 18px;
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent #655ad0 transparent;
}
.game-tip-dismiss {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto !important;
  flex: 0 0 auto;
}
.game-tip-dismiss:hover {
  background: rgba(255, 255, 255, 0.28);
}

.write-word-feedback {
  font-size: 17px;
  font-weight: 500;
}

.students-list {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.student-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
.student-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}
.student-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.student-card__name {
  font-size: 18px;
  font-weight: 650;
  color: var(--md-sys-color-on-surface);
}
.student-card__code,
.student-card__pin {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 6px;
}
.student-card__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.student-card__actions button {
  width: auto;
  margin: 0;
  padding: 6px 10px;
}
.student-card__share {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--md-sys-color-surface-container-lowest);
  border-radius: 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
}
.student-card__share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}
.student-card__share-row span {
  font-weight: 600;
  min-width: 48px;
}
.student-card__share-row code {
  font-family: var(
    --font-mono,
    "SFMono-Regular",
    "Menlo",
    "Monaco",
    "Consolas",
    "Liberation Mono",
    "Courier New",
    monospace
  );
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--md-sys-color-surface);
}
.student-card__share a {
  color: var(--md-sys-color-primary);
  word-break: break-all;
}
.students-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
  border: 1px dashed var(--md-sys-color-outline-variant);
  border-radius: 14px;
  background: var(--md-sys-color-surface-container-lowest);
}

.assign-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.assign-empty {
  text-align: center;
  color: var(--muted);
  padding: 18px 12px;
  border: 1px dashed var(--md-sys-color-outline-variant);
  border-radius: 12px;
}
.assign-student {
  border: 0;
  padding: 0;
}
.assign-student summary {
  list-style: none;
  display: block;
  cursor: pointer;
}
.assign-student summary::-webkit-details-marker {
  display: none;
}
.assign-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
.assign-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.assign-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.assign-card__title {
  font-size: 18px;
  font-weight: 650;
  color: var(--md-sys-color-on-surface);
}
.assign-card__badge {
  font-size: 12px;
  font-weight: 600;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.assign-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}
.assign-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.assign-card__cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--md-sys-color-primary);
}
.assign-card .material-symbols-outlined {
  font-size: 20px;
  transition: transform 0.2s ease;
}
.assign-student[open] .assign-card__cta .material-symbols-outlined {
  transform: rotate(180deg);
}
.assign-student__body {
  margin-top: 14px;
  border-left: 2px solid var(--md-sys-color-outline-variant);
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.assign-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.assign-tree__item {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
}
.assign-tree__item--editing {
  border: 1px dashed var(--md-sys-color-primary);
  background: var(--md-sys-color-surface);
}
.assign-tree__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}
.assign-tree__name {
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}
.assign-tree__meta {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}
.assign-tree__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.assign-tree__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.assign-tree__actions button {
  width: auto;
  padding: 6px 10px;
  margin: 0;
}
.assign-tree__form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-end;
}
.assign-tree__form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}
.assign-tree__form-group label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--md-sys-color-on-surface-variant);
}
.assign-tree__form-group select,
.assign-tree__form-group input {
  margin: 0;
}
.assign-tree__empty {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-style: italic;
  background: var(--md-sys-color-surface-container-lowest);
  border-radius: 12px;
}
#prompt-generator label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}
#prompt-generator label:first-of-type {
  margin-top: 0;
}
#prompt-generator select,
#prompt-generator input {
  margin: 6px 0 4px;
}
.prompt-output {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-low);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.prompt-output .btn.copied {
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
}

/* Generic row layout inside games */
body.game .row {
  display: grid;
  gap: 12px;
}
body.game .card h1 {
  text-align: center;
  margin-bottom: 24px;
}

/* ===== Game: Build Sentence ===== */
body.game--build-sentence .card__body {
  row-gap: 18px;
}
body.game--build-sentence .sb-box {
  border: 2px dashed var(--md-sys-color-primary);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  padding: 18px;
  border-radius: 16px;
  min-height: 110px;
}
body.game--build-sentence .sb-label {
  color: var(--md-sys-color-primary);
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}
body.game--build-sentence .sb-placeholder {
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
}
body.game--build-sentence .sb-sentence {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
body.game--build-sentence .sb-correct {
  margin-top: 10px;
  color: var(--md-sys-color-error);
  font-weight: 600;
}
body.game--build-sentence .sb-correct-label {
  font-weight: 700;
  margin-right: 6px;
}
body.game--build-sentence .sb-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}
body.game--build-sentence .sb-chip {
  margin: 4px 0;
  border-radius: 14px;
}
body.game--build-sentence .sb-chip:hover {
  border-color: var(--md-sys-color-primary);
  background: rgba(103, 80, 164, 0.08);
}
body.game--build-sentence .sb-chip[disabled] {
  opacity: 0.5;
  cursor: default;
}
body.game--build-sentence .sb-chip--filled {
  background: var(--md-sys-color-surface-container-high);
}
body.game--build-sentence .sb-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
body.game--build-sentence .sb-controls .btn {
  width: auto;
}
body.game--build-sentence .sb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
body.game--build-sentence #feedback {
  text-align: center;
  margin-top: 6px;
  min-height: 20px;
}

/* ===== Game: Missing Letters ===== */
body.game--missing-letters .card__body {
  row-gap: 18px;
}
body.game--missing-letters .ml-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
body.game--missing-letters .ml-title {
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}
body.game--missing-letters .ml-sub {
  color: var(--muted);
  font-size: 14px;
}
body.game--missing-letters .ml-prompt {
  text-align: center;
  margin: 8px 0 12px;
  font-size: 20px;
}
body.game--missing-letters .ml-masked {
  font-size: 28px;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  padding: 18px;
  border-radius: 12px;
}
body.game--missing-letters .ml-letters {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 6px;
  min-height: 76px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  background: var(--md-sys-color-surface-container-low);
}
body.game--missing-letters .ml-letter {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: transform 0.05s ease;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}
body.game--missing-letters .ml-letter:active {
  transform: scale(0.98);
}
body.game--missing-letters .ml-feedback {
  text-align: center;
  min-height: 20px;
  margin-top: 6px;
}
body.game--missing-letters .ml-progress {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}
body.game--missing-letters .btn-wide {
  min-width: 140px;
}

@media (min-width: var(--bp-xl)) {
  body.game--missing-letters .ml-prompt {
    font-size: 24px;
  }
  body.game--missing-letters .ml-masked {
    font-size: 36px;
  }
  body.game--missing-letters .ml-letter {
    font-size: 20px;
    padding: 14px 18px;
  }
  body.game--missing-letters .ml-letters {
    min-height: 84px;
  }
}
@media (max-width: var(--bp-l)) {
  body.game--missing-letters .ml-prompt {
    font-size: 20px;
  }
  body.game--missing-letters .ml-masked {
    font-size: 32px;
  }
}
@media (max-width: var(--bp-m)) {
  body.game--missing-letters .ml-prompt {
    font-size: 18px;
  }
  body.game--missing-letters .ml-masked {
    font-size: 26px;
  }
  body.game--missing-letters .ml-letter {
    font-size: 16px;
    padding: 10px 14px;
  }
  body.game--missing-letters .ml-letters {
    gap: 10px;
    min-height: 68px;
  }
}
@media (max-width: var(--bp-s)) {
  body.game--missing-letters .ml-prompt {
    font-size: 16px;
  }
  body.game--missing-letters .ml-masked {
    font-size: 22px;
  }
  body.game--missing-letters .ml-letter {
    font-size: 15px;
    padding: 10px 12px;
  }
  body.game--missing-letters .ml-letters {
    min-height: 60px;
  }
}

/* ===== Game: Word Match ===== */
body.game--word-match .card__body {
  row-gap: 18px;
}
body.game--word-match #cols {
  min-height: 220px;
}
body.game--word-match .col {
  border: 1px dashed var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 12px;
  min-height: 240px;
  background: var(--md-sys-color-surface);
}
body.game--word-match .item {
  padding: 8px 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  margin: 6px 0;
  cursor: pointer;
  font-size: 16px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  text-align: left;
  transition:
    border-color 0.12s ease,
    background-color 0.12s ease;
}
body.game--word-match .item:hover {
  border-color: var(--md-sys-color-primary);
  background: rgba(103, 80, 164, 0.12);
}
body.game--word-match .item:disabled {
  opacity: 0.85;
  cursor: default;
}
body.game--word-match .item.active {
  border-color: var(--md-sys-color-primary);
  border-width: 3px;
  background: rgba(124, 58, 237, 0.12);
}
body.game--word-match .item.done {
  background: #e6f4ea;
  border-color: #16a34a;
  color: #14532d;
  opacity: 1;
}
body.game--word-match .item.wrong {
  background: #fde7e9;
  border-color: #b3261e;
  color: #7a1a15;
}
body.game--word-match #progress {
  margin-top: 12px;
  display: inline-block;
}

@media (max-width: 1024px) {
  body.game--word-match .container {
    padding: 16px;
  }
}
@media (max-width: 768px) {
  body.game--word-match .grid-2 {
    grid-template-columns: 1fr;
  }
  body.game--word-match .col {
    min-height: 180px;
  }
  body.game--word-match .item {
    font-size: 15px;
  }
}
@media (max-width: 480px) {
  body.game--word-match .item {
    padding: 10px;
    font-size: 14px;
  }
}
@media (min-width: 1366px) {
  body.game--word-match .item {
    font-size: 18px;
  }
}

/* ===== Game: Write Word ===== */
body.game--write-word #feedback {
  text-align: center;
  min-height: 20px;
}
body.game--write-word .card__body {
  row-gap: 18px;
}
body.game--flashcards #listen {
  width: auto;
  min-width: 48px;
  align-self: center;
}

/* ===== Game: Flashcards ===== */
body.game--flashcards #panel {
  display: grid;
  gap: 14px;
}
body.game--flashcards #a.small {
  min-height: 24px;
}
body.game--flashcards #q {
  margin: 32px 0;
}
body.game--flashcards .card__body {
  row-gap: 18px;
}

/* ===== Admin Standalone (dark demo) ===== */
body.page--admin-standalone {
  background: #0b1020;
  color: #e5e9f0;
}
body.page--admin-standalone .wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}
body.page--admin-standalone .card {
  background: #141a33;
  border: 1px solid #20284a;
  border-radius: 14px;
  padding: 18px;
  box-shadow: none;
}
body.page--admin-standalone input,
body.page--admin-standalone button,
body.page--admin-standalone textarea,
body.page--admin-standalone select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2b355f;
  background: #0f1430;
  color: #e5e9f0;
  margin: 6px 0;
}
body.page--admin-standalone button {
  border: 0;
  background: linear-gradient(90deg, #7c3aed, #22c55e);
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.12s ease;
}
body.page--admin-standalone button:hover {
  opacity: 0.9;
}
body.page--admin-standalone .grid {
  display: grid;
  gap: 12px;
}
body.page--admin-standalone .g2 {
  grid-template-columns: 1fr 1fr;
}
body.page--admin-standalone .muted {
  color: #9aa3b2;
}
body.page--admin-standalone .row {
  margin: 8px 0;
}
body.page--admin-standalone table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
body.page--admin-standalone th,
body.page--admin-standalone td {
  border-bottom: 1px solid #2b355f;
  padding: 8px;
  text-align: left;
}
body.page--admin-standalone code {
  background: #0f1430;
  padding: 2px 6px;
  border-radius: 6px;
}
body.page--admin-standalone pre {
  white-space: pre-wrap;
  background: #0f1430;
  padding: 10px;
  border-radius: 10px;
  min-height: 90px;
}

/* Responsive breakpoints */
@media (max-width: var(--bp-l)) {
  .wrap {
    max-width: 960px;
    padding: 20px;
  }
}
@media (max-width: var(--bp-m)) {
  .wrap {
    max-width: 740px;
    padding: 16px;
  }
  .g2 {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .app-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .app-header__right {
    width: 100%;
    justify-content: space-between;
  }
  th,
  td {
    padding: 8px 6px;
  }
  h1 {
    font-size: 22px;
  }
  .btn {
    font-size: 13px;
  }
  .badge#q {
    font-size: 24px;
  }
}
@media (max-width: var(--bp-s)) {
  .wrap {
    max-width: 100%;
    padding: 12px;
  }
  .card {
    padding: 14px;
  }
  .btn {
    padding: 10px 12px;
    font-size: 12.5px;
  }
  .btn.btn--xs {
    padding: 6px 10px;
  }
  h1 {
    font-size: 20px;
  }
  .badge#q {
    font-size: 22px;
  }
}
@media (min-width: var(--bp-l)) {
  h1 {
    font-size: 26px;
  }
  .btn {
    font-size: 15px;
  }
}
@media (min-width: var(--bp-xl)) {
  h1 {
    font-size: 30px;
  }
  .btn {
    font-size: 16px;
  }
  .badge#q {
    font-size: 32px;
  }
}
