body {
    background-color: #120b21;
    background-image:
        radial-gradient(1100px 520px at 50% -180px, rgba(245, 197, 66, 0.16), transparent 70%),
        repeating-linear-gradient(45deg, rgba(245, 197, 66, 0.035) 0 2px, transparent 2px 26px),
        repeating-linear-gradient(-45deg, rgba(245, 197, 66, 0.035) 0 2px, transparent 2px 26px);
    background-size: auto;
}

.page.royal {
    --gold: #f5c542;
    --gold-text: #f8d77a;
    --gold-soft: rgba(245, 197, 66, 0.5);
    --gold-line: rgba(245, 197, 66, 0.28);
    --plum: rgba(30, 19, 52, 0.94);
    --plum-deep: rgba(21, 14, 38, 0.88);
    --lilac: #cbbfe6;
    --lilac-muted: #a99cc9;
    max-width: 1400px;
    padding-right: 24px;
    padding-left: 24px;
}

.royal-card .crown,
.royal-home .crown {
    width: 52px;
    height: 39px;
    margin: 0;
    vertical-align: middle;
    filter: drop-shadow(0 0 10px rgba(245, 197, 66, 0.55));
}

.royal-card .crown path,
.royal-home .crown path {
    fill: var(--gold);
    stroke: #7a5413;
}

.royal-card .crown .band,
.royal-home .crown .band {
    fill: none;
}

.royal-card .paw {
    width: 56px;
    height: 56px;
    fill: var(--gold);
    filter: drop-shadow(0 0 10px rgba(245, 197, 66, 0.55));
}

.royal-gate {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 120px);
}

.royal-card {
    display: grid;
    justify-items: center;
    gap: 12px;
    width: min(440px, 100%);
    padding: 36px 30px 32px;
    border-radius: 24px;
    background: radial-gradient(120% 70% at 50% 0%, rgba(245, 197, 66, 0.12), transparent 60%), var(--plum);
    box-shadow: inset 0 0 0 1px var(--gold-soft), 0 26px 54px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.royal-brand {
    margin: 0;
    color: var(--gold-text);
    font: 700 58px/1 var(--font);
    text-shadow: 0 0 18px rgba(245, 197, 66, 0.45), 0 2px 0 #7a5413;
}

.royal-card h1 {
    margin: 4px 0 0;
    color: #ffffff;
    font: 700 24px/1.2 var(--font);
}

.royal-tag {
    margin: 0;
    color: var(--lilac);
    font: 400 18px/1.4 var(--font);
}

.royal-soon {
    margin: 4px 0 0;
    color: #ffffff;
    font: 700 28px/1.2 var(--font);
    letter-spacing: 0.02em;
}

.royal-notice {
    margin: 0;
    padding: 8px 14px;
    border-radius: 12px;
    color: #fecdd3;
    background: rgba(225, 29, 72, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.5);
    font: 700 15px/1.3 var(--font);
}

.royal-card form {
    margin: 0;
}

.royal-discord,
.royal-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    margin-top: 6px;
    padding: 0 24px;
    border: 0;
    border-radius: 14px;
    font: 700 18px/1 var(--font);
    text-decoration: none;
}

.royal-discord {
    color: #ffffff;
    background: #5865f2;
    box-shadow: 0 8px 22px rgba(88, 101, 242, 0.35);
}

.royal-discord:hover {
    background: #4752c4;
}

.royal-discord svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.royal-ghost {
    color: var(--gold-text);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--gold-soft);
}

.royal-ghost:hover {
    background: rgba(245, 197, 66, 0.08);
}

.profile {
    display: grid;
    gap: 22px;
}

.royal-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--gold-line);
}

.royal-home {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--gold-text);
    font: 700 32px/1 var(--font);
    text-decoration: none;
    text-shadow: 0 0 14px rgba(245, 197, 66, 0.35);
}

.royal-home .crown {
    width: 36px;
    height: 27px;
}

.royal-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
}

.royal-tab {
    position: relative;
    isolation: isolate;
    display: inline-grid;
    align-content: center;
    justify-items: center;
    min-height: 44px;
    padding: 4px 16px;
    border-radius: 10px;
    color: var(--lilac);
    font: 700 17px/1.1 var(--font);
    text-decoration: none;
}

.royal-tab small {
    position: absolute;
    top: 3px;
    right: 2px;
    z-index: -1;
    padding: 2px 5px 1px;
    border-radius: 3px;
    color: #1d0f38;
    background: rgba(245, 197, 66, 0.75);
    font: 700 9px/1 var(--font);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    transform: rotate(8deg);
    pointer-events: none;
}

.royal-tab:hover {
    color: #ffffff;
}

.royal-tab.active {
    color: var(--gold-text);
    background: rgba(245, 197, 66, 0.1);
    box-shadow: inset 0 0 0 1px var(--gold-soft);
}

.find {
    position: relative;
    flex: 1 1 220px;
    max-width: 380px;
    margin-left: auto;
}

.find input {
    width: 100%;
    min-height: 44px;
    padding: 8px 14px 8px 42px;
    border: 0;
    border-radius: 12px;
    color: #f3eeff;
    background: var(--plum-deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5c542' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 20 20'/%3E%3C/svg%3E") no-repeat 14px 50% / 18px 18px;
    box-shadow: inset 0 0 0 1px var(--gold-line);
    font: 400 17px/1.3 var(--font);
    -webkit-appearance: none;
    appearance: none;
}

.find input::placeholder {
    color: var(--lilac-muted);
}

.find input:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--gold), 0 0 16px rgba(245, 197, 66, 0.25);
}

.find input::-webkit-search-cancel-button {
    display: none;
}

.find-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 30;
    display: grid;
    gap: 2px;
    max-height: 330px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    border-radius: 14px;
    background: #1b1230;
    box-shadow: inset 0 0 0 1px var(--gold-soft), 0 16px 32px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scaleY(0.96);
    transform-origin: 50% 0;
    transition: opacity 0.16s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.find.open .find-list {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.16s ease, transform 0.24s cubic-bezier(0.2, 1.3, 0.4, 1), visibility 0s;
}

.find-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: 10px;
    color: #f3eeff;
    font: 700 16px/1.2 var(--font);
    text-decoration: none;
}

.find-list a:hover,
.find-list a.active {
    color: #ffffff;
    background: rgba(245, 197, 66, 0.1);
}

.find-list img {
    flex: none;
    border-radius: 50%;
}

.find-empty {
    padding: 10px;
    color: var(--lilac-muted);
    text-align: center;
}

.royal-out {
    margin: 0;
}

.royal-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    color: var(--gold-text);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--gold-soft);
    font: 700 16px/1 var(--font);
    text-decoration: none;
}

.royal-link:hover {
    background: rgba(245, 197, 66, 0.08);
}

.royal-link.quiet {
    color: var(--lilac);
    box-shadow: inset 0 0 0 1px rgba(203, 191, 230, 0.35);
}

.profile {
    gap: 44px;
}

.hero-stage {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 34px;
    min-height: 270px;
    padding: 34px 46px;
    border-radius: 22px;
    background:
        radial-gradient(34% 95% at 15% 0%, rgba(255, 233, 163, 0.24), transparent 72%),
        radial-gradient(26% 85% at 88% 0%, rgba(255, 233, 163, 0.18), transparent 72%),
        radial-gradient(60% 40% at 50% 100%, rgba(0, 0, 0, 0.4), transparent 75%),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.16), rgba(255, 255, 255, 0.035) 26px, rgba(0, 0, 0, 0.16) 52px),
        linear-gradient(180deg, #4b2486, #2c1453 55%, #1b0d35);
    box-shadow:
        inset 0 0 0 2px var(--gold),
        inset 0 0 0 7px #1d0f38,
        inset 0 0 0 8px rgba(245, 197, 66, 0.55),
        0 26px 56px rgba(0, 0, 0, 0.5);
}

.hero-stage::before {
    content: '';
    position: absolute;
    inset: 14px;
    pointer-events: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23f5c542' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 44V16C4 9 9 4 16 4h28'/%3E%3Cpath d='M10 44V22c0-7 5-12 12-12h22' stroke-opacity='.5'/%3E%3Ccircle cx='17' cy='17' r='3' fill='%23f5c542' stroke='none'/%3E%3C/svg%3E") left top / 48px 48px no-repeat,
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23f5c542' stroke-width='2' stroke-linecap='round'%3E%3Cg transform='matrix(-1 0 0 1 48 0)'%3E%3Cpath d='M4 44V16C4 9 9 4 16 4h28'/%3E%3Cpath d='M10 44V22c0-7 5-12 12-12h22' stroke-opacity='.5'/%3E%3Ccircle cx='17' cy='17' r='3' fill='%23f5c542' stroke='none'/%3E%3C/g%3E%3C/svg%3E") right top / 48px 48px no-repeat,
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23f5c542' stroke-width='2' stroke-linecap='round'%3E%3Cg transform='matrix(1 0 0 -1 0 48)'%3E%3Cpath d='M4 44V16C4 9 9 4 16 4h28'/%3E%3Cpath d='M10 44V22c0-7 5-12 12-12h22' stroke-opacity='.5'/%3E%3Ccircle cx='17' cy='17' r='3' fill='%23f5c542' stroke='none'/%3E%3C/g%3E%3C/svg%3E") left bottom / 48px 48px no-repeat,
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23f5c542' stroke-width='2' stroke-linecap='round'%3E%3Cg transform='matrix(-1 0 0 -1 48 48)'%3E%3Cpath d='M4 44V16C4 9 9 4 16 4h28'/%3E%3Cpath d='M10 44V22c0-7 5-12 12-12h22' stroke-opacity='.5'/%3E%3Ccircle cx='17' cy='17' r='3' fill='%23f5c542' stroke='none'/%3E%3C/g%3E%3C/svg%3E") right bottom / 48px 48px no-repeat;
    opacity: 0.8;
}

.hero-stage > * {
    position: relative;
    z-index: 1;
}

.medallion {
    display: grid;
    place-items: center;
    width: 176px;
    height: 176px;
    border-radius: 50%;
    background: conic-gradient(from 20deg, #f5c542, #fff3c4 10%, #c8901c 23%, #f5c542 36%, #fff3c4 50%, #a8740e 64%, #f5c542 78%, #fff3c4 90%, #f5c542);
    box-shadow: 0 0 0 4px #1d0f38, 0 0 0 6px rgba(245, 197, 66, 0.7), 0 0 46px rgba(245, 197, 66, 0.45), 0 18px 30px rgba(0, 0, 0, 0.5);
}

.medallion::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: repeating-conic-gradient(rgba(90, 58, 6, 0.6) 0 3deg, transparent 3deg 10deg);
    -webkit-mask: radial-gradient(closest-side, transparent 88%, #000 89% 97%, transparent 98%);
    mask: radial-gradient(closest-side, transparent 88%, #000 89% 97%, transparent 98%);
}

.medallion::after {
    content: '';
    position: absolute;
    top: -9px;
    left: 50%;
    width: 22px;
    height: 22px;
    margin-left: -11px;
    background: linear-gradient(135deg, #ffb3c1, #e11d48 48%, #7f0f2a);
    box-shadow: 0 0 0 3px #f5c542, 0 0 0 5px #1d0f38, 0 0 16px rgba(225, 29, 72, 0.7);
    transform: rotate(45deg);
}

.medallion-face {
    position: relative;
    width: 144px;
    height: 144px;
    border-radius: 50%;
    object-fit: cover;
    background: #2a1d48;
    box-shadow: 0 0 0 3px #4a2c07;
}

.stage-who {
    display: grid;
    justify-items: center;
    gap: 14px;
    min-width: 0;
    text-align: center;
}

.stage-kicker {
    margin: 0;
    color: var(--lilac);
    font: 700 13px/1.2 var(--font);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.plaque {
    max-width: 100%;
    margin: 0;
    filter: drop-shadow(1.5px 0 0 #6b4808) drop-shadow(-1.5px 0 0 #6b4808) drop-shadow(0 1.5px 0 #6b4808) drop-shadow(0 -1.5px 0 #6b4808) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.5));
}

.plaque span {
    position: relative;
    display: block;
    padding: 10px 46px 12px;
    overflow-wrap: anywhere;
    color: #3b2205;
    background: linear-gradient(180deg, #fff3c4, #f5c542 40%, #dba52c 62%, #a8740e);
    clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 20px 100%, 0 50%);
    font: 700 clamp(28px, 3.3vw, 42px)/1.1 var(--font);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.plaque span::before,
.plaque span::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff8dc, #b07d12 70%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.plaque span::before {
    left: 24px;
}

.plaque span::after {
    right: 24px;
}

.stage-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px 56px;
}

.stage-rank {
    display: flex;
    align-items: center;
    gap: 14px;
}

.shield {
    flex: none;
    width: 56px;
    height: 64px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.shield-rim {
    fill: #f5c542;
}

.shield-face {
    fill: #6d28d9;
}

.shield-crown {
    fill: #ffe9a3;
}

.stage-rank.empty .shield-rim {
    fill: #8f86b5;
}

.stage-rank.empty .shield-face {
    fill: #3b3157;
}

.stage-rank.empty .shield-crown {
    fill: #5a5080;
}

.rank-text {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.rank-text strong {
    color: #ffffff;
    font: 700 23px/1.1 var(--font);
}

.rank-text .bar {
    width: 230px;
    max-width: 100%;
    height: 12px;
}

.rank-text small {
    color: var(--lilac);
    font: 400 15px/1.2 var(--font);
}

.stage-glory {
    position: relative;
    display: grid;
    place-items: center;
    width: 136px;
    height: 127px;
}

.laurel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.35));
}

.laurel path,
.laurel circle {
    fill: #f5c542;
}

.laurel .laurel-stem {
    fill: none;
    stroke: #d9a22a;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.stage-glory > div {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 5px;
    margin-top: -4px;
}

.stage-glory strong {
    color: #ffe08a;
    font: 700 24px/1 var(--font);
    text-shadow: 0 0 14px rgba(245, 197, 66, 0.5), 0 2px 0 rgba(0, 0, 0, 0.45);
}

.stage-glory strong.long {
    font-size: 20px;
}

.stage-glory strong.longer {
    font-size: 17px;
}

.stage-glory small {
    color: var(--lilac);
    font: 700 10px/1 var(--font);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.stage-hero {
    width: 150px;
    height: 206px;
    border: 5px solid transparent;
    border-radius: 10px;
    object-fit: cover;
    background: conic-gradient(from 200deg, #f5c542, #fff3c4, #c8901c, #f5c542, #fff3c4, #a8740e, #f5c542) border-box;
    box-shadow: 0 0 0 2px #1d0f38, 0 0 0 4px rgba(245, 197, 66, 0.55), 0 0 34px rgba(245, 197, 66, 0.28), 0 18px 30px rgba(0, 0, 0, 0.5);
}

.stage-hero.empty {
    display: block;
    background:
        radial-gradient(circle at 50% 38%, #3a2466, #170d2e 75%) padding-box,
        linear-gradient(135deg, #5c4a2a, #a08a5a 22%, #d6c79a 40%, #8a7448 60%, #a08a5a 80%, #5c4a2a) border-box;
    box-shadow: 0 0 0 2px #1d0f38, 0 0 0 4px rgba(160, 138, 90, 0.45), 0 18px 30px rgba(0, 0, 0, 0.5);
}

.stage-hero.empty svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-cloak {
    fill: rgba(203, 191, 230, 0.15);
}

.hero-seam {
    fill: none;
    stroke: rgba(8, 4, 18, 0.35);
    stroke-width: 1.5;
}

.hero-face {
    fill: rgba(8, 4, 18, 0.6);
}

.hero-clasp {
    fill: rgba(245, 197, 66, 0.5);
}

.hero-mark {
    fill: rgba(245, 197, 66, 0.7);
    font: 700 30px/1 var(--font);
    text-anchor: middle;
}

.folio {
    --tone: #f5c542;
    --tone-light: #ffe9a3;
    --tone-dark: #a8740e;
    --tone-fold: #6b4808;
    --tone-text: #ffe08a;
    --tone-soft: rgba(245, 197, 66, 0.45);
    --tone-ink: #3b2205;
    --tone-ink-shadow: rgba(255, 255, 255, 0.5);
    --tone-stripe: rgba(107, 72, 8, 0.5);
    position: relative;
    display: grid;
    align-content: start;
    gap: 18px;
    min-width: 0;
    padding: 46px 20px 26px;
    border-radius: 18px;
    background:
        radial-gradient(110% 55% at 50% 0%, color-mix(in srgb, var(--tone) 13%, transparent), transparent 62%),
        linear-gradient(180deg, #25173f, #170e2b);
    box-shadow:
        inset 0 0 0 1px var(--tone-soft),
        inset 0 0 0 6px rgba(10, 6, 20, 0.35),
        inset 0 0 0 7px rgba(255, 255, 255, 0.05),
        0 18px 38px rgba(0, 0, 0, 0.42);
}

.folio::before {
    content: '';
    position: absolute;
    inset: 12px;
    pointer-events: none;
    background:
        linear-gradient(var(--tone), var(--tone)) left top / 22px 2px no-repeat,
        linear-gradient(var(--tone), var(--tone)) left top / 2px 22px no-repeat,
        linear-gradient(var(--tone), var(--tone)) right top / 22px 2px no-repeat,
        linear-gradient(var(--tone), var(--tone)) right top / 2px 22px no-repeat,
        linear-gradient(var(--tone), var(--tone)) left bottom / 22px 2px no-repeat,
        linear-gradient(var(--tone), var(--tone)) left bottom / 2px 22px no-repeat,
        linear-gradient(var(--tone), var(--tone)) right bottom / 22px 2px no-repeat,
        linear-gradient(var(--tone), var(--tone)) right bottom / 2px 22px no-repeat;
    opacity: 0.5;
}

.folio.trophies {
    --tone: #e11d48;
    --tone-light: #ff8fa6;
    --tone-dark: #9f1239;
    --tone-fold: #5c0a20;
    --tone-text: #ffb3c1;
    --tone-soft: rgba(255, 77, 109, 0.45);
    --tone-ink: #ffffff;
    --tone-ink-shadow: rgba(80, 6, 24, 0.7);
    --tone-stripe: rgba(255, 214, 224, 0.6);
}

.folio.arcade-wall {
    --tone: #22d3ee;
    --tone-light: #b5f6ff;
    --tone-dark: #0e7490;
    --tone-fold: #083e4d;
    --tone-text: #a5f3fc;
    --tone-soft: rgba(34, 211, 238, 0.42);
    --tone-ink: #06262e;
    --tone-ink-shadow: rgba(255, 255, 255, 0.45);
    --tone-stripe: rgba(6, 38, 46, 0.4);
}

.folio.inventory {
    --tone: #3b82f6;
    --tone-light: #a5c8ff;
    --tone-dark: #1e40af;
    --tone-fold: #10235e;
    --tone-text: #bcd3ff;
    --tone-soft: rgba(79, 139, 255, 0.45);
    --tone-ink: #ffffff;
    --tone-ink-shadow: rgba(8, 20, 60, 0.7);
    --tone-stripe: rgba(220, 232, 255, 0.55);
}

.folio.life-hall {
    --tone: #10b981;
    --tone-light: #8af0c8;
    --tone-dark: #047857;
    --tone-fold: #023d2d;
    --tone-text: #a7f3d0;
    --tone-soft: rgba(47, 211, 154, 0.42);
    --tone-ink: #ffffff;
    --tone-ink-shadow: rgba(2, 40, 28, 0.75);
    --tone-stripe: rgba(214, 255, 238, 0.55);
}

.ribbon {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 2;
    margin: 0;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 7px 9px rgba(0, 0, 0, 0.45));
}

.ribbon::before,
.ribbon::after {
    content: '';
    position: absolute;
    top: 11px;
    bottom: -11px;
    width: 34px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.28)) left 0 top 5px / 100% 1.5px no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.28)) left 0 bottom 5px / 100% 1.5px no-repeat,
        linear-gradient(180deg, var(--tone-dark), color-mix(in srgb, var(--tone-dark) 70%, #000000));
}

.ribbon::before {
    left: -30px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%);
}

.ribbon::after {
    right: -30px;
    clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%);
}

.ribbon span {
    position: relative;
    z-index: 1;
    display: block;
    padding: 12px 34px 13px;
    color: var(--tone-ink);
    background:
        linear-gradient(var(--tone-stripe), var(--tone-stripe)) left 0 top 5px / 100% 1.5px no-repeat,
        linear-gradient(var(--tone-stripe), var(--tone-stripe)) left 0 bottom 5px / 100% 1.5px no-repeat,
        linear-gradient(180deg, var(--tone-light), var(--tone) 46%, var(--tone-dark));
    font: 700 23px/1 var(--font);
    letter-spacing: 0.04em;
    text-shadow: 0 1px 0 var(--tone-ink-shadow);
}

.ribbon span::before,
.ribbon span::after {
    content: '';
    position: absolute;
    top: 100%;
    width: 11px;
    height: 11px;
    background: var(--tone-fold);
}

.ribbon span::before {
    left: 0;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.ribbon span::after {
    right: 0;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.sub {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 0;
    color: var(--tone-text);
    font: 700 13px/1 var(--font);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.sub::before,
.sub::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--tone-soft));
}

.sub::after {
    background: linear-gradient(90deg, var(--tone-soft), transparent);
}

.sub b {
    color: #ffffff;
    letter-spacing: 0.1em;
}

.hint {
    margin: 0;
    color: var(--lilac-muted);
    font: 400 14px/1.4 var(--font);
    text-align: center;
}

.hint.boxed {
    padding: 18px 14px;
    border-radius: 10px;
    background: rgba(10, 6, 20, 0.3);
    outline: 1px dashed var(--tone-soft);
    outline-offset: -1px;
}

.bar {
    display: block;
    width: 100%;
    height: 10px;
    overflow: visible;
}

.bar-track {
    fill: rgba(10, 6, 20, 0.72);
}

.bar-fill {
    fill: var(--bar-fill, #f5c542);
}

.bar-shine {
    fill: rgba(255, 255, 255, 0.32);
}

.bar-ticks {
    stroke: rgba(10, 6, 20, 0.5);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.bar-frame {
    fill: none;
    stroke: var(--bar-rim, rgba(245, 197, 66, 0.75));
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.bar.gold {
    --bar-fill: #f5c542;
    --bar-rim: rgba(245, 197, 66, 0.8);
}

.bar.blue {
    --bar-fill: #60a5fa;
    --bar-rim: rgba(96, 165, 250, 0.8);
}

.bar.pink {
    --bar-fill: #ff6fae;
    --bar-rim: rgba(255, 111, 174, 0.8);
}

.bar.green {
    --bar-fill: #34d399;
    --bar-rim: rgba(52, 211, 153, 0.8);
}

.treasures {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px 14px;
}

.treasure {
    display: grid;
    flex: 0 0 calc((100% - 56px) / 5);
    justify-items: center;
    align-content: start;
    gap: 7px;
    min-width: 0;
    text-align: center;
    container-type: inline-size;
}

.treasure-face {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    margin-bottom: 4px;
    border: 5px solid transparent;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 36%, #43297a, #1a1033 72%) padding-box,
        conic-gradient(from 200deg, #f5c542, #fff3c4, #c8901c, #f5c542, #fff3c4, #a8740e, #f5c542) border-box;
    box-shadow: 0 0 0 3px rgba(10, 6, 20, 0.6), 0 0 26px rgba(245, 197, 66, 0.22), inset 0 6px 14px rgba(0, 0, 0, 0.5), 0 12px 18px rgba(0, 0, 0, 0.35);
}

.treasure-face img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}

.treasure-face span {
    font-size: 40px;
    line-height: 1;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}

.treasure strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #ffe08a;
    font: 700 30px/1 var(--font);
    text-shadow: 0 0 14px rgba(245, 197, 66, 0.4), 0 2px 0 rgba(0, 0, 0, 0.5);
}

.treasure strong.long {
    font-size: min(30px, 19cqi);
    white-space: nowrap;
}

.treasure-label {
    color: var(--lilac-muted);
    font: 700 12px/1.1 var(--font);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hall {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 44px 22px;
}

.hall-col {
    display: grid;
    gap: 44px;
    min-width: 0;
}

.plaques {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    container-type: inline-size;
}

.plaque-stat {
    display: grid;
    flex: 1 1 96px;
    justify-items: center;
    align-content: start;
    gap: 6px;
    min-width: 0;
    max-width: 150px;
    padding: 15px 5px 13px;
    border-radius: 6px;
    text-align: center;
    background:
        radial-gradient(circle at 8px 8px, #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 8px) 8px, #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        radial-gradient(circle at 8px calc(100% - 8px), #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        linear-gradient(180deg, #43152f, #261027);
    box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 6px 14px rgba(0, 0, 0, 0.35);
    position: relative;
}

.plaque-stat:focus-visible {
    outline: 2px solid rgba(255, 179, 193, 0.7);
    outline-offset: 2px;
}

.plaque-stat[data-tip]::before,
.plaque-stat[data-tip]::after {
    position: absolute;
    left: 50%;
    z-index: 6;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}

.plaque-stat[data-tip]::after {
    content: attr(data-tip);
    bottom: calc(100% + 11px);
    width: max-content;
    max-width: 210px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #f3eeff;
    background: #1d1232;
    box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.55), 0 12px 24px rgba(0, 0, 0, 0.55);
    font: 400 13px/1.35 var(--font);
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
    white-space: normal;
    transform: translate(-50%, 4px);
}

.plaque-stat[data-tip]::before {
    content: '';
    bottom: calc(100% + 6px);
    width: 10px;
    height: 10px;
    margin-left: -5px;
    background: #1d1232;
    box-shadow: inset -1px -1px 0 rgba(255, 77, 109, 0.55);
    transform: translateY(4px) rotate(45deg);
}

.plaque-stat[data-tip]:hover::before,
.plaque-stat[data-tip]:hover::after,
.plaque-stat[data-tip]:focus-visible::before,
.plaque-stat[data-tip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.plaque-stat[data-tip]:hover::after,
.plaque-stat[data-tip]:focus-visible::after {
    transform: translate(-50%, 0);
}

.plaque-stat[data-tip]:hover::before,
.plaque-stat[data-tip]:focus-visible::before {
    transform: translateY(0) rotate(45deg);
}

.plaque-stat img,
.plaque-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    font-size: 26px;
    line-height: 32px;
}

.plaque-stat strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #ffb3c1;
    font: 700 23px/1 var(--font);
    text-shadow: 0 0 12px rgba(255, 77, 109, 0.45);
}

.plaque-stat small {
    color: var(--lilac-muted);
    font: 700 11px/1.2 var(--font);
    letter-spacing: 0.06em;
    white-space: nowrap;
    text-transform: uppercase;
}

@container (max-width: 491.98px) {
    .plaque-stat {
        flex: 0 0 calc((100% - 16px) / 3);
        max-width: none;
    }
}

@container (max-width: 291px) {
    .plaque-stat {
        flex-basis: calc((100% - 8px) / 2);
    }
}

@container (max-width: 191px) {
    .plaque-stat {
        flex-basis: 100%;
    }
}

.medals {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 6px;
}

.medal {
    --m: #9ca3af;
    --m-light: #e5e7eb;
    --m-dark: #4b5563;
    display: grid;
    justify-items: center;
    width: 74px;
    text-align: center;
}

.medal::before {
    content: '';
    width: 30px;
    height: 26px;
    margin-bottom: -12px;
    background: linear-gradient(90deg, var(--m-dark) 0 28%, var(--m-light) 28% 38%, var(--m) 38% 62%, var(--m-light) 62% 72%, var(--m-dark) 72%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
}

.medal-face {
    z-index: 1;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 3px solid transparent;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--m) 30%, #140b26), color-mix(in srgb, var(--m-dark) 26%, #0b0616) 80%) padding-box,
        conic-gradient(from 210deg, #f5c542, #fff3c4, #c8901c, #f5c542, #fff3c4, #a8740e, #f5c542) border-box;
    box-shadow:
        0 7px 12px rgba(0, 0, 0, 0.45),
        0 0 16px color-mix(in srgb, var(--m) 35%, transparent),
        inset 0 0 0 2px color-mix(in srgb, var(--m) 75%, transparent),
        inset 0 0 14px rgba(0, 0, 0, 0.55);
}

.medal-mark {
    display: grid;
    place-items: center;
    font: 28px/1 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
    visibility: hidden;
    animation: medal-late 0s linear 1.5s forwards;
}

.medal-mark.drawn {
    visibility: visible;
    animation: none;
}

@keyframes medal-late {
    to {
        visibility: visible;
    }
}

.medal-mark canvas {
    display: block;
}

.medal small {
    margin-top: 6px;
    color: #f3eeff;
    font: 700 13px/1.1 var(--font);
    text-transform: capitalize;
}

.medal.tone-0 {
    --m: #ff5a36;
    --m-light: #ffb199;
    --m-dark: #a3200a;
}

.medal.tone-1 {
    --m: #2f8cff;
    --m-light: #a9d1ff;
    --m-dark: #0b4a9e;
}

.medal.tone-2 {
    --m: #34c759;
    --m-light: #a7f0b9;
    --m-dark: #146b2c;
}

.medal.tone-3 {
    --m: #ffd60a;
    --m-light: #fff2a8;
    --m-dark: #a37f00;
}

.medal.tone-4 {
    --m: #a08a72;
    --m-light: #dccdbc;
    --m-dark: #5c4a38;
}

.medal.tone-5 {
    --m: #7dd3c8;
    --m-light: #d4f5f1;
    --m-dark: #2f7d74;
}

.medal.tone-6 {
    --m: #9b6bff;
    --m-light: #ffe14d;
    --m-dark: #ff5a5a;
}

.medal.tone-7 {
    --m: #c9cfe6;
    --m-light: #f4f6ff;
    --m-dark: #6f7699;
}

.medal.tone-8 {
    --m: #ffab1f;
    --m-light: #ffe0a3;
    --m-dark: #a35f00;
}

.medal.tone-9 {
    --m: #7fdcff;
    --m-light: #e0f7ff;
    --m-dark: #2a86a8;
}

.medal.tone-10 {
    --m: #ff4d8d;
    --m-light: #ffb3cf;
    --m-dark: #a3134a;
}

.medal.tone-6.on::before {
    background: linear-gradient(90deg, #ff5a5a 0 17%, #ffb84d 17% 33%, #ffe14d 33% 50%, #5ee07a 50% 67%, #4db8ff 67% 83%, #9b6bff 83%);
}

.medal.tone-6.on .medal-face {
    background:
        radial-gradient(closest-side, #241a4a, #120c28 82%, transparent 84%) padding-box,
        conic-gradient(#ff5a5a, #ffb84d, #ffe14d, #5ee07a, #4db8ff, #9b6bff, #ff5a5a) padding-box,
        conic-gradient(from 210deg, #f5c542, #fff3c4, #c8901c, #f5c542, #fff3c4, #a8740e, #f5c542) border-box;
    box-shadow: 0 7px 12px rgba(0, 0, 0, 0.45), 0 0 16px rgba(155, 107, 255, 0.35), inset 0 0 14px rgba(0, 0, 0, 0.4);
}

.medal:not(.on)::before {
    background: #3b3157;
}

.medal:not(.on) .medal-face {
    background: radial-gradient(circle at 50% 50%, #251e40, #120d24 80%) padding-box, linear-gradient(#4a4170, #4a4170) border-box;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}

.medal:not(.on) .medal-mark {
    filter: grayscale(1) brightness(1.15);
    opacity: 0.55;
}

.medal:not(.on) small {
    color: var(--lilac-muted);
    opacity: 0.7;
}

.rosettes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 8px;
}

.rosette {
    --r-light: #4a406a;
    --r-main: #3b3157;
    --r-dark: #241d3a;
    --r-core: #2a2346;
    --r-core-light: #3d3460;
    --r-ink: #a99cc9;
    --r-glow: transparent;
    --r-rim: linear-gradient(#4a4170, #4a4170);
    position: relative;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 6px;
    min-width: 0;
    text-align: center;
}

.rosette::before,
.rosette::after {
    content: '';
    position: absolute;
    top: 40px;
    left: 50%;
    width: 16px;
    height: 40px;
    background: linear-gradient(90deg, var(--r-dark) 0 28%, var(--r-light) 28% 40%, var(--r-main) 40% 60%, var(--r-light) 60% 72%, var(--r-dark) 72%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    transform-origin: 50% 0;
}

.rosette::before {
    margin-left: -18px;
    transform: rotate(18deg);
}

.rosette::after {
    margin-left: 2px;
    transform: rotate(-18deg);
}

.rosette-badge {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    border-radius: 50%;
    background: repeating-conic-gradient(var(--r-light) 0deg, var(--r-main) 7.5deg, var(--r-light) 15deg);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18), 0 0 0 2px var(--r-dark), 0 8px 14px rgba(0, 0, 0, 0.45), 0 0 18px var(--r-glow);
}

.rosette-core {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-radius: 50%;
    color: var(--r-ink);
    background: radial-gradient(circle, var(--r-core-light), var(--r-core) 75%) padding-box, var(--r-rim) border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    font: 700 15px/1 var(--font);
}

.rosette-core.long {
    font-size: 12px;
}

.rosette small {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #f3eeff;
    font: 700 13px/1.15 var(--font);
}

.rosette small span {
    display: block;
    margin-top: 2px;
    color: var(--lilac-muted);
    font-weight: 400;
}

.rosette.gold {
    --r-light: #ffe9a3;
    --r-main: #f5c542;
    --r-dark: #a8740e;
    --r-core: #f3d27a;
    --r-core-light: #fff8e1;
    --r-ink: #5a3a05;
    --r-glow: rgba(245, 197, 66, 0.4);
    --r-rim: conic-gradient(from 210deg, #f5c542, #fff3c4, #c8901c, #f5c542, #fff3c4, #a8740e, #f5c542);
}

.rosette.silver {
    --r-light: #f4f6fb;
    --r-main: #c3cbda;
    --r-dark: #6f788c;
    --r-core: #dfe5ef;
    --r-core-light: #ffffff;
    --r-ink: #2f3646;
    --r-glow: rgba(220, 228, 240, 0.3);
    --r-rim: conic-gradient(from 210deg, #c3cbda, #ffffff, #8a93a6, #c3cbda, #ffffff, #7d8699, #c3cbda);
}

.rosette.bronze {
    --r-light: #f6b98a;
    --r-main: #d98a4e;
    --r-dark: #8a4a1f;
    --r-core: #ebbd94;
    --r-core-light: #fde7d2;
    --r-ink: #4a230b;
    --r-glow: rgba(217, 138, 78, 0.35);
    --r-rim: conic-gradient(from 210deg, #d98a4e, #ffd2ad, #9a5528, #d98a4e, #ffd2ad, #8a4a1f, #d98a4e);
}

.rosette.plain {
    --r-light: #ff8fa6;
    --r-main: #e11d48;
    --r-dark: #8f0f2e;
    --r-core: #f7c0cc;
    --r-core-light: #fff0f3;
    --r-ink: #7f1230;
    --r-glow: rgba(225, 29, 72, 0.3);
    --r-rim: conic-gradient(from 210deg, #f5c542, #fff3c4, #c8901c, #f5c542, #fff3c4, #a8740e, #f5c542);
}

.rosette.off small {
    color: var(--lilac-muted);
}

.machines {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 14px;
}

.machine {
    position: relative;
    display: grid;
    align-content: start;
    gap: 9px;
    padding: 0 0 13px;
    overflow: hidden;
    border-radius: 14px 14px 8px 8px;
    color: var(--text);
    text-decoration: none;
    background: linear-gradient(180deg, #231a4c, #130d2c 58%, #0c0920);
    box-shadow: inset 5px 0 0 rgba(255, 255, 255, 0.03), inset -5px 0 0 rgba(0, 0, 0, 0.25), 0 10px 22px rgba(0, 0, 0, 0.45);
    transition: box-shadow 0.16s ease;
    container-type: inline-size;
}

.machine::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px var(--neon-soft);
    pointer-events: none;
    transition: box-shadow 0.16s ease;
}

.machine:hover {
    box-shadow: 0 0 24px var(--neon-soft), 0 10px 22px rgba(0, 0, 0, 0.45);
}

.machine:hover::after {
    box-shadow: inset 0 0 0 2px var(--neon);
}

.machine-sign {
    display: block;
    padding: 9px 6px 8px;
    overflow: hidden;
    color: #ffffff;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent), #0b0920;
    border-bottom: 2px solid var(--neon-soft);
    font: 400 24px/1 var(--pixel);
    letter-spacing: 0.04em;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 0 2px #ffffff, 0 0 8px var(--neon), 0 0 18px var(--neon);
}

.machine-screen {
    display: block;
    margin: 2px 12px 0;
    padding: 10px 14px;
    overflow: hidden;
    aspect-ratio: 180 / 100;
    border-radius: 8px;
    background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 3px), #06050d;
    box-shadow: inset 0 0 0 2px #2b2552, inset 0 0 20px var(--neon-soft);
}

.machine-screen svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.machine-score {
    display: grid;
    justify-items: center;
    gap: 5px;
    margin: 0 12px;
}

.machine-score small {
    color: var(--muted);
    font: 700 10px/1 var(--font);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.machine-score strong {
    display: block;
    width: 100%;
    padding: 5px 6px 4px;
    overflow: hidden;
    border-radius: 5px;
    color: var(--neon);
    background: #06050d;
    box-shadow: inset 0 0 0 1px var(--neon-soft), inset 0 0 12px rgba(0, 0, 0, 0.6);
    font: 400 21px/1 var(--pixel);
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 0 6px var(--neon-soft);
}

.machine-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 0 12px;
    color: var(--muted);
    font: 700 13px/1.2 var(--font);
    text-align: center;
}

.machine-meta span {
    padding: 5px 4px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

@container (max-width: 170px) {
    .machine-meta {
        grid-template-columns: minmax(0, 1fr);
        gap: 5px;
    }
}

.counters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.counter {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 5px;
    min-width: 0;
    padding: 15px 8px 13px;
    border-radius: 6px;
    text-align: center;
    background:
        radial-gradient(circle at 8px 8px, #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 8px) 8px, #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        radial-gradient(circle at 8px calc(100% - 8px), #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), #ffd9a8 0 1.5px, #8a5a1c 2px, transparent 3px),
        linear-gradient(180deg, rgba(30, 58, 138, 0.38), rgba(15, 23, 62, 0.5));
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 14px rgba(0, 0, 0, 0.3);
}

.counter > span {
    font-size: 26px;
    line-height: 1;
}

.counter strong {
    color: #bcd3ff;
    font: 700 26px/1 var(--font);
    text-shadow: 0 0 12px rgba(79, 139, 255, 0.5);
}

.counter small {
    color: var(--lilac-muted);
    font: 700 11px/1.2 var(--font);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.counter.wide {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: stretch;
    align-items: center;
    gap: 16px;
    padding: 13px 18px;
    text-align: left;
}

.counter.wide > span {
    font-size: 32px;
}

.counter-bar {
    display: grid;
    gap: 7px;
}

.counter-bar strong small {
    color: var(--lilac-muted);
    font: 700 15px/1 var(--font);
    letter-spacing: 0;
    text-transform: none;
}

.counter-bar .bar {
    height: 12px;
}

.card-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 14px 12px;
    max-height: 520px;
    margin: -6px;
    padding: 6px;
    overflow-y: auto;
}

.card-shelf.more {
    -webkit-mask-image: linear-gradient(180deg, #000000 calc(100% - 70px), transparent);
    mask-image: linear-gradient(180deg, #000000 calc(100% - 70px), transparent);
}

.card {
    --rar: #c4b5fd;
    --rar-light: #efeaff;
    --rar-dark: #6d5bb5;
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    margin: 0;
    padding: 4px;
    border-radius: 9px;
    background: linear-gradient(155deg, var(--rar-light), var(--rar) 34%, var(--rar-dark) 82%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.4), 0 0 14px color-mix(in srgb, var(--rar) 32%, transparent);
}

.card img,
.card-blank {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
    background: #160e2a;
}

.card figcaption {
    display: grid;
    align-content: start;
    gap: 3px;
    padding: 6px 4px 5px;
    border-radius: 0 0 6px 6px;
    text-align: center;
    background: linear-gradient(180deg, #1f1338, #120b22);
}

.card figcaption strong {
    overflow-wrap: anywhere;
    color: #ffffff;
    font: 700 13px/1.15 var(--font);
}

.card figcaption small {
    color: var(--rar-light);
    font: 700 10px/1 var(--font);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.card-count {
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 2px 6px;
    border-radius: 5px;
    color: #ffffff;
    background: rgba(12, 8, 24, 0.86);
    box-shadow: inset 0 0 0 1px var(--rar);
    font: 700 13px/1.2 var(--font);
}

.card.rarity-1 {
    --rar: #cb2626;
    --rar-light: #ff9a9a;
    --rar-dark: #6e0f0f;
}

.card.rarity-2 {
    --rar: #ff6b09;
    --rar-light: #ffbb8a;
    --rar-dark: #8a3300;
}

.card.rarity-3 {
    --rar: #f1e509;
    --rar-light: #fffaa8;
    --rar-dark: #857d00;
}

.card.rarity-4 {
    --rar: #3b5bff;
    --rar-light: #a8b8ff;
    --rar-dark: #0a1f9e;
}

.card.rarity-5 {
    --rar: #9b3cf0;
    --rar-light: #d9b0ff;
    --rar-dark: #4a0d8a;
}

.card.rarity-6 {
    --rar: #ff8a1f;
    --rar-light: #ffe08a;
    --rar-dark: #8a3300;
}

.card.rarity-5::after,
.card.rarity-6::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 6px;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.32) 50%, transparent 62%) -160px 0 / 200% 100% no-repeat;
    animation: card-sheen 4.8s ease-in-out infinite;
}

@keyframes card-sheen {
    0%,
    55% {
        background-position: 160% 0;
    }

    100% {
        background-position: -60% 0;
    }
}

.frame {
    display: grid;
    justify-items: center;
    margin: 0;
}

.frame-art {
    position: relative;
    display: block;
    width: 100%;
    max-width: 440px;
    padding: 14px;
    border-radius: 4px;
    background: linear-gradient(135deg, #7a4f0c, #f5c542 20%, #fff3c4 38%, #c8901c 58%, #f5c542 78%, #7a4f0c);
    box-shadow: inset 0 0 0 2px rgba(58, 35, 6, 0.55), inset 0 0 0 5px rgba(255, 243, 196, 0.25), 0 0 0 2px #3a2306, 0 18px 32px rgba(0, 0, 0, 0.5);
}

.frame-art::before {
    content: '';
    position: absolute;
    inset: 3px;
    pointer-events: none;
    background:
        radial-gradient(circle, #fff3c4 0 2px, #7a4f0c 3px, transparent 4px) left top / 14px 14px no-repeat,
        radial-gradient(circle, #fff3c4 0 2px, #7a4f0c 3px, transparent 4px) right top / 14px 14px no-repeat,
        radial-gradient(circle, #fff3c4 0 2px, #7a4f0c 3px, transparent 4px) left bottom / 14px 14px no-repeat,
        radial-gradient(circle, #fff3c4 0 2px, #7a4f0c 3px, transparent 4px) right bottom / 14px 14px no-repeat;
}

.frame-art img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 2px;
    background: #1b1230;
    box-shadow: 0 0 0 3px #3a2306;
}

.frame figcaption {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 5px;
    width: min(340px, 92%);
    margin-top: -18px;
    padding: 12px 18px 14px;
    border-radius: 4px;
    color: #4a3214;
    background: linear-gradient(180deg, #fbf2dc, #eedcb3);
    box-shadow: inset 0 0 0 1px rgba(122, 84, 19, 0.45), inset 0 0 0 4px rgba(255, 255, 255, 0.35), 0 0 0 2px #b07d12, 0 10px 18px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.frame figcaption strong {
    color: #2e1d06;
    font: 700 24px/1.1 var(--font);
}

.frame figcaption span {
    font: 400 15px/1.3 var(--font);
}

.frame figcaption .pet-kind {
    margin-top: -2px;
    font-style: italic;
}

.frame figcaption .pet-kind::first-letter {
    text-transform: uppercase;
}

.frame .love {
    display: grid;
    justify-items: center;
    gap: 5px;
    width: 100%;
    max-width: 230px;
    color: #9d1d5a;
    font-weight: 700;
}

.frame .love .bar {
    --bar-rim: rgba(157, 29, 90, 0.7);
}

.frame .love .bar-track {
    fill: rgba(74, 50, 20, 0.18);
}

.frame.empty {
    justify-self: center;
    place-items: center;
    align-content: center;
    gap: 8px;
    width: min(440px, 100%);
    min-height: 210px;
    padding: 20px;
    border: 13px solid transparent;
    border-radius: 4px;
    background:
        radial-gradient(70% 60% at 50% 42%, rgba(91, 61, 150, 0.35), transparent 72%) padding-box,
        linear-gradient(180deg, #1d1236, #140c26) padding-box,
        linear-gradient(135deg, #5c4a2a, #a08a5a 22%, #d6c79a 40%, #8a7448 60%, #a08a5a 80%, #5c4a2a) border-box;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 0 2px #2a1f10, 0 14px 26px rgba(0, 0, 0, 0.4);
}

.frame.empty p {
    margin: 0;
    color: var(--lilac-muted);
    font: 400 15px/1.35 var(--font);
}

.frame-paw {
    font-size: 44px;
    line-height: 1;
    opacity: 0.55;
}

.strips {
    display: grid;
    gap: 12px;
}

.strip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px 20px;
    min-width: 0;
    padding: 14px 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(6, 78, 59, 0.3), rgba(6, 40, 32, 0.38));
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.strip.empty {
    grid-template-columns: auto minmax(0, 1fr);
}

.strip-text {
    display: grid;
    justify-items: start;
    gap: 6px;
    min-width: 0;
    text-align: left;
}

.strip-text p {
    margin: 0;
    color: var(--lilac);
    font: 400 15px/1.35 var(--font);
}

.strip-text a {
    color: #a7f3d0;
    font-weight: 700;
    text-decoration: none;
}

.strip-text a:hover {
    text-decoration: underline;
}

.strip .strip-title {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #ffffff;
    font: 700 18px/1.25 var(--font);
}

.strip-text .bar {
    width: 100%;
    max-width: 280px;
}

.strip-tiles {
    display: flex;
    gap: 8px;
}

.life-tile {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    width: 90px;
    padding: 9px 4px 8px;
    border-radius: 8px;
    text-align: center;
    background: rgba(2, 30, 22, 0.55);
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.life-tile > span {
    font-size: 18px;
    line-height: 1;
}

.life-tile strong {
    color: #a7f3d0;
    font: 700 20px/1 var(--font);
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(47, 211, 154, 0.45);
}

.life-tile small {
    color: var(--lilac-muted);
    font: 700 10px/1.1 var(--font);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.crest-faces {
    display: flex;
    align-items: center;
    gap: 7px;
}

.crest-face {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 50%;
    background: #2a1d48;
    box-shadow: 0 0 0 3px #f5c542, 0 6px 12px rgba(0, 0, 0, 0.45);
}

.crest-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crest-face.ghost {
    background: rgba(10, 6, 20, 0.35);
    box-shadow: 0 0 0 2px rgba(203, 191, 230, 0.3);
}

.crest-heart {
    position: relative;
    z-index: 1;
    font-size: 26px;
    line-height: 1;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}

.crest.empty .crest-heart {
    filter: grayscale(1) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
    opacity: 0.6;
}

.no-face {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #ffffff;
    background: linear-gradient(135deg, #6d28d9, #3b1a7a);
    font: 700 26px/1 var(--font);
}

.pennant {
    width: 84px;
    height: 105px;
    overflow: visible;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.45));
}

.pennant .rod {
    fill: #b07d12;
}

.pennant .rod-end {
    fill: #f5c542;
    stroke: #7a5413;
    stroke-width: 1;
}

.pennant .cloth-shade {
    fill: url(#cloth-fold);
}

.pennant .cloth-trim {
    fill: none;
    stroke: rgba(255, 236, 170, 0.8);
    stroke-width: 1.6;
    stroke-dasharray: 4 3;
}

.pennant .emblem-ring {
    fill: rgba(0, 0, 0, 0.28);
    stroke: #f5c542;
    stroke-width: 3;
}

.pennant .tattoo {
    font-size: 30px;
    text-anchor: middle;
}

.pennant .cloth.ghost {
    fill: rgba(255, 255, 255, 0.04);
    stroke: rgba(203, 191, 230, 0.35);
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
}

.banner-box .motto {
    color: #d9f99d;
    font-style: italic;
}

.banner-faces {
    display: flex;
    padding-left: 8px;
}

.banner-face {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-left: -8px;
    overflow: hidden;
    border-radius: 50%;
    background: #2a1d48;
    box-shadow: 0 0 0 2px #0f2a22, 0 0 0 3px rgba(245, 197, 66, 0.6);
}

.banner-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-face .no-face {
    font-size: 15px;
}

.sandcastle {
    width: 96px;
    height: 72px;
    overflow: visible;
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
}

.sandcastle .sand-body {
    fill: url(#sand-glow);
}

.sandcastle .sand-edge {
    fill: none;
    stroke: #8a6232;
    stroke-width: 1.5;
    stroke-linejoin: round;
}

.sandcastle .sand-shade {
    fill: rgba(122, 82, 32, 0.26);
}

.sandcastle .sand-side {
    fill: rgba(122, 82, 32, 0.18);
}

.sandcastle .sand-light {
    fill: rgba(255, 249, 228, 0.42);
}

.sandcastle .sand-ridge {
    fill: none;
    stroke: rgba(122, 82, 32, 0.38);
    stroke-width: 0.9;
    stroke-linecap: round;
}

.sandcastle .sand-hole {
    fill: #7a5328;
}

.sandcastle .sand-grain {
    fill: rgba(130, 88, 36, 0.5);
}

.sandcastle .sand-sparkle {
    fill: rgba(255, 251, 236, 0.85);
}

.sandcastle .flag-pole {
    fill: none;
    stroke: #6b4a24;
    stroke-width: 1.4;
    stroke-linecap: round;
}

.sandcastle .flag-cloth {
    fill: #10b981;
    stroke: #047857;
    stroke-width: 0.8;
    stroke-linejoin: round;
}

.sandcastle .shell {
    fill: #f7cdbb;
    stroke: #b9785f;
    stroke-width: 0.7;
    stroke-linejoin: round;
}

.sandcastle .shell-ridge {
    fill: none;
    stroke: #b9785f;
    stroke-width: 0.5;
    stroke-linecap: round;
}

@media (prefers-reduced-motion: reduce) {
    .card.rarity-5::after,
    .card.rarity-6::after {
        animation: none;
    }

    .machine {
        transition: none;
    }
}

@media (max-width: 1100px) {
    .hall {
        grid-template-columns: minmax(0, 1fr);
    }

    .find {
        margin-left: 0;
    }

    .stage-hero {
        width: 132px;
        height: 182px;
    }
}

@media (max-width: 900px) {
    .hero-stage {
        grid-template-columns: auto minmax(0, 1fr);
        padding: 32px 34px;
    }

    .stage-hero {
        display: none;
    }
}

@media (max-width: 760px) {
    .hero-stage {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        gap: 22px;
        padding: 34px 20px 28px;
        text-align: center;
    }

    .rank-text {
        justify-items: center;
    }

    .treasure {
        flex-basis: calc((100% - 28px) / 3);
    }

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

@media (max-width: 520px) {
    .page.royal {
        padding-right: 16px;
        padding-left: 16px;
    }

    .profile {
        gap: 40px;
    }

    .folio {
        padding: 42px 14px 20px;
    }

    .folio::before {
        inset: 8px;
    }

    .ribbon span {
        padding: 11px 22px 12px;
        font-size: 20px;
    }

    .ribbon::before,
    .ribbon::after {
        width: 28px;
    }

    .ribbon::before {
        left: -24px;
    }

    .ribbon::after {
        right: -24px;
    }

    .medallion {
        width: 144px;
        height: 144px;
    }

    .medallion-face {
        width: 116px;
        height: 116px;
    }

    .plaque span {
        padding: 9px 38px 11px;
    }

    .treasures {
        gap: 16px 8px;
    }

    .treasure {
        flex-basis: calc((100% - 16px) / 3);
    }

    .treasure-face {
        width: 74px;
        height: 74px;
        border-width: 4px;
    }

    .treasure-face img {
        width: 40px;
        height: 40px;
    }

    .treasure-face span {
        font-size: 32px;
    }

    .treasure strong {
        font-size: 23px;
    }

    .treasure-label {
        font-size: 11px;
        letter-spacing: 0.1em;
    }

    .rosettes {
        gap: 14px 4px;
    }

    .rosette::before,
    .rosette::after {
        top: 34px;
        width: 14px;
        height: 34px;
    }

    .rosette::before {
        margin-left: -16px;
    }

    .rosette-badge {
        width: 54px;
        height: 54px;
        margin-bottom: 16px;
    }

    .rosette-core {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .rosette-core.long {
        font-size: 10px;
    }

    .rosette small {
        font-size: 12px;
    }

    .machines {
        gap: 12px 10px;
    }

    .machine-sign {
        font-size: 21px;
    }

    .machine-score strong {
        font-size: 19px;
    }

    .counter strong {
        font-size: 22px;
    }

    .card-shelf {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
        gap: 12px 10px;
    }

    .strip {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px 14px;
        padding: 14px;
    }

    .strip-tiles {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .plaque-stat[data-tip]::after {
        max-width: 160px;
    }

    .royal-brand {
        font-size: 48px;
    }

    .royal-tab {
        padding: 4px 10px;
    }
}
