/* ——— Финал 2x2 ——— */
.final-layout {
  margin: 0;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.final-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "redo hero"
    "fb parents";
  gap: 12px 16px;
  align-items: stretch;
}
.final-card {
  background: #FFFFFF;
  border: 1px solid #D5E0F0;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.final-card p { margin: 0; line-height: 1.42; color: #334155; }
.final-redo { grid-area: redo; justify-content: center; align-items: center; text-align: center; position: relative; overflow: hidden; }
.final-hero { grid-area: hero; text-align: center; align-items: center; justify-content: center; gap: 14px; }
.final-fb { grid-area: fb; justify-content: center; }
.final-parents { grid-area: parents; justify-content: space-between; }
.final-congrats {
  font-size: 1.5rem;
  font-weight: 800;
  color: #173B7B;
  line-height: 1.25;
  z-index: 1;
}
.final-lesson-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1564D9;
  line-height: 1.28;
}
.final-lesson-title:empty { display: none; }
.final-salute-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.final-salute {
  width: min(78%, 240px);
  max-height: 180px;
  object-fit: contain;
  margin: 0;
  z-index: 0;
  pointer-events: none;
}
.final-salute.hidden { display: none; }
.final-mascot.splash-wrap {
  width: 100%;
  max-width: 420px;
  min-height: 220px;
  max-height: min(48vh, 380px);
  margin: 0 auto;
  flex: 1 1 auto;
}
.final-win {
  font-weight: 800;
  color: #173B7B;
  font-size: 1.45rem;
  line-height: 1.3;
}
.final-points-big {
  font-size: 1.45rem;
  font-weight: 800;
  color: #1564D9 !important;
  margin: 0 !important;
}
.final-fb-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.final-fb-row p { font-size: 0.95rem; color: #334155; }
#feedback-btns button,
.final-fb-row button {
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--border);
  margin: 0;
}
#feedback-btns button:hover,
.final-fb-row button:hover { border-color: var(--accent); background: #f8fafc; }
#feedback-btns button.is-on,
.final-fb-row button.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.final-tasks-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: #EFF6FF;
  border: 1.5px solid #93C5FD;
  font-weight: 800;
  color: #1564D9;
  text-decoration: none;
  margin-top: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.final-tasks-link::before {
  content: '📄';
  font-size: 1rem;
  line-height: 1;
}
.final-tasks-link:hover {
  background: #DBEAFE;
  border-color: #1564D9;
  color: #104FAE;
}
.final-tasks-link.hidden { display: none; }
.final-parents .organizers-map > img { border-radius: 8px; }
.final-parents .final-parents-text { font-size: 0.92rem; color: #334155; }
.final-parents button { width: 100%; margin: 0; }
@media (max-width: 720px) {
  .final-layout { max-height: none; }
  .final-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "redo"
      "fb"
      "parents";
  }
  .final-mascot.splash-wrap { max-height: 260px; min-height: 180px; }
  .final-congrats, .final-win, .final-points-big { font-size: 1.25rem; }
}

/* —— Личный кабинет —— */
#screen-student-cabinet .cabinet-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 12px;
  max-width: 760px;
}
@media (min-width: 980px) {
  .page:not(.has-vk-embedded) #screen-student-cabinet .cabinet-layout {
    display: grid;
    grid-template-columns: minmax(400px, 1.05fr) minmax(380px, 0.95fr);
    gap: 20px;
    max-width: 1280px;
    align-items: start;
  }
}
#screen-student-cabinet .cabinet-panel {
  background: #FFFFFF;
  border: 1px solid #D5E0F0;
  border-radius: 16px;
  padding: 18px 20px 20px;
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
#screen-student-cabinet .cabinet-panel h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #173B7B;
}
.cabinet-avatar-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #EFF6FF 0%, #F8FAFC 100%);
  border: 1.5px solid #BFDBFE;
  flex-wrap: wrap;
}
.cabinet-avatar-badge {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #93C5FD;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(21, 100, 217, 0.08);
}
.cabinet-avatar-badge.is-initials {
  font-size: 1rem;
  font-weight: 800;
  color: #1D4ED8;
  background: #DBEAFE;
}
.cabinet-avatar-info {
  flex: 1 1 200px;
  min-width: 0;
}
.cabinet-avatar-title {
  font-weight: 800;
  font-size: 0.96rem;
  color: #173B7B;
  margin-bottom: 2px;
}

.cabinet-password-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #F8FAFD;
  border: 1px solid #DCE6F5;
}
.cabinet-password-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  color: #173B7B;
  font-size: 0.94rem;
}
.cabinet-pass-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  background: #E2E8F0;
  color: #475569;
}
.cabinet-pass-status.is-on {
  background: #DCFCE7;
  color: #15803D;
}
.cab-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
#screen-student-cabinet .cab-pass-wrap input {
  padding-right: 88px;
}
.cab-pass-eye {
  position: absolute;
  right: 7px;
  width: auto !important;
  height: 30px;
  margin: 0 !important;
  padding: 0 10px !important;
  border-radius: 8px;
  border: 1px solid #D8E4F5;
  background: #FFFFFF;
  color: #36568A;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}
.cab-pass-eye:hover {
  background: #EFF6FF;
  color: #1564D9;
}
#screen-student-cabinet input::-ms-reveal,
#screen-student-cabinet input::-ms-clear {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
#screen-student-cabinet input::-webkit-reveal,
#screen-student-cabinet input::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
}
.cabinet-remove-pass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #B91C1C;
  cursor: pointer;
}
.cabinet-remove-pass input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #DC2626;
}

/* —— Модалка выбора зверюшки-аватарки —— */
.avatar-dlg {
  max-width: 560px !important;
  width: min(560px, calc(100vw - 24px)) !important;
}
.avatar-dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.avatar-dlg-head h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #173B7B;
}
.avatar-dlg-explain {
  padding: 10px 13px;
  border-radius: 12px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E3A8A;
  font-size: 0.88rem;
  line-height: 1.42;
  margin-bottom: 12px;
}
.avatar-dlg-namesake-note {
  margin-top: 6px;
  font-weight: 700;
  color: #B45309;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  max-height: min(54vh, 360px);
  overflow-y: auto;
  padding: 2px;
}
@media (max-width: 560px) {
  .avatar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.avatar-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100% !important;
  margin: 0 !important;
  padding: 8px 4px !important;
  border-radius: 12px;
  border: 2px solid #E2E8F0;
  background: #FFFFFF;
  color: #173B7B;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.avatar-tile:hover:not(:disabled) {
  border-color: #1564D9;
  background: #EFF6FF;
  transform: translateY(-2px);
}
.avatar-tile.is-current {
  border-color: #16A34A;
  background: #F0FDF4;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.16);
}
.avatar-tile.is-taken,
.avatar-tile:disabled {
  opacity: 0.45;
  background: #F1F5F9;
  border-color: #CBD5E1;
  cursor: not-allowed;
  transform: none;
}
.avatar-tile-emoji {
  font-size: 1.85rem;
  line-height: 1.1;
}
.avatar-tile-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.avatar-tile.is-taken .avatar-tile-label {
  color: #B91C1C;
}
#screen-student-cabinet .cabinet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
#screen-student-cabinet .cabinet-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
#screen-student-cabinet .cabinet-field--wide {
  grid-column: 1 / -1;
}
#screen-student-cabinet .cabinet-field label {
  font-size: 0.8rem;
  color: #46618B;
  margin: 0;
}
#screen-student-cabinet .cabinet-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid #c5d0e0;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  color: #173B7B;
  background: #F8FAFD;
}
#screen-student-cabinet .cabinet-field input:focus {
  outline: none;
  border-color: #1564D9;
  background: #fff;
}
#screen-student-cabinet .cabinet-consent {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px 12px;
  align-items: start;
  margin: 16px 0 14px;
  padding: 12px 14px;
  background: #F5F8FD;
  border: 1px solid #E0E7F2;
  border-radius: 10px;
}
#screen-student-cabinet .cabinet-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: #1564D9;
}
#screen-student-cabinet .cabinet-consent-text {
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #243E66;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#screen-student-cabinet .cabinet-consent-text a {
  color: #1564D9;
  font-weight: 600;
  text-decoration: underline;
}
#screen-student-cabinet #cab-save-btn {
  width: auto;
  min-width: 140px;
  margin: 0;
  padding: 10px 22px;
}
.auth-optional { color: #526580; font-weight: 500; }
@media (max-width: 560px) {
  #screen-student-cabinet .cabinet-grid { grid-template-columns: 1fr; }
  #screen-student-cabinet .cabinet-layout { max-width: none; }
}
