.profile-page {
  padding-bottom: 28px;
}

[hidden] {
  display: none !important;
}

.profile-hero {
  padding: 34px 0 12px;
}

.profile-shell {
  display: grid;
  gap: 18px;
}

.profile-cover {
  position: relative;
  min-height: 320px;
  border-radius: 32px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 106, 92, 0.35), rgba(243, 193, 75, 0.24)),
    linear-gradient(180deg, rgba(31, 23, 54, 0.98), rgba(9, 7, 15, 0.98));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  isolation: isolate;
}

.profile-cover-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 183, 3, 0.16), transparent 26%);
  pointer-events: none;
}

.profile-cover::before,
.profile-cover::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: inherit;
  pointer-events: none;
}

.profile-cover::before {
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 92, 92, 0.28), transparent 22%),
    radial-gradient(circle at 82% 16%, rgba(65, 180, 255, 0.26), transparent 18%),
    radial-gradient(circle at 72% 82%, rgba(255, 189, 70, 0.16), transparent 20%);
  filter: blur(12px);
  animation: coverGlow 9s ease-in-out infinite alternate;
  opacity: 0.95;
}

.profile-cover::after {
  inset: auto 8% 14px 8%;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 92, 92, 0.9), rgba(65, 180, 255, 0.85), rgba(255, 189, 70, 0.95), transparent);
  filter: blur(1px);
  animation: scanLine 4.5s linear infinite;
  opacity: 0.75;
}

.profile-energy {
  position: absolute;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
  mix-blend-mode: screen;
}

.profile-energy-fire {
  width: 240px;
  height: 240px;
  top: -40px;
  right: -48px;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 231, 147, 0.95), rgba(255, 137, 64, 0.55) 38%, rgba(255, 106, 92, 0.12) 68%, transparent 72%);
  filter: blur(12px);
  animation: fireFloat 6s ease-in-out infinite;
}

.profile-energy-water {
  width: 290px;
  height: 290px;
  left: -84px;
  bottom: -82px;
  background:
    radial-gradient(circle at 45% 45%, rgba(135, 214, 255, 0.92), rgba(71, 147, 255, 0.45) 40%, rgba(30, 79, 198, 0.12) 70%, transparent 74%);
  filter: blur(14px);
  animation: waterFloat 8s ease-in-out infinite reverse;
}

.profile-energy-spark {
  width: 150px;
  height: 150px;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.15) 34%, transparent 68%);
  filter: blur(2px);
  animation: sparkPulse 2.8s ease-in-out infinite;
}

.profile-summary {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 104px;
  height: 104px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  font-weight: 900;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.06),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(255, 82, 82, 0.28),
    0 0 52px rgba(65, 180, 255, 0.18);
}

.profile-avatar::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, #ff5c5c, #ffcf5a, #56d0ff, #ff5c5c);
  animation: ringSpin 4.5s linear infinite;
  z-index: -2;
}

.profile-avatar::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.3), transparent 28%),
    radial-gradient(circle at 70% 30%, rgba(255, 196, 102, 0.18), transparent 35%),
    linear-gradient(145deg, rgba(11, 9, 18, 0.1), rgba(11, 9, 18, 0.28));
  border: 1px solid rgba(255, 255, 255, 0.09);
  z-index: -1;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

.profile-avatar.frame-fire,
.profile-post.frame-fire {
  box-shadow:
    0 0 0 2px rgba(255, 92, 92, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(255, 92, 92, 0.28);
}

.profile-avatar.frame-water,
.profile-post.frame-water {
  box-shadow:
    0 0 0 2px rgba(86, 208, 255, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(86, 208, 255, 0.24);
}

.profile-avatar.frame-sunset,
.profile-post.frame-sunset {
  box-shadow:
    0 0 0 2px rgba(255, 207, 90, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(255, 207, 90, 0.26);
}

.profile-avatar.frame-royal,
.profile-post.frame-royal {
  box-shadow:
    0 0 0 2px rgba(160, 120, 255, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(160, 120, 255, 0.24);
}

.profile-avatar.frame-neon,
.profile-post.frame-neon {
  box-shadow:
    0 0 0 2px rgba(93, 255, 194, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(93, 255, 194, 0.24);
}

.profile-avatar.frame-ice,
.profile-post.frame-ice {
  box-shadow:
    0 0 0 2px rgba(190, 240, 255, 0.18),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(190, 240, 255, 0.26);
}

.profile-avatar.frame-snake,
.profile-post.frame-snake {
  box-shadow:
    0 0 0 2px rgba(93, 214, 122, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(93, 214, 122, 0.26);
}

.profile-avatar.frame-lions,
.profile-post.frame-lions {
  box-shadow:
    0 0 0 2px rgba(255, 193, 75, 0.18),
    0 18px 34px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(255, 193, 75, 0.28);
}

.profile-cover h1 {
  margin: 10px 0 6px;
  color: #fff;
}

.profile-handle {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
}

.profile-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-follow-btn.active {
  background: rgba(255, 106, 92, 0.18);
  color: var(--accent);
}

.profile-follow-btn.is-hidden {
  display: none !important;
}

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

.profile-stat {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.profile-stat strong {
  display: block;
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.profile-stat span {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 18px;
}

.profile-edit-card {
  grid-column: 1 / -1;
}

.profile-card {
  padding: 20px;
  border-radius: 26px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.profile-details {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.detail-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-row strong {
  text-align: left;
}

.profile-posts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.profile-post {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.profile-post-link {
  display: block;
  color: inherit;
}

.profile-post video {
  width: 100%;
  aspect-ratio: 9 / 12;
  object-fit: cover;
  display: block;
  background: #000;
}

.profile-post-body {
  padding: 14px;
}

.profile-post-body h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.profile-post-body p {
  margin: 0;
  font-size: 0.9rem;
}

.profile-post-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.profile-edit-form {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.profile-edit-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.profile-frame-picker {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.profile-frame-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-frame-head strong {
  display: block;
  margin-bottom: 4px;
}

.profile-frame-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.profile-frame-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-frame-option {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.profile-frame-option::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 14px currentColor;
}

.profile-frame-option.active {
  background: rgba(255, 106, 92, 0.14);
  border-color: rgba(255, 106, 92, 0.28);
}

.profile-avatar-edit {
  width: 92px;
  height: 92px;
}

.profile-edit-note strong {
  display: block;
  margin-bottom: 6px;
}

.profile-edit-note p {
  margin: 0 0 10px;
  color: var(--muted);
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-edit-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.profile-edit-grid label.full {
  grid-column: 1 / -1;
}

.profile-edit-grid input,
.profile-edit-note input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 14px 15px;
  outline: none;
}

.profile-edit-note input {
  padding: 12px;
}

.profile-edit-actions {
  display: flex;
  justify-content: flex-end;
}

@keyframes ringSpin {
  to { transform: rotate(360deg); }
}

@keyframes coverGlow {
  from { transform: scale(1); opacity: 0.72; }
  to { transform: scale(1.06); opacity: 1; }
}

@keyframes fireFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-8px, 10px, 0) scale(1.06); }
}

@keyframes waterFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(10px, -8px, 0) scale(1.04); }
}

@keyframes sparkPulse {
  0%, 100% { transform: translateX(-50%) scale(0.9); opacity: 0.45; }
  50% { transform: translateX(-50%) scale(1.2); opacity: 0.95; }
}

@keyframes scanLine {
  0% { transform: translateX(-16%); opacity: 0; }
  12% { opacity: 0.78; }
  50% { opacity: 0.95; }
  88% { opacity: 0.78; }
  100% { transform: translateX(16%); opacity: 0; }
}

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