:root {
  --bg: #effafd;
  --blue: #5087d5;
  --plum: #b00078;
  --plum-dark: #920063;
  --text: #101114;
  --muted: #5d5d5d;
  --white: #ffffff;
  --icon-bg: #d9d9d9;
  --input-border: #e5dada;
  --card-shadow: 16px 20px 24px rgba(0, 0, 0, 0.18);
  --input-shadow: 14px 16px 20px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Nunito", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  min-height: 100vh;
  padding: 34px 62px 44px;
}

.app-frame {
  max-width: 1256px;
  margin: 0 auto;
}

.screen-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--blue);
  border-radius: 18px;
  min-height: 102px;
  padding: 22px 28px;
  margin-bottom: 22px;
}

.topbar-left,
.topbar-right,
.card-actions,
.form-actions,
.status-actions,
.category-switch {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-left,
.topbar-right {
  min-width: 250px;
}

.topbar-right {
  justify-content: flex-end;
}

.brand-title {
  flex: 1;
  color: var(--white);
  font-size: clamp(1.6rem, 2vw, 2.15rem);
  font-weight: 800;
  line-height: 1.15;
}

.topbar-home .brand-title {
  max-width: 650px;
}

.nav-button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 13px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.nav-button,
.secondary-button {
  background: var(--white);
  color: var(--plum);
}

.primary-button {
  background: var(--plum);
  color: var(--white);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
}

.primary-button:hover {
  background: var(--plum-dark);
}

.nav-button:hover,
.secondary-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.topbar-home .topbar-right .primary-button,
.topbar-home .topbar-right .secondary-button {
  min-width: 184px;
  justify-content: center;
  font-size: 1rem;
}

.topbar-home .secondary-button {
  color: var(--blue);
}

.screen-topbar:not(.topbar-home) .nav-button,
.screen-topbar:not(.topbar-home) .secondary-button,
.screen-topbar:not(.topbar-home) .primary-button {
  min-width: 116px;
  justify-content: center;
}

.home-layout {
  display: grid;
  grid-template-columns: 1fr 634px;
  gap: 44px;
  align-items: start;
}

.welcome-panel {
  padding: 58px 0 0;
}

.welcome-panel h1 {
  max-width: 640px;
  margin: 0 auto 28px;
  text-align: center;
  font-size: 1.22rem;
  line-height: 1.45;
  font-weight: 800;
}

.welcome-panel p {
  max-width: 670px;
  margin: 0 auto;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.5;
  font-weight: 700;
  color: var(--muted);
}

.cta-wrap {
  margin-top: 22px;
  text-align: center;
}

.cta-wrap .primary-button {
  min-width: 280px;
}

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

.home-category-card,
.game-card,
.user-card,
.stat-card {
  background: var(--white);
  border-radius: 36px;
  box-shadow: var(--card-shadow);
}

.home-category-card {
  min-height: 510px;
  padding: 20px 20px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.icon-box {
  width: 232px;
  height: 248px;
  margin: 18px auto 16px;
  border-radius: 38px;
  display: grid;
  place-items: center;
  background: var(--icon-bg);
  color: #111;
  font-size: 1.15rem;
  font-weight: 700;
}

.icon-box img {
  display: block;
  margin: 0 auto;
}

.home-category-card h2,
.game-card h3,
.user-card h3 {
  margin: 0;
}

.home-category-card h2 {
  min-height: 108px;
  padding: 4px 20px 0;
  font-size: 1.08rem;
  line-height: 1.32;
  font-weight: 800;
}

.card-actions {
  justify-content: center;
}

.home-category-card .primary-button,
.game-card .primary-button {
  min-width: 102px;
  padding-inline: 26px;
}

.catalog-panel {
  margin-top: 6px;
}

.catalog-header {
  margin-bottom: 16px;
}

.catalog-header .category-switch {
  display: none;
}

.catalog-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
  gap: 14px;
  margin-bottom: 18px;
  align-items: end;
}

.search-field {
  display: grid;
  gap: 7px;
  color: #2a2a2a;
  font-weight: 800;
}

.search-field input,
.search-field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--white);
  color: var(--text);
  box-shadow: 8px 10px 16px rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

.catalog-greeting {
  margin: 0 0 20px;
  color: #3d3d3d;
  font-size: clamp(1.7rem, 2.6vw, 3rem);
  font-weight: 500;
  line-height: 1.18;
}

.games-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 52px;
}

.game-card {
  min-height: 500px;
  padding: 20px 20px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-card .icon-box {
  width: 278px;
  height: 245px;
  margin: 18px auto 24px;
}

.game-card h3 {
  min-height: 54px;
  padding: 0 8px;
  font-size: 1.08rem;
  line-height: 1.25;
  font-weight: 800;
}

.game-card-content {
  min-height: 68px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}

.year-badge,
.status-pill,
.category-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.year-badge,
.category-chip {
  color: #5a5a5a;
  font-size: 1.22rem;
  line-height: 1.2;
}

.status-pill {
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--white);
}

.status-pill.pendente {
  background: #f39d3c;
}

.status-pill.aprovado {
  background: #2c9b69;
}

.status-pill.rejeitado {
  background: #cf4b63;
}

.auth-wrapper {
  max-width: 816px;
  margin: 76px 0 0 178px;
}

.auth-title {
  margin: 0 0 10px;
  font-size: 2.15rem;
  line-height: 1;
  font-weight: 800;
}

.auth-subtitle {
  margin: 0 0 20px;
  color: #767676;
  font-size: 1.02rem;
  line-height: 1.45;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #111;
  font-size: 1rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 18px;
  box-shadow: var(--input-shadow);
  font-size: 1rem;
  font-weight: 700;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 100px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  min-width: 78px;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--plum);
  color: var(--white);
  font-weight: 800;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--plum-dark);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.category-icon-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 700;
}

.category-icon-preview strong,
.category-icon-preview span {
  display: block;
}

.category-icon-preview strong {
  color: var(--text);
  margin-bottom: 3px;
}

.preview-icon-box {
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--icon-bg);
}

.preview-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

input::placeholder,
textarea::placeholder {
  color: #7a7a7a;
  font-weight: 700;
}

.form-actions {
  justify-content: center;
  margin-top: 16px;
}

.form-actions .primary-button {
  min-width: 258px;
}

.auth-alt-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
  color: var(--muted);
  font-weight: 800;
}

.auth-alt-action .secondary-button {
  min-width: 170px;
  text-align: center;
}

.hint-box,
.message-banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
}

.hint-box {
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
}

.message-banner {
  font-weight: 700;
}

.message-banner.success {
  background: #ecfff5;
  color: #207953;
}

.message-banner.error {
  background: #fff1f4;
  color: #ac3750;
}

.message-banner.info {
  background: #eef6ff;
  color: #2b66b0;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.admin-panel {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  padding: 18px;
}

.editing-panel {
  outline: 3px solid rgba(176, 0, 120, 0.22);
  background: rgba(255, 255, 255, 0.74);
}

.edit-mode-note {
  margin: -2px 0 16px;
  color: var(--plum);
  font-weight: 800;
}

.admin-games-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  gap: 14px;
  margin-top: 14px;
  align-items: end;
}

.clear-filters-button {
  min-height: 48px;
}

.panel-title,
.section-heading {
  margin: 0 0 10px;
  font-size: 1.7rem;
  font-weight: 800;
}

.panel-subtitle,
.meta-line,
.muted {
  color: var(--muted);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.stat-card {
  padding: 18px;
  text-align: center;
}

.stat-card strong {
  display: block;
  color: var(--plum);
  font-size: 2rem;
}

.users-list {
  display: grid;
  gap: 18px;
}

.admin-search {
  margin-top: 14px;
}

.teacher-groups {
  display: grid;
  gap: 18px;
}

.teacher-group {
  display: grid;
  gap: 12px;
}

.teacher-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.teacher-group-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 800;
}

.teacher-group-header span {
  min-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: var(--white);
  font-weight: 800;
}

.user-card {
  padding: 18px;
}

.user-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.meta-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.empty-state {
  padding: 26px;
  text-align: center;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.empty-state.compact {
  padding: 16px;
  border-radius: 18px;
}

.modal {
  width: min(620px, calc(100% - 20px));
  border: 0;
  border-radius: 24px;
  padding: 0;
}

.modal::backdrop {
  background: rgba(80, 135, 213, 0.24);
}

.modal-card {
  padding: 22px;
  background: var(--white);
}

.modal-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

@media (max-width: 1100px) {
  .home-layout,
  .games-list,
  .admin-grid,
  .stats-row,
  .catalog-tools,
  .admin-games-tools {
    grid-template-columns: 1fr;
  }

  .home-cards {
    grid-template-columns: 1fr;
  }

  .auth-wrapper {
    margin: 48px auto 0;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 18px 14px 28px;
  }

  .screen-topbar {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    padding: 18px;
  }

  .topbar-left,
  .topbar-right,
  .card-actions,
  .form-actions,
  .status-actions {
    width: 100%;
  }

  .topbar-left,
  .topbar-right {
    min-width: 0;
  }

  .brand-title {
    text-align: center;
    order: -1;
  }

  .nav-button,
  .primary-button,
  .secondary-button {
    flex: 1 1 100%;
  }

  .home-layout {
    gap: 28px;
  }

  .catalog-header {
    display: flex;
    flex-direction: column;
  }

  .catalog-greeting {
    order: -1;
  }

  .welcome-panel {
    order: -1;
    padding-top: 0;
  }

  .icon-box,
  .game-card .icon-box {
    width: 100%;
    max-width: 280px;
  }
}
