*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --pf-primary: #3390ec;
  --pf-primary-dark: #2481cc;
  --pf-text: #0f1419;
  --pf-muted: #6b7280;
  --pf-card: #ffffff;
  --pf-radius: 18px;
  --pf-font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

body.profile-page {
  font-family: var(--pf-font);
  color: var(--pf-text);
  background: #e8f0ea url("/images/tg-pattern.svg") center top repeat;
  background-size: 420px;
}

.profile-shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 14px 32px;
}

.profile-top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: max(10px, env(safe-area-inset-top)) 0 8px;
  background: linear-gradient(180deg, rgba(232, 240, 234, 0.98), rgba(232, 240, 234, 0));
  backdrop-filter: blur(6px);
}

.profile-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--pf-primary-dark);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(36, 129, 204, 0.15);
  box-shadow: 0 4px 16px rgba(15, 30, 60, 0.08);
}

.profile-hero {
  position: relative;
  margin-top: 4px;
  padding: 28px 20px 22px;
  border-radius: calc(var(--pf-radius) + 4px);
  text-align: center;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(145deg, #3b9aed 0%, #2481cc 45%, #1a6fb0 100%);
  box-shadow: 0 16px 40px rgba(36, 129, 204, 0.35);
}

.profile-hero__glow {
  position: absolute;
  inset: -40% -20% auto;
  height: 120%;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35), transparent 55%);
  pointer-events: none;
}

.profile-avatar {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: #2481cc;
  background: linear-gradient(180deg, #fff, #eef6ff);
  box-shadow: 0 8px 24px rgba(15, 30, 60, 0.2);
  animation: profile-avatar-pulse 3s ease-in-out infinite;
}

.profile-avatar__letter {
  line-height: 1;
}

@keyframes profile-avatar-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.profile-name {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.profile-sub {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  font-size: 15px;
  opacity: 0.92;
}

.profile-rating {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #b45309;
  letter-spacing: 0.02em;
}

.profile-meta {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  font-size: 13px;
  opacity: 0.85;
}

.profile-hero__actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.profile-btn:active {
  transform: scale(0.98);
}

.profile-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #45a049, #2e8b57);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.profile-btn--ghost {
  color: var(--pf-primary-dark);
  background: rgba(255, 255, 255, 0.95);
}

.profile-btn--block {
  width: 100%;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.profile-stat {
  padding: 14px 10px;
  text-align: center;
  background: var(--pf-card);
  border-radius: var(--pf-radius);
  box-shadow: 0 6px 20px rgba(15, 30, 60, 0.08);
}

.profile-stat__val {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--pf-primary-dark);
  font-variant-numeric: tabular-nums;
}

.profile-stat__label {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--pf-muted);
  line-height: 1.25;
}

.profile-card {
  margin-top: 14px;
  padding: 18px 16px 16px;
  background: var(--pf-card);
  border-radius: var(--pf-radius);
  box-shadow: 0 8px 28px rgba(15, 30, 60, 0.08);
}

.profile-card--muted {
  background: rgba(255, 255, 255, 0.92);
}

.profile-card__head {
  margin-bottom: 12px;
}

.profile-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-card__lead {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--pf-muted);
  line-height: 1.4;
}

.profile-reviews {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-review {
  padding: 12px 12px 11px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #f3f8fc);
  border: 1px solid rgba(51, 144, 236, 0.12);
}

.profile-review__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.profile-review__author {
  font-size: 14px;
  font-weight: 700;
  color: var(--pf-text);
}

.profile-review__date {
  font-size: 11px;
  color: var(--pf-muted);
  white-space: nowrap;
}

.profile-review__stars {
  color: #f5a623;
  font-size: 13px;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.profile-review__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #374151;
}

.profile-review-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-stars__label,
.profile-field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pf-muted);
}

.profile-stars__row {
  display: inline-flex;
  gap: 4px;
}

.profile-stars__btn {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: #d1d5db;
  cursor: pointer;
  padding: 0 2px;
}

.profile-stars__btn.is-on {
  color: #f5a623;
}

.profile-field__input {
  width: 100%;
  border: 1px solid rgba(15, 20, 25, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  font: 15px/1.4 var(--pf-font);
  resize: vertical;
  min-height: 96px;
}

.profile-field__input:focus {
  outline: 2px solid rgba(51, 144, 236, 0.35);
  border-color: rgba(51, 144, 236, 0.45);
}

.profile-form-error {
  margin: 0;
  font-size: 13px;
  color: #b91c1c;
}

.profile-form-ok {
  margin: 0;
  font-size: 13px;
  color: #15803d;
  font-weight: 600;
}

.profile-about {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #4b5563;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.profile-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--pf-primary-dark);
  text-decoration: none;
}

.profile-empty {
  margin: 0;
  padding: 12px 0;
  text-align: center;
  color: var(--pf-muted);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .profile-avatar {
    animation: none;
  }
}

@media (max-width: 400px) {
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .profile-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 12px 14px;
  }

  .profile-stat__label {
    margin: 0;
    font-size: 13px;
  }
}
