.profile-page {
  --profile-cream: #fbf2dc;
  --profile-ink: #253b34;
  --profile-gold: #f3d084;
  --profile-green: #aee1c6;
  width: 100%;
  max-width: min(100%, var(--play-width, 1080px));
  padding: 5px 0 18px;
  line-height: 1.4;
}
.profile-page [hidden], .profile-dialog [hidden] { display: none !important; }
.profile-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.profile-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: clamp(14px, 3vw, 32px);
  border: 1px solid #4e786d;
  border-radius: 22px;
  background: radial-gradient(ellipse at 85% 10%, #376757 0%, #234438 42%, #172d30 95%);
}
.profile-welcome h2 { font-size: clamp(1.9rem, 3.7vw, 3.2rem); line-height: 1.05; margin: 3px 0 8px; }
.profile-welcome p { color: #e0f1e8; }
.profile-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 4px; }
.profile-title-row h2 { margin: 3px 0; }
.profile-welcome .profile-wallet {
  display: inline-flex; align-items: center; gap: 5px; min-height: 34px;
  padding: 2px 9px 2px 3px; border-radius: 20px;
  background: #ffe7a5; color: #4c3213; font-size: .83rem; font-weight: 700;
}
.profile-wallet .profile-sticker { width: 29px; }
.profile-wallet strong { font-size: 1.05rem; }
.profile-shelf-link { display: inline-flex; align-items: center; min-height: 44px; color: #ffe4ac; font-size: .92rem; font-weight: 700; text-underline-offset: 3px; }
.profile-welcome-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 5px; }
.profile-kicker { font-size: .75rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.profile-welcome .profile-kicker, .profile-collection .profile-kicker { color: var(--profile-green); }
.profile-tools, .profile-reward-actions, .profile-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.profile-tools { align-items: end; flex-wrap: nowrap; min-width: 0; max-width: 100%; }
.profile-tools label { display: grid; min-width: 0; gap: 2px; font-size: .82rem; font-weight: 700; }
.profile-tools select { width: 100%; min-width: 0; max-width: 260px; }
.profile-tools :is(select, button) { min-height: 44px; }
.profile-tools button { flex: 0 0 auto; white-space: nowrap; }
.profile-notice { color: var(--profile-gold); margin: 6px 4px; min-height: 1.4em; font-weight: 700; }
.profile-notice:empty { min-height: 0; }
.profile-dashboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: clamp(9px, 1.5vw, 16px); }
.profile-panel {
  background: var(--profile-cream);
  color: var(--profile-ink);
  min-width: 0;
  padding: clamp(12px, 2vw, 23px);
  border-radius: 18px;
}
.profile-panel h2 { font-size: clamp(1.25rem, 2.15vw, 1.85rem); line-height: 1.1; margin: 4px 0 8px; }
.profile-panel .profile-kicker { color: #486456; }
.profile-level {
  margin-bottom: clamp(9px, 1.5vw, 16px);
  background: linear-gradient(125deg, #f0f8de, #d9f0e1);
  box-shadow: inset 0 0 0 1px #bdd5b7;
}
.profile-level-top { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.profile-level-avatar {
  display: grid; place-items: center; flex: 0 0 auto; width: clamp(58px, 12vw, 82px);
  aspect-ratio: 1; border-radius: 50%; border: 2px solid #b1cbb4; background: #fff6dc;
  font-size: clamp(30px, 6vw, 45px);
}
.profile-level-avatar img { width: 100%; }
.profile-level h2 { margin-bottom: 4px; }
#profileXp { font-weight: 700; color: #3a6254; }
#profileXpBar { display: block; appearance: none; width: 100%; height: 14px; border: 0; border-radius: 12px; overflow: hidden; background: #c3dfcd; }
#profileXpBar::-webkit-progress-bar { background: #c3dfcd; }
#profileXpBar::-webkit-progress-value { background: linear-gradient(90deg,#23634c,#4b9164); border-radius: 12px; }
#profileXpBar::-moz-progress-bar { background: linear-gradient(90deg,#23634c,#4b9164); border-radius: 12px; }
#profileNextLevel { margin-top: 7px; font-weight: 750; }
.profile-xp-rules { margin-top: 4px; font-size: .88rem; color: #436255; }
.profile-avatar-picker summary { display: list-item; padding: 11px 0; min-height: 44px; font-weight: 800; cursor: pointer; }
.profile-avatar-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(91px,1fr)); gap: 8px; }
.profile-avatar-grid button {
  display: grid; align-content: start; justify-items: center; gap: 4px; padding: 7px 4px;
  border: 2px solid #aecbb9; border-radius: 14px; background: #f7fff5; color: #23463c;
  font: inherit; font-size: .82rem; line-height: 1.2; cursor: pointer;
}
.profile-avatar-grid button[aria-pressed="true"] { border-color: #397957; background: #d6efd8; }
.profile-avatar-grid button:disabled { opacity: 1; color: #4b5c52; background: #e2ebe1; cursor: default; }
.profile-avatar-grid button:disabled img { filter: grayscale(1); opacity: .7; }
.profile-avatar-art { display: grid; place-items: center; width: 53px; height: 53px; font-size: 33px; }
#profileAvatarStatus:not(:empty) { padding-top: 7px; font-size: .9rem; font-weight: 750; }
.profile-symbols { position: absolute; pointer-events: none; }
.profile-sticker { display: block; width: 100%; height: auto; }
.profile-star-face { opacity: var(--star-face, 1); }
.profile-medal-check { opacity: var(--medal-check, 1); }
.profile-journey { background: linear-gradient(154deg, #fffae8, #fbefdc 72%); }
.profile-journey-heading, .profile-daily-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.profile-journey-heading h2 { text-wrap: balance; }
.profile-journey-mascot {
  width: clamp(49px, 10vw, 76px);
  padding: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff0b4 0 48%, transparent 70%);
  transform: rotate(12deg);
  filter: drop-shadow(0 3px 0 #ddad5b44);
}
.profile-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(5px, 1.25vw, 10px); margin: 8px 0 12px; }
.profile-metrics p {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 1px;
  padding: 6px 2px 8px;
  border: 1px solid #ead18d;
  border-radius: 14px;
  background: #fff1b8;
  box-shadow: 0 3px 0 #e8c867;
  text-align: center;
  font-size: .77rem;
  font-weight: 750;
}
.profile-metrics p:nth-child(2) { background: #fce4d9; border-color: #edc1b1; box-shadow: 0 3px 0 #e1ae9b; }
.profile-metrics .profile-sticker { width: clamp(31px, 6vw, 50px); }
.profile-metrics strong { font-size: clamp(1.3rem, 3vw, 1.95rem); line-height: 1.08; overflow-wrap: anywhere; max-width: 100%; }
.profile-progress-strip { margin: 12px 0 10px; }
#profileStarTotal { font-size: .88rem; color: #754a22; font-weight: 800; margin-bottom: 4px; }
.profile-journey progress {
  display: block;
  appearance: none;
  width: 100%;
  height: 12px;
  border: 1px solid #dcc7a0;
  border-radius: 12px;
  background: #f4e5c7;
  color: #b67827;
  overflow: hidden;
}
.profile-journey progress::-webkit-progress-bar { background: #f4e5c7; }
.profile-journey progress::-webkit-progress-value { background: linear-gradient(90deg, #d78e35, #f3b847); border-radius: 12px; }
.profile-journey progress::-moz-progress-bar { background: linear-gradient(90deg, #d78e35, #f3b847); border-radius: 12px; }
.profile-album {
  border: 1px solid #d8d4eb;
  border-radius: 16px;
  background: #eeeaf8;
  padding: clamp(8px, 1.5vw, 14px);
  color: #3d375b;
}
.profile-album-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 7px; }
.profile-album-heading h3 { font-size: clamp(1rem, 1.8vw, 1.25rem); }
#profileAlbumPage { font-size: .81rem; color: #524a70; }
.profile-album-nav { display: flex; gap: 5px; }
.profile-album-nav button {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border: 1px solid #a29ac4;
  border-radius: 12px;
  background: #fffafd;
  color: #44396b;
  font-size: 1.65rem;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
}
.profile-album-nav button:disabled { background: #e6e1f2; color: #69617c; cursor: default; }
#profileStarBook { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(3px, 1vw, 8px); }
.profile-album-slot {
  display: grid;
  justify-items: center;
  padding: 2px 1px 3px;
  border: 1px dashed #aaa2c1;
  border-radius: 10px;
  background: #f7f3fc;
  color: #5c5376;
  font-size: .72rem;
  font-weight: 750;
  --star-face: 0;
  --star-fill: #e9e3f3;
  --star-line: #8d83a7;
}
.profile-album-slot .profile-sticker { width: min(100%, 44px); }
.profile-album-slot[data-earned] {
  border: 1px solid #e4b962;
  background: #fff3bc;
  color: #754a22;
  --star-face: 1;
  --star-fill: #ffd65d;
  --star-line: #a66324;
}
.profile-album-slot[data-next] { border: 2px dashed #8c7daf; padding: 1px 0 2px; background: #fffaff; }
#profileBest, .profile-reward-hint { font-size: .88rem; }
.profile-star-book, #profileBest { margin-top: 8px; }
.profile-star-book summary, .profile-local summary { cursor: pointer; font-weight: 750; padding-block: 9px; }
.profile-star-book summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid #dbcba3;
  border-radius: 11px;
  background: #fff8e3;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.profile-star-book summary::-webkit-details-marker { display: none; }
.profile-star-book summary::after { content: '▸'; margin-left: auto; color: #685833; }
.profile-star-book[open] summary { margin-bottom: 5px; }
.profile-star-book[open] summary::after { content: '▾'; }
.profile-star-book summary .profile-sticker { width: 27px; }
.profile-daily { background: #e6f1df; }
.profile-daily-heading .profile-sticker { width: clamp(44px, 9vw, 68px); transform: rotate(11deg); }
.profile-daily-rules { font-size: .92rem; color: #344d3e; }
#profileDailyStatus { font-size: .92rem; margin-top: 5px; }
#profileDailyStatus:empty { margin-top: 0; }
.profile-today { display: flex; align-items: center; gap: 6px; margin: 9px 0; padding: 6px 8px; border-radius: 12px; background: #f8faeb; font-size: .9rem; font-weight: 700; }
.profile-today .profile-sticker { flex: 0 0 28px; width: 28px; }
.profile-today[data-earned] { background: #fff0bb; color: #754a22; }
body.game-screen main .profile-daily-link { display: inline-flex; align-items: center; text-decoration: none; background: #2d6a57; border: 1px solid #215142; color: #fffbea; border-radius: 13px; }
.profile-milestones { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.profile-milestones li {
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 6px 2px;
  border: 1px solid #d5cbe5;
  border-radius: 11px;
  background: #f2ecf6;
  color: #4c4263;
  font-size: .81rem;
  text-align: center;
  --medal-check: 0;
}
.profile-milestones li .profile-sticker { width: min(100%, 45px); }
.profile-milestones li[data-earned] {
  background: #fff0bb;
  border-color: #e2b967;
  color: #724923;
  --medal-fill: #ffd56b;
  --medal-line: #a66324;
  --medal-ribbon: #ee9266;
  --medal-check: 1;
}
.profile-rewards { display: grid; grid-template-columns: clamp(84px, 14vw, 164px) minmax(0, 1fr); gap: 10px 20px; align-items: center; margin-top: 10px; background: #f3e5ca; }
.profile-reward-actions { margin: 8px 0 5px; }
.profile-reward-actions .btn:disabled { opacity: 1; background: #e2dac8; color: #585a51; border: 1px solid #bdb39f; }
.profile-egg-image { display: block; width: 100%; height: auto; }
.profile-reward-hint { font-weight: 700; }
.profile-collection { margin-top: 16px; }
.profile-collection-title { display: flex; flex-wrap: wrap; gap: 3px 10px; justify-content: space-between; align-items: end; margin: 0 4px 7px; }
.profile-collection-title h2 { font-size: clamp(1.45rem, 2.8vw, 2.35rem); line-height: 1.15; }
#profileFound { color: #cbe8dc; font-weight: 750; }
.profile-shelf { display: grid; gap: 8px; }
.profile-shelf-row {
  min-width: 0;
  border: 1px solid #997459;
  border-bottom: 9px solid #a98362;
  border-radius: 13px;
  padding: 7px clamp(7px, 1.3vw, 16px) 5px;
  background: linear-gradient(180deg, #412f2b, #614736);
  box-shadow: 0 3px 0 #44332a;
}
.profile-shelf-row h3 { color: #fbecd2; font-size: clamp(.93rem, 1.6vw, 1.08rem); }
.profile-shelf-row ul, .profile-prize-choices {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(3px, 1vw, 12px);
  list-style: none;
}
.profile-piece {
  display: grid;
  align-content: start;
  justify-items: center;
  color: #fff1d6;
  text-align: center;
  font-size: clamp(.72rem, 1.4vw, .98rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.profile-figure-art {
  display: block;
  width: min(100%, 142px);
  aspect-ratio: 1;
  border-radius: 12%;
  background-size: 300% 200%;
  background-position: var(--figure-x, 0%) var(--figure-y, 0%);
  background-repeat: no-repeat;
}
.profile-figure-art[data-plate="bosque"] { background-image: url("../games/perfil/bosque-3d.webp"); }
.profile-figure-art[data-plate="agua"] { background-image: url("../games/perfil/agua-3d.webp"); }
.profile-figure-art[data-plate="tesoros"] { background-image: url("../games/perfil/tesoros-3d.webp"); }
.profile-figure-art[data-plate="deportes"] { background-image: url("../games/perfil/deportes-3d.webp"); }
.profile-figure-art[data-plate="dinosaurios"] { background-image: url("../games/perfil/dinosaurios-3d.webp"); }
.profile-figure-art[data-plate="espacio"] { background-image: url("../games/perfil/espacio-3d.webp"); }
.profile-figure-art[data-column="1"] { --figure-x: 50%; }
.profile-figure-art[data-column="2"] { --figure-x: 100%; }
.profile-figure-art[data-row="1"] { --figure-y: 100%; }
.profile-piece[data-locked] .profile-figure-art { filter: grayscale(1); opacity: .68; }
.profile-piece small { display: block; font-size: .77em; color: #f4e6d0; font-weight: 500; }
.profile-local { margin: 12px 4px 0; color: #d2e1e3; font-size: .92rem; }
.profile-local p { max-width: 64ch; margin-bottom: 8px; }
.profile-page :is(button, select, summary, [tabindex]):focus-visible { outline-color: #318064; }
.profile-welcome :is(button, select):focus-visible, .profile-collection-title h2:focus-visible, .profile-local :is(button, summary):focus-visible { outline-color: #f3d084; }
.profile-dialog { line-height: 1.4; max-width: 570px; }
.profile-dialog label[for] { display: block; font-weight: 700; margin-bottom: 4px; }
.profile-dialog input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid #728795;
  border-radius: 8px;
  padding: 8px 10px;
  background: #0d1c2b;
  color: #f7fbff;
  font: inherit;
}
.profile-icons { display: flex; flex-wrap: wrap; gap: 6px; border: 0; margin: 11px 0; }
.profile-icons legend { margin-bottom: 5px; font-weight: 700; }
.profile-icons label { display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 54px; min-height: 44px; border: 1px solid #7b98a6; border-radius: 8px; font-size: 1.14rem; cursor: pointer; }
.profile-icons label:has(input:checked) { background: #2e5d4e; }
.profile-icons input { accent-color: #87ddae; }
.profile-dialog-actions { justify-content: flex-end; margin-top: 10px; }
.profile-dialog .profile-dialog-message { color: #f9dba0; font-size: .94rem; margin: 7px 0; }
.profile-dialog-message:empty { display: none; }
.profile-prize { text-align: center; }
.profile-prize .profile-dialog-actions { justify-content: center; }
.profile-prize-art { max-width: 155px; margin: 0 auto 7px; }
.profile-prize-art svg { display: block; width: 100%; height: auto; }
.profile-prize-art .profile-figure-art { width: 100%; }
.profile-prize-art[data-reveal] { animation: profile-appear 270ms ease-out both; }
@keyframes profile-appear { from { transform: scale(.8); opacity: .35; } }
.profile-hatch {
  position: relative;
  width: min(100%, 155px);
  aspect-ratio: 1;
  margin: 0 auto 7px;
  animation: profile-wobble 450ms ease-in-out both;
}
.profile-hatch > * { position: absolute; inset: 0; width: 100%; }
.profile-hatch-top {
  clip-path: polygon(0 0, 100% 0, 100% 54%, 70% 54%, 59% 49%, 48% 58%, 39% 48%, 29% 54%, 0 54%);
  animation: profile-shell-top 360ms 450ms ease-out both;
}
.profile-hatch-bottom {
  clip-path: polygon(0 54%, 29% 54%, 39% 48%, 48% 58%, 59% 49%, 70% 54%, 100% 54%, 100% 100%, 0 100%);
  animation: profile-shell-bottom 360ms 450ms ease-out both;
}
.profile-hatch-crack path {
  stroke-dasharray: 90;
  filter: drop-shadow(0 1px 1px #533d2b);
  animation: profile-crack 360ms 180ms ease-out both;
}
.profile-hatch > .profile-hatch-spark {
  inset: 50% auto auto 50%;
  width: auto;
  opacity: 0;
  color: var(--spark-color, #ffe298);
  font-size: 1.55rem;
  text-shadow: 0 2px 0 #3a544d;
  animation: profile-spark 390ms 420ms ease-out both;
  --spark-x: -65px;
  --spark-y: -55px;
}
.profile-hatch-spark:nth-of-type(2) { --spark-x: 55px; --spark-y: -68px; --spark-color: #abedd3; }
.profile-hatch-spark:nth-of-type(3) { --spark-x: -74px; --spark-y: 26px; --spark-color: #ffaf91; }
.profile-hatch-spark:nth-of-type(4) { --spark-x: 68px; --spark-y: 23px; }
@keyframes profile-wobble { 25% { transform: rotate(-7deg); } 65% { transform: rotate(7deg); } }
@keyframes profile-shell-top { 55% { opacity: 1; } to { transform: translate(12%, -26%) rotate(14deg); opacity: 0; } }
@keyframes profile-shell-bottom { 55% { opacity: 1; } to { transform: translate(-10%, 14%) rotate(-11deg); opacity: 0; } }
@keyframes profile-crack { from { stroke-dashoffset: 90; } 55% { stroke-dashoffset: 0; opacity: 1; } to { stroke-dashoffset: 0; opacity: 0; } }
@keyframes profile-spark { 22% { opacity: .95; } to { transform: translate(var(--spark-x), var(--spark-y)); opacity: 0; } }
.profile-prize-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-prize-choices button { display: grid; justify-items: center; align-content: start; gap: 2px; border: 2px solid #8da99f; border-radius: 10px; padding: 4px; background: #203b39; color: #f8f2df; font-weight: 700; cursor: pointer; }
.profile-prize-choices button[aria-pressed="true"] { background: #2e5d4e; border-color: #f3d084; }
.profile-prize-choices .profile-figure-art { width: min(100%, 88px); }
@media (max-width: 690px) {
  .profile-dashboard { grid-template-columns: 1fr; }
  .profile-daily { grid-row: 1; }
  .profile-shelf-row ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-dialog { padding: 15px; }
}
@media (max-width: 400px) {
  .profile-rewards { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .profile-rewards .profile-egg-art { width: 75px; }
}
