.student-avatar {
  --avatar-bg: #dbeafe;
  --avatar-main: #2563eb;
  --avatar-accent: #38bdf8;
  --avatar-ink: #10203d;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 3.4rem;
  height: 3.4rem;
  border: 3px solid #fff;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.88), transparent 34%),
    linear-gradient(135deg, var(--avatar-bg), #fff);
  box-shadow: 0 10px 22px rgba(16, 32, 61, 0.12);
  overflow: hidden;
}

.student-avatar--sm {
  width: 2.65rem;
  height: 2.65rem;
  border-width: 2px;
}

.student-avatar--lg {
  width: 4.4rem;
  height: 4.4rem;
}

.student-avatar__shape,
.student-avatar__shape::before,
.student-avatar__shape::after,
.student-avatar__spark,
.student-avatar__spark::before,
.student-avatar__spark::after {
  content: "";
  position: absolute;
  display: block;
}

.student-avatar__shape {
  left: 50%;
  top: 50%;
  width: 1.9rem;
  height: 1.9rem;
  transform: translate(-50%, -50%);
}

.student-avatar__spark {
  right: 0.48rem;
  top: 0.52rem;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--avatar-accent);
  opacity: 0.85;
}

.student-avatar--rocket {
  --avatar-bg: #dbeafe;
  --avatar-main: #1d4ed8;
  --avatar-accent: #f97316;
}

.student-avatar--rocket .student-avatar__shape {
  width: 0.9rem;
  height: 2rem;
  border-radius: 999px 999px 45% 45%;
  background: #fff;
  border: 0.16rem solid var(--avatar-main);
  transform: translate(-50%, -56%) rotate(28deg);
}

.student-avatar--rocket .student-avatar__shape::before {
  left: 50%;
  top: 0.34rem;
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 50%;
  background: var(--avatar-accent);
  transform: translateX(-50%);
}

.student-avatar--rocket .student-avatar__shape::after {
  left: 50%;
  bottom: -0.46rem;
  width: 0.42rem;
  height: 0.62rem;
  border-radius: 0 0 999px 999px;
  background: #facc15;
  transform: translateX(-50%);
}

.student-avatar--planet {
  --avatar-bg: #dcfce7;
  --avatar-main: #10b981;
  --avatar-accent: #2563eb;
}

.student-avatar--planet .student-avatar__shape {
  width: 1.68rem;
  height: 1.68rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #86efac, var(--avatar-main));
  box-shadow: inset -0.34rem -0.26rem 0 rgba(16, 32, 61, 0.14);
}

.student-avatar--planet .student-avatar__shape::before {
  left: -0.48rem;
  top: 0.56rem;
  width: 2.62rem;
  height: 0.48rem;
  border: 0.16rem solid var(--avatar-accent);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.student-avatar--star {
  --avatar-bg: #fef3c7;
  --avatar-main: #f59e0b;
  --avatar-accent: #f97316;
}

.student-avatar--star .student-avatar__shape {
  width: 2.05rem;
  height: 2.05rem;
  background: linear-gradient(145deg, #fde68a, var(--avatar-main));
  clip-path: polygon(50% 0%, 61% 33%, 96% 33%, 68% 54%, 79% 90%, 50% 68%, 21% 90%, 32% 54%, 4% 33%, 39% 33%);
}

.student-avatar--comet {
  --avatar-bg: #ede9fe;
  --avatar-main: #7c3aed;
  --avatar-accent: #38bdf8;
}

.student-avatar--comet .student-avatar__shape {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--avatar-main);
  box-shadow: -0.62rem 0.3rem 0 -0.12rem rgba(56, 189, 248, 0.85);
  transform: translate(-34%, -55%);
}

.student-avatar--comet .student-avatar__shape::before,
.student-avatar--comet .student-avatar__shape::after {
  right: 0.72rem;
  width: 1.55rem;
  height: 0.28rem;
  border-radius: 999px;
  background: var(--avatar-accent);
}

.student-avatar--comet .student-avatar__shape::before {
  top: 0.16rem;
  transform: rotate(-16deg);
}

.student-avatar--comet .student-avatar__shape::after {
  top: 0.72rem;
  transform: rotate(12deg);
}

.student-avatar--pencil {
  --avatar-bg: #fff7ed;
  --avatar-main: #f97316;
  --avatar-accent: #1d4ed8;
}

.student-avatar--pencil .student-avatar__shape {
  width: 0.68rem;
  height: 2.18rem;
  border-radius: 0.22rem;
  background: linear-gradient(#fde68a 0 18%, var(--avatar-main) 18% 84%, #f8fafc 84%);
  transform: translate(-50%, -50%) rotate(42deg);
}

.student-avatar--pencil .student-avatar__shape::after {
  left: 0.12rem;
  bottom: -0.3rem;
  border-left: 0.22rem solid transparent;
  border-right: 0.22rem solid transparent;
  border-top: 0.38rem solid var(--avatar-ink);
}

.student-avatar--book {
  --avatar-bg: #e0f2fe;
  --avatar-main: #0ea5e9;
  --avatar-accent: #f43f5e;
}

.student-avatar--book .student-avatar__shape {
  width: 2.2rem;
  height: 1.62rem;
  border-radius: 0.22rem;
  background: linear-gradient(90deg, #fff 0 48%, #e0f2fe 48% 52%, #fff 52%);
  border: 0.14rem solid var(--avatar-main);
}

.student-avatar--book .student-avatar__shape::before {
  left: 50%;
  top: 0.12rem;
  width: 0.1rem;
  height: 1.16rem;
  background: var(--avatar-main);
  transform: translateX(-50%);
}

.student-avatar--compass {
  --avatar-bg: #f1f5f9;
  --avatar-main: #0f766e;
  --avatar-accent: #f43f5e;
}

.student-avatar--compass .student-avatar__shape {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 0.18rem solid var(--avatar-main);
}

.student-avatar--compass .student-avatar__shape::before {
  left: 50%;
  top: 0.22rem;
  border-left: 0.33rem solid transparent;
  border-right: 0.33rem solid transparent;
  border-bottom: 1.25rem solid var(--avatar-accent);
  transform: translateX(-50%) rotate(24deg);
}

.student-avatar--gem {
  --avatar-bg: #fce7f3;
  --avatar-main: #db2777;
  --avatar-accent: #f9a8d4;
}

.student-avatar--gem .student-avatar__shape {
  width: 1.7rem;
  height: 1.7rem;
  background: linear-gradient(145deg, var(--avatar-accent), var(--avatar-main));
  border: 0.14rem solid #9d174d;
  transform: translate(-50%, -48%) rotate(45deg);
}

.student-avatar--gem .student-avatar__shape::before {
  inset: 0.22rem auto auto 0.22rem;
  width: 0.72rem;
  height: 0.18rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.student-profile-row,
.student-summary-inline {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.student-profile-row > div,
.student-summary-inline > div {
  min-width: 0;
}

.student-profile-row h3,
.student-summary-inline h3,
.student-summary-inline p {
  margin-bottom: 0.25rem;
}

.avatar-picker,
.student-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.avatar-picker--compact {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.avatar-choice,
.student-choice-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.avatar-choice input,
.student-choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-choice__visual,
.student-choice__visual {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4.5rem;
  padding: 0.75rem;
  border: 2px solid rgba(15, 29, 47, 0.1);
  border-radius: 18px;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.avatar-choice__visual strong,
.student-choice__visual strong {
  display: block;
  color: var(--ink);
  line-height: 1.2;
}

.avatar-choice__visual small,
.student-choice__visual small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.avatar-choice input:checked + .avatar-choice__visual,
.student-choice-card input:checked + .student-choice__visual {
  border-color: var(--primary);
  background: rgba(26, 86, 168, 0.045);
  box-shadow: 0 0 0 4px rgba(26, 86, 168, 0.12);
}

.avatar-choice input:focus-visible + .avatar-choice__visual,
.student-choice-card input:focus-visible + .student-choice__visual {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 86, 168, 0.16);
}

.avatar-choice:hover .avatar-choice__visual,
.student-choice-card:hover .student-choice__visual {
  transform: translateY(-1px);
  border-color: rgba(26, 86, 168, 0.42);
}

.avatar-update-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(15, 29, 47, 0.08);
}

.student-choice-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  width: min(100%, 480px);
}

.student-choice__visual {
  min-height: 3.8rem;
  padding: 0.62rem 0.7rem;
}

@media (max-width: 640px) {
  .avatar-picker,
  .student-choice-grid,
  .student-choice-grid--compact {
    grid-template-columns: 1fr;
  }

  .student-profile-row,
  .student-summary-inline {
    align-items: flex-start;
  }
}
