#hero-profile {
  --profile-paper: url('assets/cardboard/paper-label.webp');
  --profile-red: url('assets/cardboard/red-label.webp');
  --profile-wood: url('assets/techniques/reference/frame-wood.webp');
  --profile-frame: url('assets/profile/frame.webp');
  --profile-width: min(1510px, calc(100vw - 32px), calc((100dvh - var(--panel-clearance, 90px) - 24px) * 1.7));
  --profile-height: calc(var(--profile-width) / 1.7);
  position: fixed;
  z-index: 12;
  inset: max(12px, calc((100dvh - var(--profile-height) - var(--panel-clearance, 90px)) / 2)) auto auto 50%;
  transform: translateX(-50%);
  width: var(--profile-width);
  height: var(--profile-height);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  color: #472819;
  color-scheme: light;
  background: transparent;
  font: 600 clamp(13px, 1.3vw, 20px)/1.2 Georgia, serif;
  filter: drop-shadow(2px 7px 4px #3220158c);
  container: hero-profile / inline-size;
}

#hero-profile::backdrop { background: transparent; }
.cardboard-game:has(#hero-profile[open]) :is(.stage-dock, .stage-progress, .intro-find-pin, .interact, .feedback) { visibility: hidden; }

.hero-profile-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr);
  gap: 1.5%;
  height: 100%;
  padding: 6.1% 3.5% 4%;
}

.hero-profile-shell::before,
.hero-profile-shell::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.hero-profile-shell::before {
  z-index: -2;
  inset: 7% 2.3% 3.8%;
  background: #593019 var(--profile-wood) center / 101px auto;
  background-blend-mode: multiply;
  background-color: #af866b;
}

.hero-profile-shell::after { z-index: -1; inset: 0; background: var(--profile-frame) center / 100% 100% no-repeat; }
.profile-frame-heading { position: absolute; display: grid; place-items: center; inset: 0 0 auto; min-height: 10%; color: #ffe6ac; }
.profile-frame-heading h2 { margin: 0; padding-block: 0 .18em; font-size: 4cqw; line-height: 1; text-shadow: 0 3px #4c2312; }
.profile-frame-heading button {
  position: absolute;
  top: 14%;
  right: 2.15%;
  width: clamp(32px, 4.3cqw, 64px);
  aspect-ratio: 1;
  border: 0;
  background: url('assets/techniques/reference/close-stud.webp') center / contain no-repeat;
}

.profile-frame-heading button:hover { filter: brightness(1.2); }
#hero-profile button:focus-visible { outline: 2px solid #b24d29; outline-offset: 2px; }
#hero-profile .profile-frame-heading button:focus-visible { outline-color: #ffe0a5; }
.profile-hero { position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; gap: 1.1cqw; }
.profile-hero > h3 {
  justify-self: center;
  max-width: 100%;
  margin: 0;
  padding: .15em 1.2em .21em;
  background: var(--profile-paper) center / 100% 100% no-repeat;
  font-size: clamp(24px, 3cqw, 46px);
  overflow-wrap: anywhere;
  text-align: center;
}

.profile-faction {
  display: flex;
  justify-content: center;
  align-items: center;
  width: max-content;
  max-width: 100%;
  gap: .35em;
  margin: .18em auto 0;
  padding: .08em .55em;
  border: 1px solid currentColor;
  border-radius: .25em;
  background: #63724d26;
  color: #3e4d33;
  font-size: clamp(10px, .42em, 17px);
  line-height: 1.05;
}

.profile-faction[data-faction="gates"] { background: #964b3022; color: #763b27; }
.profile-faction img { width: 1.52em; height: 1.15em; object-fit: contain; }

.profile-level-labels { display: grid; grid-template-columns: 1fr 1fr 1.15fr; align-items: stretch; gap: .45em; text-align: center; }
.profile-level-labels > * {
  display: grid;
  place-items: center;
  min-height: 2em;
  min-width: 0;
  padding: .32em .25em;
  white-space: normal;
  background: var(--profile-paper) center / 100% 100% no-repeat;
}
.profile-level-labels > strong { color: #fff0c1; background-image: var(--profile-red); }
.profile-level-labels > small { font-size: .79em; }
.profile-level-bar {
  display: block;
  width: 100%;
  height: clamp(11px, 2.05cqw, 31px);
  margin-top: .36em;
  border: 2px solid #b17b47;
  border-radius: 24px;
  background: #312015;
  accent-color: #edaa3c;
}
.profile-level-bar::-webkit-progress-bar { background: #312015; border-radius: inherit; }
.profile-level-bar::-webkit-progress-value { background: #edaa3c; border-radius: inherit; }
.profile-level-bar::-moz-progress-bar { background: #edaa3c; border-radius: inherit; }
.profile-injury-note {
  position: absolute;
  z-index: 4;
  justify-self: center;
  align-self: end;
  bottom: 7.5cqw;
  padding: .52em 1em;
  font-size: .83em;
  background: var(--profile-paper) center / 100% 100% no-repeat;
  color: #84352e;
}

.profile-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  background: url('assets/techniques/practice-stage.webp') center / 100% 100% no-repeat;
}
.profile-stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: url('assets/techniques/tree/stage-frame.webp') center / 100% 100% no-repeat; }
#hero-profile .profile-stage .doll-portrait {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  display: grid;
  place-items: end center;
  min-width: 0;
  min-height: 0;
  max-width: none;
  overflow: visible;
  padding: 0 0 15%;
  background: none;
  border: 0;
  container-type: size;
}
#hero-profile .profile-stage .doll-stencil { width: min(100cqw, 43cqh); max-width: none; height: auto; }
#hero-profile .profile-stage .doll-person { filter: drop-shadow(2px 3px 1px #3520157d); }
.profile-item {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 63%;
  aspect-ratio: .83;
  display: grid;
  place-items: center;
  background: var(--profile-paper) center / 100% 100% no-repeat;
  transform: rotate(-4deg);
  filter: drop-shadow(1px 4px 2px #2b1b10b0);
}
.profile-item[data-profile-gear='body'] { grid-column: 3; transform: rotate(4deg); }
.profile-item img { display: block; width: 77%; height: 81%; object-fit: contain; }
.profile-stat-plates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 0; }
.profile-stat-plates > div {
  display: grid;
  grid-template: auto auto / minmax(24px, 32%) minmax(0, 1fr);
  align-items: center;
  padding: .45em .48em;
  background: var(--profile-paper) center / 100% 100% no-repeat;
  text-align: center;
}
.profile-stat-plates img { grid-row: span 2; width: 100%; max-height: 3.3em; object-fit: contain; }
.profile-stat-plates dt { font-size: clamp(12px, 1.3cqw, 21px); overflow-wrap: anywhere; }
.profile-stat-plates dd { margin: 0; font-size: clamp(16px, 2.2cqw, 33px); font-weight: 800; }

.profile-dossier { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.profile-dossier [data-profile-tabs] { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 2px; padding-inline: 4%; }
.profile-dossier [data-profile-tab] {
  position: relative;
  min-height: clamp(37px, 4.45cqw, 66px);
  margin-bottom: -13px;
  padding: .28em .15em .67em;
  border: 0;
  color: #4f2713;
  background: url('assets/profile/tab-paper.webp') center bottom / 100% 100% no-repeat;
  font-size: clamp(14px, 2.1cqw, 31px);
  overflow-wrap: anywhere;
}
.profile-dossier [data-profile-tab][aria-pressed='true'] { color: #ffe7b3; background-image: url('assets/profile/tab-red.webp'); }
.profile-dossier [data-profile-guide-next] {
  color: #653216;
  filter: drop-shadow(0 -1px 4px #ffc651) brightness(1.15);
  text-decoration: underline;
  text-underline-offset: .15em;
}
#profile-page {
  z-index: 1;
  flex: 1;
  min-height: 0;
  padding: clamp(12px, 1.7cqw, 25px) clamp(12px, 1.9cqw, 29px) 1em;
  background: url('assets/techniques/tree/tree-paper.webp') center / 100% 100% no-repeat;
  overflow: auto;
  scrollbar-color: #a36c3f #ddb278;
  overscroll-behavior: contain;
}
.profile-paper-heading { display: flex; align-items: center; gap: .4em; justify-content: space-between; }
.profile-paper-title {
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: .38em .92em .46em;
  background: var(--profile-red) center / 100% 100% no-repeat;
  color: #ffe2aa;
  font: 700 clamp(16px, 2.37cqw, 34px)/1.04 Georgia, serif;
}
.profile-paper-heading > strong {
  padding: .48em .64em;
  background: var(--profile-paper) center / 100% 100% no-repeat;
  font-size: .92em;
  text-align: center;
}
.profile-training-guide {
  margin: .55em 0 0;
  padding: .45em .62em;
  border-inline-start: 3px solid #a9612c;
  background: #ffe0aeae;
  color: #522d1a;
  font-size: .78em;
  line-height: 1.3;
}
.profile-training-guide strong { display: block; margin-bottom: .16em; }
.profile-directions { display: flex; flex-wrap: wrap; gap: .22em; padding-block: .45em .35em; }
.profile-directions button {
  min-height: 28px;
  padding: .22em .64em;
  border: 0;
  background: var(--profile-paper) center / 100% 100% no-repeat;
  font-size: .73em;
  color: #633b20;
}
.profile-directions button[aria-pressed='true'] { color: #ffe7b8; background-image: var(--profile-red); }
.profile-directions .profile-direction-short { display: none; }
.profile-compact-rank { display: none; }
.profile-skill-list {
  --profile-skill-row: clamp(46px, 5.42cqw, 79px);
  max-height: calc(3 * var(--profile-skill-row) + 4px);
  scrollbar-color: #8b572e #e5bc84;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 2px;
}
.profile-skill {
  display: grid;
  align-items: center;
  grid-template-columns: clamp(48px, 8cqw, 111px) minmax(0, 1fr) auto;
  gap: 1.05cqw;
  width: 100%;
  min-height: var(--profile-skill-row);
  padding: .14em .53em;
  text-align: left;
  border: 1px solid transparent;
  border-bottom-color: #b37d447a;
  background: transparent;
  color: #482714;
}
.profile-skill:hover { background: #edc58a82; }
.profile-skill:is(:focus-visible, [aria-pressed='true']) {
  border-color: #a96a20;
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px #ffe2a1;
  background: #ffcf7f74;
}
.profile-skill-name { font-size: clamp(15px, 2.25cqw, 31px); line-height: 1.03; overflow-wrap: anywhere; }
.profile-skill-art { display: grid; place-items: center; min-height: 2em; height: clamp(33px, 4.6cqw, 67px); background: var(--profile-paper) center / 100% 100% no-repeat; }
.profile-skill-art img { width: 72%; height: 87%; object-fit: contain; }
.profile-pips { display: grid; grid-auto-flow: column; gap: clamp(4px, .65cqw, 10px); }
.profile-pips > span {
  width: clamp(10px, 1.65cqw, 23px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #c19359;
  border: 1px solid #855731;
  box-shadow: inset 1px 1px 2px #7543206b;
}
.profile-pips > [data-trained] { background: #f8b63e; border-color: #a04613; box-shadow: inset 0 0 0 2px #ffc754; }
.profile-skill-details {
  margin: .72em 0 0;
  padding: clamp(10px, 1.14cqw, 18px) clamp(12px, 1.5cqw, 22px);
  background: url('assets/techniques/tree/dossier-card.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 1px #7a572e63);
}
.profile-skill-heading { display: flex; gap: .3em; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.profile-skill-heading h4 { margin: 0; padding: .32em .79em .38em; overflow-wrap: anywhere; background: var(--profile-red) center / 100% 100% no-repeat; color: #ffe6aa; font-size: clamp(15px, 2cqw, 28px); }
.profile-skill-heading > span { padding: .38em .68em; font-size: .69em; white-space: nowrap; background: var(--profile-paper) center / 100% 100% no-repeat; }
.profile-skill-current { margin: .55em 0 0; color: #6e4526; font-size: .78em; line-height: 1.23; }
.profile-skill-ranks, .profile-skill-heading > .profile-rank-current-label { display: none; }
.profile-skill-effect { margin: .63em 0 .54em; font-size: .92em; line-height: 1.28; }
.profile-skill-action { display: grid; justify-items: center; gap: .25em; }
.profile-skill-action small { color: #725038; font-size: .68em; text-align: center; }
.profile-learn {
  min-height: 40px;
  max-width: 98%;
  padding: .38em .92em .46em;
  border: 0;
  color: #ffe8b0;
  background: var(--profile-red) center / 100% 100% no-repeat;
  font-size: clamp(16px, 2.2cqw, 31px);
  font-weight: 800;
}
.profile-learn:hover:enabled { filter: brightness(1.11); }
.profile-learn[data-profile-guide-action] { filter: drop-shadow(0 0 3px #c57a28); }
.profile-learn[data-profile-guide-action]:hover { filter: drop-shadow(0 0 3px #c57a28) brightness(1.13); }
.profile-learn:disabled { filter: grayscale(.69); opacity: .75; }
.profile-skill-reset { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .7em; margin-top: .52em; font-size: .68em; }
.profile-skill-reset button { border: 0; padding: .3em .15em; background: transparent; color: #69391d; text-decoration: underline; text-underline-offset: .2em; }
.profile-dossier output { min-height: 1em; margin: .15em .65em 0; color: #ffe4b0; font: 700 .74em/1 Georgia, serif; }
.profile-dossier output:empty { visibility: hidden; }
.profile-empty { margin: 1em .35em; }
.profile-characteristics { margin: .6em 0 0; }
.profile-characteristics > div { display: flex; justify-content: space-between; gap: 1em; align-items: center; min-height: clamp(43px, 7cqw, 102px); padding: .68em .25em; border-bottom: 1px dashed #ae744674; }
.profile-characteristics dt { display: flex; gap: .55em; align-items: center; font-size: clamp(13px, 2.09cqw, 30px); }
.profile-characteristics dt img { width: clamp(25px, 4cqw, 59px); aspect-ratio: 1; padding: .2em; object-fit: contain; background: var(--profile-paper) center / 100% 100% no-repeat; }
.profile-characteristics dd { margin: 0; padding: .38em .8em; text-align: right; background: var(--profile-paper) center / 100% 100% no-repeat; font-size: clamp(13px, 1.8cqw, 26px); }
.profile-duel-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35em; margin: .65em 0 .3em; }
.profile-duel-stats > div { padding: .42em .15em; text-align: center; background: var(--profile-paper) center / 100% 100% no-repeat; }
.profile-duel-stats dt { font-size: clamp(11px, 1.4cqw, 18px); }
.profile-duel-stats dd { margin: .16em 0 0; font-weight: 800; }
.profile-crit-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-duel-hint { margin: .2em .2em 0; color: #664a30; font-size: .72em; line-height: 1.35; }

@media (max-width: 760px) {
  #hero-profile {
    --profile-width: calc(100vw - 14px);
    inset: 7px auto auto 50%;
    height: auto;
    max-height: calc(100dvh - 60px);
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 10px;
    font-size: clamp(13px, 3.5cqw, 18px);
  }
  .hero-profile-shell { grid-template-columns: 1fr; height: auto; gap: 9px; padding: 0 10px 10px; }
  .hero-profile-shell::before { inset: 5px 4px 1px; border-radius: 9px; }
  .hero-profile-shell::after { background-size: 100% auto; background-position: center top; }
  .profile-frame-heading { position: sticky; z-index: 3; top: 0; margin-inline: -7px; height: 41px; min-height: 0;
    background: var(--profile-frame) center top / 100% auto no-repeat, #593019 var(--profile-wood) center / 78px auto; }
  .profile-frame-heading h2 { padding-bottom: .15em; font-size: clamp(20px, 5.2cqw, 38px); }
  .profile-frame-heading button { top: 5px; right: 8px; width: 32px; }
  .profile-hero { grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 6px; }
  .profile-stage { height: clamp(158px, 52cqw, 260px); }
  #hero-profile .profile-stage .doll-stencil { width: min(92cqw, 43cqh); }
  .profile-injury-note { bottom: 49px; }
  .profile-stat-plates > div { padding-block: .3em; }
  .profile-stat-plates img { max-height: 2.2em; }
  #profile-page { overflow: visible; min-height: 180px; }
  .profile-skill-details { margin-top: .6em; }
  .profile-skill-list { max-height: calc(4 * var(--profile-skill-row) + 4px); }
  .profile-directions button, .profile-skill-reset button { min-height: 34px; }
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 540px) {
  #hero-profile {
    --profile-width: min(calc(100vw - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right) + 14px)), var(--panel-height) * 2.37);
    --profile-height: var(--panel-height);
    inset: var(--panel-center) auto auto 50%;
    height: var(--profile-height);
    max-height: none;
    overflow: hidden;
    transform: translate(-50%, -50%);
    font-size: clamp(12px, 1.65cqw, 15px);
  }
  #hero-profile .hero-profile-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); height: 100%; gap: 1.5%; padding: clamp(32px, 6dvh, 40px) 3.5% 2.5%; }
  #hero-profile .hero-profile-shell::before { inset: 7% 2.3% 3.8%; }
  #hero-profile .hero-profile-shell::after { background-size: 100% 100%; }
  #hero-profile .profile-frame-heading { position: absolute; inset: 0 0 auto; height: 33px; margin: 0; background: none; }
  #hero-profile .profile-frame-heading h2 { font-size: clamp(17px, 3.6cqw, 26px); }
  #hero-profile .profile-frame-heading button { top: 2px; right: 2%; width: 32px; }
  #hero-profile .profile-hero { gap: 3px; }
  #hero-profile .profile-hero > h3 { font-size: clamp(16px, 3cqw, 24px); }
  #hero-profile .profile-faction { font-size: .59em; }
  #hero-profile .profile-stage { height: auto; }
  #hero-profile .profile-level-labels { gap: 2px; }
  #hero-profile .profile-level-labels > * { min-height: 0; padding: .2em .15em; font-size: .85em; }
  #hero-profile .profile-level-bar { height: 10px; margin-top: 2px; }
  #hero-profile .profile-stat-plates > div { padding: 3px 2px; grid-template-columns: minmax(18px, 27%) minmax(0, 1fr); }
  #hero-profile .profile-stat-plates dt { font-size: clamp(10px, 1.55cqw, 13px); }
  #hero-profile .profile-stat-plates dd { font-size: clamp(13px, 2cqw, 17px); }
  #hero-profile [data-profile-tab] { min-height: 31px; font-size: clamp(14px, 2.1cqw, 18px); }
  #hero-profile #profile-page {
    display: grid;
    align-content: start;
    gap: 3px 7px;
    min-height: 0;
    overflow: clip;
    padding: 10px 12px 3px;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  }
  #hero-profile #profile-page[data-profile-view='skills'] { align-content: stretch; grid-template-rows: auto auto minmax(0, 1fr) auto; }
  #hero-profile #profile-page[data-profile-view='skills']:has(.profile-training-guide) { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
  #hero-profile #profile-page > :is(.profile-paper-heading, .profile-paper-title, .profile-training-guide, .profile-directions, .profile-duel-hint, .profile-empty) { grid-column: 1 / -1; }
  #hero-profile .profile-paper-title { font-size: clamp(14px, 2.35cqw, 19px); }
  #hero-profile .profile-paper-heading > strong { padding: .3em .5em; }
  #hero-profile .profile-training-guide { margin: 0; padding: .28em .4em; font-size: .86em; line-height: 1.16; }
  #hero-profile .profile-training-guide strong { display: inline; margin: 0; }
  #hero-profile .profile-directions { padding: 0; }
  #hero-profile .profile-directions button { min-height: 25px; padding-inline: .45em; font-size: .83em; }
  #hero-profile .profile-skill-picker { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
  #hero-profile .profile-skill-list { --profile-skill-row: 35px; max-height: none; min-height: 0; overflow: clip; }
  #hero-profile .profile-skill { grid-template-columns: minmax(23px, 22%) minmax(0, 1fr) auto; gap: 3px; padding: 2px 3px; }
  #hero-profile .profile-skill-name { font-size: clamp(11px, 1.8cqw, 16px); }
  #hero-profile .profile-skill-art { min-height: 0; height: 26px; }
  #hero-profile .profile-pips { gap: 2px; }
  #hero-profile .profile-pips > span { width: clamp(5px, 1cqw, 9px); }
  #hero-profile .profile-skill-pager { display: flex; justify-content: center; align-items: center; flex: none; gap: 5px; margin-top: 2px; }
  #hero-profile .profile-skill-pager button { min-width: 26px; min-height: 24px; padding: 0 4px; border: 0; background: var(--profile-paper) center / 100% 100% no-repeat; color: #633b20; font: 700 18px/1 Georgia, serif; }
  #hero-profile .profile-skill-pager button:disabled { opacity: .5; }
  #hero-profile .profile-skill-details { display: flex; flex-direction: column; align-self: start; min-height: 0; max-height: 100%; margin: 0; padding: 5px 7px; }
  #hero-profile .profile-skill-heading { flex: none; }
  #hero-profile .profile-skill-heading h4 { font-size: clamp(13px, 1.85cqw, 17px); }
  #hero-profile .profile-skill-heading > span { font-size: .8em; }
  #hero-profile :is(.profile-skill-effect, .profile-skill-current) {
    flex: none;
    margin: .3em 0;
    font-size: clamp(11px, 1.5cqw, 14px);
    line-height: 1.2;
  }
  #hero-profile .profile-skill-details[data-profile-rank-view='next'] .profile-skill-current,
  #hero-profile .profile-skill-details[data-profile-rank-view='current'] :is(.profile-skill-effect, .profile-skill-heading > span:not(.profile-rank-current-label)) { display: none; }
  #hero-profile .profile-skill-details[data-profile-rank-view='current'] .profile-rank-current-label { display: inline; }
  #hero-profile .profile-skill-ranks { display: flex; align-items: center; gap: 4px; margin-top: 3px; }
  #hero-profile .profile-skill-ranks button {
    min-height: 22px;
    padding: 2px 5px;
    border: 1px solid #ad8256;
    border-radius: 3px;
    background: #f0ce96;
    color: #633b20;
    font: 700 11px/1.1 'Trebuchet MS', sans-serif;
  }
  #hero-profile .profile-skill-ranks button[aria-pressed='true'] { background: #843d23; color: #ffe5b2; }
  #hero-profile .profile-skill-action { display: flex; flex: none; flex-wrap: wrap; justify-content: space-between; align-items: center; }
  #hero-profile .profile-learn { min-height: 32px; font-size: clamp(13px, 1.8cqw, 16px); }
  #hero-profile .profile-skill-reset {
    grid-column: 1;
    grid-row: 4;
    justify-content: flex-start;
    align-self: end;
    gap: 3px 6px;
    margin: 0;
  }
  #hero-profile .profile-skill-reset button { min-height: 21px; }
  #hero-profile #profile-page:has(.profile-skill-reset) .profile-skill-details { grid-column: 2; grid-row: 3 / span 2; }
  #hero-profile #profile-page:has(.profile-training-guide) .profile-skill-reset { grid-row: 5; }
  #hero-profile #profile-page:has(.profile-training-guide, .profile-skill-reset) .profile-skill-details {
    grid-column: 2;
  }
  #hero-profile #profile-page:has(.profile-training-guide):has(.profile-skill-reset) .profile-skill-details { grid-row: 4 / span 2; }
  #hero-profile [data-profile-view='stats'] { grid-template-columns: minmax(0, .98fr) minmax(0, 1.02fr); }
  #hero-profile .profile-characteristics { grid-row: span 2; margin: 0; }
  #hero-profile .profile-characteristics > div { min-height: 0; gap: 4px; padding: 2px 1px; }
  #hero-profile .profile-characteristics dt { min-width: 0; gap: .2em; font-size: clamp(11px, 1.62cqw, 14px); }
  #hero-profile .profile-characteristics dt img { width: clamp(16px, 2.9cqw, 26px); flex: none; }
  #hero-profile .profile-characteristics dd { max-width: 54%; padding: .26em .32em; font-size: clamp(11px, 1.55cqw, 14px); overflow-wrap: anywhere; }
  #hero-profile .profile-duel-stats { align-self: center; margin: 0; gap: 2px; }
  #hero-profile .profile-duel-stats dt { font-size: clamp(10px, 1.4cqw, 12px); }
  #hero-profile .profile-duel-hint { font-size: .83em; }
  #hero-profile .profile-dossier output { margin: 2px 4px 0; }
  #hero-profile .profile-dossier output:empty { display: none; }
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 350px) {
  #hero-profile {
    --profile-width: min(calc(100vw - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right) + 14px)), var(--panel-height) * 2.85);
  }
  #hero-profile .hero-profile-shell { grid-template-columns: minmax(0, .77fr) minmax(0, 1.75fr); padding-bottom: 1.65%; }
  #hero-profile .profile-stat-plates > div { gap: 1px; }
  #hero-profile .profile-stat-plates dt { grid-column: 1 / -1; grid-row: 1; }
  #hero-profile .profile-stat-plates img { grid-column: 1; grid-row: 2; }
  #hero-profile #profile-page { padding-block: 6px 1px; }
  #hero-profile #profile-page[data-profile-view='skills'] {
    grid-template-columns: minmax(0, .67fr) minmax(0, 1.33fr);
  }
  #hero-profile #profile-page[data-profile-view='skills'] .profile-directions { grid-column: 1; }
  #hero-profile .profile-directions button { min-height: 20px; }
  #hero-profile .profile-skill-list { --profile-skill-row: 27px; }
  #hero-profile .profile-skill { grid-template-columns: 20px minmax(0, 1fr) auto; }
  #hero-profile .profile-skill-name { font-size: 12px; }
  #hero-profile .profile-skill-art { height: 21px; }
  #hero-profile .profile-skill-pager button { min-height: 21px; }
  #hero-profile .profile-skill-details { grid-column: 2; grid-row: 2 / span 2; padding: 4px 6px; }
  #hero-profile #profile-page:has(.profile-training-guide) .profile-skill-details { grid-row: 3 / span 2; }
  #hero-profile #profile-page:has(.profile-skill-reset) .profile-skill-details { grid-row: 2 / span 3; }
  #hero-profile #profile-page:has(.profile-training-guide):has(.profile-skill-reset) .profile-skill-details { grid-row: 3 / span 3; }
  #hero-profile .profile-skill-heading h4 { padding: .28em .5em; font-size: 13px; }
  #hero-profile .profile-skill-heading > span { padding: .28em .4em; font-size: 10px; }
  #hero-profile .profile-skill-current { margin-top: .26em; }
  #hero-profile :is(.profile-skill-effect, .profile-skill-current) { font-size: clamp(10.5px, 1.45cqw, 12px); }
  #hero-profile .profile-learn { min-height: 29px; }
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 540px) {
  html[data-mobile-game] #hero-profile .hero-profile-shell {
    grid-template-columns: minmax(0, .72fr) minmax(0, 1.7fr);
    padding: 37px 3% 2%;
  }
  html[data-mobile-game] #hero-profile #profile-page[data-profile-view='skills'] {
    grid-template-columns: minmax(0, .66fr) minmax(0, 1.34fr);
    padding-inline: 8px;
  }
  html[data-mobile-game] #hero-profile .profile-frame-heading button { width: 44px; }
  html[data-mobile-game] #hero-profile .profile-stat-plates dt { grid-column: 1 / -1; grid-row: 1; }
  html[data-mobile-game] #hero-profile .profile-stat-plates :is(img, dd) { grid-row: 2; }
  html[data-mobile-game] #hero-profile .profile-skill-list { --profile-skill-row: 38px; }
  html[data-mobile-game] #hero-profile .profile-skill-pager button { min-width: 44px; min-height: 34px; }
  html[data-mobile-game] #hero-profile .profile-skill-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
    justify-items: end;
  }
  html[data-mobile-game] #hero-profile .profile-skill-action small {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: start;
  }
  html[data-mobile-game] #hero-profile .profile-learn { min-height: 44px; }
  html[data-mobile-game] #hero-profile .profile-skill-ranks { margin-top: 2px; }
  html[data-mobile-game] #hero-profile .profile-skill-ranks button { min-height: 29px; }
  html[data-mobile-game] #hero-profile :is(.profile-skill-effect, .profile-skill-current) {
    font-size: clamp(11px, 1.5cqw, 14px);
    line-height: 1.17;
  }
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 350px) {
  html[data-mobile-game] #hero-profile .profile-directions { flex-wrap: nowrap; gap: 2px; }
  html[data-mobile-game] #hero-profile .profile-directions button { padding-inline: 3px; }
  html[data-mobile-game] #hero-profile .profile-directions [data-profile-direction='Исследование'] span:first-child { display: none; }
  html[data-mobile-game] #hero-profile .profile-directions .profile-direction-short { display: inline; }
  html[data-mobile-game] #hero-profile .profile-skill-list { --profile-skill-row: 32px; }
  html[data-mobile-game] #hero-profile .profile-skill-pager button { min-height: 29px; }
  html[data-mobile-game] #hero-profile .profile-skill-ranks button { min-height: 26px; }
  html[data-mobile-game] #hero-profile .profile-skill-details:has(.profile-skill-ranks) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 4px;
  }
  html[data-mobile-game] #hero-profile .profile-skill-details:has(.profile-skill-ranks) .profile-skill-heading > span { display: none; }
  html[data-mobile-game] #hero-profile .profile-skill-details:has(.profile-skill-ranks) .profile-skill-ranks { margin: 0; white-space: nowrap; }
  html[data-mobile-game] #hero-profile .profile-compact-rank { display: inline; }
  html[data-mobile-game] #hero-profile .profile-skill-details:has(.profile-skill-ranks) :is(.profile-skill-effect, .profile-skill-current, .profile-skill-action) { grid-column: 1 / -1; }
}
