/* =========================================================
   Page Layout
   ========================================================= */

.profile-page{
  width: 100vw;
  max-width: none !important;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* =========================================================
   top-links
   ========================================================= */

.profile-settings-wrapper,
.settings-top-links {
  position: relative;
  z-index: 2;
}

/* top links */
.settings-top-links {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .settings-top-links {
    top: 12px;
    left: 12px;
    gap: 8px;
  }

  .profile-settings-wrapper {
    margin-top: 62px;
  }
}


.top-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 14px;
  border-radius: 999px;

  font-size: 13px;
  font-weight: 900;
  text-decoration: none;

  background: var(--btn-surface);
  color: var(--text);
  border: 1px solid var(--btn-border);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  transition: background-color .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.top-link-btn:hover {
  background: var(--btn-surface-hover);
}

.top-link-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* =========================================================
   Theme Tokens
   ========================================================= */

body.theme-dark{
  --panel: rgba(15, 15, 15, .72);
  --panel-border: rgba(255,255,255,.10);
  --text: #fff;
  --muted: rgba(255,255,255,.80);

  --card: rgba(20,20,20,.72);
  --card-border: rgba(255,255,255,.08);

  --input-bg: rgba(255,255,255,.06);
  --input-border: rgba(255,255,255,.16);

  --btn-surface: rgba(0,0,0,.35);
  --btn-surface-hover: rgba(0,0,0,.50);
  --btn-border: rgba(255,255,255,.16);

  --modal-bg: #141414;
  --modal-border: rgba(255,255,255,.12);

  --profile-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_NIGHT.webp");
}

body.theme-light{
  --panel: rgba(255,255,255,.84);
  --panel-border: rgba(0,0,0,.12);
  --text: #111;
  --muted: rgba(0,0,0,.70);

  --card: rgba(255,255,255,.88);
  --card-border: rgba(0,0,0,.10);

  --input-bg: rgba(255,255,255,.92);
  --input-border: rgba(0,0,0,.16);

  --btn-surface: rgba(255,255,255,.78);
  --btn-surface-hover: rgba(255,255,255,.94);
  --btn-border: rgba(0,0,0,.14);

  --modal-bg: #ffffff;
  --modal-border: rgba(0,0,0,.12);

  --profile-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_LIGHT.webp");
}


/* =========================================================
   Background
   ========================================================= */

.profile-bg-wrap{
  min-height: 100vh;
  position: relative;
  padding: 14px 0 24px;
  background-color: #0b0b0b;
  background-image: var(--profile-bg-url, var(--profile-bg-fallback));
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

.profile-bg-wrap.bg-repeat{
  background-repeat: repeat-y;
  background-size: 100% auto;
  background-position: center center;
  background-attachment: scroll;
}

.profile-bg-wrap.bg-single{
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}


/* =========================================================
   Main Shell
   ========================================================= */

.profile-shell{
  position: relative;
  z-index: 1;
  width: min(980px, 94vw);
  margin: 0 auto;
}

.profile-panel{
  padding: 14px;
  border-radius: 18px;
  backdrop-filter: blur(6px);
  color: var(--text, #fff);
  background: var(--panel, rgba(15, 15, 15, .72));
  border: 1px solid var(--panel-border, rgba(255,255,255,.10));
}


/* =========================================================
   Header
   ========================================================= */

.profile-header{
  position: relative;
  overflow: hidden;
  min-height: 180px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: #111;
  border: 1px solid rgba(255,255,255,.10);
}

body.theme-light .profile-header{
  border-color: rgba(0,0,0,.12);
}

.profile-header img.bg{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.75);
}

.profile-header .overlay{
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,.10));
}

.profile-top{
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  color: #fff;
}

.profile-avatar{
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 16px;
  background: #222;
  border: 2px solid rgba(255,255,255,.15);
}

.profile-title{
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
}

.profile-sub{
  margin-top: 4px;
  font-size: .92rem;
  opacity: .85;
}

.profile-status{
  position: relative;
  z-index: 2;

  margin: -8px 16px 16px;
  max-width: 520px;

  font-size: .95rem;
  line-height: 1.4;

  color: rgba(255,255,255,.92);

  white-space: pre-line;
  word-break: break-word;
}

body.theme-light .profile-status{
  color: rgba(255,255,255,.92);
}

.profile-actions{
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}


/* =========================================================
   Buttons
   ========================================================= */

.btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: .92rem;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  color: var(--text, #fff);
  background: var(--btn-surface, rgba(0,0,0,.35));
  border: 1px solid var(--btn-border, rgba(255,255,255,.16));
  transition:
    background-color .22s ease,
    color .22s ease,
    border-color .22s ease,
    box-shadow .22s ease,
    transform .08s ease;
}

.btn:hover{
  background: var(--btn-surface-hover, rgba(0,0,0,.50));
}

.btn:active{
  transform: translateY(1px);
}

.btn:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.btn.danger{
  color: var(--text, #fff);
  border-color: rgba(255,80,80,.35);
}


/* =========================================================
   Toolbar / Search
   ========================================================= */

.profile-subbar{
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 12px;
}

.u-search{
  display: flex;
  align-items: center;
  gap: 8px;
}

.u-search input{
  width: min(320px, 70vw);
  padding: 8px 10px;
  border-radius: 12px;
  outline: none;
  color: var(--text, #111);
  background: var(--input-bg, #fff);
  border: 1px solid var(--input-border, rgba(0,0,0,.10));
  transition:
    background-color .22s ease,
    color .22s ease,
    border-color .22s ease,
    box-shadow .22s ease;
}

.u-search input:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}


/* =========================================================
   Universes Grid
   ========================================================= */

.universes-grid{
  display: grid;
  align-items: stretch;
  justify-content: start;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 220px));
}


/* =========================================================
   Universe Card
   ========================================================= */

.u-card{
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text, #fff);
  background: var(--card, #1b1b1b);
  border: 1px solid var(--card-border, rgba(255,255,255,.06));
  transition:
    background-color .22s ease,
    color .22s ease,
    border-color .22s ease,
    box-shadow .22s ease;
}

.u-card:hover{
  border-color: rgba(255,255,255,.18);
}

body.theme-light .u-card:hover{
  border-color: rgba(0,0,0,.20);
}

.u-card-img{
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #111;
}

.u-card-img img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.u-card-img img.fallback{
  opacity: .75;
}

.u-card-stats{
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  font-size: .85rem;
  color: #fff;
  border-radius: 10px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}

.u-card-stats-row{
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.u-card-stats-icon{
  font-size: .9rem;
  opacity: .9;
}

.u-card-body{
  padding: 10px 12px;
}

.u-title{
  font-weight: 700;
}


/* =========================================================
   Modal
   ========================================================= */

.modal-backdrop{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(0,0,0,.55);
}

.modal{
  width: min(720px, 100%);
  padding: 14px;
  border-radius: 16px;
  color: var(--text, #fff);
  background: var(--modal-bg, #141414);
  border: 1px solid var(--modal-border, rgba(255,255,255,.12));
}

#shareCopyStatus{
  transition: opacity .25s ease;
}


/* =========================================================
   Footer
   ========================================================= */

body.profile-page-active .footer{
  display: none !important;
}

.profile-footer{
  margin-top: 18px;
  padding: 14px 0 18px;
  text-align: center;
  font-size: 16px;
  opacity: .85;
  color: var(--text, #fff);
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 820px){
  .universes-grid{
    grid-template-columns: repeat(auto-fill, minmax(200px, 200px));
  }
}

@media (max-width: 760px){
  .profile-bg-wrap{
    padding: 10px 0 18px;
  }

  .profile-shell{
    width: min(720px, 96vw);
  }

  .profile-panel{
    padding: 12px;
    border-radius: 16px;
  }

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

@media (max-width: 560px){
  .universes-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}