
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #080808;
  --panel: #111111;
  --line: #303030;
  --white: #ffffff;
  --gray: #969696;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0;
}

body {
  background: var(--bg);
  color: var(--white);
  font-family: 'Montserrat', sans-serif;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid white;
  outline-offset: 3px;
}

/* HEADER */

.header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  background: #050505;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 53px;
  height: 53px;
  object-fit: contain;
}

.brand span {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1.5px;
}

.navigation {
  display: flex;
  gap: 25px;
  align-items: center;
}

.navigation a {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  white-space: nowrap;
  transition: color .2s;
}

.navigation a:hover {
  color: #999;
}

.navigation .active {
  border-bottom: 1px solid white;
  padding-bottom: 8px;
}

/* PORTADA */

.profile-page {
  max-width: 1600px;
  margin: auto;
}

.cover {
  width: 100%;
  height: 350px;
  position: relative;
  overflow: hidden;
  background: #171717;
}

.cover > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.cover-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,.1),
    rgba(0,0,0,.15) 45%,
    rgba(0,0,0,.75)
  );
}

.cover-code {
  position: absolute;
  left: 5%;
  top: 30px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-shadow: 0 2px 6px black;
}

.cover-edit {
  position: absolute;
  right: 5%;
  bottom: 25px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  background: rgba(0,0,0,.8);
  border: 1px solid #888;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: .2s;
}

.cover-edit:hover {
  background: white;
  color: black;
}

.profile-container {
  padding: 0 5% 90px;
}

/* IDENTIDAD */

.identity-section {
  position: relative;
  padding-bottom: 35px;
  border-bottom: 1px solid var(--line);
}

.identity-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: -65px;
  position: relative;
  z-index: 2;
}

.avatar-frame {
  position: relative;
  width: 160px;
  height: 160px;
  padding: 5px;
  background: #080808;
  border: 2px solid #fff;
}

.avatar-frame > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #111;
}

.avatar-edit {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 35px;
  height: 35px;
  background: white;
  color: black;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 25px;
}

.avatar-edit:hover {
  background: #ccc;
}

.outline-button {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 20px;
  background: #111;
  border: 1px solid #777;
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: .2s;
}

.outline-button:hover {
  background: white;
  color: black;
}

.outline-button span {
  font-size: 17px;
}

.identity-info {
  padding-top: 22px;
}

.name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.name-line h1 {
  font-size: clamp(28px, 3.2vw, 46px);
  font-weight: 900;
  letter-spacing: -1px;
  overflow-wrap: anywhere;
}

.rank-badge {
  padding: 9px 12px;
  background: white;
  color: black;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}

.real-name {
  color: #aaa;
  font-size: 15px;
  font-weight: 600;
  margin-top: 12px;
}

.biography {
  color: #ccc;
  font-size: 13px;
  line-height: 1.9;
  max-width: 850px;
  margin-top: 23px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 25px;
  margin-top: 28px;
  color: #777;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* ESTADÍSTICAS */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin: 35px 0;
}

.stat {
  padding: 26px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.stat:last-child {
  border-right: 0;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1px;
}

.stat strong {
  font-size: 34px;
  font-weight: 900;
}

/* COLUMNAS */

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  align-items: start;
}

.right-panels {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 26px;
  border-bottom: 1px solid var(--line);
}

.section-code {
  color: #777;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
}

.panel-heading h2 {
  font-size: clamp(14px, 1.5vw, 21px);
  font-weight: 900;
  margin-top: 12px;
  letter-spacing: .3px;
}

.small-edit {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  color: #aaa;
  font-size: 10px;
  font-weight: 700;
}

.small-edit:hover {
  color: white;
}

/* LISTAS */

.activity-list {
  padding: 0 26px;
}

.activity-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 24px 0;
  border-bottom: 1px solid #282828;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-number {
  color: #666;
  font-size: 11px;
  font-weight: 700;
}

.activity-name {
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.activity-detail {
  font-size: 10px;
  font-weight: 700;
  color: #999;
  text-align: right;
  white-space: nowrap;
}

.empty-state {
  padding: 25px 0;
  color: #777;
  font-size: 12px;
}

/* VENTANAS DE EDICIÓN */

.edit-dialog {
  width: min(92vw, 560px);
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
  border: 1px solid #555;
  padding: 0;
  color: white;
  background: #101010;
}

.edit-dialog::backdrop {
  background: rgba(0,0,0,.84);
  backdrop-filter: blur(5px);
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 32px;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 12px;
}

.dialog-heading h2 {
  font-size: 25px;
  margin-top: 12px;
  font-weight: 900;
}

.close-btn {
  border: 0;
  color: white;
  background: transparent;
  font-size: 32px;
}

.edit-form > label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ccc;
  margin-top: 8px;
}

.edit-form input,
.edit-form textarea,
.edit-form select {
  width: 100%;
  padding: 15px;
  border: 1px solid #383838;
  background: #1a1a1a;
  color: white;
  font-size: 13px;
  outline: none;
}

.edit-form input:focus,
.edit-form textarea:focus,
.edit-form select:focus {
  border-color: white;
}

.edit-form textarea {
  resize: vertical;
  line-height: 1.7;
}

.word-counter {
  text-align: right;
  color: #999;
  font-size: 10px;
}

.word-counter.limit-reached,
.form-error {
  color: #ff8585;
}

.form-error {
  font-size: 11px;
  line-height: 1.7;
}

.form-error:empty {
  display: none;
}

.editor-help {
  color: #aaa;
  font-size: 12px;
  line-height: 1.8;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 15px;
}

.cancel-btn,
.save-btn {
  padding: 16px 19px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .7px;
  border: 1px solid white;
}

.cancel-btn {
  color: white;
  background: transparent;
}

.save-btn {
  color: black;
  background: white;
}

.cancel-btn:hover {
  background: #252525;
}

.save-btn:hover {
  background: #ccc;
}

/* FOOTER */

footer {
  display: flex;
  justify-content: space-between;
  padding: 30px 5%;
  border-top: 1px solid #303030;
  color: #777;
  font-size: 10px;
  letter-spacing: 2px;
}

/* ADAPTACIÓN */

@media (max-width: 1100px) {
  .navigation {
    gap: 13px;
  }

  .navigation a {
    font-size: 9px;
  }

  .brand span {
    font-size: 13px;
  }
}

@media (max-width: 850px) {
  .header {
    height: auto;
    min-height: 75px;
    padding: 15px 5%;
    flex-wrap: wrap;
    gap: 15px;
  }

  .navigation {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .cover {
    height: 260px;
  }

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

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat:nth-child(2) {
    border-right: 0;
  }

  .stat:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .cover {
    height: 200px;
  }

  .cover-code {
    font-size: 8px;
  }

  .cover-edit {
    bottom: 12px;
    right: 4%;
    padding: 10px;
    font-size: 8px;
  }

  .profile-container {
    padding-left: 4%;
    padding-right: 4%;
  }

  .identity-top {
    margin-top: -45px;
  }

  .avatar-frame {
    width: 110px;
    height: 110px;
  }

  .outline-button {
    padding: 12px;
    font-size: 9px;
  }

  .name-line h1 {
    font-size: 27px;
  }

  .stat {
    padding: 20px 15px;
  }

  .stat strong {
    font-size: 26px;
  }

  .panel-heading,
  .activity-list {
    padding-left: 18px;
    padding-right: 18px;
  }

  .activity-item {
    grid-template-columns: 25px minmax(0,1fr);
  }

  .activity-detail {
    grid-column: 2;
    text-align: left;
  }

  .edit-form {
    padding: 22px;
  }

  footer {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
}

/* Discord y avatar */
.discord-banner{display:flex;gap:16px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding:16px 20px;margin:18px 0;border:1px solid #333;background:#0e0e0e}
.discord-banner[hidden]{display:none}
.discord-banner.warn{border-color:#5865f2}
.discord-banner.ok{border-color:#2f8f5b}
.discord-banner strong{display:block;margin-bottom:4px}
.discord-banner span{color:#aaa;font-size:14px}
.discord-banner .discord-gate-btn{padding:10px 18px;background:#5865f2;color:#fff;text-decoration:none;font-weight:700;letter-spacing:.08em;font-size:13px}
.source-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:6px 0 14px}
.source-tabs button{flex:1;padding:10px;background:#111;color:#aaa;border:1px solid #333;cursor:pointer;font:inherit;font-size:12px;letter-spacing:.06em}
.source-tabs button.active{color:#fff;border-color:#fff}
.source-pane{min-height:120px}
.source-preview{width:96px;height:96px;border-radius:50%;object-fit:cover;display:block;margin:8px auto}
.avatar-pick-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:10px;max-height:260px;overflow:auto}
.avatar-pick{padding:0;border:2px solid #333;background:#000;cursor:pointer;aspect-ratio:1}
.avatar-pick img{width:100%;height:100%;object-fit:cover;display:block}
.avatar-pick.selected{border-color:#fff}
.cover-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr))}
.cover-grid .avatar-pick{aspect-ratio:16/9}
.record-note{color:#777;font-size:12px;margin:18px 0}
dialog [hidden]{display:none!important}

/* Compacto */
.header{height:64px}
.brand img{width:40px;height:40px}
.cover{height:220px}
.cover-code{top:18px}
.cover-edit{bottom:14px;padding:9px 14px}
.profile-container{padding:0 5% 50px;max-width:1200px;margin:0 auto}
.identity-section{padding-bottom:20px}
.identity-top{margin-top:-48px;align-items:flex-end;gap:12px}
.avatar-frame{width:112px;height:112px;padding:4px;flex-shrink:0}
.avatar-edit{width:28px;height:28px;font-size:20px;bottom:4px;right:4px}
.outline-button{padding:10px 16px;gap:8px}
.identity-info{padding-top:14px}
.name-line{gap:12px}
.name-line h1{font-size:clamp(22px,2.6vw,32px);letter-spacing:-.5px}
.rank-badge{padding:6px 10px}
.real-name{font-size:13px;margin-top:6px}
.biography{font-size:13px;line-height:1.6;margin-top:12px;max-width:760px}
.profile-meta{margin-top:14px;gap:18px}
.stats-row{margin:20px 0}
.stat{padding:16px 20px;gap:6px}
.stat strong{font-size:24px}
.profile-grid{gap:16px}
.right-panels{gap:16px}
.panel-heading{padding:14px 18px}
.panel-heading h2{margin-top:6px;font-size:15px}
.activity-list{padding:0 18px}
.activity-item{padding:12px 0;gap:10px}
.activity-name{line-height:1.4}
.empty-state{padding:16px 0}

/* ===== Perfil / estilo cómic ===== */
:root{--bg:#120818;--panel:#1b1025;--line:#63317c;--white:#fff4ff;--gray:#c3a6d0}
body{
  background:
    radial-gradient(circle at 12% 18%,rgba(208,92,255,.18) 0 2px,transparent 3px),
    radial-gradient(circle at 82% 72%,rgba(208,92,255,.14) 0 2px,transparent 3px),
    #120818;
  background-size:24px 24px,32px 32px,auto;
}
.header{background:#08040c;border-bottom:3px solid #d05cff;box-shadow:0 5px 0 #000}
.navigation a:hover{color:#e0a0ff}
.navigation .active{border-color:#d05cff}
.profile-page{padding-bottom:30px}
.cover{border:4px solid #000;box-shadow:8px 8px 0 #000;transform:rotate(-.3deg)}
.cover::after{position:absolute;inset:12px;content:"";pointer-events:none;border:2px solid rgba(208,92,255,.75);transform:rotate(.8deg)}
.cover-shade{background:linear-gradient(to bottom,rgba(18,8,24,.08),rgba(18,8,24,.3) 45%,rgba(18,8,24,.88))}
.cover-code{color:#f0caff;text-shadow:3px 3px 0 #000}
.cover-edit,.outline-button,.avatar-edit{background:#d05cff;border:3px solid #000;color:#180b27;box-shadow:3px 3px 0 #000}
.cover-edit:hover,.outline-button:hover,.avatar-edit:hover{background:#f0a2ff;color:#180b27}
.identity-section{padding:0 22px 35px;background:#1b1025;border:3px solid #000;border-top:0;box-shadow:6px 6px 0 #000}
.avatar-frame{border:4px solid #000;background:#d05cff;box-shadow:4px 4px 0 #000;transform:rotate(-2deg)}
.avatar-frame>img{border:2px solid #000}
.name-line h1,.panel-heading h2{color:#fff4ff;text-shadow:2px 2px 0 #7220a8}
.rank-badge{background:#d05cff;border:2px solid #000;box-shadow:3px 3px 0 #000}
.real-name,.biography,.profile-meta,.stat-label,.section-code{color:var(--gray)}
.stats-row{margin:35px 0;border:3px solid #000;background:#1b1025;box-shadow:5px 5px 0 #000}
.stat{border-right:2px solid var(--line)}
.stat strong{color:#e4a4ff;text-shadow:2px 2px 0 #000}
.panel{background:#1b1025;border:3px solid #000;box-shadow:5px 5px 0 #000}
.panel:nth-child(odd){transform:rotate(-.35deg)}
.right-panels .panel:nth-child(even){transform:rotate(.35deg)}
.panel-heading{border-bottom:2px solid var(--line)}
.activity-item{border-bottom:1px solid #4d285c}
.activity-name{color:#f5e6fa}
.activity-detail{color:#c39bd0}
.record-note{padding:15px;border:2px solid #63317c;background:#1b1025;color:#c3a6d0;box-shadow:3px 3px 0 #000}
.edit-dialog{border:4px solid #000;background:#1b1025;box-shadow:8px 8px 0 #000}
.edit-dialog::backdrop{background:rgba(11,3,16,.88)}
.edit-form input,.edit-form textarea,.edit-form select{background:#0d0612;border:2px solid #63317c}
.edit-form input:focus,.edit-form textarea:focus,.edit-form select:focus{border-color:#d05cff}
.save-btn{background:#d05cff;border:3px solid #000;color:#180b27;box-shadow:3px 3px 0 #000}
@media(max-width:700px){
  .identity-section{padding:0 12px 28px}
  .cover{box-shadow:5px 5px 0 #000}
  .stats-row{box-shadow:4px 4px 0 #000}
  .panel:nth-child(odd),.right-panels .panel:nth-child(even){transform:none}
}
.discord-banner{padding:12px 16px;margin:14px 0}
.discord-banner span{font-size:13px}
.discord-banner .discord-gate-btn{padding:8px 14px;font-size:11px}
.edit-dialog{width:min(94vw,480px)}
.edit-form{padding:20px;gap:8px}
.dialog-heading{margin-bottom:4px}
.dialog-heading h2{font-size:19px;margin-top:6px}
.close-btn{font-size:26px;line-height:1}
.edit-form > label{margin-top:4px}
.edit-form input,.edit-form textarea,.edit-form select{padding:10px 12px}
.edit-form textarea{min-height:90px}
.dialog-actions{margin-top:8px}
.cancel-btn,.save-btn{padding:11px 16px}
.source-pane{min-height:90px}
.source-preview{width:80px;height:80px}
.avatar-pick-grid{max-height:200px}
.record-note{margin:12px 0}
footer{padding:18px 5%}
@media(max-width:850px){.stats-row{margin:16px 0}.header{height:auto;padding:10px 5%}}
@media(max-width:520px){.cover{height:150px}.cover-code{display:none}.identity-top{margin-top:-36px}.avatar-frame{width:84px;height:84px}.outline-button{padding:9px 11px}.stat strong{font-size:20px}.stat{padding:12px}}

/* Ajustes de distribución: evitar que el avatar se monte sobre el aviso de Discord. */
.header{height:auto;min-height:64px;flex-wrap:wrap;gap:8px 24px;padding-top:8px;padding-bottom:8px}
.navigation{min-width:0;flex-wrap:wrap;justify-content:flex-end;gap:4px 8px;overflow:visible;padding:0}
.navigation a{padding:10px 8px;font-size:10px}
.navigation .active{padding-bottom:10px}
.profile-container{width:min(1200px,100%);padding:0 5% 50px}
.discord-banner{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:14px 22px;margin:18px 0 0;padding:16px 18px}
.discord-banner>div{min-width:0}
.discord-banner strong{line-height:1.4}
.discord-banner span{display:block;line-height:1.6;overflow-wrap:anywhere}
.discord-banner .discord-gate-btn{display:inline-flex;justify-content:center;align-items:center;min-height:40px;padding:10px 16px;text-align:center;white-space:nowrap}
.identity-top{margin-top:0;align-items:center;gap:20px}
.identity-section{padding-bottom:24px}
.avatar-frame{width:112px;height:112px}
.identity-top>.outline-button{max-width:100%;justify-content:center;white-space:nowrap}
.identity-info{padding-top:16px}
.name-line{gap:10px 14px}
.stats-row{grid-template-columns:repeat(4,minmax(0,1fr))}
.stat{min-width:0}
.stat-label{line-height:1.5}
.profile-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}
.right-panels{min-width:0;gap:18px}
.panel-heading{min-width:0}
.panel-heading h2{line-height:1.35;overflow-wrap:anywhere}
.activity-item{grid-template-columns:28px minmax(0,1fr) auto}
.activity-detail{white-space:normal;overflow-wrap:anywhere}
.discord-banner .discord-gate-btn,.avatar-edit,.avatar-pick,.source-preview{border-radius:0}
@media(max-width:1100px){
  .header{justify-content:center}
  .navigation{width:100%;justify-content:center}
}
@media(max-width:850px){
  .header{justify-content:space-between}
  .navigation{justify-content:flex-start}
  .profile-grid{grid-template-columns:1fr}
  .stats-row{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat:nth-child(2){border-right:0}
  .stat:nth-child(-n+2){border-bottom:1px solid var(--line)}
}
@media(max-width:520px){
  .header{align-items:flex-start;padding:8px 4%}
  .brand{min-height:42px}
  .navigation{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;width:100%}
  .navigation a{display:flex;align-items:center;min-height:38px;padding:8px;border:1px solid #303030;font-size:9px;white-space:normal;line-height:1.35}
  .navigation .active{padding-bottom:8px;border-color:#777}
  .cover{height:150px}
  .profile-container{padding-right:4%;padding-left:4%}
  .discord-banner{grid-template-columns:1fr;padding:13px;gap:12px}
  .discord-banner .discord-gate-btn{width:100%;white-space:normal}
  .identity-top{align-items:center;gap:12px}
  .avatar-frame{width:84px;height:84px}
  .identity-top>.outline-button{max-width:calc(100% - 96px);padding:10px;white-space:normal;text-align:center;line-height:1.4}
  .name-line{align-items:flex-start}
  .name-line h1{max-width:100%;overflow-wrap:anywhere}
  .profile-meta{gap:8px 14px;line-height:1.6}
  .stat{padding:13px 10px}
  .stat-label{font-size:9px;letter-spacing:.5px}
  .stat strong{font-size:20px}
  .panel-heading{padding:13px}
  .activity-list{padding:0 13px}
  .activity-item{grid-template-columns:23px minmax(0,1fr);gap:8px}
  .activity-detail{grid-column:2;text-align:left}
  .dialog-actions{flex-wrap:wrap}
  .dialog-actions button{flex:1;min-width:120px}
  .source-tabs button{min-width:calc(50% - 6px)}
}
