.profile-page {
  min-height: 100svh;
  background:
    radial-gradient(circle at 82% 14%, rgba(28, 216, 104, .12), transparent 27rem),
    #05100b;
}

.profile-topbar {
  position: absolute;
  background: linear-gradient(180deg, rgba(3, 12, 8, .86), rgba(3, 12, 8, .18));
}

.profile-desktop-nav .is-current {
  color: var(--lime);
  opacity: 1;
}

.profile-main {
  min-height: 100svh;
}

.profile-intro {
  position: relative;
  min-height: 470px;
  padding: 148px max(5vw, calc((100% - var(--max)) / 2)) 90px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(3, 13, 8, .99) 0%, rgba(3, 13, 8, .92) 45%, rgba(3, 13, 8, .48) 78%),
    url("assets/raiens-hero.webp") 74% 32% / cover no-repeat;
}

.profile-intro::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(transparent, #05100b);
}

.profile-grid-bg {
  position: absolute;
  inset: 0;
  opacity: .13;
  background-image:
    linear-gradient(rgba(141, 255, 31, .18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 255, 31, .18) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(90deg, #000, transparent 76%);
}

.profile-orb {
  position: absolute;
  border: 1px solid rgba(141, 255, 31, .28);
  border-radius: 50%;
  box-shadow: 0 0 45px rgba(141, 255, 31, .07);
}

.profile-orb-one {
  top: 132px;
  right: 11%;
  width: 170px;
  height: 170px;
}

.profile-orb-two {
  right: 6%;
  bottom: 55px;
  width: 65px;
  height: 65px;
}

.profile-intro-copy {
  position: relative;
  z-index: 2;
  width: min(100%, 800px);
}

.profile-intro-copy .eyebrow {
  margin-bottom: 17px;
}

.profile-intro h1 {
  margin-bottom: 20px;
  font-size: clamp(72px, 9vw, 130px);
}

.profile-intro-copy > p:last-child {
  max-width: 630px;
  margin: 0;
  color: #bdcbc1;
  font-size: 17px;
  line-height: 1.65;
}

.profile-intro-number {
  position: absolute;
  z-index: 1;
  right: 6%;
  bottom: -40px;
  color: rgba(141, 255, 31, .07);
  font-size: clamp(200px, 24vw, 370px);
  font-weight: 950;
  font-style: italic;
  line-height: .8;
}

.profile-loading {
  width: min(92%, var(--max));
  min-height: 245px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: #a8b7ad;
}

.profile-loading > span {
  font-size: 42px;
  animation: profileSpin 1.1s linear infinite;
}

.profile-loading strong,
.profile-loading small {
  display: block;
}

.profile-loading strong {
  color: #eff8f1;
  font-size: 13px;
  letter-spacing: .12em;
}

.profile-loading small {
  margin-top: 7px;
  color: #718078;
}

.profile-guest,
.profile-not-found,
.profile-dashboard {
  width: min(92%, var(--max));
  margin: 0 auto;
}

.profile-guest[hidden],
.profile-not-found[hidden],
.profile-dashboard[hidden],
.profile-loading[hidden] {
  display: none;
}

.profile-guest,
.profile-not-found {
  min-height: 500px;
  padding: 90px 0 105px;
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  align-items: center;
  gap: clamp(55px, 9vw, 125px);
}

.guest-visual {
  position: relative;
  min-height: 330px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(141, 255, 31, .24);
  background:
    radial-gradient(circle at 50% 45%, rgba(141, 255, 31, .2), transparent 38%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(141, 255, 31, .045) 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(141, 255, 31, .045) 40px),
    #0a1d14;
  box-shadow: 18px 18px 0 #071810;
}

.guest-visual > span {
  width: 145px;
  height: 145px;
  display: grid;
  place-items: center;
  color: #07120b;
  background: var(--lime);
  clip-path: polygon(14% 0, 86% 0, 100% 14%, 100% 86%, 86% 100%, 14% 100%, 0 86%, 0 14%);
  font-size: 54px;
  font-weight: 950;
  letter-spacing: -.08em;
}

.guest-visual > i {
  position: absolute;
  right: 27px;
  bottom: 20px;
  color: rgba(255, 255, 255, .1);
  font-size: 100px;
  font-weight: 950;
  font-style: italic;
  line-height: 1;
}

.guest-copy > small,
.identity-panel > small,
.friend-code-card small,
.bests-heading small {
  color: var(--lime);
  font: 850 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
}

.guest-copy h2 {
  margin-bottom: 22px;
}

.guest-copy > p {
  max-width: 650px;
  color: #a4b2a8;
  font-size: 17px;
  line-height: 1.75;
}

.guest-actions {
  margin: 30px 0 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-button {
  min-height: 56px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .11em;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.profile-button:hover {
  transform: translateY(-3px);
}

.profile-button-primary {
  color: #061008;
  background: var(--lime);
  box-shadow: 6px 6px 0 rgba(141, 255, 31, .14);
}

.profile-button-ghost {
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .035);
}

.privacy-note {
  padding: 15px 17px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  border-left: 2px solid #42c6ff;
  color: #91a29a;
  background: rgba(66, 198, 255, .065);
}

.privacy-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.privacy-note strong {
  color: #d8e6dc;
}

.profile-dashboard {
  padding: 88px 0 105px;
}

.profile-shell {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 22px;
}

.identity-panel {
  position: relative;
  min-height: 590px;
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  border: 1px solid rgba(141, 255, 31, .25);
  background:
    radial-gradient(circle at 82% 20%, rgba(141, 255, 31, .17), transparent 28%),
    #0a1e15;
  box-shadow: 16px 16px 0 #07170f;
}

.identity-pattern {
  position: absolute;
  inset: 0;
  opacity: .07;
  background-image:
    linear-gradient(#8dff1f 1px, transparent 1px),
    linear-gradient(90deg, #8dff1f 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(135deg, transparent, #000 55%);
}

.profile-avatar {
  position: relative;
  width: 125px;
  height: 125px;
  display: grid;
  place-items: center;
  color: #06110a;
  background: var(--lime);
  clip-path: polygon(14% 0, 86% 0, 100% 14%, 100% 86%, 86% 100%, 14% 100%, 0 86%, 0 14%);
  box-shadow: inset 0 0 0 10px rgba(0, 0, 0, .08);
  font-size: 46px;
  font-weight: 950;
  letter-spacing: -.08em;
}

.profile-avatar-editor {
  position: relative;
  width: min(100%, 360px);
  margin-bottom: 23px;
}

.profile-avatar-actions {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-avatar-actions button {
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--lime);
  color: #06110a;
  background: var(--lime);
  font: 900 9px/1 ui-monospace, monospace;
  letter-spacing: .08em;
  cursor: pointer;
}

.profile-avatar-actions button.is-secondary {
  color: #d9e9dd;
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .04);
}

.profile-avatar-actions button:hover {
  filter: brightness(1.08);
}

.profile-avatar-actions button:disabled {
  cursor: wait;
  opacity: .55;
}

.profile-avatar-help,
.profile-avatar-status {
  position: relative;
  max-width: 330px;
  margin: 9px 0 0;
  color: #91a39a;
  font: 750 9px/1.45 ui-monospace, monospace;
  letter-spacing: .025em;
}

.profile-avatar-status {
  min-height: 1.45em;
  color: var(--lime);
}

.profile-avatar-status.is-error {
  color: #ff9aae;
}

.identity-panel .visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.online-pill {
  position: absolute;
  top: 43px;
  right: 42px;
  padding: 8px 11px;
  border: 1px solid rgba(141, 255, 31, .2);
  border-radius: 999px;
  color: #cce8d3;
  background: rgba(3, 15, 9, .55);
  font: 850 8px/1 ui-monospace, monospace;
  letter-spacing: .1em;
}

.online-pill i {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  display: inline-block;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
}

.identity-panel h2 {
  position: relative;
  max-width: 100%;
  margin: 10px 0 8px;
  overflow-wrap: anywhere;
  font-size: clamp(42px, 5vw, 69px);
}

.identity-panel > p {
  position: relative;
  margin: 0;
  color: #83958a;
  font: 850 10px/1.2 ui-monospace, monospace;
  letter-spacing: .13em;
}

.identity-stats {
  position: relative;
  width: 100%;
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(255, 255, 255, .11);
}

.identity-stats > div {
  min-width: 0;
  padding: 20px;
}

.identity-stats > div + div {
  border-left: 1px solid rgba(255, 255, 255, .11);
}

.identity-stats small,
.level-progress span {
  display: block;
  color: #77897e;
  font: 800 8px/1.2 ui-monospace, monospace;
  letter-spacing: .12em;
}

.identity-stats strong {
  display: block;
  margin-top: 7px;
  color: var(--lime);
  font-size: clamp(30px, 4vw, 46px);
  font-style: italic;
  line-height: 1;
}

.level-progress {
  position: relative;
  width: 100%;
  margin-top: 22px;
}

.level-progress > div:first-child {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.level-progress b {
  color: #c8d5cc;
  font: 850 9px/1 ui-monospace, monospace;
}

.level-track {
  height: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, .1);
}

.level-track i {
  width: 0;
  height: 100%;
  display: block;
  background: var(--lime);
  box-shadow: 0 0 14px rgba(141, 255, 31, .55);
  transition: width .6s ease;
}

.profile-side {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 22px;
}

.friend-code-card[hidden],
.public-profile-card[hidden],
.profile-avatar-actions[hidden],
.bests-heading > a[hidden],
.logout-button[hidden] {
  display: none;
}

.friend-code-card {
  padding: clamp(25px, 4vw, 38px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  border: 1px solid rgba(255, 255, 255, .12);
  background:
    linear-gradient(140deg, rgba(141, 255, 31, .11), transparent 56%),
    #0b1b14;
}

.friend-code-card strong {
  margin: 10px 0 12px;
  display: block;
  color: #f3fff5;
  font: 950 clamp(27px, 4vw, 43px)/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .1em;
}

.friend-code-card p {
  max-width: 560px;
  margin: 0;
  color: #829489;
  font-size: 12px;
  line-height: 1.55;
}

.friend-code-card button {
  min-height: 51px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid rgba(141, 255, 31, .4);
  color: var(--lime);
  background: rgba(141, 255, 31, .06);
  cursor: pointer;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .1em;
}

.friend-code-card button:hover {
  background: rgba(141, 255, 31, .13);
}

.friend-code-card button:disabled {
  opacity: .55;
  cursor: wait;
}

.copy-status {
  min-height: 16px;
  grid-column: 1 / -1;
  color: var(--lime) !important;
  font-weight: 750;
}

.public-profile-card {
  min-height: 280px;
  padding: clamp(25px, 4vw, 38px);
  display: grid;
  gap: 25px;
  border: 1px solid rgba(141, 255, 31, .24);
  background:
    radial-gradient(circle at 94% 4%, rgba(141, 255, 31, .16), transparent 42%),
    #0b1b14;
}

.public-profile-card > div:first-child > small {
  color: var(--lime);
  font: 850 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
}

.public-profile-card h3 {
  margin: 12px 0 13px;
  font-size: clamp(29px, 3.3vw, 43px);
  font-style: italic;
  line-height: .93;
}

.public-profile-card p {
  max-width: 610px;
  margin: 0;
  color: #829489;
  font-size: 12px;
  line-height: 1.6;
}

.public-profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(255, 255, 255, .11);
}

.public-profile-stats > span {
  min-width: 0;
  padding: 16px;
}

.public-profile-stats > span + span {
  border-left: 1px solid rgba(255, 255, 255, .11);
}

.public-profile-stats small,
.public-profile-stats strong {
  display: block;
}

.public-profile-stats small {
  color: #77897e;
  font: 800 8px/1.2 ui-monospace, monospace;
  letter-spacing: .12em;
}

.public-profile-stats strong {
  margin-top: 7px;
  color: var(--lime);
  font-size: 25px;
  font-style: italic;
}

.public-profile-card > a {
  min-height: 49px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(141, 255, 31, .35);
  color: var(--lime);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .1em;
}

.public-profile-card > a:hover {
  color: #061008;
  background: var(--lime);
}

.is-public-profile .profile-avatar-actions,
.is-public-profile .profile-avatar-help,
.is-public-profile .profile-avatar-status {
  display: none;
}

.is-public-profile .profile-avatar-editor {
  margin-bottom: 29px;
}

.is-public-profile .profile-intro h1 {
  font-size: clamp(56px, 7.6vw, 106px);
}

.is-public-profile .profile-account-footer {
  justify-content: flex-start;
}

.profile-shortcuts {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  border: 1px solid rgba(255, 255, 255, .12);
  background: #08170f;
}

.profile-shortcuts a {
  min-height: 105px;
  padding: 20px 25px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 17px;
  transition: color .2s ease, background .2s ease;
}

.profile-shortcuts a + a {
  border-top: 1px solid rgba(255, 255, 255, .1);
}

.profile-shortcuts a:hover {
  color: var(--lime);
  background: rgba(141, 255, 31, .05);
}

.shortcut-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #061008;
  background: var(--lime);
  font-size: 21px;
  transform: rotate(-3deg);
}

.profile-shortcuts small,
.profile-shortcuts strong {
  display: block;
}

.profile-shortcuts small {
  margin-bottom: 6px;
  color: #718278;
  font: 800 8px/1 ui-monospace, monospace;
  letter-spacing: .12em;
}

.profile-shortcuts strong {
  font-size: 12px;
  letter-spacing: .07em;
}

.profile-shortcuts a > b {
  font-size: 21px;
}

.personal-bests {
  margin-top: 95px;
}

.bests-heading {
  margin-bottom: 29px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 25px;
}

.bests-heading h2 {
  margin: 10px 0 0;
}

.bests-heading > a {
  margin-bottom: 10px;
  padding: 13px 16px;
  border: 1px solid rgba(141, 255, 31, .35);
  color: var(--lime);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .11em;
}

.best-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(255, 255, 255, .12);
  border-left: 1px solid rgba(255, 255, 255, .12);
}

.best-card {
  position: relative;
  min-height: 205px;
  padding: 23px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, .12);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  background: #091811;
  transition: transform .2s ease, background .2s ease;
}

.best-card:hover {
  z-index: 1;
  transform: translateY(-4px);
  background: #0b2016;
}

.best-card:nth-child(1) {
  background:
    linear-gradient(145deg, rgba(141, 255, 31, .11), transparent 65%),
    #0a1b13;
}

.best-card-icon {
  margin-bottom: 23px;
  font-size: 27px;
}

.best-card small {
  color: #82928a;
  font: 800 8px/1.3 ui-monospace, monospace;
  letter-spacing: .1em;
}

.best-card h3 {
  margin: 7px 0 22px;
  font-size: 17px;
  line-height: 1.05;
  letter-spacing: -.025em;
}

.best-score {
  margin-top: auto;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.best-score strong {
  color: var(--lime);
  font-size: 35px;
  font-style: italic;
  line-height: .9;
}

.best-score span {
  color: #718177;
  font: 800 8px/1.2 ui-monospace, monospace;
  letter-spacing: .08em;
  text-align: right;
}

.best-card.is-empty .best-score strong {
  color: #536159;
}

.profile-account-footer {
  margin-top: 38px;
  padding: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .022);
}

.profile-account-footer .privacy-note {
  max-width: 730px;
  padding-block: 10px;
}

.logout-button {
  min-height: 48px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid rgba(255, 112, 139, .35);
  color: #ff8da3;
  background: rgba(255, 112, 139, .045);
  cursor: pointer;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .1em;
}

.logout-button:hover {
  background: rgba(255, 112, 139, .1);
}

.logout-button:disabled {
  opacity: .5;
  cursor: wait;
}

.profile-error {
  margin: 14px 0 0;
  padding: 13px 15px;
  color: #ff9aae;
  border-left: 2px solid #f25572;
  background: rgba(242, 85, 114, .08);
  font-size: 12px;
  line-height: 1.5;
}

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

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

  .identity-panel {
    min-height: 520px;
  }

  .best-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .profile-desktop-nav {
    display: none !important;
  }

  .profile-intro {
    min-height: 430px;
    padding: 125px 5% 78px;
    background:
      linear-gradient(0deg, rgba(3, 13, 8, .99), rgba(3, 13, 8, .42)),
      url("assets/raiens-hero.webp") 68% 28% / cover no-repeat;
  }

  .profile-intro-copy > p:last-child {
    max-width: 92%;
    font-size: 15px;
  }

  .profile-guest,
  .profile-not-found {
    grid-template-columns: 1fr;
    gap: 55px;
  }

  .guest-visual {
    width: min(100%, 520px);
  }

  .friend-code-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .friend-code-card button {
    width: 100%;
    justify-content: space-between;
  }

  .copy-status {
    grid-column: auto;
  }

  .bests-heading {
    align-items: start;
    flex-direction: column;
  }

  .profile-account-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .logout-button {
    justify-content: space-between;
  }
}

@media (max-width: 600px) {
  .profile-topbar {
    height: 74px;
  }

  .profile-intro {
    min-height: 390px;
    padding: 104px 18px 65px;
  }

  .profile-intro h1 {
    font-size: clamp(65px, 21vw, 90px);
  }

  .is-public-profile .profile-intro h1 {
    font-size: clamp(43px, 14vw, 62px);
  }

  .profile-intro-copy .eyebrow {
    font-size: 9px;
  }

  .profile-loading,
  .profile-guest,
  .profile-not-found,
  .profile-dashboard {
    width: calc(100% - 36px);
  }

  .profile-loading {
    min-height: 210px;
  }

  .profile-guest,
  .profile-not-found {
    padding: 65px 0 80px;
  }

  .guest-visual {
    min-height: 275px;
    box-shadow: 9px 9px 0 #071810;
  }

  .guest-copy h2,
  .bests-heading h2 {
    font-size: 43px;
  }

  .guest-copy > p {
    font-size: 15px;
  }

  .guest-actions {
    display: grid;
  }

  .profile-button {
    width: 100%;
  }

  .profile-dashboard {
    padding: 58px 0 78px;
  }

  .identity-panel {
    min-height: 510px;
    padding: 25px;
    box-shadow: 9px 9px 0 #07170f;
  }

  .profile-avatar {
    width: 103px;
    height: 103px;
    font-size: 39px;
  }

  .profile-avatar-editor {
    width: calc(100% - 112px);
    min-width: 160px;
  }

  .profile-avatar-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-avatar-actions button {
    width: 100%;
  }

  .online-pill {
    top: 28px;
    right: 24px;
    font-size: 7px;
  }

  .identity-stats > div {
    padding: 17px 14px;
  }

  .identity-stats strong {
    font-size: 31px;
  }

  .level-progress > div:first-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .friend-code-card {
    padding: 24px 20px;
  }

  .friend-code-card strong {
    font-size: clamp(25px, 8vw, 36px);
  }

  .profile-shortcuts a {
    min-height: 94px;
    padding: 16px;
    grid-template-columns: 44px 1fr auto;
    gap: 13px;
  }

  .profile-shortcuts strong {
    font-size: 10px;
  }

  .personal-bests {
    margin-top: 70px;
  }

  .best-grid {
    grid-template-columns: 1fr;
  }

  .best-card {
    min-height: 170px;
  }

  .profile-account-footer {
    padding: 16px;
  }
}

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

  .level-track i {
    transition: none;
  }
}
