:root {
    --bg-color: #090806;
    --card-bg: #18100a;
    --accent-color: #d9a441;
    --accent-hover: #9f621d;
    --text-main: #f7e8c1;
    --text-sub: #b9a27c;
    --border-color: rgba(220, 169, 82, 0.42);
    --hp-color: #10b981;
    --mp-color: #3b82f6;
    --danger-color: #ef4444;
    --nav-height: 86px;
    --action-panel-border: rgba(251, 191, 36, 0.76);
    --action-panel-bg: radial-gradient(180% 100% at 50% -30%, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0) 45%),
        linear-gradient(180deg, rgba(11, 17, 29, 0.97), rgba(8, 12, 22, 0.95));
    --action-panel-shadow: 0 0 0 1px rgba(251, 191, 36, 0.28),
        0 0 26px rgba(251, 191, 36, 0.34),
        0 12px 32px rgba(0, 0, 0, 0.62);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-gutter: 14px;
    --icon-nav-home: url("./assets/ui/icons/059.png?v=20260531");
    --icon-nav-troy: url("./assets/ui/icons/058.png?v=20260531");
    --icon-nav-companions: url("./assets/ui/icons/060.png?v=20260604d");
    --icon-nav-inventory: url("./assets/ui/icons/062.png?v=20260531");
    --icon-nav-ranking: url("./assets/ui/icons/nav-ranking-framed.png?v=20260531");
    --icon-nav-king: url("./assets/ui/icons/nav-king-framed.png?v=20260531");
    --icon-anchor: url("./assets/ui/icons/020.png");
    --icon-chest: url("./assets/ui/icons/004.png");
    --icon-chest-gold: url("./assets/ui/icons/008.png");
    --icon-coin: url("./assets/ui/icons/002.png");
    --icon-coin-stack: url("./assets/ui/icons/003.png");
    --icon-chip: url("./assets/ui/icons/046.png");
    --icon-compass: url("./assets/ui/icons/015.png");
    --icon-qr-scan: url("./assets/ui/icons/030.png");
    --icon-crown: url("./assets/ui/icons/057.png");
    --icon-dart: url("./assets/ui/icons/042.png");
    --icon-microphone: url("./assets/ui/icons/044.png");
    --icon-money-bag: url("./assets/ui/icons/001.png");
    --icon-pirate-flag: url("./assets/ui/icons/023.png");
    --icon-potion-blue: url("./assets/ui/icons/006.png");
    --icon-refresh: url("./assets/ui/buttons/action-refresh.png");
    --icon-settings: url("./assets/ui/buttons/action-settings.png");
    --icon-skull: url("./assets/ui/icons/019.png");
    --icon-swords: url("./assets/ui/icons/033.png");
    --icon-tarot: url("./assets/ui/icons/038.png");
    --icon-trophy: url("./assets/ui/icons/056.png");
    --icon-vial: url("./assets/ui/icons/special-vial.png");
    --icon-mushroom: url("./assets/ui/icons/special-mushroom.png");
    --icon-slot-all: url("./assets/ui/icons/029.png");
    --icon-slot-equipment: url("./assets/ui/icons/040.png");
    --icon-slot-tarot: url("./assets/ui/icons/038.png");
    --icon-slot-head: url("./assets/ui/icons/032.png");
    --icon-slot-weapon: url("./assets/ui/icons/076.png");
    --icon-slot-shield: url("./assets/ui/icons/077.png");
    --icon-slot-armor: url("./assets/ui/icons/073.png");
    --icon-slot-accessory: url("./assets/ui/icons/074.png");
    --panel-sheet-frame: url("./assets/ui/panels/panel-sheet-frame.png");
    --panel-sheet-plaque: url("./assets/ui/banners/banner-plaque.png");
    --panel-sheet-plaque-gold: url("./assets/ui/banners/banner-plaque-gold.png");
    --panel-sheet-plaque-blue: url("./assets/ui/banners/banner-plaque-blue.png");
    --panel-sheet-divider: url("./assets/ui/banners/banner-divider.png");
    --panel-sheet-rule: url("./assets/ui/banners/banner-rule.png");
    --banner-sheet-skull: url("./assets/ui/icons/050.png");
    --banner-sheet-swords: url("./assets/ui/icons/051.png");
    --banner-sheet-anchor: url("./assets/ui/icons/052.png");
    --banner-sheet-purple: url("./assets/ui/icons/053.png");
    --icon-action-plus: url("./assets/ui/buttons/action-plus.png");
    --icon-action-refresh: url("./assets/ui/buttons/action-refresh.png");
    --icon-action-check: url("./assets/ui/buttons/action-check.png");
    --icon-action-close: url("./assets/ui/buttons/action-close.png");
    --icon-action-cannon: url("./assets/ui/icons/034.png");
    --icon-action-card: url("./assets/ui/icons/071.png");
    --icon-action-crew: url("./assets/ui/icons/063.png");
    --icon-action-mail: url("./assets/ui/icons/064.png");
    --icon-action-map: url("./assets/ui/icons/015.png");
    --icon-action-ship: url("./assets/ui/icons/060.png");
    --icon-action-swords: url("./assets/ui/icons/033.png");
    --icon-companion-dice: url("./assets/ui/icons/041.png");
    --icon-companion-drink: url("./assets/ui/icons/043.png");
    --icon-companion-eightball: url("./assets/ui/icons/047.png");
    --icon-companion-fish: url("./assets/ui/icons/037.png");
    --icon-companion-game: url("./assets/ui/icons/041.png");
    --icon-companion-poker-chip: url("./assets/ui/icons/046.png");
}

/* Tarot Kingdom rulebook */
#tarotKingdomRulebookButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    appearance: none;
    min-width: 66px;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid rgba(236, 196, 92, 0.72);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(38, 52, 100, 0.96), rgba(9, 17, 48, 0.98));
    color: #f7fbff;
    -webkit-text-fill-color: #f7fbff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 3px 10px rgba(0, 0, 0, 0.3);
    font: 800 10px/1 system-ui, sans-serif;
    letter-spacing: 0.08em;
    cursor: pointer;
    pointer-events: auto;
}

#tarotKingdomRulebookButton > span:first-child {
    color: #f4cf65;
    -webkit-text-fill-color: #f4cf65;
    font-size: 14px;
    line-height: 1;
}

#tarotKingdomRulebookButton:hover,
#tarotKingdomRulebookButton:focus-visible {
    border-color: #ffe498;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    outline: 2px solid rgba(245, 196, 76, 0.35);
    outline-offset: 2px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.is-battle-active #tarotKingdomRulebookButton {
    position: fixed;
    z-index: 1201;
    top: max(8px, env(safe-area-inset-top));
    right: max(50px, env(safe-area-inset-right), calc((100vw - 640px) / 2 + 50px));
}

#tarotKingdomRoot.is-rulebook-open #tarotKingdomRulebookButton {
    visibility: hidden;
}

.tarot-kingdom-rulebook-overlay {
    position: fixed;
    z-index: 1800;
    inset: 0;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: 18px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 12%, rgba(43, 79, 133, 0.38), transparent 44%),
        rgba(1, 4, 14, 0.9);
    backdrop-filter: blur(8px);
}

.tarot-kingdom-rulebook-overlay[hidden] {
    display: none;
}

.tarot-kingdom-rulebook-page {
    width: min(100%, 720px);
    height: min(100%, 920px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(229, 190, 87, 0.72);
    border-radius: 18px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px),
        linear-gradient(155deg, #111b36 0%, #080d20 42%, #050817 100%);
    background-size: 6px 6px, 6px 6px, auto;
    color: #e8edf8;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.72), inset 0 0 60px rgba(1, 4, 14, 0.42);
    scrollbar-color: #a98237 #080d20;
}

.tarot-kingdom-rulebook-top {
    position: sticky;
    z-index: 3;
    top: 0;
    background: #081027;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.tarot-kingdom-rulebook-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(229, 190, 87, 0.42);
    background:
        linear-gradient(110deg, rgba(20, 48, 91, 0.98), rgba(8, 15, 39, 0.98)),
        #081027;
}

.tarot-kingdom-rulebook-kicker,
.tarot-kingdom-rulebook-section-no {
    display: block;
    color: #e7bd58;
    font: 800 9.5px/1.4 system-ui, sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.tarot-kingdom-rulebook-header h2 {
    margin: 5px 0 7px;
    color: #fff4c5;
    font: 900 clamp(24px, 5vw, 36px)/1.06 Georgia, "Yu Mincho", serif;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 0 #000, 0 0 22px rgba(238, 190, 70, 0.22);
}

.tarot-kingdom-rulebook-header h2 span {
    white-space: nowrap;
}

.tarot-kingdom-rulebook-header p {
    max-width: 520px;
    margin: 0;
    color: #bfcbe3;
    font-size: 12px;
    line-height: 1.6;
}


.tarot-kingdom-rulebook-nav {
    display: flex;
    gap: 7px;
    padding: 13px 18px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 7, 21, 0.96);
    scrollbar-width: none;
}

.tarot-kingdom-rulebook-nav::-webkit-scrollbar {
    display: none;
}

.tarot-kingdom-rulebook-nav button {
    flex: 0 0 auto;
    appearance: none;
    min-height: 32px;
    padding: 7px 16px;
    border: 2px solid rgba(126, 151, 199, 0.42);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(30, 48, 85, 0.68), rgba(18, 32, 65, 0.64));
    color: #f7fbff;
    -webkit-text-fill-color: #f7fbff;
    font: 800 12px/1.3 system-ui, sans-serif;
    cursor: pointer;
    transition: all 200ms ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.tarot-kingdom-rulebook-nav button:hover,
.tarot-kingdom-rulebook-nav button:focus-visible {
    border-color: #e7bd58;
    background: linear-gradient(135deg, rgba(50, 75, 120, 0.82), rgba(35, 60, 100, 0.78));
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    outline: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.tarot-kingdom-rulebook-nav button.is-active {
    border-color: #ffe498;
    background: linear-gradient(135deg, rgba(100, 120, 180, 0.92), rgba(70, 95, 160, 0.92));
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    box-shadow: 0 0 20px rgba(230, 189, 88, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tarot-kingdom-rulebook-body {
    padding: 6px 20px 28px;
}

.tarot-kingdom-rulebook-section {
    padding: 22px 4px 26px;
    scroll-margin-top: 178px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    outline: none;
}

.tarot-kingdom-rulebook-section:last-child {
    border-bottom: 0;
}

.tarot-kingdom-rulebook-section h3 {
    margin: 8px 0 16px;
    padding: 10px 0 0;
    color: #fff4c5;
    font: 900 clamp(20px, 4.5vw, 26px)/1.3 Georgia, "Yu Mincho", serif;
    letter-spacing: 0.05em;
    border-top: 2px solid rgba(230, 189, 88, 0.3);
}

.tarot-kingdom-rulebook-section h4 {
    margin: 0 0 5px;
    color: #f3d788;
    font-size: 12px;
}

.tarot-kingdom-rulebook-section p {
    margin: 0;
    color: #bac6dc;
    font-size: 12px;
    line-height: 1.75;
}

.tarot-kingdom-rulebook-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: kingdom-rule-step;
}

.tarot-kingdom-rulebook-steps li {
    position: relative;
    min-height: 85px;
    padding: 13px 13px 13px 48px;
    border: 1px solid rgba(115, 146, 198, 0.32);
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(30, 48, 85, 0.62), rgba(15, 28, 60, 0.58));
    counter-increment: kingdom-rule-step;
    transition: all 200ms ease;
}

.tarot-kingdom-rulebook-steps li:hover {
    border-color: rgba(230, 189, 88, 0.4);
    background: linear-gradient(135deg, rgba(40, 60, 100, 0.68), rgba(20, 35, 70, 0.65));
}

.tarot-kingdom-rulebook-steps li::before {
    position: absolute;
    top: 12px;
    left: 11px;
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border: 1px solid rgba(232, 192, 87, 0.62);
    border-radius: 50%;
    color: #ffe398;
    content: counter(kingdom-rule-step);
    font-size: 10px;
    font-weight: 900;
}

.tarot-kingdom-rulebook-steps strong,
.tarot-kingdom-rulebook-steps span {
    display: block;
}

.tarot-kingdom-rulebook-steps strong {
    margin-bottom: 4px;
    color: #eef4ff;
    font-size: 12px;
}

.tarot-kingdom-rulebook-steps span {
    color: #aebbd3;
    font-size: 11px;
    line-height: 1.55;
}

.tarot-kingdom-rulebook-alert,
.tarot-kingdom-rulebook-note {
    display: grid;
    gap: 6px;
    margin-top: 15px;
    padding: 13px 15px;
    border: 2px solid rgba(241, 196, 73, 0.58);
    border-radius: 13px;
    background: linear-gradient(110deg, rgba(120, 70, 15, 0.48), rgba(50, 35, 20, 0.42));
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tarot-kingdom-rulebook-alert strong,
.tarot-kingdom-rulebook-note strong {
    color: #ffe292;
    font-size: 12px;
}

.tarot-kingdom-rulebook-alert span,
.tarot-kingdom-rulebook-note span {
    color: #e2d5b5;
    font-size: 11px;
    line-height: 1.6;
}

.tarot-kingdom-rulebook-jump {
    margin-top: 15px;
    padding: 13px;
    border: 1px solid rgba(115, 146, 198, 0.32);
    border-radius: 13px;
    background: rgba(6, 15, 38, 0.62);
}

.tarot-kingdom-rulebook-jump > strong {
    display: block;
    margin-bottom: 9px;
    color: #f3d788;
    font-size: 11px;
    letter-spacing: 0.06em;
}

.tarot-kingdom-rulebook-jump > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.tarot-kingdom-rulebook-jump button {
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(126, 151, 199, 0.38);
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(30, 48, 85, 0.72), rgba(18, 32, 65, 0.68));
    color: #f7fbff;
    -webkit-text-fill-color: #f7fbff;
    font-size: 10px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.tarot-kingdom-rulebook-jump button:hover,
.tarot-kingdom-rulebook-jump button:focus-visible {
    border-color: #e7bd58;
    background: linear-gradient(135deg, rgba(50, 75, 120, 0.82), rgba(35, 60, 100, 0.78));
    outline: none;
}

.tarot-kingdom-rulebook-jump button > span {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    border: 1px solid rgba(231, 189, 88, 0.54);
    border-radius: 50%;
    color: #ffe398;
    -webkit-text-fill-color: #ffe398;
    font-size: 10px;
}

.tarot-kingdom-rulebook-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.tarot-kingdom-rulebook-facts > div {
    display: flex;
    min-height: 75px;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(111, 139, 190, 0.32);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(25, 45, 80, 0.6), rgba(12, 25, 55, 0.56));
    transition: all 200ms ease;
}

.tarot-kingdom-rulebook-facts > div:hover {
    border-color: rgba(230, 189, 88, 0.4);
    background: linear-gradient(135deg, rgba(35, 55, 95, 0.68), rgba(20, 35, 65, 0.64));
}

.tarot-kingdom-rulebook-facts strong {
    color: #f1c95f;
    font: 900 25px/1 Georgia, serif;
}

.tarot-kingdom-rulebook-facts span {
    color: #b9c7df;
    font-size: 10px;
    line-height: 1.45;
}

.tarot-kingdom-rulebook-judge-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin: 0 0 15px;
    padding: 0;
    list-style: none;
}

.tarot-kingdom-rulebook-judge-flow li {
    position: relative;
    display: flex;
    min-height: 56px;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(111, 139, 190, 0.3);
    border-radius: 10px;
    background: rgba(13, 28, 59, 0.62);
}

.tarot-kingdom-rulebook-judge-flow li:not(:last-child)::after {
    position: absolute;
    z-index: 1;
    top: 50%;
    right: -8px;
    color: #e7bd58;
    content: "›";
    font-size: 15px;
    transform: translateY(-55%);
}

.tarot-kingdom-rulebook-judge-flow li > span {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    border-radius: 50%;
    background: rgba(231, 189, 88, 0.16);
    color: #f4cd65;
    font-size: 9px;
    font-weight: 900;
}

.tarot-kingdom-rulebook-judge-flow strong,
.tarot-kingdom-rulebook-judge-flow small {
    display: block;
}

.tarot-kingdom-rulebook-judge-flow strong {
    color: #eef4ff;
    font-size: 10px;
}

.tarot-kingdom-rulebook-judge-flow small {
    margin-top: 2px;
    color: #93a5c5;
    font-size: 8px;
    line-height: 1.35;
}

.tarot-kingdom-rulebook-copy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.tarot-kingdom-rulebook-copy-grid > div {
    padding: 13px 14px;
    border-left: 3px solid rgba(224, 183, 74, 0.72);
    background: linear-gradient(to right, rgba(20, 40, 75, 0.48), rgba(13, 25, 53, 0.44));
    border-radius: 0 8px 8px 0;
    transition: all 200ms ease;
}

.tarot-kingdom-rulebook-copy-grid > div:hover {
    border-left-color: rgba(255, 244, 197, 0.88);
    background: linear-gradient(to right, rgba(30, 50, 90, 0.56), rgba(18, 32, 65, 0.52));
}

.tarot-kingdom-rulebook-suits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    align-items: center;
    margin-top: 15px;
}

.tarot-kingdom-rulebook-suits-caption {
    margin: 15px 0 -4px;
    color: #f0ce75;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

.tarot-kingdom-rulebook-suits > div {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(15, 30, 60, 0.64), rgba(8, 18, 45, 0.6));
    transition: all 200ms ease;
}

.tarot-kingdom-rulebook-suits > div:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(20, 40, 75, 0.72), rgba(12, 25, 55, 0.68));
}

.tarot-kingdom-rulebook-card-image {
    --rulebook-card-scale: 0.5833;

    position: relative;
    display: inline-block;
    width: 28px;
    height: 47px;
    flex: 0 0 28px;
    overflow: hidden;
    border: 1px solid rgba(208, 220, 245, 0.48);
    border-radius: 3px;
    background: #050812;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.42);
    vertical-align: middle;
}

.tarot-kingdom-rulebook-card-image::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 80px;
    background-image: url('Sprites/Buildings/tarot.png');
    background-repeat: no-repeat;
    background-position: var(--rulebook-card-x, 0) var(--rulebook-card-y, 0);
    background-size: 512px 1024px;
    content: '';
    image-rendering: pixelated;
    transform: scale(var(--rulebook-card-scale));
    transform-origin: top left;
}

.tarot-kingdom-rulebook-card-image.has-rank-badge::after {
    position: absolute;
    z-index: 1;
    right: 1px;
    bottom: 1px;
    display: grid;
    min-width: 17px;
    height: 17px;
    place-items: center;
    padding: 0 3px;
    border: 1px solid rgba(255, 228, 152, 0.9);
    border-radius: 5px;
    background: rgba(3, 8, 24, 0.92);
    color: #fff4c5;
    content: attr(data-rulebook-card-rank);
    font: 900 9px/1 system-ui, sans-serif;
    text-shadow: 0 1px 1px #000000;
}

.tarot-kingdom-rulebook-card-image.has-rank-badge[data-rulebook-card-suit="Wand"]::after {
    border-color: #ffaaa2;
    background: #8f2727;
    color: #fff4ef;
}

.tarot-kingdom-rulebook-card-image.has-rank-badge[data-rulebook-card-suit="Cup"]::after {
    border-color: #9fcaff;
    background: #245aa8;
    color: #f2f8ff;
}

.tarot-kingdom-rulebook-card-image.has-rank-badge[data-rulebook-card-suit="Sword"]::after {
    border-color: #d2b8ff;
    background: #66449a;
    color: #fbf6ff;
}

.tarot-kingdom-rulebook-card-image.has-rank-badge[data-rulebook-card-suit="Pentacle"]::after {
    border-color: #a9e7ba;
    background: #277343;
    color: #f0fff3;
}

.tarot-kingdom-rulebook-card-image.has-rank-badge.is-major::after {
    border-color: #ffe7a0;
    background: #82601d;
    color: #fff8d8;
}

.tarot-kingdom-rulebook-card-image.is-major {
    border-color: rgba(242, 213, 129, 0.72);
    box-shadow: 0 3px 9px rgba(202, 155, 48, 0.24);
}

.tarot-kingdom-rulebook-suits > div > strong {
    color: #e8eefb;
    font-size: 11px;
}

.tarot-kingdom-rulebook-suits-diagram {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    margin: 18px auto 4px;
}

.tarot-kingdom-rulebook-table-wrap {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid rgba(128, 151, 194, 0.28);
    border-radius: 12px;
}

.tarot-kingdom-rulebook-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.tarot-kingdom-rulebook-table-wrap th,
.tarot-kingdom-rulebook-table-wrap td {
    padding: 12px 11px;
    border-bottom: 1px solid rgba(128, 151, 194, 0.2);
    color: #c8d4e8;
    font-size: 11px;
    line-height: 1.5;
    text-align: left;
    vertical-align: middle;
}

.tarot-kingdom-rulebook-table-wrap th {
    color: #fff4c5;
    background: linear-gradient(90deg, rgba(45, 70, 120, 0.82), rgba(35, 54, 91, 0.82));
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
}

.tarot-kingdom-rulebook-table-wrap th:first-child { width: 30%; }
.tarot-kingdom-rulebook-table-wrap th:last-child { width: 25%; }
.tarot-kingdom-rulebook-table-wrap tr:last-child td { border-bottom: 0; }
.tarot-kingdom-rulebook-table-wrap td:first-child { color: #f0f4fc; }

.tarot-kingdom-rulebook-table-wrap td:last-child > span,
.tarot-kingdom-rulebook-table-wrap td:last-child > small {
    display: block;
}

.tarot-kingdom-rulebook-role-condition,
.tarot-kingdom-rulebook-role-cards {
    display: block;
}

.tarot-kingdom-rulebook-role-condition {
    color: #c8d4e8;
}

.tarot-kingdom-rulebook-role-cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    margin-top: 7px;
}

.tarot-kingdom-rulebook-table-wrap td:last-child > span {
    color: #f4cd65;
    font-size: 12px;
    font-weight: 900;
}

.tarot-kingdom-rulebook-table-wrap td:last-child > small {
    margin-top: 2px;
    color: #91a8ce;
    font-size: 8px;
}

.tarot-kingdom-rulebook-order {
    display: inline-grid;
    width: 19px;
    height: 19px;
    margin-right: 5px;
    place-items: center;
    border-radius: 50%;
    background: rgba(231, 189, 88, 0.16);
    color: #e7bd58;
    font-size: 8px;
}

.tarot-kingdom-rulebook-call-rules {
    margin-top: 10px;
    padding: 13px 15px;
    border: 1px solid rgba(115, 157, 220, 0.32);
    border-radius: 13px;
    background: rgba(20, 48, 91, 0.34);
}

.tarot-kingdom-rulebook-call-rules ul {
    display: grid;
    gap: 6px;
    margin: 9px 0 8px;
    padding: 0;
    list-style: none;
}

.tarot-kingdom-rulebook-call-rules li {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 8px;
    color: #bdc9df;
    font-size: 10px;
    line-height: 1.45;
}

.tarot-kingdom-rulebook-call-rules li strong {
    color: #f2d581;
}

.tarot-kingdom-rulebook-call-rules > p {
    padding-top: 8px;
    border-top: 1px solid rgba(128, 151, 194, 0.2);
    color: #aebbd3;
    font-size: 10px;
    line-height: 1.55;
}

.tarot-kingdom-rulebook-special-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.tarot-kingdom-rulebook-special-grid > div {
    min-height: 140px;
    padding: 13px;
    border: 1px solid rgba(127, 150, 194, 0.32);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(35, 55, 95, 0.72), rgba(15, 28, 55, 0.75));
    transition: all 200ms ease;
}

.tarot-kingdom-rulebook-special-grid > div:hover {
    border-color: rgba(230, 189, 88, 0.48);
    background: linear-gradient(145deg, rgba(45, 65, 110, 0.78), rgba(20, 35, 65, 0.82));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.tarot-kingdom-rulebook-special-grid > div > .tarot-kingdom-rulebook-card-image {
    margin-bottom: 11px;
}

.tarot-kingdom-rulebook-special-grid > div > h4 {
    margin: 0 0 7px;
    color: #fff4c5;
    font: 900 13px/1.2 system-ui, sans-serif;
    letter-spacing: 0.02em;
}

.tarot-kingdom-rulebook-special-grid p {
    margin: 0;
    color: #bac6dc;
    font-size: 11px;
    line-height: 1.6;
}

.tarot-kingdom-rulebook-major-list {
    margin-top: 16px;
    padding: 15px;
    border: 1px solid rgba(210, 177, 79, 0.35);
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(55, 45, 75, 0.44), rgba(35, 25, 50, 0.42));
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tarot-kingdom-rulebook-major-list dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 14px;
    margin: 10px 0 0;
}

.tarot-kingdom-rulebook-major-list h4 {
    margin: 0 0 11px;
    color: #fff4c5;
    font: 900 12px/1.2 system-ui, sans-serif;
    letter-spacing: 0.05em;
}

.tarot-kingdom-rulebook-major-list dl > div {
    padding-top: 9px;
    border-top: 1px solid rgba(191, 163, 103, 0.22);
}

.tarot-kingdom-rulebook-major-list dt {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f2d581;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.tarot-kingdom-rulebook-major-list dd {
    margin: 4px 0 0;
    color: #bdc9df;
    font-size: 10px;
    line-height: 1.6;
}

.tarot-kingdom-rulebook-note.is-score {
    border-color: rgba(115, 157, 220, 0.38);
    background: rgba(20, 48, 91, 0.42);
}

.tarot-kingdom-rulebook-section.is-checklist ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tarot-kingdom-rulebook-section.is-checklist li {
    position: relative;
    padding: 9px 10px 9px 27px;
    border-radius: 9px;
    background: rgba(18, 34, 66, 0.52);
    color: #c8d4e8;
    font-size: 10px;
    line-height: 1.45;
}

.tarot-kingdom-rulebook-section.is-checklist li::before {
    position: absolute;
    top: 8px;
    left: 9px;
    color: #e7bd58;
    content: "✓";
    font-weight: 900;
}

.tarot-kingdom-rulebook-glossary {
    margin-top: 15px;
    padding: 14px;
    border: 1px solid rgba(128, 151, 194, 0.24);
    border-radius: 12px;
    background: rgba(8, 18, 42, 0.58);
}

.tarot-kingdom-rulebook-glossary dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    margin: 9px 0 0;
}

.tarot-kingdom-rulebook-glossary dl > div {
    padding-top: 7px;
    border-top: 1px solid rgba(128, 151, 194, 0.18);
}

.tarot-kingdom-rulebook-glossary dt {
    color: #f2d581;
    font-size: 10px;
    font-weight: 900;
}

.tarot-kingdom-rulebook-glossary dd {
    margin: 3px 0 0;
    color: #aebbd3;
    font-size: 9px;
    line-height: 1.5;
}

.tarot-kingdom-rulebook-footer {
    display: grid;
    gap: 9px;
    justify-items: center;
    padding: 18px 20px max(22px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(229, 190, 87, 0.25);
    background: rgba(3, 8, 24, 0.84);
}

.tarot-kingdom-rulebook-footer button {
    min-width: 190px;
    min-height: 42px;
    padding: 10px 22px;
    border: 1px solid #d7ae4d;
    border-radius: 10px;
    background: linear-gradient(180deg, #355495, #182955);
    color: #fff4c5;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 7px 18px rgba(0, 0, 0, 0.3);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.tarot-kingdom-rulebook-footer button:hover,
.tarot-kingdom-rulebook-footer button:focus-visible {
    background: linear-gradient(180deg, #4569b1, #20366d);
    outline: 2px solid rgba(245, 196, 76, 0.34);
    outline-offset: 2px;
}

.tarot-kingdom-rulebook-footer small {
    color: #7688aa;
    font-size: 9px;
}

@media (max-width: 560px) {
    .tarot-kingdom-rulebook-overlay {
        padding: 0;
    }

    .tarot-kingdom-rulebook-page {
        width: 100%;
        height: 100%;
        border: 0;
        border-radius: 0;
    }

    .tarot-kingdom-rulebook-header {
        padding: max(15px, env(safe-area-inset-top)) max(15px, env(safe-area-inset-right)) 14px max(15px, env(safe-area-inset-left));
    }

    .tarot-kingdom-rulebook-header h2 {
        margin: 3px 0 4px;
        font-size: 21px;
    }

    .tarot-kingdom-rulebook-header h2 span {
        display: block;
        font-size: 15px;
    }

    .tarot-kingdom-rulebook-header p {
        max-width: 280px;
        font-size: 9px;
        line-height: 1.45;
    }

    .tarot-kingdom-rulebook-nav {
        padding: 10px 12px;
    }

    .tarot-kingdom-rulebook-body {
        padding: 2px 12px 22px;
    }

    .tarot-kingdom-rulebook-section {
        padding: 18px 2px 22px;
        scroll-margin-top: 140px;
    }

    .tarot-kingdom-rulebook-section h3 {
        margin: 6px 0 12px;
        font-size: 20px;
    }

    .tarot-kingdom-rulebook-steps,
    .tarot-kingdom-rulebook-copy-grid,
    .tarot-kingdom-rulebook-major-list dl,
    .tarot-kingdom-rulebook-section.is-checklist ul,
    .tarot-kingdom-rulebook-glossary dl {
        grid-template-columns: 1fr;
    }

    .tarot-kingdom-rulebook-judge-flow {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tarot-kingdom-rulebook-judge-flow li:nth-child(2)::after {
        display: none;
    }

    .tarot-kingdom-rulebook-facts {
        gap: 5px;
    }

    .tarot-kingdom-rulebook-facts > div {
        min-height: 72px;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 7px 4px;
        text-align: center;
    }

    .tarot-kingdom-rulebook-facts strong {
        font-size: 22px;
    }

    .tarot-kingdom-rulebook-facts span {
        font-size: 8px;
    }

    .tarot-kingdom-rulebook-table-wrap th,
    .tarot-kingdom-rulebook-table-wrap td {
        padding: 8px 6px;
        font-size: 8px;
    }

    .tarot-kingdom-rulebook-table-wrap thead {
        display: none;
    }

    .tarot-kingdom-rulebook-table-wrap tbody {
        display: grid;
        gap: 8px;
        padding: 8px;
    }

    .tarot-kingdom-rulebook-table-wrap tr {
        display: grid;
        grid-template-columns: 1fr auto;
        padding: 10px;
        border: 1px solid rgba(128, 151, 194, 0.24);
        border-radius: 10px;
        background: rgba(13, 28, 59, 0.54);
    }

    .tarot-kingdom-rulebook-table-wrap td {
        padding: 0;
        border-bottom: 0;
    }

    .tarot-kingdom-rulebook-table-wrap td:first-child {
        display: flex;
        align-items: center;
        grid-column: 1;
        grid-row: 1;
    }

    .tarot-kingdom-rulebook-table-wrap td:nth-child(2) {
        grid-column: 1 / -1;
        grid-row: 2;
        padding-top: 9px;
    }

    .tarot-kingdom-rulebook-table-wrap td:last-child {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
    }

    .tarot-kingdom-rulebook-table-wrap td:first-child strong {
        margin-top: 0;
        font-size: 11px;
    }

    .tarot-kingdom-rulebook-role-condition {
        font-size: 10px;
        line-height: 1.55;
    }

    .tarot-kingdom-rulebook-role-cards {
        margin-top: 8px;
    }

    .tarot-kingdom-rulebook-special-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tarot-kingdom-rulebook-special-grid > div {
        min-height: 125px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-kingdom-rulebook-page {
        scroll-behavior: auto;
    }
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    min-height: 100%;
    overscroll-behavior: none;
    background-color: var(--bg-color);
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
    overscroll-behavior: none;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, rgba(4, 5, 7, 0.78), rgba(9, 8, 6, 0.96)),
        radial-gradient(ellipse at 16% 14%, rgba(25, 70, 92, 0.36), transparent 42%),
        radial-gradient(ellipse at 84% 16%, rgba(115, 67, 18, 0.34), transparent 40%),
        repeating-linear-gradient(90deg, #190f08 0 34px, #0f0905 34px 68px);
}

#appWrapper {
    min-height: 100dvh;
    max-width: 1040px;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(7, 10, 13, 0.2), rgba(8, 6, 5, 0.76)),
        linear-gradient(90deg, rgba(220, 169, 82, 0.05), transparent 16%, transparent 84%, rgba(220, 169, 82, 0.05));
}

h1, h2 {
    margin: 0;
    font-weight: 900;
    letter-spacing: 0.05em;
}

h2 {
    font-size: 15px;
    color: var(--accent-color);
    margin-bottom: 12px;
    border-bottom: none;
    padding-bottom: 0;
}

/* --- ボタン共通スタイル --- */
button {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: #fff;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
    min-height: 46px;
}

button:active {
    transform: scale(0.96);
}

button:disabled {
    background: #4b5563;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.ui-modal-close {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    max-width: 52px;
    max-height: 52px;
    flex: 0 0 52px;
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--icon-action-close) center / 38px 38px no-repeat;
    color: transparent;
    font-size: 0;
    line-height: 0;
    text-indent: -9999px;
    filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.62));
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.ui-modal-close:not(:disabled):is(:hover, :focus-visible) {
    filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.62)) brightness(1.12);
}

.ui-modal-close:not(:disabled):active {
    transform: translateY(1px) scale(0.97);
}

.ui-modal-close:focus-visible {
    outline: 2px solid rgba(248, 226, 168, 0.92);
    outline-offset: 2px;
}

/* --- グローバルステータスバー (ヘッダー) --- */
#globalStatusBar {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(7, 8, 10, 0.96), rgba(18, 12, 7, 0.92)),
        repeating-linear-gradient(90deg, rgba(90, 47, 20, 0.28) 0 28px, rgba(34, 20, 11, 0.28) 28px 56px);
    backdrop-filter: blur(8px);
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(220, 169, 82, 0.38);
    z-index: 1000;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.48);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

#globalPlayerInfoTop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    gap: 10px;
    width: min(100%, 980px);
    justify-self: center;
    min-height: 46px;
    padding: 6px 10px;
    border: 1px solid rgba(220, 169, 82, 0.36);
    border-radius: 8px;
    background: rgba(7, 10, 14, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.07);
}

#globalPlayerInfo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    min-width: 0;
}

#globalPlayerName {
    appearance: none;
    border: 0;
    background: transparent;
    color: #f9e4b5;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: bold;
    font-size: clamp(16px, 2.5vw, 24px);
    cursor: pointer;
    display: inline-block;
    max-width: min(52vw, 440px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 0 #000;
}

#globalPlayerName:hover,
#globalPlayerName:focus-visible {
    color: var(--accent-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.global-rank-badge {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, 0.34);
    background: linear-gradient(180deg, rgba(70, 45, 24, 0.88), rgba(20, 14, 10, 0.9));
    color: #ffe2a0;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    max-width: 24vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-color: rgba(235, 194, 116, 0.56);
}

.currency-display {
    background: linear-gradient(180deg, rgba(32, 27, 22, 0.96), rgba(8, 10, 13, 0.98));
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 22px;
    color: #f1d37b;
    border: 1px solid rgba(235, 194, 116, 0.62);
    flex-shrink: 0;
    border-color: rgba(245, 158, 11, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.18), 0 3px 10px rgba(0, 0, 0, 0.36);
    min-width: clamp(118px, 24vw, 150px);
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 900;
    overflow: visible;
    font-family: Georgia, "Times New Roman", "Yu Mincho", serif;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 2px 0 #3a1b06,
        0 0 4px rgba(0, 0, 0, 0.72),
        0 0 7px rgba(235, 176, 60, 0.28);
}

/* --- コンテンツエリア (カード) --- */
.content-area {
    background: linear-gradient(180deg, rgba(32, 20, 12, 0.95), rgba(12, 9, 8, 0.96)),
        repeating-linear-gradient(90deg, rgba(103, 57, 24, 0.18) 0 24px, rgba(24, 15, 9, 0.18) 24px 48px);
    border-radius: 8px;
    padding: 16px 14px;
    margin: 12px var(--app-gutter);
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.08),
        0 12px 26px rgba(0, 0, 0, 0.38);
    border: 1px solid rgba(220, 169, 82, 0.38);
    position: relative;
    overflow: hidden;
}

.content-area::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.06) 45%, transparent 70%);
    transform: translateX(-120%);
    animation: cardSheen 10s ease-in-out infinite;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .content-area::after {
        animation: none;
    }
}

.home-hero-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.home-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
    min-height: 132px;
}

.home-ps-card {
    display: grid;
    align-items: center;
    gap: 12px;
    padding: 15px 16px 12px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(243, 214, 151, 0.96), rgba(188, 141, 73, 0.94)),
        repeating-linear-gradient(0deg, rgba(87, 49, 23, 0.12) 0 1px, transparent 1px 8px);
    border: 1px solid rgba(98, 54, 23, 0.5);
    box-shadow: inset 0 0 0 3px rgba(74, 38, 17, 0.14), 0 10px 22px rgba(0, 0, 0, 0.34);
    position: relative;
    overflow: visible;
    color: #201107;
    width: min(356px, calc(100% - 92px));
    min-height: 132px;
    margin: 4px 0 0 2px;
    margin-top: 0;
    margin-left: 0;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: 10px;
    row-gap: 0;
}

.home-exp-card {
    position: static;
    margin-bottom: 0;
    width: min(372px, calc(100% - 24px));
    padding: 14px 14px 16px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(16, 11, 8, 0.86), rgba(4, 4, 5, 0.94)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.1), transparent 58%);
    border: 13px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-align: center;
    margin-top: 22px;
    min-height: 210px;
    display: grid;
    grid-template-columns: 98px minmax(0, 1fr);
    grid-template-areas: "rank values"
        "rank bar"
        "rank vitals"
        "button button";
    column-gap: 16px;
    row-gap: 8px;
    align-items: center;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 13px / 0 stretch;
}

.home-exp-header {
    display: grid;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    margin-bottom: 6px;
    grid-area: rank;
    align-self: stretch;
    place-items: center;
}

.home-exp-bar {
    height: 12px;
    background: rgba(9, 8, 7, 0.72);
    border-radius: 999px;
    overflow: hidden;
    grid-area: bar;
    border: 1px solid rgba(214, 165, 85, 0.58);
}

.home-exp-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.9), rgba(251, 191, 36, 0.9));
    width: 0%;
    transition: width 0.35s ease;
}

.home-exp-values {
    margin-top: 6px;
    font-size: 17px;
    color: #efe1c4;
    text-align: center;
    grid-area: values;
    justify-self: stretch;
    font-weight: 900;
    line-height: 1.2;
}

.troy-order-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.home-player-ship-head {
    display: grid;
    place-items: center;
    gap: 0;
    color: var(--text-sub);
    font-size: 9px;
    text-align: center;
    position: absolute;
    top: 24px;
    left: 50%;
    width: 96px;
    transform: translateX(-50%);
    z-index: 2;
}

.home-player-ship-head strong {
    color: #fde68a;
    font-size: 10px;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-player-ship-title,
button.home-player-ship-name {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    line-height: 1.15;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
}

.home-player-ship-body {
    display: grid;
    place-items: center;
    gap: 0;
    margin-top: 0;
    position: absolute;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.home-player-ship-icon {
    width: 62px;
    height: 62px;
    border-radius: 0;
    background: url("./Sprites/Ships/ships.png") var(--player-ship-sprite-x, -56px) 0 / 1792px 896px no-repeat;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 0 white) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.72));
}

.home-player-ship-icon.is-boat { --player-ship-sprite-x: -56px; }
.home-player-ship-icon.is-explorer { --player-ship-sprite-x: -392px; }
.home-player-ship-icon.is-defender { --player-ship-sprite-x: -728px; }
.home-player-ship-icon.is-fighter { --player-ship-sprite-x: -1064px; }
.home-player-ship-icon.is-merchant { --player-ship-sprite-x: -1400px; }
.home-player-ship-icon.is-guild {
    --player-ship-group-x: 0px;
    --player-ship-sprite-x: -56px;
    --guild-hull-frame-x: -64px;
    --guild-hull-animation-x: 0px;
    --guild-sail-frame-x: -64px;
    --guild-sail-animation-x: 0px;
    --guild-top-y: 0px;
    position: relative;
    overflow: hidden;
    background: none;
}

.home-guild-ship-layer {
    position: absolute;
    inset: 0;
    image-rendering: pixelated;
    pointer-events: none;
    background-image: url("./Sprites/Ships/guildShips.png");
    background-repeat: no-repeat;
    background-size: 1344px 768px;
}

.home-guild-ship-layer.is-hull {
    background-position: var(--guild-hull-frame-x, -64px) var(--guild-top-y, 0px);
}

.home-guild-ship-layer.is-sail-top {
    background-position: var(--guild-sail-frame-x, -64px) var(--guild-top-y, 0px);
}

.home-guild-ship-layer.is-sail-middle {
    background-position: var(--guild-sail-frame-x, -64px) calc(var(--guild-top-y, 0px) - 256px);
}

.home-guild-ship-layer.is-sail-bottom {
    background-position: var(--guild-sail-frame-x, -64px) calc(var(--guild-top-y, 0px) - 512px);
}

.home-guild-ship-layer.is-white {
    display: none;
}

.home-player-ship-meta,
.home-player-ship-empty,
.home-player-ship-final {
    color: var(--text-sub);
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
}

.home-player-ship-upgrades {
    display: grid;
    gap: 3px;
    margin-top: 5px;
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: calc(100% - 14px);
    margin: 0;
    transform: translateX(-50%);
    z-index: 2;
}

.home-player-ship-upgrades button {
    min-height: 34px;
    padding: 4px 7px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(70, 181, 238, 0.24), rgba(3, 28, 45, 0.32)),
        linear-gradient(180deg, #104c70, #071b29);
    color: #eff8ff;
    font-size: 15px;
    font-weight: 800;
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 10px / 0 stretch;
    width: 100%;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    line-height: 1.05;
}

.home-player-ship-upgrades button span {
    display: block;
    margin-top: 2px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.1;
    opacity: 0.8;
}

.home-player-ship-icon.is-exploring-sail {
    animation: homePlayerShipSail 620ms ease-in-out infinite;
}

.home-player-ship-icon.is-exploring-up {
    animation: homePlayerShipLookUp 780ms ease-in-out infinite;
}

.home-player-ship-icon.is-exploring-left {
    animation: homePlayerShipLookLeft 760ms ease-in-out infinite;
}

.home-player-ship-icon.is-exploring-battle {
    animation: homePlayerShipBattle 160ms ease-in-out infinite;
}

.home-player-ship-icon.is-exploring-treasure {
    animation: homePlayerShipTreasure 680ms ease-in-out infinite;
}

.exploration-sequence-overlay {
    position: fixed;
    inset: 0;
    z-index: 10035;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(ellipse at 50% 18%, rgba(14, 165, 233, 0.18), transparent 42%),
        rgba(2, 6, 23, 0.72);
}

.exploration-sequence-dialog {
    width: min(620px, 100%);
    padding: 18px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 14px / 0 stretch;
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 18% 0%, rgba(253, 230, 138, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(16, 11, 7, 0.42), rgba(2, 4, 7, 0.88)),
        repeating-linear-gradient(90deg, rgba(102, 60, 27, 0.1) 0 28px, rgba(4, 6, 9, 0.1) 28px 56px);
    box-shadow:
        0 30px 78px rgba(0, 0, 0, 0.62),
        inset 0 1px 0 rgba(255, 239, 180, 0.16);
}

.exploration-sequence-scene {
    position: relative;
    height: 306px;
    overflow: hidden;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-navy-wide.png") 34 / 12px / 0 stretch;
    border-radius: 6px;
    background:
        linear-gradient(180deg, rgba(8, 47, 73, 0.06) 0%, rgba(5, 12, 18, 0.1) 42%, rgba(6, 24, 36, 0.28) 100%),
        url("./Sprites/background/sea-departure-v2.webp") center -50px / cover no-repeat;
}

.exploration-sequence-overlay.is-sky-mist .exploration-sequence-scene {
    background:
        linear-gradient(180deg, rgba(226, 232, 240, 0.2) 0%, rgba(100, 116, 139, 0.12) 42%, rgba(14, 116, 144, 0.18) 43%, rgba(15, 23, 42, 0.42) 100%),
        url("./Sprites/background/sea-departure-v2.webp") center -50px / auto 150% no-repeat;
}

.exploration-sequence-overlay.is-sky-deep .exploration-sequence-scene {
    background:
        linear-gradient(180deg, rgba(14, 165, 233, 0.08) 0%, rgba(12, 74, 110, 0.12) 42%, rgba(3, 105, 161, 0.2) 43%, rgba(8, 47, 73, 0.54) 100%),
        url("./Sprites/background/sea-departure-v2.webp") center -50px / auto 150% no-repeat;
}

.exploration-sequence-overlay.is-sky-storm .exploration-sequence-scene {
    background:
        linear-gradient(180deg, rgba(71, 85, 105, 0.34) 0%, rgba(30, 41, 59, 0.24) 42%, rgba(8, 47, 73, 0.34) 43%, rgba(15, 23, 42, 0.68) 100%),
        url("./Sprites/background/sea-departure-v2.webp") center -50px / auto 150% no-repeat;
}

.exploration-sequence-overlay.is-battle .exploration-sequence-scene,
.exploration-sequence-overlay.is-treasure .exploration-sequence-scene {
    background:
        linear-gradient(180deg, rgba(5, 12, 18, 0.1) 0%, rgba(7, 10, 15, 0.08) 48%, rgba(19, 12, 6, 0.2) 100%),
        url("./Sprites/background/deck.webp") center bottom / auto 150% no-repeat;
}

.exploration-sequence-overlay.is-returning .exploration-sequence-scene {
    background:
        radial-gradient(ellipse at 50% 70%, rgba(250, 204, 21, 0.16), transparent 34%),
        linear-gradient(180deg, rgba(14, 165, 233, 0.06), rgba(8, 47, 73, 0.48)),
        url("./Sprites/background/sea-return-v2.webp") center center / cover no-repeat;
}

.exploration-sequence-scene::before {
    content: "";
    position: absolute;
    inset: 8px;
    z-index: 1;
    pointer-events: none;
    border-radius: 4px;
    box-shadow:
        inset 0 0 42px rgba(0, 0, 0, 0.46),
        inset 0 0 0 1px rgba(255, 240, 180, 0.08);
}

.exploration-sequence-scene::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 72px;
    z-index: 1;
    height: 34px;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    opacity: 0.5;
}

.exploration-sequence-sky {
    display: none;
}

.exploration-sequence-compass {
    position: absolute;
    right: 18px;
    top: 18px;
    z-index: 2;
    width: 42px;
    aspect-ratio: 1 / 1;
    background: url("./assets/ui/icons/015.png") center / contain no-repeat;
    opacity: 0.56;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.58));
}

.exploration-sequence-horizon {
    position: absolute;
    left: 18px;
    right: 18px;
    top: 118px;
    height: 1px;
    z-index: 2;
    background: linear-gradient(90deg, transparent, rgba(254, 243, 199, 0.46), transparent);
    opacity: 0.62;
}

.exploration-sequence-arrival {
    position: absolute;
    right: 92px;
    bottom: 107px;
    width: 50px;
    height: 50px;
    z-index: 2;
    border: 2px solid rgba(254, 243, 199, 0.74);
    border-radius: 50%;
    box-shadow: inset 0 0 14px rgba(14, 165, 233, 0.18), 0 0 18px rgba(250, 204, 21, 0.22);
    opacity: 0;
    transform: scale(0.56);
    transition: opacity 260ms ease, transform 420ms ease;
}

.exploration-sequence-island {
    --exploration-island-art-bottom-offset: 0px;
    position: absolute;
    right: 30px;
    bottom: 52px;
    width: 146px;
    height: 112px;
    z-index: 2;
    display: grid;
    place-items: center;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-size: 88px;
    line-height: 1;
    opacity: 1;
    transform: none;
    text-shadow: 0 16px 18px rgba(0, 0, 0, 0.38);
    filter: brightness(0.68) saturate(0.74) blur(1.4px);
    transition: filter 320ms ease;
}

.exploration-sequence-island.has-image {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.exploration-sequence-island::before {
    content: "";
    position: absolute;
    inset: -18px -24px -12px;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 52% 58%, rgba(226, 232, 240, 0.58), rgba(148, 163, 184, 0.24) 46%, transparent 74%);
    filter: blur(8px);
    opacity: 0.72;
}

.exploration-sequence-island.has-image img {
    position: relative;
    z-index: 2;
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 16px 16px rgba(0, 0, 0, 0.42));
}

.exploration-sequence-boss {
    position: absolute;
    right: 20px;
    bottom: 118px;
    display: grid;
    place-items: center;
    width: 96px;
    height: 126px;
    z-index: 4;
    opacity: 0;
    transform: scale(0.55);
    filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 18px rgba(248, 113, 113, 0.28));
    pointer-events: none;
}

.exploration-boss-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.exploration-sequence-boss-image {
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

.exploration-sequence-boss small {
    position: absolute;
    left: 50%;
    bottom: 0;
    display: inline-grid;
    place-items: center;
    min-width: 44px;
    min-height: 18px;
    padding: 1px 6px;
    transform: translateX(-50%);
    border: 1px solid rgba(254, 202, 202, 0.72);
    border-radius: 999px;
    background: rgba(69, 10, 10, 0.82);
    color: #fecaca;
    font-family: var(--font-main, system-ui, sans-serif);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
}

.exploration-sequence-avatar {
    --avatar-attack-x: -48px;
    --avatar-attack-recoil-x: -34px;
    --avatar-attack-y: 0px;
    --avatar-combat-scale: 2.05;
    --avatar-combat-scale-hit: 2.14;
    --avatar-facing-scale-x: -1;
    --avatar-slash-left: -30px;
    --avatar-slash-top: 8px;
    position: absolute;
    right: 86px;
    bottom: 70px;
    width: 64px;
    height: 64px;
    z-index: 6;
    opacity: 0;
    image-rendering: pixelated;
    pointer-events: none;
    filter: drop-shadow(0 14px 12px rgba(0, 0, 0, 0.44));
}

.exploration-sequence-overlay.is-boss-weak .exploration-sequence-boss small {
    border-color: rgba(134, 239, 172, 0.76);
    background: rgba(20, 83, 45, 0.84);
    color: #bbf7d0;
}

.exploration-sequence-overlay.is-boss-medium .exploration-sequence-boss small {
    border-color: rgba(253, 186, 116, 0.82);
    background: rgba(124, 45, 18, 0.84);
    color: #fed7aa;
}

.exploration-sequence-overlay.is-boss-strong .exploration-sequence-boss small {
    border-color: rgba(252, 165, 165, 0.86);
    background: rgba(127, 29, 29, 0.88);
    color: #fee2e2;
}

.exploration-sequence-ship-effect {
    position: absolute;
    left: 226px;
    bottom: 98px;
    width: 96px;
    height: 96px;
    z-index: 5;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.exploration-sequence-ship {
    --exploration-ship-start-left: clamp(28px, calc(100% - 540px), 42px);
    --exploration-ship-docked-left: calc(100% - 216px);
    --exploration-ship-bottom: 64px;
    --exploration-ship-scale: 1.8;
    --exploration-ship-voyage-delay: 0ms;
    position: absolute;
    left: var(--exploration-ship-start-left);
    bottom: var(--exploration-ship-bottom);
    width: 64px;
    height: 64px;
    z-index: 6;
    background: url("./Sprites/Ships/ships.png") var(--player-ship-sprite-x, -64px) var(--player-ship-sprite-y, -128px) / 2048px 1024px no-repeat;
    image-rendering: pixelated;
    transform: scale(var(--exploration-ship-scale));
    filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.34));
}

.exploration-sequence-ship.is-boat { --player-ship-group-x: 0px; --player-ship-sprite-x: -64px; --player-ship-sprite-y: -128px; }
.exploration-sequence-ship.is-explorer { --player-ship-group-x: -384px; --player-ship-sprite-x: -448px; --player-ship-sprite-y: -128px; }
.exploration-sequence-ship.is-defender { --player-ship-group-x: -768px; --player-ship-sprite-x: -832px; --player-ship-sprite-y: -128px; }
.exploration-sequence-ship.is-fighter { --player-ship-group-x: -1152px; --player-ship-sprite-x: -1216px; --player-ship-sprite-y: -128px; }
.exploration-sequence-ship.is-merchant { --player-ship-group-x: -1536px; --player-ship-sprite-x: -1600px; --player-ship-sprite-y: -128px; }
.exploration-sequence-ship.is-guild {
    --player-ship-group-x: 0px;
    --player-ship-sprite-x: -64px;
    --player-ship-sprite-y: -128px;
    --guild-hull-frame-x: -64px;
    --guild-hull-animation-x: 0px;
    --guild-sail-frame-x: -64px;
    --guild-sail-animation-x: 0px;
    --guild-top-y: -128px;
    overflow: hidden;
    background: none;
}

.exploration-sequence-ship.is-party-member {
    z-index: 5;
    opacity: 0.94;
    filter: drop-shadow(0 9px 9px rgba(0, 0, 0, 0.38));
}

.exploration-sequence-ship.is-party-position-1 {
    --exploration-ship-start-left: 4px;
    --exploration-ship-docked-left: max(0px, calc(100% - 300px));
    --exploration-ship-bottom: 118px;
    --exploration-ship-scale: 1.12;
}

.exploration-sequence-ship.is-party-position-2 {
    --exploration-ship-start-left: 14px;
    --exploration-ship-docked-left: max(4px, calc(100% - 326px));
    --exploration-ship-bottom: 28px;
    --exploration-ship-scale: 1.05;
}

.exploration-sequence-ship.is-party-position-3 {
    --exploration-ship-start-left: 26px;
    --exploration-ship-docked-left: max(8px, calc(100% - 350px));
    --exploration-ship-bottom: 78px;
    --exploration-ship-scale: 0.98;
}

.exploration-sequence-chests {
    position: absolute;
    right: 88px;
    bottom: 102px;
    min-width: 72px;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 260ms ease, transform 260ms ease, filter 260ms ease;
    z-index: 5;
}

.exploration-sequence-log {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 7;
    display: grid;
    gap: 3px;
    pointer-events: none;
}

.exploration-sequence-log div {
    padding: 4px 7px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 7px / 0 stretch;
    border-radius: 5px;
    background: rgba(2, 6, 23, 0.62);
    color: #e0f2fe;
    font-size: 11px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exploration-sequence-mini-chest {
    width: 42px;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
    background: url("./Sprites/items/Chest/chest2_idle_strip8.png") 0 0 / 800% 100% no-repeat;
    filter: drop-shadow(0 0 18px rgba(250, 204, 21, 0.62));
    animation-delay: calc(var(--i) * 90ms);
}

.exploration-sequence-chest-more {
    min-width: 34px;
    padding: 3px 6px;
    border: 1px solid rgba(250, 204, 21, 0.44);
    border-radius: 6px;
    background: rgba(17, 24, 39, 0.82);
    color: #fde68a;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.22);
}

.exploration-sequence-no-chest {
    display: grid;
    place-items: center;
    min-width: 74px;
    min-height: 40px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.78);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

.exploration-sequence-overlay.is-voyage .exploration-sequence-ship:not(.is-party-member),
.exploration-sequence-overlay.is-returning .exploration-sequence-ship:not(.is-party-member) {
    --exploration-ship-bottom: calc(50% - 32px);
}

.exploration-sequence-overlay.is-voyage .exploration-sequence-ship {
    animation:
        explorationSequenceVoyage 2880ms cubic-bezier(0.33, 0.33, 0.55, 1) var(--exploration-ship-voyage-delay) forwards,
        homePlayerShipFrameStep 300ms steps(3) infinite;
}

.exploration-sequence-overlay.is-returning .exploration-sequence-ship {
    animation:
        explorationSequenceReturnVoyage 4800ms linear forwards,
        homePlayerShipFrameStep 300ms steps(3) forwards;
}

.exploration-sequence-overlay.is-returning .exploration-sequence-arrival,
.exploration-sequence-overlay.is-returning .exploration-sequence-island,
.exploration-sequence-overlay.is-returning .exploration-sequence-boss {
    display: none;
}

.exploration-sequence-overlay.is-voyage .exploration-sequence-arrival {
    animation: explorationSequenceArrival 2880ms ease-out forwards;
}

.exploration-sequence-overlay.is-voyage .exploration-sequence-island {
    bottom: calc(50% - var(--exploration-island-art-bottom-offset) - 20px);
    animation: explorationSequenceIslandAtmosphere 2880ms ease-out forwards;
}

.exploration-sequence-overlay.is-voyage .exploration-sequence-island::before {
    animation: explorationSequenceIslandFog 2880ms ease-out forwards;
}

.exploration-sequence-overlay.is-arrival .exploration-sequence-island,
.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-island {
    filter: brightness(0.96) saturate(0.98) blur(0);
}

.exploration-sequence-overlay.is-battle .exploration-sequence-horizon,
.exploration-sequence-overlay.is-battle .exploration-sequence-arrival,
.exploration-sequence-overlay.is-battle .exploration-sequence-island {
    opacity: 0 !important;
    transition: none;
}

.exploration-sequence-overlay.is-battle .exploration-sequence-ship {
    opacity: 0;
    animation: none !important;
}

.exploration-sequence-overlay:not(.is-battle) .exploration-sequence-avatar {
    opacity: 0 !important;
}

.exploration-sequence-overlay.is-battle .exploration-sequence-boss {
    left: 42px;
    right: auto;
    bottom: 118px;
    width: 112px;
    height: 134px;
    opacity: 1;
    transform: scale(1);
    animation: none;
}

.exploration-sequence-overlay.is-battle .exploration-sequence-avatar {
    bottom: 118px;
    opacity: 1 !important;
}

.exploration-sequence-overlay.is-battle .exploration-sequence-ship-effect {
    left: 260px;
    bottom: 90px;
}

.exploration-sequence-overlay.is-battle.is-result-none .exploration-sequence-boss {
    opacity: 0.24;
    animation: none;
}

.exploration-sequence-overlay.is-battle.is-result-victory .exploration-sequence-boss {
    animation: none;
}

.exploration-sequence-overlay.is-battle.is-result-defeat .exploration-sequence-ship {
    opacity: 0;
    animation: none !important;
}

.exploration-sequence-overlay.is-battle.is-result-escaped .exploration-sequence-ship,
.exploration-sequence-overlay.is-battle.is-result-draw .exploration-sequence-ship {
    opacity: 0;
    animation: none !important;
}

.exploration-sequence-overlay.is-battle.is-defender-run .exploration-sequence-ship-effect {
    opacity: 1;
    border: 3px solid rgba(147, 197, 253, 0.72);
    box-shadow: 0 0 24px rgba(147, 197, 253, 0.52), inset 0 0 22px rgba(147, 197, 253, 0.28);
    animation: explorationSequenceShield 720ms ease-in-out infinite;
}

.exploration-sequence-overlay.is-battle.is-fighter-run .exploration-sequence-ship-effect {
    opacity: 1;
    border-radius: 0;
    background: linear-gradient(90deg, rgba(248, 113, 113, 0.0), rgba(248, 113, 113, 0.78));
    clip-path: polygon(0 44%, 100% 26%, 100% 74%, 0 56%);
    animation: explorationSequenceBlast 360ms ease-out infinite;
}

.exploration-sequence-overlay.is-battle.is-merchant-run .exploration-sequence-ship-effect {
    opacity: 1;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.76) 0 18%, transparent 20% 100%);
    animation: explorationSequenceCoin 660ms ease-in-out infinite;
}

.exploration-sequence-overlay.is-sail.is-explorer-run .exploration-sequence-ship {
    animation-duration: 540ms;
}

.exploration-sequence-overlay.is-treasure .exploration-sequence-ship,
.exploration-sequence-overlay.is-treasure .exploration-sequence-horizon,
.exploration-sequence-overlay.is-treasure .exploration-sequence-arrival,
.exploration-sequence-overlay.is-treasure .exploration-sequence-island,
.exploration-sequence-overlay.is-treasure .exploration-sequence-log {
    opacity: 0 !important;
    animation: none !important;
    transition: none;
}

.home-player-ship-frame:not(.is-exploring) .home-player-ship-icon.is-guild .home-guild-ship-layer.is-hull,
.exploration-sequence-overlay.is-sail .exploration-sequence-ship.is-guild .home-guild-ship-layer.is-hull,
.exploration-sequence-overlay.is-up .exploration-sequence-ship.is-guild .home-guild-ship-layer.is-hull,
.exploration-sequence-overlay.is-left .exploration-sequence-ship.is-guild .home-guild-ship-layer.is-hull,
.exploration-sequence-overlay.is-battle .exploration-sequence-ship.is-guild .home-guild-ship-layer.is-hull,
.exploration-sequence-overlay.is-returning .exploration-sequence-ship.is-guild .home-guild-ship-layer.is-hull,
.exploration-sequence-overlay.is-treasure .exploration-sequence-ship.is-guild .home-guild-ship-layer.is-hull {
    animation: homeGuildShipHullFrameStep 300ms steps(3) infinite;
}

.home-player-ship-frame:not(.is-exploring) .home-player-ship-icon.is-guild .home-guild-ship-layer:not(.is-hull),
.exploration-sequence-overlay.is-sail .exploration-sequence-ship.is-guild .home-guild-ship-layer:not(.is-hull),
.exploration-sequence-overlay.is-up .exploration-sequence-ship.is-guild .home-guild-ship-layer:not(.is-hull),
.exploration-sequence-overlay.is-left .exploration-sequence-ship.is-guild .home-guild-ship-layer:not(.is-hull),
.exploration-sequence-overlay.is-battle .exploration-sequence-ship.is-guild .home-guild-ship-layer:not(.is-hull),
.exploration-sequence-overlay.is-returning .exploration-sequence-ship.is-guild .home-guild-ship-layer:not(.is-hull),
.exploration-sequence-overlay.is-treasure .exploration-sequence-ship.is-guild .home-guild-ship-layer:not(.is-hull) {
    animation: homeGuildShipSailFrameStep 300ms steps(3) infinite;
}

@keyframes homeGuildShipHullFrameStep {
    from {
        background-position-x: var(--guild-hull-animation-x, 0px);
    }
    to {
        background-position-x: calc(var(--guild-hull-animation-x, 0px) - 192px);
    }
}

@keyframes homeGuildShipSailFrameStep {
    from {
        background-position-x: var(--guild-sail-animation-x, 0px);
    }
    to {
        background-position-x: calc(var(--guild-sail-animation-x, 0px) - 192px);
    }
}

.exploration-sequence-overlay.is-treasure .exploration-sequence-boss {
    opacity: 0;
}

.exploration-sequence-overlay.is-treasure .exploration-sequence-arrival {
    opacity: 0.95;
    transform: scale(1.18);
}

.exploration-sequence-overlay.is-treasure .exploration-sequence-chests {
    left: 50%;
    right: auto;
    bottom: 104px;
    min-width: 180px;
    opacity: 1;
    gap: 8px;
    transform: translateX(-50%) scale(1.28);
    filter: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.38));
}

.exploration-sequence-overlay.is-treasure .exploration-sequence-mini-chest {
    background-position: 0 0;
    animation: none;
}

.exploration-sequence-overlay.is-treasure.has-sequence-rewards .exploration-sequence-scene::after {
    background:
        radial-gradient(circle at 50% 60%, rgba(250, 204, 21, 0.28), transparent 20%),
        linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.18));
}

.exploration-sequence-overlay.is-opening-chest .exploration-sequence-mini-chest {
    background-image: url("./Sprites/items/Chest/chest2_idle_strip8.png");
    background-position: 0 0;
    animation: explorationSequenceChestPop 560ms ease-in-out 1;
}

.exploration-sequence-overlay.is-opened-chest .exploration-sequence-mini-chest {
    background-image: url("./Sprites/items/Chest/chest2_open_strip8.png");
    background-position: 100% 0;
    animation: none;
}

.exploration-sequence-overlay.is-opening-chest .exploration-sequence-chest-more,
.exploration-sequence-overlay.is-opened-chest .exploration-sequence-chest-more {
    transform: translateY(-4px);
}

.exploration-sequence-copy {
    display: grid;
    gap: 4px;
    margin-top: 14px;
    color: #bae6fd;
    text-align: center;
}

.exploration-sequence-copy strong {
    color: #fef3c7;
    font-size: 17px;
}

.exploration-sequence-copy span {
    min-height: 20px;
    font-size: 13px;
    font-weight: 800;
}

.exploration-battle-mode-choice {
    display: grid;
    gap: 9px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(212, 177, 91, 0.72);
    border-radius: 5px;
    background:
        radial-gradient(circle at 50% 0, rgba(126, 82, 180, 0.18), transparent 58%),
        rgba(8, 7, 12, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255, 238, 177, 0.06), 0 5px 14px rgba(0, 0, 0, 0.42);
}

.exploration-battle-mode-choice[hidden] {
    display: none;
}

.exploration-battle-mode-head {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 9px;
    min-width: 0;
    text-align: center;
}

.exploration-battle-mode-head span {
    color: #f87171;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.exploration-battle-mode-head strong {
    min-width: 0;
    overflow: hidden;
    color: #fff3c4;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exploration-battle-mode-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.exploration-battle-mode-actions button {
    min-width: 0;
    min-height: 46px;
    padding: 5px 7px;
    border: 9px solid transparent;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 9px / 0 stretch;
    background: transparent;
    color: #f8e7b0;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 1px 2px #000;
    cursor: pointer;
}

.exploration-battle-mode-actions button span,
.exploration-battle-mode-actions button small {
    display: block;
}

.exploration-battle-mode-actions button small {
    margin-top: 3px;
    color: rgba(248, 231, 176, 0.76);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
}

.exploration-battle-mode-actions button.is-online {
    border-image-source: url("./assets/ui/buttons/button-blue-large.png");
    color: #d7f1ff;
}

.exploration-battle-mode-actions button.is-online small {
    color: rgba(215, 241, 255, 0.78);
}

.exploration-battle-mode-actions button.is-cancel {
    grid-column: 1 / -1;
    min-height: 34px;
    border-image-source: url("./assets/ui/buttons/button-dark-compact.png");
    color: #cfc5ad;
    font-size: 11px;
}

.exploration-battle-mode-actions button:not(:disabled):active {
    transform: translateY(1px);
}

.exploration-battle-mode-actions button.is-selected {
    filter: brightness(1.22) drop-shadow(0 0 7px rgba(255, 221, 133, 0.38));
}

.exploration-battle-mode-actions button:disabled:not(.is-selected) {
    opacity: 0.48;
}

.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-arrival {
    opacity: 0.22;
}

.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-island {
    opacity: 1;
    filter: brightness(0.96) saturate(0.98) blur(0);
}

.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-island::before {
    opacity: 0.14;
    filter: blur(5px);
}

.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-ship {
    left: var(--exploration-ship-docked-left);
    bottom: 64px;
    opacity: 0.92;
    transform: scale(1.8);
    animation: none !important;
}

.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-boss {
    left: auto;
    right: 73px;
    bottom: 78px;
    width: 60px;
    height: 60px;
    opacity: 1;
    transform: none;
    animation: none;
    filter: drop-shadow(0 7px 6px rgba(0, 0, 0, 0.48));
}

.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-boss-image {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(var(--exploration-monster-scale)) !important;
    transform-origin: center center;
}

.exploration-sequence-overlay.is-encounter-choice .exploration-sequence-boss small {
    display: none;
}

@keyframes homePlayerShipSail {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

@keyframes homePlayerShipLookUp {
    0%, 100% { transform: translateY(-2px); }
    50% { transform: translateY(-5px); }
}

@keyframes homePlayerShipLookLeft {
    0%, 100% { transform: translateX(-4px) scaleX(-1); }
    50% { transform: translateX(-9px) scaleX(-1); }
}

@keyframes homePlayerShipBattle {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

@keyframes homePlayerShipTreasure {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 0 rgba(250, 204, 21, 0)); }
    50% { transform: translateY(-2px); filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.75)); }
}

@keyframes explorationSequenceVoyage {
    from {
        left: var(--exploration-ship-start-left);
        bottom: var(--exploration-ship-bottom);
        transform: scale(var(--exploration-ship-scale));
    }
    to {
        left: var(--exploration-ship-docked-left);
        bottom: var(--exploration-ship-bottom);
        transform: scale(var(--exploration-ship-scale));
    }
}

@keyframes explorationSequenceReturnVoyage {
    0% {
        left: calc(100% + 72px);
        bottom: var(--exploration-ship-bottom);
        opacity: 0;
        transform: scale(var(--exploration-ship-scale));
    }
    10%, 86% {
        opacity: 1;
    }
    100% {
        left: -92px;
        bottom: var(--exploration-ship-bottom);
        opacity: 0;
        transform: scale(var(--exploration-ship-scale));
    }
}

@keyframes explorationSequenceArrival {
    0%, 34% { opacity: 0; transform: scale(0.56); }
    72% { opacity: 0.18; transform: scale(0.82); }
    100% { opacity: 0.34; transform: scale(1); }
}

@keyframes explorationSequenceIslandAtmosphere {
    0% { filter: brightness(0.68) saturate(0.74) blur(1.4px); }
    48% { filter: brightness(0.78) saturate(0.82) blur(0.9px); }
    100% { filter: brightness(0.96) saturate(0.98) blur(0); }
}

@keyframes explorationSequenceIslandFog {
    0% { opacity: 0.72; filter: blur(8px); }
    54% { opacity: 0.46; filter: blur(7px); }
    100% { opacity: 0.14; filter: blur(5px); }
}

@keyframes explorationSequenceBattle {
    0%, 100% { transform: translateX(0) scale(1.8); }
    50% { transform: translateX(4px) scale(1.8); }
}

@keyframes avatarCombatAttack {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    38% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-attack-x) * 0.28)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    54% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-attack-x) * 0.08)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatPolearm {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    22% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    46%, 53% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    70% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.16)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatUnarmed {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    16% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    38%, 45% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    62% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.16)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatSlash {
    0%, 24%, 100% {
        opacity: 0;
        transform: rotate(-24deg) translateX(0) scale(0.42);
    }
    42% {
        opacity: 1;
        transform: rotate(-24deg) translateX(-10px) scale(1);
    }
    62% {
        opacity: 0;
        transform: rotate(-24deg) translateX(-18px) scale(1.12);
    }
}

@keyframes avatarCombatPolearmPierce {
    0%, 26%, 100% {
        opacity: 0;
        transform: translateX(0) scaleX(0.18);
    }
    44% {
        opacity: 1;
        transform: translateX(-32px) scaleX(1.18);
    }
    62% {
        opacity: 0;
        transform: translateX(-54px) scaleX(1.42);
    }
}

@keyframes avatarCombatMuzzle {
    0%, 42%, 100% {
        opacity: 0;
        transform: scale(0.3);
    }
    46%, 49% {
        opacity: 1;
        transform: translateX(-3px) scale(1.28);
    }
    62% {
        opacity: 0;
        transform: translateX(-12px) scale(2);
    }
}

@keyframes avatarCombatBigMuzzle {
    0%, 43%, 100% {
        opacity: 0;
        transform: translateX(0) scale(0.26);
    }
    47%, 55% {
        opacity: 1;
        transform: translateX(-10px) scale(1.58);
    }
    68% {
        opacity: 0;
        transform: translateX(-25px) scale(2.62);
    }
}

@keyframes avatarCombatShieldBash {
    0%, 30%, 100% {
        opacity: 0;
        transform: translateX(0) scaleX(0.42) scaleY(0.7);
    }
    44%, 52% {
        opacity: 0.9;
        transform: translateX(-12px) scaleX(1.08) scaleY(0.9);
    }
    70% {
        opacity: 0;
        transform: translateX(-26px) scaleX(1.34) scaleY(1.08);
    }
}

@keyframes avatarCombatSword {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    22% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.55)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    40% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.5)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    50%, 56% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    72% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.22)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatDagger {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    12% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    25% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.45)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    31%, 36% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    50% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.18)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatBlunt {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    24% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    44% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.28)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    56%, 63% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    78% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.16)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatAxe {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    22% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    44% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.22)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    58%, 64% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    78% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.18)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatGreatsword {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    24% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.45)) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    48% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    64%, 71% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    86% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.22)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatGreataxe {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    26% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.4)) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    52% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    72%, 80% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    90% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.3)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatStaff {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    28% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    52%, 60% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    76% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.2)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatShield {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    24% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    48%, 55% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    72% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.2)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatWand {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    22% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    46%, 52% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    68% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.2)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatBow {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    24% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.45)) translateY(calc(var(--avatar-attack-y) - var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    42%, 50% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) - var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    52% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    66% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.08)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatGun {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    26% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(calc(var(--avatar-attack-y) + var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    45%, 49% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) - var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    63% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.36)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    80% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.1)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatBigGun {
    0%, 100% {
        transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    20% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.5)) translateY(calc(var(--avatar-attack-y) - var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    40%, 47% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x))) translateY(calc(var(--avatar-attack-y) - var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    48%, 56% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x))) translateY(calc(var(--avatar-attack-y) - var(--avatar-motion-lift-y))) scale(var(--avatar-combat-scale-hit)) scaleX(var(--avatar-facing-scale-x));
    }
    66% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.55)) translateY(calc(var(--avatar-attack-y) - var(--avatar-motion-lift-y) * 0.5)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    78% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-forward-x) * 0.18)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    90% {
        transform: translateX(calc(var(--avatar-attack-start-x) + var(--avatar-motion-recoil-x) * 0.12)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarCombatSwordSlash {
    0%, 26%, 100% { opacity: 0; transform: rotate(-24deg) translateX(0) scale(0.34); }
    40% { opacity: 0.92; transform: rotate(-24deg) translateX(-14px) scale(0.92); }
    48%, 54% { opacity: 1; transform: rotate(-24deg) translateX(-24px) scale(1.14); }
    70% { opacity: 0; transform: rotate(-24deg) translateX(-44px) scale(1.28); }
}

@keyframes avatarCombatDaggerStab {
    0%, 18%, 100% { opacity: 0; transform: translateX(0) scaleX(0.12); }
    28%, 34% { opacity: 0.95; transform: translateX(-18px) translateY(8px) scaleX(1.08); }
    46% { opacity: 0; transform: translateX(-38px) translateY(8px) scaleX(1.18); }
}

@keyframes avatarCombatPunchImpact {
    0%, 30%, 100% { opacity: 0; transform: translateX(0) scale(0.24); }
    40%, 46% { opacity: 0.94; transform: translateX(-17px) scale(1); }
    60% { opacity: 0; transform: translateX(-31px) scale(1.34); }
}

@keyframes avatarCombatBluntImpact {
    0%, 50%, 100% { opacity: 0; transform: translateX(0) translateY(0) scale(0.22); }
    58%, 66% { opacity: 0.9; transform: translateX(-14px) translateY(9px) scale(1.04); }
    80% { opacity: 0; transform: translateX(-18px) translateY(11px) scale(1.36); }
}

@keyframes avatarCombatAxeCleave {
    0%, 46%, 100% { opacity: 0; transform: rotate(-48deg) translateX(0) translateY(0) scale(0.28); }
    54%, 62% { opacity: 0.95; transform: rotate(-48deg) translateX(-14px) translateY(8px) scale(1.06); }
    78% { opacity: 0; transform: rotate(-48deg) translateX(-28px) translateY(14px) scale(1.28); }
}

@keyframes avatarCombatGreatswordCleave {
    0%, 60%, 100% { opacity: 0; transform: rotate(-54deg) translateX(0) translateY(0) scale(0.22); }
    66%, 76% { opacity: 0.96; transform: rotate(-54deg) translateX(-16px) translateY(12px) scale(1.1); }
    92% { opacity: 0; transform: rotate(-54deg) translateX(-32px) translateY(20px) scale(1.3); }
}

@keyframes avatarCombatGreataxeCleave {
    0%, 66%, 100% { opacity: 0; transform: rotate(-72deg) translateX(0) translateY(0) scale(0.22); }
    72%, 82% { opacity: 1; transform: rotate(-72deg) translateX(-16px) translateY(14px) scale(1.22); }
    96% { opacity: 0; transform: rotate(-72deg) translateX(-32px) translateY(24px) scale(1.54); }
}

@keyframes avatarCombatStaffPulse {
    0%, 22%, 100% { opacity: 0; transform: translateX(6px) translateY(-10px) scale(0.18); filter: brightness(1); }
    38% { opacity: 0.82; transform: translateX(-4px) translateY(-16px) scale(0.58); filter: brightness(1.45); }
    52% { opacity: 1; transform: translateX(-20px) translateY(-16px) scale(0.96); filter: brightness(1.72); }
    74% { opacity: 0; transform: translateX(-52px) translateY(-14px) scale(1.28); filter: brightness(1.18); }
}

@keyframes avatarCombatWandSpark {
    0%, 20%, 100% { opacity: 0; transform: translateX(6px) translateY(0) scale(0.18); filter: brightness(1); }
    34% { opacity: 1; transform: translateX(-4px) translateY(-6px) scale(0.58); filter: brightness(1.55); }
    48% { opacity: 1; transform: translateX(-24px) translateY(-7px) scale(0.86); filter: brightness(1.75); }
    68% { opacity: 0; transform: translateX(-50px) translateY(-5px) scale(0.82); filter: brightness(1.12); }
}

@keyframes avatarCombatArrowShot {
    0%, 46%, 100% { opacity: 0; transform: translateX(18px) scaleX(0.18); }
    50% { opacity: 0.9; transform: translateX(15px) scaleX(0.72); }
    54% { opacity: 1; transform: translateX(0) scaleX(0.9); }
    66% { opacity: 1; transform: translateX(-64px) scaleX(1.08); }
    80% { opacity: 0; transform: translateX(-116px) scaleX(1.18); }
}

@keyframes avatarWeaponGunRecoil {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-2deg); filter: none; }
    26% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 0) rotate(-3deg); filter: brightness(1.05); }
    45%, 49% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(8px, 1px) rotate(4deg); filter: brightness(1.34) drop-shadow(0 0 5px rgba(251, 191, 36, 0.78)); }
    63% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(3px, 0) rotate(1deg); filter: brightness(1.08); }
    80% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-1deg); filter: none; }
}

@keyframes avatarWeaponBigGunRecoil {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-2deg); filter: none; }
    20% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 1px) rotate(-3deg); filter: brightness(1.04); }
    40%, 47% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 2px) rotate(-4deg); filter: brightness(1.08); }
    48%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(15px, 3px) rotate(5deg); filter: brightness(1.48) drop-shadow(0 0 9px rgba(251, 191, 36, 0.88)); }
    66% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(8px, 1px) rotate(2deg); filter: brightness(1.12); }
    78% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 0) rotate(-3deg); filter: none; }
    90% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, 0) rotate(-1deg); filter: none; }
}

@keyframes avatarWeaponPolearmThrust {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    18% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -1px) rotate(-34deg); }
    36% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-68deg); }
    46%, 54% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-7px, 2px) rotate(-88deg); }
    70% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 0) rotate(-54deg); }
}

@keyframes avatarHandGunGrip {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-2deg); }
    26% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 0) rotate(-3deg); }
    45%, 49% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(8px, 1px) rotate(3deg); }
    63% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(3px, 0) rotate(1deg); }
    80% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-1deg); }
}

@keyframes avatarHandBigGunGrip {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-2deg); }
    20% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 1px) rotate(-3deg); }
    40%, 47% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 2px) rotate(-4deg); }
    48%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(15px, 3px) rotate(4deg); }
    66% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(8px, 1px) rotate(2deg); }
    78% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 0) rotate(-3deg); }
    90% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, 0) rotate(-1deg); }
}

@keyframes avatarHandPolearmGrip {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    18% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -1px) rotate(-3deg); }
    36% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-5deg); }
    46%, 54% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-7px, 2px) rotate(-8deg); }
    70% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 0) rotate(-3deg); }
}

@keyframes avatarHandPunch {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    16% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(3px, 1px) rotate(5deg); }
    38%, 45% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-13px, 1px) rotate(-9deg); }
    62% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 0) rotate(-2deg); }
}

@keyframes avatarHandSwordCut {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    28% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -2px) rotate(-5deg); }
    44%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 0) rotate(-7deg); }
    72% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-4px, 1px) rotate(-9deg); }
}

@keyframes avatarWeaponSwordCut {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-6deg); }
    28% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -2px) rotate(-34deg); }
    44%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 0) rotate(-92deg); }
    72% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 2px) rotate(-118deg); }
}

@keyframes avatarWeaponDaggerJab {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-8deg); }
    18% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 3px) rotate(-36deg); }
    28%, 36% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-11px, 8px) rotate(-88deg); }
    48% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 3px) rotate(-42deg); }
    64% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 0) rotate(-18deg); }
}

@keyframes avatarWeaponBluntSmash {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-6deg); }
    22% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -3px) rotate(-24deg); }
    40% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -8px) rotate(-42deg); }
    56%, 64% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-4px, 6px) rotate(-68deg); }
    78% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 2px) rotate(-36deg); }
}

@keyframes avatarWeaponAxeChop {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-5deg); }
    22% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -4px) rotate(-34deg); }
    40% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -8px) rotate(-52deg); }
    54%, 62% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-4px, 7px) rotate(-76deg); }
    76% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 2px) rotate(-40deg); }
}

@keyframes avatarWeaponGreatswordDrop {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-6deg); filter: none; }
    24%, 50% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(3px, -5px) rotate(-38deg); filter: brightness(1.05); }
    66%, 78% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-5px, 7px) rotate(-82deg); filter: brightness(1.18) drop-shadow(0 0 4px rgba(254, 240, 138, 0.55)); }
    90% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 3px) rotate(-48deg); filter: brightness(1.04); }
}

@keyframes avatarWeaponGreataxeDrop {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-6deg); filter: none; }
    28%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(4px, -9px) rotate(-48deg); filter: brightness(1.04); }
    74%, 86% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-5px, 8px) rotate(-88deg); filter: brightness(1.22) drop-shadow(0 0 5px rgba(254, 215, 170, 0.58)); }
    94% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 2px) rotate(-52deg); filter: brightness(1.04); }
}

@keyframes avatarWeaponStaffCast {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-4deg); filter: none; }
    24% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -3px) rotate(-9deg); filter: brightness(1.08); }
    42%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, -9px) rotate(-17deg); filter: brightness(1.34) drop-shadow(0 0 5px rgba(147, 197, 253, 0.85)); }
    72% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, -3px) rotate(-10deg); filter: brightness(1.08); }
}

@keyframes avatarWeaponWandFlick {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(-4deg); filter: none; }
    22% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -2px) rotate(-15deg); filter: brightness(1.08); }
    36%, 46% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, -2px) rotate(15deg); filter: brightness(1.24) drop-shadow(0 0 4px rgba(251, 191, 36, 0.72)); }
    60% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, -1px) rotate(4deg); filter: brightness(1.04); }
}

@keyframes avatarWeaponBowDraw {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); filter: none; }
    24% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-3deg); filter: brightness(1.04); }
    42%, 50% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 1px) rotate(-5deg); filter: brightness(1.1); }
    52% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 0) rotate(3deg); filter: brightness(1.08); }
    66% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 0) rotate(1deg); filter: brightness(1.04); }
}

@keyframes avatarHandDaggerJab {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    18% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 3px) rotate(-2deg); }
    28%, 36% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-11px, 8px) rotate(-4deg); }
    48% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 3px) rotate(-1deg); }
    64% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 0) rotate(0deg); }
}

@keyframes avatarHandBluntGrip {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    22% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -3px) rotate(-5deg); }
    40% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -8px) rotate(-10deg); }
    56%, 64% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-4px, 6px) rotate(-7deg); }
    78% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 2px) rotate(-3deg); }
}

@keyframes avatarHandAxeGrip {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    22% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -4px) rotate(-6deg); }
    40% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(2px, -8px) rotate(-11deg); }
    54%, 62% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-4px, 7px) rotate(-9deg); }
    76% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 2px) rotate(-4deg); }
}

@keyframes avatarHandGreatswordGrip {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    24%, 50% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(3px, -5px) rotate(-8deg); }
    66%, 78% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-5px, 7px) rotate(-10deg); }
    90% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 3px) rotate(-4deg); }
}

@keyframes avatarHandGreataxeGrip {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    28%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(4px, -9px) rotate(-12deg); }
    74%, 86% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-5px, 8px) rotate(-12deg); }
    94% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 2px) rotate(-5deg); }
}

@keyframes avatarWeaponShieldBash {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg) scale(1); }
    24% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-1deg) scale(1); }
    40%, 50% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-13px, 0) rotate(0deg) scale(1.12); }
    66% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 0) rotate(0deg) scale(1.03); }
}

@keyframes avatarHandShieldBash {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    24% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-1deg); }
    40%, 50% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-13px, 0) rotate(-2deg); }
    66% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 0) rotate(0deg); }
}

@keyframes avatarHandStaffCast {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    24% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -3px) rotate(-4deg); }
    42%, 56% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, -9px) rotate(-8deg); }
    72% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, -3px) rotate(-3deg); }
}

@keyframes avatarHandStaffFocus {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    30% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, -2px) rotate(2deg); }
    46%, 58% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, -5px) rotate(5deg); }
    74% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, -2px) rotate(2deg); }
}

@keyframes avatarHandWandFlick {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    22% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, -2px) rotate(-5deg); }
    36%, 46% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, -2px) rotate(7deg); }
    60% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 0) rotate(2deg); }
}

@keyframes avatarHandBowDraw {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    24% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(4px, 0) rotate(-2deg); }
    42%, 50% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(11px, 0) rotate(-5deg); }
    52% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-3px, 0) rotate(3deg); }
    66% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-1px, 0) rotate(1deg); }
}

@keyframes avatarHandBowHold {
    0%, 100% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
    24% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 0) rotate(-1deg); }
    42%, 50% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(1px, 1px) rotate(-2deg); }
    52% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(-2px, 0) rotate(2deg); }
    66% { transform: var(--avatar-layer-base-transform, translate(0px, 0px)) translate(0, 0) rotate(0deg); }
}

@keyframes avatarVictoryPose {
    0%, 100% {
        transform: translateX(-50%) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    22% {
        transform: translateX(calc(-50% + var(--avatar-victory-shift-x, 0px))) translateY(calc(var(--avatar-attack-y) - 15px)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    44% {
        transform: translateX(-50%) translateY(calc(var(--avatar-attack-y) - 4px)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
    62% {
        transform: translateX(calc(-50% + var(--avatar-victory-rebound-x, 0px))) translateY(calc(var(--avatar-attack-y) - 6px)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    }
}

@keyframes avatarVictoryBadge {
    0% {
        opacity: 0;
        transform: translate(-50%, 8px) scaleX(var(--avatar-facing-scale-x, 1)) scale(0.72);
    }
    22%, 78% {
        opacity: 1;
        transform: translate(-50%, 0) scaleX(var(--avatar-facing-scale-x, 1)) scale(1);
    }
    100% {
        opacity: 0.92;
        transform: translate(-50%, -3px) scaleX(var(--avatar-facing-scale-x, 1)) scale(0.96);
    }
}

@keyframes avatarVictoryLayerBob {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -3px; }
}

@keyframes avatarHeadDrop {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }
    38% {
        transform: translate(var(--avatar-defeat-head-x, 10px), 34px) rotate(var(--avatar-defeat-head-rotate, 34deg));
    }
    68% {
        transform: translate(var(--avatar-defeat-head-bounce-x, -4px), 50px) rotate(var(--avatar-defeat-head-bounce-rotate, -11deg));
    }
    100% {
        opacity: 0.96;
        transform: translate(var(--avatar-defeat-head-rest-x, 3px), 48px) rotate(var(--avatar-defeat-head-rest-rotate, 7deg));
    }
}

@keyframes explorationSequenceShipDefeat {
    0%, 100% { transform: translateX(0) scale(1.8); filter: grayscale(0.2); }
    50% { transform: translateX(-4px) scale(1.8); filter: grayscale(0.65); }
}

@keyframes explorationSequenceShield {
    0%, 100% { transform: scale(0.85); opacity: 0.62; }
    50% { transform: scale(1.08); opacity: 1; }
}

@keyframes explorationSequenceBlast {
    0% { transform: translateX(-16px) scaleX(0.6); opacity: 0; }
    35% { opacity: 1; }
    100% { transform: translateX(72px) scaleX(1.12); opacity: 0; }
}

@keyframes explorationSequenceCoin {
    0%, 100% { transform: translateY(0) scale(0.8); opacity: 0.46; }
    50% { transform: translateY(-18px) scale(1.08); opacity: 1; }
}

@keyframes explorationSequenceChest {
    from { background-position: 0 0; }
    to { background-position: 100% 0; }
}

@keyframes explorationSequenceChestPop {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-8px) scale(1.08);
    }
}

.exploration-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 10036;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(ellipse at 50% 18%, rgba(245, 158, 11, 0.14), transparent 40%),
        rgba(2, 6, 23, 0.78);
}

.exploration-result-dialog {
    position: relative;
    width: min(620px, 100%);
    max-height: min(720px, 92vh);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 14px / 0 stretch;
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 18% 0%, rgba(250, 204, 21, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(15, 10, 6, 0.48), rgba(2, 4, 7, 0.9)),
        repeating-linear-gradient(90deg, rgba(102, 60, 27, 0.1) 0 28px, rgba(4, 6, 9, 0.1) 28px 56px);
    box-shadow:
        0 30px 78px rgba(0, 0, 0, 0.64),
        inset 0 1px 0 rgba(255, 239, 180, 0.16);
}

.exploration-result-close {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 4;
}

.exploration-result-head {
    display: grid;
    gap: 4px;
    padding-right: 58px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 224, 160, 0.14);
}

.exploration-result-head span {
    color: #facc15;
    font-size: 12px;
    font-weight: 900;
}

.exploration-result-head strong {
    color: #f8fafc;
    font-size: 20px;
}

.exploration-result-head small {
    color: #bae6fd;
    font-size: 12px;
    font-weight: 800;
}

.exploration-result-showcase {
    min-height: 100px;
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 8px / 0 stretch;
    border-radius: 6px;
    background:
        radial-gradient(ellipse at 22% 50%, rgba(250, 204, 21, 0.22), transparent 38%),
        linear-gradient(90deg, rgba(43, 27, 10, 0.74), rgba(15, 23, 42, 0.5)),
        url("./assets/ui/bg-sea.png") center / cover no-repeat;
    transition: min-height 260ms ease, text-align 260ms ease;
}

.exploration-result-overlay:where(.is-awaiting-open, .is-opening, .is-opened) .exploration-result-showcase.has-rewards {
    position: relative;
    isolation: isolate;
    min-height: 232px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    overflow: hidden;
}

.exploration-result-chest-button {
    position: relative;
    z-index: 2;
    width: 86px;
    min-height: 0;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-image: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: transparent;
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease;
}

.exploration-result-chest-button:not(:disabled):active {
    transform: scale(0.96);
}

.exploration-result-chest-button:disabled {
    background: transparent;
    color: transparent;
    cursor: default;
}

.exploration-result-overlay:where(.is-awaiting-open, .is-opening, .is-opened) .exploration-result-chest-button {
    width: 126px;
    filter: drop-shadow(0 0 24px rgba(250, 204, 21, 0.42));
}

.exploration-result-loot-reveal {
    position: absolute;
    inset: 8px 12px 58px;
    z-index: 3;
    pointer-events: none;
}

.exploration-result-loot-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
    transform-origin: center;
}

.exploration-result-overlay.is-opened .exploration-result-loot-card {
    animation: explorationResultLootPop 560ms cubic-bezier(0.16, 0.8, 0.25, 1) var(--loot-delay, 0ms) 1 both;
}

.exploration-result-loot-icon-frame {
    position: relative;
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 231, 163, 0.7);
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.34), transparent 32%),
        radial-gradient(circle at 50% 50%, rgba(250, 204, 21, 0.42), rgba(70, 40, 10, 0.9));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.36),
        0 0 22px rgba(250, 204, 21, 0.56),
        0 8px 18px rgba(0, 0, 0, 0.38);
}

.exploration-result-loot-card.is-rare .exploration-result-loot-icon-frame {
    border-color: rgba(147, 197, 253, 0.9);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.36),
        0 0 22px rgba(96, 165, 250, 0.58),
        0 8px 18px rgba(0, 0, 0, 0.38);
}

.exploration-result-loot-card.is-epic .exploration-result-loot-icon-frame {
    border-color: rgba(216, 180, 254, 0.92);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.36),
        0 0 22px rgba(192, 132, 252, 0.62),
        0 8px 18px rgba(0, 0, 0, 0.38);
}

.exploration-result-loot-icon {
    display: grid;
    place-items: center;
    max-width: 62px;
    max-height: 62px;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.54));
}

.exploration-result-loot-icon.is-image-icon {
    width: 58px;
    height: 58px;
}

.exploration-result-loot-icon.is-image-icon img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.exploration-result-loot-icon.is-fallback {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff7d6;
    font-size: 30px;
    line-height: 1;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.86);
}

.exploration-result-loot-count {
    position: absolute;
    right: -8px;
    bottom: -6px;
    min-width: 24px;
    min-height: 20px;
    display: grid;
    place-items: center;
    padding: 1px 5px;
    border: 1px solid rgba(255, 241, 194, 0.66);
    border-radius: 999px;
    background: rgba(3, 7, 18, 0.9);
    color: #fff4ce;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.exploration-result-chest {
    width: 76px;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
    background: url("./Sprites/items/Chest/chest2_idle_strip8.png") 0 0 / 800% 100% no-repeat;
    filter: drop-shadow(0 0 18px rgba(250, 204, 21, 0.46));
}

.exploration-result-overlay:where(.is-awaiting-open, .is-opening, .is-opened) .exploration-result-chest.has-rewards {
    width: 112px;
    background-position: 0 0;
    animation: none;
}

.exploration-result-overlay.is-opening .exploration-result-chest.has-rewards {
    background-image: url("./Sprites/items/Chest/chest2_open_strip8.png");
    animation: explorationResultChestOpen 760ms steps(7) 1 forwards;
    filter: drop-shadow(0 0 24px rgba(250, 204, 21, 0.7));
}

.exploration-result-overlay.is-opened .exploration-result-chest.has-rewards {
    background-image: url("./Sprites/items/Chest/chest2_open_strip8.png");
    background-position: 100% 0;
    animation: none;
    filter: drop-shadow(0 0 18px rgba(250, 204, 21, 0.58));
}

.exploration-result-chest.is-empty {
    background-image: url("./Sprites/items/Chest/chest1_idle_strip8.png");
    background-position: 0 0;
    filter: grayscale(0.7) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}

.exploration-result-showcase b {
    display: block;
    color: #fde68a;
    font-size: 14px;
}

.exploration-result-prompt {
    position: relative;
    z-index: 4;
}

.exploration-result-prompt span {
    display: block;
    margin-top: 4px;
    color: #e0f2fe;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

.exploration-result-details {
    max-height: 900px;
    opacity: 1;
    overflow: visible;
    transition: max-height 320ms ease, opacity 220ms ease;
}

.exploration-result-overlay.is-opened .exploration-result-details {
    animation: explorationResultDetailsIn 280ms ease-out 1;
}

.exploration-result-overlay.is-awaiting-open .exploration-result-details,
.exploration-result-overlay.is-opening .exploration-result-details {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.exploration-result-destination-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 122px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 8px / 0 stretch;
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.5);
    overflow: hidden;
}

.exploration-result-destination-art {
    width: 122px;
    height: 128px;
    display: grid;
    place-items: center;
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.exploration-result-destination-image {
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    border-radius: 5px;
    background: rgba(2, 6, 23, 0.6);
}

.exploration-result-destination-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.exploration-result-destination-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.exploration-result-destination-copy b {
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 900;
}

.exploration-result-destination-copy strong {
    min-width: 0;
    color: #f8fafc;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.exploration-result-destination-copy span {
    color: #fde68a;
    font-size: 12px;
    font-weight: 900;
}

.exploration-result-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.exploration-result-body div {
    min-height: 66px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 8px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 8px / 0 stretch;
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.46);
}

.exploration-result-body b {
    color: var(--text-sub);
    font-size: 11px;
}

.exploration-result-body span {
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 800;
}

.exploration-result-rewards {
    display: grid;
    gap: 6px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    overflow-x: hidden;
}

.exploration-result-rewards li {
    max-width: 100%;
    min-width: 0;
    min-height: 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 8px / 0 stretch;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.62);
}

.exploration-result-rewards strong {
    min-width: 0;
    color: #f8fafc;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.exploration-result-rewards span {
    color: #fde68a;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.exploration-result-reward.is-empty {
    opacity: 0.76;
}

/* the random options a dropped piece came with, on a line of their own under its name */
.exploration-result-reward-options {
    grid-column: 1 / -1;
    margin-top: -6px;
    color: #86efac;
    font-size: 11px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.exploration-result-reward.is-rare span { color: #93c5fd; }
.exploration-result-reward.is-epic span { color: #d8b4fe; }
.exploration-result-reward.is-legendary span { color: #fde68a; }

.exploration-result-log {
    display: grid;
    gap: 4px;
    margin-top: 10px;
}

.exploration-result-log div {
    padding: 5px 8px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 7px / 0 stretch;
    border-radius: 5px;
    color: #c7d2fe;
    font-size: 11px;
    line-height: 1.35;
    background: rgba(2, 6, 23, 0.42);
}

.exploration-result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.exploration-result-actions button {
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    border-radius: 6px;
    background:
        linear-gradient(180deg, rgba(255, 227, 139, 0.18), rgba(86, 48, 12, 0.2));
    color: #111827;
    font-weight: 900;
}

.exploration-result-actions button:first-child {
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.28));
    color: #e5e7eb;
}

.exploration-result-overlay.is-defeat .exploration-result-head span {
    color: #fb7185;
}

.exploration-result-overlay.is-escaped .exploration-result-head span,
.exploration-result-overlay.is-draw .exploration-result-head span {
    color: #67e8f9;
}

@keyframes explorationResultChestOpen {
    from { background-position: 0 0; transform: scale(1); }
    58% { transform: scale(1.08); }
    to { background-position: 100% 0; transform: scale(1); }
}

@keyframes explorationResultLootPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.18);
        filter: brightness(1.8) blur(2px);
    }
    64% {
        opacity: 1;
        transform: translate(calc(-50% + var(--loot-x)), calc(-50% + var(--loot-y) - 8px)) scale(1.12);
        filter: brightness(1.22);
    }
    100% {
        opacity: 1;
        transform: translate(calc(-50% + var(--loot-x)), calc(-50% + var(--loot-y))) scale(1);
        filter: brightness(1);
    }
}

@keyframes explorationResultDetailsIn {
    from { transform: translateY(8px); }
    to { transform: translateY(0); }
}

@media (max-width: 520px) {
    .exploration-result-showcase {
        grid-template-columns: 68px minmax(0, 1fr);
    }

    .exploration-result-overlay:where(.is-awaiting-open, .is-opening, .is-opened) .exploration-result-showcase.has-rewards {
        grid-template-columns: 1fr;
    }

    .exploration-result-loot-reveal {
        inset: 8px 8px 56px;
    }

    .exploration-result-loot-card {
        width: 66px;
        height: 66px;
    }

    .exploration-result-loot-icon-frame {
        width: 58px;
        height: 58px;
        border-radius: 12px;
    }

    .exploration-result-loot-icon.is-image-icon {
        width: 50px;
        height: 50px;
    }

    .exploration-result-chest {
        width: 62px;
    }

    .exploration-result-overlay:where(.is-awaiting-open, .is-opening, .is-opened) .exploration-result-chest-button {
        width: 112px;
    }

    .exploration-result-overlay:where(.is-awaiting-open, .is-opening, .is-opened) .exploration-result-chest.has-rewards {
        width: 102px;
    }

    .exploration-result-destination-card {
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 10px;
    }

    .exploration-result-destination-art {
        width: 86px;
        height: 98px;
    }

    .exploration-result-destination-copy strong {
        font-size: 15px;
    }

    .exploration-result-body {
        grid-template-columns: 1fr;
    }
}

.ship-evolution-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 6, 23, 0.78);
}

.ship-evolution-choice-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 6, 23, 0.66);
}

.ship-evolution-choice-dialog {
    width: min(320px, 100%);
    padding: 12px;
    border: 1px solid rgba(250, 204, 21, 0.32);
    border-radius: 8px;
    background: #0f172a;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.48);
}

.ship-evolution-choice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    min-height: 30px;
}

.ship-evolution-choice-head strong {
    color: #fde68a;
    font-size: 15px;
}

.ship-evolution-choice-close {
    margin: -11px -11px -11px 0;
}

.ship-evolution-choice-list {
    display: grid;
    gap: 8px;
}

.ship-evolution-choice-list button {
    min-height: 46px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(250, 204, 21, 0.2);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.84);
    color: #f8fafc;
    font-family: inherit;
}

.ship-evolution-choice-list button strong {
    font-size: 13px;
}

.ship-evolution-choice-list button span {
    color: #fde68a;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.ship-evolution-dialog {
    position: relative;
    width: min(520px, 100%);
    padding: 18px;
    overflow: hidden;
    border: 1px solid rgba(250, 204, 21, 0.32);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98)),
        radial-gradient(circle at 50% 42%, rgba(250, 204, 21, 0.24), transparent 44%);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.52);
}

.ship-evolution-close {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
}

.ship-evolution-stage {
    position: relative;
    height: 230px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(14, 165, 233, 0.18), transparent 48%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.2) 0%, rgba(14, 116, 144, 0.32) 100%);
}

.ship-evolution-wake {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 40px;
    height: 38px;
    background:
        repeating-linear-gradient(90deg, rgba(186, 230, 253, 0.0) 0 18px, rgba(186, 230, 253, 0.34) 18px 26px, rgba(186, 230, 253, 0.0) 26px 48px);
    opacity: 0.75;
    animation: shipEvolutionWake 900ms linear infinite;
}

.ship-evolution-light {
    position: absolute;
    width: 120px;
    height: 180px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(254, 240, 138, 0.0), rgba(254, 240, 138, 0.72), rgba(125, 211, 252, 0.0));
    filter: blur(2px);
    opacity: 0;
    transform: scale(0.65);
    animation: shipEvolutionLight 1850ms ease-out forwards;
}

.ship-evolution-ship {
    position: absolute;
    width: 64px;
    height: 64px;
    background: url("./Sprites/Ships/ships.png") var(--player-ship-sprite-x, -64px) 0 / 2048px 1024px no-repeat;
    image-rendering: pixelated;
    transform: scale(2.2);
    filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.42));
}

.ship-evolution-ship.is-boat { --player-ship-sprite-x: -64px; }
.ship-evolution-ship.is-explorer { --player-ship-sprite-x: -448px; }
.ship-evolution-ship.is-defender { --player-ship-sprite-x: -832px; }
.ship-evolution-ship.is-fighter { --player-ship-sprite-x: -1216px; }
.ship-evolution-ship.is-merchant { --player-ship-sprite-x: -1600px; }

.ship-evolution-ship.is-before {
    animation: shipEvolutionBefore 1850ms cubic-bezier(0.2, 0.82, 0.24, 1) forwards;
}

.ship-evolution-ship.is-after {
    opacity: 0;
    animation: shipEvolutionAfter 1850ms cubic-bezier(0.2, 0.82, 0.24, 1) forwards;
}

.ship-evolution-bursts {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ship-evolution-bursts span {
    position: absolute;
    left: 50%;
    top: 47%;
    width: 6px;
    height: 18px;
    border-radius: 999px;
    background: #fde68a;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 22.5deg)) translateY(0);
    animation: shipEvolutionBurst 760ms ease-out 940ms forwards;
}

.ship-evolution-overlay.is-defender .ship-evolution-bursts span { background: #93c5fd; }
.ship-evolution-overlay.is-fighter .ship-evolution-bursts span { background: #fb7185; }
.ship-evolution-overlay.is-merchant .ship-evolution-bursts span { background: #fbbf24; }
.ship-evolution-overlay.is-explorer .ship-evolution-bursts span { background: #67e8f9; }

.ship-evolution-copy {
    display: grid;
    gap: 4px;
    margin-top: 14px;
    color: var(--text-sub);
    text-align: center;
}

.ship-evolution-copy span {
    font-size: 12px;
}

.ship-evolution-copy strong {
    color: #fde68a;
    font-size: 20px;
    line-height: 1.25;
}

.ship-evolution-ok {
    display: block;
    min-width: 120px;
    min-height: 38px;
    margin: 16px auto 0;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #facc15;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.ship-evolution-overlay.is-finished .ship-evolution-ok {
    opacity: 1;
    transform: translateY(0);
}

@keyframes shipEvolutionWake {
    from { transform: translateX(0); }
    to { transform: translateX(-48px); }
}

@keyframes shipEvolutionLight {
    0% { opacity: 0; transform: scale(0.65); }
    28% { opacity: 0.82; transform: scale(0.92); }
    66% { opacity: 1; transform: scale(1.12); }
    100% { opacity: 0.22; transform: scale(1.3); }
}

@keyframes shipEvolutionBefore {
    0% { opacity: 1; transform: translateX(-96px) scale(2.2); }
    38% { opacity: 1; transform: translateX(0) scale(2.34); }
    58% { opacity: 0; transform: translateX(0) scale(0.85) rotate(8deg); }
    100% { opacity: 0; transform: translateX(0) scale(0.85) rotate(8deg); }
}

@keyframes shipEvolutionAfter {
    0%, 58% { opacity: 0; transform: translateX(0) scale(0.85) rotate(-8deg); }
    72% { opacity: 1; transform: translateX(0) scale(2.55) rotate(0); }
    100% { opacity: 1; transform: translateX(0) scale(2.2); }
}

@keyframes shipEvolutionBurst {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(calc(var(--i) * 22.5deg)) translateY(0) scaleY(0.4); }
    18% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(calc(var(--i) * 22.5deg)) translateY(-86px) scaleY(1); }
}

.home-ps-lamp {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
}

.home-ps-card.is-low .home-ps-lamp {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
    animation: pulseLamp 1.6s ease-in-out infinite;
}

.home-ps-icon {
    font-size: clamp(12px, 3.2vw, 17px);
    color: transparent;
    width: 54px;
    height: 54px;
    flex: 0 0 58px;
    background: url("./assets/ui/icons/001.png") center / contain no-repeat;
    flex-basis: auto;
    background-position: center;
    background-size: contain;
    grid-column: 1;
    grid-row: 1 / 3;
    justify-self: center;
    align-self: center;
    background-image: var(--icon-money-bag);
}

.home-ps-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
}

.home-ps-value {
    font-size: clamp(54px, 13vw, 76px);
    font-weight: 900;
    color: #f1d37b;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: filter 0.4s ease, opacity 0.4s ease;
    text-shadow: 0 3px 0 #3a1b06,
        0 0 4px rgba(0, 0, 0, 0.76),
        0 0 8px rgba(235, 176, 60, 0.32);
    overflow: visible;
    font-family: Georgia, "Times New Roman", "Yu Mincho", serif;
    line-height: 1;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.home-ps-slit {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    height: 1em;
    overflow: visible;
    min-width: 2.8ch;
}

.home-ps-slit-value {
    display: inline-block;
    transform: translateY(0);
    line-height: 1;
}

.home-ps-slit-value.slide {
    animation: vaultSlide 0.5s ease;
}

.home-ps-unit {
    font-size: 0.52em;
    color: inherit;
    font-family: inherit;
    font-weight: 900;
    line-height: 1;
    text-shadow: inherit;
    transform: translateY(0.03em);
}

.home-specialty-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    max-width: 190px;
    min-width: 0;
    white-space: nowrap;
    grid-column: 1 / 3;
    grid-row: 2;
    justify-self: center;
    align-self: end;
    width: 190px;
    margin: 0;
    justify-content: space-between;
}

.home-specialty-label {
    flex: 0 0 auto;
    color: rgba(56, 31, 13, 0.76);
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

.home-specialty-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 33px;
    padding: 0;
    border-radius: 7px;
    border: 0;
    background: transparent;
    color: #211208;
    font-size: 13px;
    line-height: 1;
    border-color: rgba(80, 45, 18, 0.24);
    font-weight: 900;
    position: relative;
    justify-content: center;
    width: 33px;
    height: 25px;
    overflow: visible;
    flex: 0 0 33px;
}

.home-specialty-chip b {
    color: #fff2c6;
    font-size: 11px;
    font-weight: 900;
    position: absolute;
    right: -4px;
    top: 50%;
    min-width: 16px;
    height: 17px;
    padding: 0 3px;
    border: 1px solid rgba(255, 226, 137, 0.72);
    border-radius: 999px;
    background: rgba(22, 12, 5, 0.82);
    font-family: "Noto Sans JP", system-ui, sans-serif;
    line-height: 15px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    transform: translateY(-50%);
}

.home-hero-tag {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.2em;
    color: var(--text-main);
}

.home-hero-subtitle {
    font-size: 12px;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.home-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(10, 14, 20, 0.98), rgba(24, 30, 42, 0.98));
}

.home-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.06) 45%, transparent 70%);
    transform: translateX(-120%);
    animation: cardSheen 10s ease-in-out infinite;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .home-card::after {
        animation: none;
    }
}

.home-card:focus-within,
.home-card:hover {
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.28), 0 10px 20px rgba(0, 0, 0, 0.35);
}

.home-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.home-card-emoji {
    font-size: 12px;
    color: var(--accent-color);
}

.home-card-title {
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--text-main);
}

.home-shortcut-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.home-shortcut-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    min-height: 68px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 11px solid transparent;
    background: linear-gradient(180deg, rgba(14, 20, 30, 0.72), rgba(4, 6, 10, 0.9)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.06), transparent 58%);
    color: #f8fafc;
    box-shadow: none;
    text-align: left;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 11px / 0 stretch;
}

.home-shortcut-btn-secondary {
    background: linear-gradient(180deg, rgba(49, 27, 13, 0.36), rgba(7, 6, 5, 0.42)),
        repeating-linear-gradient(0deg, rgba(119, 68, 30, 0.1) 0 1px, transparent 1px 12px);
    border-image: url("./assets/ui/panels/panel-wood.png") 34 fill / 11px / 0 stretch;
}

#btnCopyInviteLink {
    grid-column: 1 / -1;
}

.line-friend-promo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(56, 189, 248, 0.28);
    background: linear-gradient(180deg, rgba(8, 35, 55, 0.72), rgba(3, 8, 16, 0.88)),
        radial-gradient(circle at 50% 0%, rgba(125, 211, 252, 0.16), transparent 52%);
    border-image: url("./assets/ui/panels/panel-blue-square.png") 24 fill / 12px / 0 stretch;
}

.line-friend-promo-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.line-friend-promo-title {
    font-size: 13px;
    font-weight: 900;
    color: #f8fafc;
}

.line-friend-promo-text {
    font-size: 11px;
    line-height: 1.5;
    color: #cbd5e1;
}

.line-friend-promo-btn {
    flex: 0 0 auto;
    min-width: 110px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.38);
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.92), rgba(2, 132, 199, 0.96));
    color: #eff6ff;
    font-size: 12px;
    font-weight: 800;
}

.line-friend-promo-btn[disabled] {
    opacity: 0.62;
}

.favorite-players-section {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, rgba(10, 17, 31, 0.88), rgba(15, 23, 42, 0.94));
}

.favorite-players-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px 12px;
    margin-bottom: 10px;
}

.favorite-players-title {
    font-size: 13px;
    font-weight: 900;
    color: #f8fafc;
}

.favorite-players-sub {
    font-size: 11px;
    color: #94a3b8;
}

.favorite-players-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.favorite-player-card {
    display: grid;
    gap: 4px;
    align-content: start;
    min-height: 72px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.98));
    color: #f8fafc;
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.favorite-player-card:hover {
    border-color: rgba(245, 158, 11, 0.34);
}

.favorite-player-card-name {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    word-break: break-word;
}

.favorite-player-card-meta {
    font-size: 11px;
    color: #94a3b8;
}

.favorite-players-empty {
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    background: rgba(8, 15, 29, 0.34);
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.6;
}

.home-shortcut-main {
    font-size: 14px;
    font-weight: 800;
}

.home-shortcut-sub {
    font-size: 11px;
    color: #cbd5e1;
}

.home-qr-area {
    text-align: center;
    margin: 6px 0 0;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.42)),
        radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.12), transparent 55%);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.home-qr-note {
    font-size: 12px;
    color: var(--text-sub);
    margin: 8px 0 0;
}

@keyframes pulseLamp {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

@keyframes vaultSlide {
    0% { transform: translateY(18px); opacity: 0; }
    45% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes cardSheen {
    0%, 65% { transform: translateX(-120%); opacity: 0; }
    70% { opacity: 0.5; }
    85% { transform: translateX(120%); opacity: 0; }
    100% { transform: translateX(120%); opacity: 0; }
}

.home-qr-area canvas {
    cursor: default;
}

.transfer-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.transfer-input-row input {
    width: 100%;
    padding: 0;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

/* --- Ship cards --- */
.ship-card {
    background: linear-gradient(160deg, rgba(10, 14, 20, 0.98), rgba(20, 26, 36, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 20px rgba(0, 0, 0, 0.35);
}

.ship-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.ship-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.ship-card-name {
    color: var(--text-main);
}

.ship-card-active {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 180, 0.35);
    color: var(--accent-color);
    background: rgba(0, 255, 180, 0.12);
}

.ship-card-id {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 4px;
}

.ship-card-status {
    text-align: right;
    font-size: 12px;
    color: var(--text-sub);
}

.ship-card-status strong {
    display: block;
    font-size: 13px;
    color: var(--accent-color);
}

.ship-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
}

.ship-card-meta span {
    color: var(--text-sub);
}

.ship-card-meta b {
    color: var(--text-main);
}

.ship-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.ship-card-actions button {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 96px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    cursor: pointer;
}

.ship-card-actions button[data-variant="danger"] {
    background: var(--danger-color);
    border: none;
}

.ship-card-actions button[data-variant="accent"] {
    background: var(--accent-color);
    border: none;
}

/* --- ホーム画面: アバターと装備 --- */
#homeLayout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.avatar-card {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background:
        radial-gradient(ellipse at 50% 25%, rgba(30, 64, 120, 0.55) 0%, transparent 65%),
        linear-gradient(180deg, rgba(10, 20, 40, 0.97), rgba(6, 14, 28, 0.99));
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    box-shadow:
        0 0 0 1px rgba(245, 158, 11, 0.1),
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.avatar-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(0deg, rgba(6, 24, 50, 0.6), transparent);
    pointer-events: none;
}

.avatar-container {
    position: relative;
    width: 64px;
    height: 64px;
    transform: scale(2.0);
    transform-origin: center center;
    margin: 32px 0; /* scale分の余白確保 */
    image-rendering: pixelated;
}

/* ステータス詳細 */
.avatar-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
}

.avatar-combat-actor {
    --avatar-attack-duration: 520ms;
    --avatar-attack-start-x: 0px;
    --avatar-attack-x: -34px;
    --avatar-attack-recoil-x: -24px;
    --avatar-attack-y: 0px;
    --avatar-motion-forward-x: -16px;
    --avatar-motion-recoil-x: 4px;
    --avatar-motion-lift-y: 0px;
    --avatar-combat-scale: 1;
    --avatar-combat-scale-hit: var(--avatar-combat-scale);
    --avatar-facing-scale-x: 1;
    --avatar-slash-left: -26px;
    --avatar-slash-top: 10px;
    --avatar-foot-shadow-left: 50%;
    --avatar-foot-shadow-width: 58px;
    --avatar-foot-shadow-height: 12px;
    --avatar-foot-shadow-bottom: -4px;
    transform: translateX(var(--avatar-attack-start-x)) translateY(var(--avatar-attack-y)) scale(var(--avatar-combat-scale)) scaleX(var(--avatar-facing-scale-x));
    transform-origin: center bottom;
    isolation: isolate;
}

.avatar-combat-actor.is-avatar-attack-right {
    --avatar-attack-x: 34px;
    --avatar-attack-recoil-x: 24px;
}

.avatar-combat-actor.is-avatar-attacking {
    animation: avatarCombatAttack var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-unarmed {
    animation-name: avatarCombatUnarmed;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword {
    animation-name: avatarCombatSword;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-dagger {
    animation-name: avatarCombatDagger;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-polearm {
    animation-name: avatarCombatPolearm;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-blunt {
    animation-name: avatarCombatBlunt;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe {
    animation-name: avatarCombatAxe;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword-big {
    animation-name: avatarCombatGreatsword;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe-big {
    animation-name: avatarCombatGreataxe;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-staff {
    animation-name: avatarCombatStaff;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-wand {
    animation-name: avatarCombatWand;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-bow {
    animation-name: avatarCombatBow;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun {
    animation-name: avatarCombatGun;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun-big {
    animation-name: avatarCombatBigGun;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-shield {
    animation-name: avatarCombatShield;
}

.avatar-combat-actor::before {
    content: "";
    position: absolute;
    left: var(--avatar-foot-shadow-left);
    bottom: var(--avatar-foot-shadow-bottom);
    z-index: 0;
    width: var(--avatar-foot-shadow-width);
    height: var(--avatar-foot-shadow-height);
    pointer-events: none;
    border-radius: 50%;
    background:
        radial-gradient(ellipse, rgba(0, 0, 0, 0.54), rgba(0, 0, 0, 0.28) 48%, transparent 72%),
        radial-gradient(ellipse, rgba(248, 216, 136, 0.14), transparent 62%);
    transform: translateX(-50%) scaleX(var(--avatar-foot-shadow-scale-x, 1));
    transform-origin: center;
}

.avatar-combat-actor::after {
    content: "";
    position: absolute;
    left: var(--avatar-slash-left);
    top: var(--avatar-slash-top);
    width: 48px;
    height: 34px;
    opacity: 0;
    pointer-events: none;
    border-top: 3px solid rgba(254, 243, 199, 0.95);
    border-right: 2px solid rgba(251, 191, 36, 0.72);
    border-radius: 50%;
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.82));
    transform: rotate(-24deg) scale(0.5);
    z-index: 4;
}

.avatar-combat-actor .avatar-layer {
    z-index: 2;
}

.avatar-combat-actor.is-avatar-attacking::after {
    animation: avatarCombatSlash var(--avatar-attack-duration) ease-out both;
}

.avatar-combat-actor.is-avatar-weapon-gun::after {
    left: -10px;
    top: 27px;
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle, #fffdf0 0 18%, #ffd45d 24%, rgba(255, 132, 32, 0.88) 46%, transparent 72%);
    filter: drop-shadow(0 0 5px rgba(255, 178, 47, 0.9));
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun::after {
    animation-name: avatarCombatMuzzle;
}

.avatar-combat-actor.is-avatar-weapon-gun-big::after {
    left: -24px;
    top: 28px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle, #fff 0 12%, #fff1a8 18%, #ffb52e 34%, rgba(255, 87, 18, 0.9) 52%, transparent 72%),
        conic-gradient(from 22deg, transparent 0 8%, rgba(255, 232, 129, 0.92) 10% 14%, transparent 16% 34%, rgba(255, 143, 35, 0.82) 36% 42%, transparent 44% 100%);
    filter: drop-shadow(0 0 8px rgba(255, 152, 31, 0.96));
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun-big::after {
    animation-name: avatarCombatBigMuzzle;
}

.avatar-combat-actor.is-avatar-weapon-polearm::after {
    left: -50px;
    top: 43px;
    width: 82px;
    height: 7px;
    border-top-width: 2px;
    background: linear-gradient(90deg, transparent, rgba(254, 243, 199, 0.86) 22%, rgba(251, 191, 36, 0.72));
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-polearm::after {
    animation-name: avatarCombatPolearmPierce;
}

.avatar-combat-actor.is-avatar-weapon-sword::after {
    left: -34px;
    top: 13px;
    width: 52px;
    height: 31px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword::after {
    animation-name: avatarCombatSwordSlash;
}

.avatar-combat-actor.is-avatar-weapon-dagger::after {
    left: -39px;
    top: 30px;
    width: 42px;
    height: 9px;
    border-top-width: 2px;
    border-right: 0;
    border-radius: 999px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-dagger::after {
    animation-name: avatarCombatDaggerStab;
}

.avatar-combat-actor.is-avatar-weapon-unarmed::after {
    left: -29px;
    top: 29px;
    width: 34px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255, 249, 220, 0.92), rgba(251, 191, 36, 0.54) 38%, rgba(180, 83, 9, 0.18) 62%, transparent 76%);
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-unarmed::after {
    animation-name: avatarCombatPunchImpact;
}

.avatar-combat-actor.is-avatar-weapon-blunt::after {
    left: -30px;
    top: 44px;
    width: 44px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255, 247, 214, 0.62), rgba(180, 83, 9, 0.48) 42%, rgba(68, 45, 24, 0.22) 62%, transparent 76%);
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-blunt::after {
    animation-name: avatarCombatBluntImpact;
}

.avatar-combat-actor.is-avatar-weapon-axe::after {
    left: -34px;
    top: 18px;
    width: 54px;
    height: 38px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe::after {
    animation-name: avatarCombatAxeCleave;
}

.avatar-combat-actor.is-avatar-weapon-sword-big::after,
.avatar-combat-actor.is-avatar-weapon-axe-big::after {
    left: -48px;
    top: 3px;
    width: 72px;
    height: 52px;
    border-top-width: 5px;
    border-right-width: 4px;
}

.avatar-combat-actor.is-avatar-weapon-sword-big::after {
    left: -44px;
    top: 18px;
    width: 68px;
    height: 42px;
}

.avatar-combat-actor.is-avatar-weapon-axe-big::after {
    left: -42px;
    top: 22px;
    width: 72px;
    height: 44px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword-big::after {
    animation-name: avatarCombatGreatswordCleave;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe-big::after {
    animation-name: avatarCombatGreataxeCleave;
}

.avatar-combat-actor.is-avatar-weapon-staff::after {
    left: -52px;
    top: -2px;
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(239, 246, 255, 0.95), rgba(147, 197, 253, 0.52) 28%, transparent 54%),
        radial-gradient(circle, transparent 42%, rgba(191, 219, 254, 0.72) 46%, transparent 64%);
    filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.68));
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-staff::after {
    animation-name: avatarCombatStaffPulse;
}

.avatar-combat-actor.is-avatar-weapon-wand::after {
    left: -34px;
    top: 11px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(255, 251, 235, 1), rgba(251, 191, 36, 0.82) 28%, rgba(249, 115, 22, 0.42) 48%, transparent 72%),
        radial-gradient(circle, transparent 44%, rgba(254, 215, 170, 0.64) 48%, transparent 64%);
    filter: drop-shadow(0 0 8px rgba(251, 146, 60, 0.72));
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-wand::after {
    animation-name: avatarCombatWandSpark;
}

.avatar-combat-actor.is-avatar-weapon-bow::after {
    left: -54px;
    top: 34px;
    width: 80px;
    height: 4px;
    border: 0;
    border-radius: 999px;
    background:
        linear-gradient(90deg, transparent 0 8%, rgba(255, 251, 235, 0.98) 16%, rgba(251, 191, 36, 0.88) 54%, transparent 82%),
        linear-gradient(90deg, transparent, rgba(120, 53, 15, 0.82) 42%, transparent 64%);
    filter: drop-shadow(0 0 5px rgba(254, 240, 138, 0.55));
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-bow::after {
    animation-name: avatarCombatArrowShot;
}

.avatar-combat-actor.is-avatar-weapon-shield::after {
    left: -20px;
    top: 20px;
    width: 34px;
    height: 36px;
    border: 2px solid rgba(254, 243, 199, 0.9);
    border-radius: 42% 48% 52% 48%;
    background: radial-gradient(ellipse, rgba(255, 251, 235, 0.38), rgba(180, 83, 9, 0.18) 54%, transparent 72%);
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-shield::after {
    animation-name: avatarCombatShieldBash;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponGunRecoil var(--avatar-attack-duration) cubic-bezier(0.12, 0.82, 0.2, 1) both;
    transform-origin: 31px 37px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun-big .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponBigGunRecoil var(--avatar-attack-duration) cubic-bezier(0.12, 0.82, 0.2, 1) both;
    transform-origin: 63px 34px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-polearm .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponPolearmThrust var(--avatar-attack-duration) cubic-bezier(0.18, 0.8, 0.22, 1) both;
    transform-origin: 31px 88px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-shield .avatar-layer[id$="-layer-weapon-right"],
.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-shield .avatar-layer[id$="-layer-shield-left"] {
    animation: avatarWeaponShieldBash var(--avatar-attack-duration) cubic-bezier(0.18, 0.78, 0.22, 1) both;
    transform-origin: 32px 32px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandGunGrip var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun-big .avatar-layer[id$="-layer-hand-right"],
.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-gun-big .avatar-layer[id$="-layer-hand-left"] {
    animation: avatarHandBigGunGrip var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-polearm .avatar-layer[id$="-layer-hand-right"],
.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-polearm .avatar-layer[id$="-layer-hand-left"] {
    animation: avatarHandPolearmGrip var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-shield .avatar-layer[id$="-layer-hand-right"],
.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-shield .avatar-layer[id$="-layer-hand-left"] {
    animation: avatarHandShieldBash var(--avatar-attack-duration) cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponSwordCut var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
    transform-origin: 31px 44px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandSwordCut var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-unarmed .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandPunch var(--avatar-attack-duration) cubic-bezier(0.18, 0.8, 0.22, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-dagger .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponDaggerJab var(--avatar-attack-duration) cubic-bezier(0.16, 0.82, 0.2, 1) both;
    transform-origin: 27px 42px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-blunt .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponBluntSmash var(--avatar-attack-duration) cubic-bezier(0.18, 0.72, 0.2, 1) both;
    transform-origin: 32px 41px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponAxeChop var(--avatar-attack-duration) cubic-bezier(0.18, 0.72, 0.2, 1) both;
    transform-origin: 33px 41px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword-big .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponGreatswordDrop var(--avatar-attack-duration) cubic-bezier(0.18, 0.72, 0.2, 1) both;
    transform-origin: 29px 70px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe-big .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponGreataxeDrop var(--avatar-attack-duration) cubic-bezier(0.16, 0.72, 0.18, 1) both;
    transform-origin: 29px 70px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-staff .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponStaffCast var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
    transform-origin: 30px 88px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-wand .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponWandFlick var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
    transform-origin: 27px 42px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-bow .avatar-layer[id$="-layer-weapon-right"] {
    animation: avatarWeaponBowDraw var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
    transform-origin: 25px 44px;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-dagger .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandDaggerJab var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-blunt .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandBluntGrip var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe-big .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandGreataxeGrip var(--avatar-attack-duration) cubic-bezier(0.16, 0.72, 0.18, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe-big .avatar-layer[id$="-layer-hand-left"] {
    animation: avatarHandGreataxeGrip var(--avatar-attack-duration) cubic-bezier(0.16, 0.72, 0.18, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword-big .avatar-layer[id$="-layer-hand-right"],
.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-sword-big .avatar-layer[id$="-layer-hand-left"] {
    animation: avatarHandGreatswordGrip var(--avatar-attack-duration) cubic-bezier(0.18, 0.72, 0.2, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-axe .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandAxeGrip var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-staff .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandStaffCast var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-staff .avatar-layer[id$="-layer-hand-left"] {
    animation: avatarHandStaffFocus var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-wand .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandWandFlick var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-bow .avatar-layer[id$="-layer-hand-right"] {
    animation: avatarHandBowHold var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-attacking.is-avatar-weapon-bow .avatar-layer[id$="-layer-hand-left"] {
    animation: avatarHandBowDraw var(--avatar-attack-duration) cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.avatar-combat-actor.is-avatar-damaged {
    filter: drop-shadow(0 16px 12px rgba(0, 0, 0, 0.48)) brightness(1.45) saturate(1.25);
}

.avatar-combat-actor.is-avatar-victorious {
    animation: avatarVictoryPose 1380ms cubic-bezier(0.16, 0.78, 0.2, 1) both;
    filter: drop-shadow(0 16px 12px rgba(0, 0, 0, 0.46)) brightness(1.14) saturate(1.16);
}

.avatar-combat-actor.is-avatar-victorious::after {
    content: "WIN";
    left: 50%;
    top: -34px;
    width: auto;
    height: auto;
    min-width: 30px;
    padding: 2px 8px;
    border: 1px solid rgba(255, 232, 150, 0.9);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 246, 190, 0.96), rgba(235, 174, 52, 0.92));
    color: #241306;
    font-size: 9px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-align: center;
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.72)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.42));
    transform: translateX(-50%) scaleX(var(--avatar-facing-scale-x, 1));
    animation: avatarVictoryBadge 1600ms cubic-bezier(0.16, 0.78, 0.2, 1) both;
    z-index: 7;
}

.avatar-combat-actor.is-avatar-victorious .avatar-layer[id$="-layer-hand-right"],
.avatar-combat-actor.is-avatar-victorious .avatar-layer[id$="-layer-hand-left"],
.avatar-combat-actor.is-avatar-victorious .avatar-layer[id$="-layer-weapon-right"],
.avatar-combat-actor.is-avatar-victorious .avatar-layer[id$="-layer-shield-left"] {
    animation: avatarVictoryLayerBob 620ms ease-in-out 2;
}

.avatar-combat-actor.is-avatar-defeated {
    animation: none !important;
    filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.5));
}

.avatar-combat-death-sprite {
    position: absolute;
    z-index: 8;
    top: 9px;
    left: 4px;
    display: none;
    width: 56px;
    height: 55px;
    pointer-events: none;
    background-image: url("./Sprites/Characters/body/death.png");
    background-repeat: no-repeat;
    background-position: 0 0;
    background-size: 448px 110px;
    image-rendering: pixelated;
}

.avatar-combat-actor.is-avatar-defeated > .avatar-combat-death-sprite {
    display: block;
}

.avatar-combat-actor.is-avatar-defeated::after {
    opacity: 0;
    animation: none !important;
}

.avatar-combat-actor.is-avatar-defeated::before {
    opacity: 0.52;
    transform: translateX(-50%) scaleX(0.78);
}

.avatar-combat-actor.is-avatar-defeated .avatar-layer {
    animation: none !important;
    visibility: hidden;
    opacity: 0;
}

.avatar-combat-actor.is-avatar-defeated .avatar-layer[id$="-layer-head"],
.avatar-combat-actor.is-avatar-defeated .avatar-layer[id$="-layer-hair"],
.avatar-combat-actor.is-avatar-defeated .avatar-layer[id$="-layer-facial-hair"] {
    animation: none !important;
}

.inventory-loadout-stats {
    width: 100%;
    align-self: stretch;
    margin: 6px 0 10px;
}

.inventory-stats-header {
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.stat-item {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(22, 32, 52, 0.92));
    padding: 12px 10px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    position: relative;
    overflow: hidden;
}

.stat-item[data-stat="atk"] { border-color: rgba(239, 68, 68, 0.35); }
.stat-item[data-stat="def"] { border-color: rgba(59, 130, 246, 0.35); }
.stat-item[data-stat="agi"] { border-color: rgba(16, 185, 129, 0.35); }
.stat-item[data-stat="int"] { border-color: rgba(139, 92, 246, 0.35); }

.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.04em;
}

.stat-item[data-stat="atk"] .stat-label { color: #fca5a5; }
.stat-item[data-stat="def"] .stat-label { color: #93c5fd; }
.stat-item[data-stat="agi"] .stat-label { color: #6ee7b7; }
.stat-item[data-stat="int"] .stat-label { color: #c4b5fd; }

.stat-value {
    font-size: 22px;
    font-weight: 900;
    color: #f8fafc;
    line-height: 1;
}

.stat-item[data-stat="atk"] .stat-value { color: #fca5a5; }
.stat-item[data-stat="def"] .stat-value { color: #93c5fd; }
.stat-item[data-stat="agi"] .stat-value { color: #6ee7b7; }
.stat-item[data-stat="int"] .stat-value { color: #c4b5fd; }

.stat-value-group {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}
.stat-bonus {
    font-size: 12px;
    color: var(--hp-color);
    font-weight: 700;
}
.stat-bonus.is-zero {
    color: var(--text-sub);
}

/* セクションヘッダー共通 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-header-btn {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.9);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: none;
}

.section-header-btn::before {
    content: "";
    width: 18px;
    height: 18px;
    display: inline-block;
    margin-right: 5px;
    vertical-align: -4px;
    background: url("./assets/ui/buttons/action-refresh.png") center / contain no-repeat;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

/* インベントリソートセレクト */
.sort-select {
    background: #374151;
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'Noto Sans JP', sans-serif;
}

#pointMessage {
    font-size: 12px;
    color: var(--text-sub);
    margin: 4px 0 10px;
}

#pointMessage:empty {
    display: none;
}


/* --- バトル --- */
#battleArea {
    background-color: #1a202c;
    border-left: none;
    padding: 0;
    border-radius: 4px;
    margin-bottom: 0;
    background: transparent;
}

/* --- 下部ナビゲーション --- */
#bottomNav {
    position: fixed;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    height: var(--nav-height);
    background: linear-gradient(180deg, rgba(12, 8, 5, 0.42), rgba(3, 3, 4, 0.82)),
        repeating-linear-gradient(90deg, rgba(108, 64, 28, 0.18) 0 30px, rgba(23, 12, 6, 0.14) 30px 60px);
    backdrop-filter: none;
    border-top: 1px solid rgba(220, 169, 82, 0.42);
    display: flex;
    justify-content: stretch;
    align-items: center;
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 280ms ease, visibility 0s linear 280ms;
    gap: 5px;
    padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
    border-radius: 24px;
    border: 1px solid transparent;
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.42);
    overflow: hidden;
    flex-wrap: nowrap;
    border-image: url("./assets/ui/panels/panel-plank-wide.png") 34 fill / 10px / 0 stretch;
}

body.tabs-ready #bottomNav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 280ms ease, visibility 0s;
}

.nav-button {
    background: linear-gradient(180deg, rgba(69, 39, 19, 0.94), rgba(24, 15, 9, 0.98)),
        repeating-linear-gradient(0deg, rgba(255, 238, 194, 0.05) 0 1px, transparent 1px 7px);
    border: 1px solid rgba(220, 169, 82, 0.38);
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.12);
    color: #f0d7a4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 72px;
    height: 68px;
    font-size: 10px;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
    flex: 1 1 0;
    border-radius: 8px;
    gap: 2px;
    min-width: 0;
    max-width: none;
    overflow: hidden;
}

.nav-button.active {
    color: #fff1bd;
    background: linear-gradient(180deg, rgba(255, 244, 189, 0.22), rgba(113, 63, 18, 0.18)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.18), transparent 58%);
    border-color: rgba(255, 229, 149, 0.78);
    box-shadow: 0 0 18px rgba(217, 164, 65, 0.28), inset 0 1px 0 rgba(255, 247, 214, 0.26);
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-gold-square.png") 24 fill / 10px / 0 stretch;
}

/* --- モーダル --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 18, 0.7);
    backdrop-filter: blur(2px);
    z-index: 4000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in;
    inset: 0;
    pointer-events: auto;
}

.modal-overlay[style*="display: flex"] {
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    color: var(--text-main);
    width: 90%;
    max-width: 360px;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    text-align: center;
}

#shipDetailsModal .ship-details-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

#shipDetailsModal .ship-details-header h2 {
    margin: 0;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
}

#btnCancelTransfer, #btnCancelSell {
    background: #4b5563;
}

.world-map-modal-card {
    width: min(640px, 92vw);
    max-height: 85vh;
    overflow: auto;
    background: #0b1220;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 16px;
    color: #fff;
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.45);
}

.world-map-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.world-map-modal-title {
    font-size: 16px;
    font-weight: 700;
}

.world-map-modal-close {
    background: transparent;
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.world-map-modal-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    aspect-ratio: 3 / 5;
}

.world-map-modal-cell {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    padding: 10px 8px 12px;
    font-size: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    line-height: 1.35;
    position: relative;
    z-index: 0;
}

.world-map-modal-cell.is-capital {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(96, 165, 250, 0.6);
    font-weight: 700;
}

.world-map-modal-cell.is-world {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(251, 191, 36, 0.6);
    font-weight: 700;
}

.world-map-modal-cell.has-tarot::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 8px;
    width: var(--tarot-tile-w, 48px);
    height: var(--tarot-tile-h, 80px);
    transform: translateX(-50%);
    background-image: url('Sprites/Buildings/tarot.png');
    background-repeat: no-repeat;
    background-size: var(--tarot-sheet-w, 480px) var(--tarot-sheet-h, 960px);
    background-position: calc(var(--tarot-x, 0px) * -1) calc(var(--tarot-y, 0px) * -1);
    z-index: 0;
    image-rendering: pixelated;
}

.world-map-modal-label {
    position: relative;
    z-index: 2;
    margin-top: auto;
    display: inline-block;
    max-width: 100%;
    padding: 3px 6px;
    font-weight: 700;
    font-size: clamp(9px, 2.2vw, 12px);
    color: rgba(248, 250, 252, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 8px;
    box-sizing: border-box;
    white-space: nowrap;
}

.world-map-modal-cell.has-tarot {
    padding-top: calc(var(--tarot-tile-h, 80px) + 10px);
}

.world-map-modal-cell.is-current {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6), 0 0 12px rgba(255, 255, 255, 0.5);
}

.world-map-modal-cell.is-selected {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.6), 0 0 12px rgba(56, 189, 248, 0.45);
}

.world-map-modal-cell.is-occupied-fire {
    background: rgba(239, 68, 68, 0.22);
}

.world-map-modal-cell.is-occupied-water {
    background: rgba(59, 130, 246, 0.22);
}

.world-map-modal-cell.is-occupied-earth {
    background: rgba(34, 197, 94, 0.22);
}

.world-map-modal-cell.is-occupied-wind {
    background: rgba(245, 158, 11, 0.22);
}

.world-map-modal-cell.is-occupied-neutral {
    background: rgba(148, 163, 184, 0.18);
}

.world-map-modal-cell[data-letter]::after {
    content: attr(data-letter);
    position: absolute;
    bottom: 6px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    z-index: 3;
}

.world-map-modal-note {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-sub);
    text-align: center;
}

body.modal-lock {
    overflow: hidden;
    touch-action: none;
}

body.modal-lock #tabContainer,
body.modal-lock #globalStatusBar,
body.modal-lock #bottomNav,
body.modal-lock #phaser-container,
body.modal-lock canvas {
    pointer-events: none;
}

body.modal-lock .modal-overlay {
    pointer-events: auto;
}

/* チャット */
#tabContentMap {
    position: relative;
    display: flex;
    flex-direction: column;
}

.map-stage {
    width: 100%;
    height: calc(100vh - 140px - 220px);
    height: calc(100dvh - 140px - 220px);
    background: #000;
    touch-action: none;
}

.map-stage canvas {
    image-rendering: pixelated;
}

.map-chat-area {
    margin: 0 16px 16px;
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.08);
    z-index: 1100;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 14px / 0 stretch;
    background: linear-gradient(180deg, rgba(9, 16, 24, 0.9), rgba(3, 5, 9, 0.98)),
        radial-gradient(ellipse at 50% 0%, rgba(66, 149, 196, 0.1), transparent 58%);
}

.map-chat-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.map-chat-tab {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.22), rgba(2, 6, 23, 0.42));
    color: #d7c5a6;
    border-radius: 8px;
    padding: 5px 6px;
    font-size: 13px;
    border: 1px solid transparent;
    box-shadow: none;
    min-height: 36px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 9px / 0 stretch;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.map-chat-tab.active {
    background: linear-gradient(180deg, rgba(255, 239, 176, 0.34), rgba(109, 58, 11, 0.24)),
        linear-gradient(180deg, #e7b64b, #9c5c1e);
    color: #241306;
    border-color: rgba(255, 255, 255, 0.2);
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
    text-shadow: 0 1px 0 rgba(255, 245, 210, 0.48);
}
#chatMessages {
    background: linear-gradient(180deg, rgba(6, 14, 24, 0.92), rgba(1, 3, 7, 0.96));
    height: 132px;
    overflow-y: auto;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    margin-bottom: 10px;
    border-image: url("./assets/ui/panels/panel-navy-wide.png") 34 fill / 12px / 0 stretch;
    scrollbar-color: rgba(220, 169, 82, 0.6) rgba(3, 6, 10, 0.8);
}
#chatInputArea {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
#chatInput {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: linear-gradient(180deg, rgba(24, 31, 42, 0.92), rgba(7, 10, 15, 0.98)),
        radial-gradient(ellipse at 50% 0%, rgba(66, 149, 196, 0.08), transparent 58%);
    color: #f8f0dc;
    min-height: 42px;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 10px / 0 stretch;
    font-size: 14px;
    font-weight: 700;
    outline: none;
}

/* バトル画面調整 */
/* 順位切り替えボタン */
#rankingToggleButtons {
    display: grid;
    margin-bottom: 12px;
    background: linear-gradient(180deg, rgba(8, 11, 14, 0.94), rgba(2, 4, 7, 0.98));
    padding: 0;
    border-radius: 8px;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 14px;
    overflow: hidden;
    border: 1px solid rgba(220, 169, 82, 0.36);
}
.ranking-toggle-btn {
    flex: 0 0 auto;
    background: linear-gradient(180deg, rgba(17, 21, 25, 0.9), rgba(4, 6, 9, 0.98));
    box-shadow: none;
    font-size: 14px;
    padding: 8px 4px;
    border-radius: 0;
    color: #c9b48a;
    min-width: 0;
    min-height: 58px;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-right: 1px solid rgba(220, 169, 82, 0.22);
    font-weight: 900;
}
.ranking-toggle-btn.active {
    background: linear-gradient(180deg, rgba(255, 227, 139, 0.18), rgba(86, 48, 12, 0.18));
    color: #fff1c2;
    box-shadow: inset 0 1px 0 rgba(255, 247, 214, 0.28);
    border-color: rgba(255, 229, 149, 0.74);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.78), 0 0 8px rgba(255, 222, 128, 0.28);
}

.rank-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    vertical-align: middle;
}

/* ローディング */
.boot-splash {
    position: fixed;
    inset: 0;
    z-index: 4500;
    display: none;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
    background:
        radial-gradient(ellipse at 50% 18%, rgba(220, 169, 82, 0.16), transparent 42%),
        linear-gradient(180deg, #05070b 0%, #0b1019 52%, #020409 100%);
}

body.app-booting .boot-splash {
    display: grid;
}

.boot-splash-title {
    display: block;
    width: min(78vw, 390px);
    max-width: 100%;
    max-height: min(76dvh, 720px);
    object-fit: contain;
    filter:
        drop-shadow(0 16px 28px rgba(0, 0, 0, 0.72))
        drop-shadow(0 0 22px rgba(220, 169, 82, 0.18));
}

@media (max-width: 768px) {
    .boot-splash {
        padding: 0;
        overflow: hidden;
    }

    .boot-splash-title {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        object-fit: cover;
    }
}

.boot-splash-spinner {
    position: fixed;
    left: 50%;
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 20px));
    width: 32px;
    height: 32px;
    margin-left: -16px;
    border: 3px solid rgba(220, 169, 82, 0.24);
    border-top-color: #f7d27a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(245, 158, 11, 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Ship action button (map UI) */
.ship-action-panel {
    position: fixed;
    right: 16px;
    bottom: calc(var(--nav-height) + 240px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    z-index: 950;
    pointer-events: auto;
    touch-action: manipulation;
    padding: 8px;
}

.ship-side-cannon-panel {
    position: fixed;
    left: 16px;
    bottom: calc(var(--nav-height) + 240px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    z-index: 950;
    pointer-events: auto;
    touch-action: manipulation;
    padding: 8px;
}

.app-action-panel {
    border: 1px solid var(--action-panel-border);
    border-radius: 12px;
    background: var(--action-panel-bg);
    box-shadow: var(--action-panel-shadow);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.home-ship-stage {
    position: relative;
    width: min(392px, 100%);
    margin: 0 auto 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    border: none;
    min-height: 386px;
    margin-top: -14px;
}

.home-ship-bob {
    position: relative;
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: homeShipBob 6s ease-in-out infinite;
    min-height: 340px;
}

.home-ship-image {
    width: 260px;
    height: auto;
    image-rendering: pixelated;
}

.home-ship-avatar {
    position: absolute;
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) translateY(-32px) scale(1.6);
    transform-origin: center center;
    margin: 0;
    border-radius: 14px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.home-ship-avatar:hover,
.home-ship-avatar:focus-visible {
    outline: 2px solid rgba(255, 225, 136, 0.78);
    outline-offset: 3px;
    box-shadow: 0 0 18px rgba(255, 218, 116, 0.32);
}

.home-ship-avatar[data-sea-tone="day"] {
    background: radial-gradient(circle at 40% 30%, rgba(125, 211, 252, 0.65), rgba(14, 116, 144, 0.35) 70%);
    box-shadow: 0 8px 18px rgba(14, 116, 144, 0.35);
}

.home-ship-avatar[data-sea-tone="night"] {
    background: radial-gradient(circle at 40% 30%, rgba(30, 41, 59, 0.85), rgba(2, 6, 23, 0.9) 70%);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.5);
}

@keyframes homeShipBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

.ship-action-button {
    background: rgba(17, 24, 39, 0.9);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.ship-action-button.ship-action-button-sub {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(56, 189, 248, 0.35);
    font-size: 11px;
    padding: 8px 12px;
}

.create-island-top-button {
    position: fixed;
    left: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    right: auto;
    bottom: auto;
    z-index: 1201;
}

.ship-action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ship-action-status {
    font-size: 11px;
    color: var(--text-sub);
    text-align: right;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.ship-combat-resource-status {
    max-width: 220px;
    font-size: 10px;
    line-height: 1.35;
    color: rgba(226, 232, 240, 0.92);
    text-align: right;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0.95;
}

.ship-side-cannon-panel .ship-action-status {
    text-align: left;
}

.ship-side-cannon-button {
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(31, 41, 55, 0.92);
}

/* 島コマンドパネル（下からスライドイン） */
.island-command-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(9, 14, 24, 0.98), rgba(17, 24, 39, 1)),
        radial-gradient(120% 120% at 50% 0%, rgba(245, 158, 11, 0.12), transparent 42%);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -18px 44px rgba(2, 6, 23, 0.45);
    padding: 10px 16px calc(16px + var(--safe-bottom) + 6px);
    transform: translateY(calc(100% - 96px));
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 900;
    max-width: none;
    margin: 0 auto;
    width: 100%;
    max-height: 80dvh;
    overflow: auto;
}

.island-command-panel.active {
    transform: translateY(0);
}

.island-command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.respawn-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.respawn-label {
    font-size: 11px;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.island-command-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--accent-color);
    font-weight: 900;
}

.island-command-status {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #dbeafe;
    font-size: 12px;
    line-height: 1.45;
}

.island-command-close {
    margin: -8px -8px -8px 0;
}

.island-command-buttons {
    display: grid;
    flex-direction: column;
    gap: 10px;
}

.island-command-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, box-shadow 0.2s;
    min-height: 52px;
}

.island-command-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.island-command-btn.danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.island-command-btn.success {
    background: linear-gradient(135deg, var(--hp-color), #059669);
}

.island-command-btn.info {
    background: linear-gradient(135deg, var(--mp-color), #2563eb);
}

/* --- インベントリタブのアバター表示 --- */


.resource-summary {
    width: 100%;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.7);
}

.resource-summary-title {
    font-weight: bold;
    margin-bottom: 8px;
}

.resource-summary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 13px;
}

.resource-summary-section {
    width: 100%;
}

.resource-summary-section + .resource-summary-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.resource-summary-subtitle {
    font-size: 12px;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.84);
    margin-bottom: 6px;
}

.resource-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.resource-summary-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.resource-summary-btn {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    color: #f8fafc;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.resource-summary-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.resource-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.resource-chip-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    line-height: 1;
}

.resource-chip b {
    color: var(--accent-color);
}

.resource-chip-meta {
    font-size: 11px;
    color: rgba(226, 232, 240, 0.82);
    line-height: 1.2;
}

.map-loading-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(15, 23, 42, 0.95), #020617 55%, #000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.map-loading-overlay.is-modal {
    position: fixed;
    z-index: 4000;
    opacity: 1;
    pointer-events: auto;
}

.map-loading-world {
    position: relative;
    width: min(90vw, 72vh, 520px);
    aspect-ratio: 3 / 5;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.95));
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    transform: scale(1);
    opacity: 1;
}

.map-loading-status {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.45);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    z-index: 4;
    transition: opacity 0.25s ease;
}

.map-loading-status.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.map-loading-world.is-animating {
    animation: mapZoomIn 1.35s ease forwards;
}

.map-loading-close {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    z-index: 2;
}

.map-loading-overlay.is-modal .map-loading-close {
    display: inline-flex;
}

.map-loading-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(148, 163, 184, 0.25) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(148, 163, 184, 0.25) 1px, transparent 1px);
    background-size: 20% 20%;
    opacity: 0.8;
}

.map-loading-world .world-map-modal-grid {
    position: absolute;
    inset: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 10px;
    pointer-events: none;
}

.map-loading-world .world-map-modal-cell {
    padding: 8px 6px 10px;
    border: 1px solid rgba(148, 163, 184, 0.08);
    line-height: 1.2;
    font-size: 10px;
    color: rgba(226, 232, 240, 0.9);
    background: rgba(15, 23, 42, 0.35);
    align-items: center;
    justify-content: flex-end;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}


.map-loading-world .world-map-modal-cell.is-capital {
    color: #fde68a;
    font-weight: 700;
}

.map-loading-world .world-map-modal-cell.is-world {
    color: #fca5a5;
    font-weight: 700;
}

.map-loading-world .world-map-modal-cell.is-current {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.5);
}

.map-loading-world .world-map-modal-cell.is-occupied-fire {
    background: rgba(239, 68, 68, 0.22);
}

.map-loading-world .world-map-modal-cell.is-occupied-water {
    background: rgba(59, 130, 246, 0.22);
}

.map-loading-world .world-map-modal-cell.is-occupied-earth {
    background: rgba(34, 197, 94, 0.22);
}

.map-loading-world .world-map-modal-cell.is-occupied-wind {
    background: rgba(245, 158, 11, 0.22);
}

.map-loading-world .world-map-modal-cell.is-occupied-neutral {
    background: rgba(148, 163, 184, 0.18);
}


.map-loading-labels {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: grid;
    gap: 4px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #f8fafc;
}

.map-loading-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.map-loading-current {
    font-size: 12px;
    font-weight: 600;
}

.map-loading-sub {
    font-size: 11px;
    color: rgba(226, 232, 240, 0.7);
}

@keyframes mapZoomIn {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    70% {
        transform: scale(2.1);
        opacity: 0.95;
    }
    100% {
        transform: scale(2.4);
        opacity: 0.85;
    }
}


.modal-overlay.active {
    display: flex;
}

.player-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
}

.player-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

.player-link:focus-visible {
    outline: 2px solid rgba(245, 158, 11, 0.7);
    outline-offset: 2px;
    border-radius: 8px;
}

.player-link-inline {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

#tabContentMap.map-ready .map-loading-overlay {
    opacity: 0;
    pointer-events: none;
}

#tabContentMap.map-ready .map-loading-overlay.is-modal {
    opacity: 1;
    pointer-events: auto;
}

/* Map select buttons (nation color gradients) */
.map-select-button {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(135deg, #1f2937, #0f172a);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.25);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.map-select-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.32);
    border-color: rgba(255, 255, 255, 0.35);
}

.map-select-button[data-area="wands"] {
    background: linear-gradient(135deg, #f97316, #ef4444);
    border-color: rgba(249, 115, 22, 0.6);
}

.map-select-button[data-area="pentacles"] {
    background: linear-gradient(135deg, #84cc16, #65a30d);
    border-color: rgba(132, 204, 22, 0.6);
}

.map-select-button[data-area="swords"] {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    border-color: rgba(56, 189, 248, 0.6);
}

.map-select-button[data-area="cups"] {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    border-color: rgba(96, 165, 250, 0.6);
}

.map-select-button[data-area="joker"] {
    background: linear-gradient(135deg, #64748b, #1f2937);
    border-color: rgba(148, 163, 184, 0.5);
}

.map-select-button--ghost {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(148, 163, 184, 0.55);
    color: #e2e8f0;
    box-shadow: none;
}

/* --- TROY tab --- */
.troy-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.troy-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.troy-state-badge {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5f5;
}

.troy-state-badge.open {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.45);
    color: #bbf7d0;
}

.troy-entry-section {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.troy-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.troy-entry-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sub);
}

.troy-entry-actions {
    display: flex;
    gap: 8px;
}

.troy-entry-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 700;
}

.troy-entry-btn.alt {
    background: rgba(71, 85, 105, 0.6);
}

.troy-entry-list {
    margin-top: 10px;
    display: grid;
    gap: 6px;
}

.troy-entry-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 13px;
}

.troy-entry-item.is-king-entry {
    display: grid;
    align-items: stretch;
    gap: 8px;
}

.troy-entry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.troy-entry-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.troy-entry-item b {
    color: var(--accent-color);
}

.troy-entry-rank {
    width: fit-content;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.1);
    color: #fde68a;
    font-size: 11px;
    font-weight: 900;
}

.troy-entry-benefit {
    color: var(--text-sub);
    font-size: 11px;
    line-height: 1.35;
}

.king-direct-grant-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.king-direct-grant-input {
    width: 86px;
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-main);
}

.king-direct-grant-btn {
    min-height: 32px;
    padding: 6px 10px;
}

.king-chip-return-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 5px 8px;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    background: rgba(15, 23, 42, 0.34);
}

.king-chip-return-label {
    flex: 0 0 auto;
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.king-chip-return-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
}

.king-chip-return-input-row {
    width: 104px;
    min-height: 30px;
}

.king-chip-return-btn {
    min-height: 30px;
    padding: 5px 9px;
    --button-icon: var(--icon-coin-stack);
}

@media (max-width: 520px) {
    .king-chip-return-panel {
        flex-wrap: nowrap;
    }

    .king-chip-return-controls {
        flex: 1 1 auto;
        justify-content: flex-end;
    }

    .king-chip-return-input-row {
        flex: 1 1 88px;
        max-width: 112px;
    }

    .king-chip-return-btn {
        flex: 0 0 auto;
    }
}

.king-store-game-inline {
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.22);
    background: rgba(15, 23, 42, 0.42);
    overflow: hidden;
}

.king-store-game-inline summary {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    color: #fde68a;
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
    list-style: none;
}

.king-store-game-inline summary::-webkit-details-marker {
    display: none;
}

.king-store-game-inline summary::after {
    content: '+';
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.12);
}

.king-store-game-inline[open] summary::after {
    content: '-';
}

.king-store-game-inline-form {
    display: grid;
    gap: 8px;
    padding: 0 10px 10px;
}

.king-store-game-inline-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(104px, 0.55fr);
    gap: 8px;
}

.king-store-game-inline-form.is-rating .king-store-game-inline-grid {
    grid-template-columns: minmax(0, 0.74fr) minmax(0, 1fr);
}

.king-store-game-inline-grid label {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.king-store-game-opponent-field[hidden],
[data-store-game-score-field][hidden] {
    display: none;
}

.king-store-game-inline-actions {
    display: flex;
    justify-content: flex-end;
}

.king-store-game-inline-save {
    min-height: 34px;
    padding: 7px 12px;
}

.troy-entry-empty {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--text-sub);
}

.troy-entry-count {
    margin-top: 4px;
    text-align: center;
    font-size: 13px;
    color: var(--text-sub);
}

.troy-menu {
    display: grid;
    gap: 12px;
}

.troy-menu-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.troy-calendar-section {
    margin-top: 12px;
}

.troy-calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.troy-calendar-meta,
.troy-calendar-empty,
.troy-calendar-note,
.troy-calendar-time {
    color: var(--text-sub);
    font-size: 0.86rem;
}

.troy-calendar-list {
    display: grid;
    gap: 8px;
}

.troy-calendar-collapsed {
    display: grid;
    gap: 8px;
}

.troy-calendar-collapsed > summary {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(220, 169, 82, 0.32);
    border-radius: 8px;
    background: rgba(23, 18, 13, 0.42);
    color: #f2d394;
    cursor: pointer;
    font-weight: 900;
    list-style: none;
}

.troy-calendar-collapsed > summary::-webkit-details-marker {
    display: none;
}

.troy-calendar-collapsed > summary::after {
    content: "開く";
    flex: 0 0 auto;
    color: #ffe7a6;
    font-size: 0.78rem;
}

.troy-calendar-collapsed[open] > summary::after {
    content: "閉じる";
}

.troy-calendar-collapsed-list {
    display: grid;
    gap: 8px;
}

.troy-menu-board-section {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.troy-menu-board-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(12, 9, 6, 0.26), rgba(0, 0, 0, 0.34)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
}

.troy-coin-convert-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 44%);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(14, 10, 6, 0.78), rgba(4, 8, 14, 0.9)),
        radial-gradient(ellipse at 50% 0%, rgba(220, 169, 82, 0.12), transparent 62%);
}

.troy-coin-convert-panel[hidden] {
    display: none;
}

.home-coin-convert-panel {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.home-coin-convert-panel .troy-coin-convert-controls {
    grid-template-columns: minmax(0, 1fr) 96px;
}

.home-chip-card {
    display: grid;
    gap: 10px;
    --home-card-icon: var(--icon-chip);
}

.home-chip-card[hidden] {
    display: none;
}

.home-chip-card-icon {
    width: 26px;
    height: 26px;
    background: var(--icon-chip) center / contain no-repeat;
}

.troy-coin-convert-copy {
    min-width: 0;
}

.troy-coin-convert-title {
    color: #ffe5a4;
    font-size: 14px;
    font-weight: 1000;
    line-height: 1.25;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.troy-coin-convert-note,
.troy-coin-convert-message {
    margin-top: 3px;
    color: #d0b98c;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
}

.troy-coin-convert-message {
    grid-column: 1 / -1;
    min-height: 15px;
}

.troy-coin-convert-message[data-tone="success"] {
    color: #bbf7d0;
}

.troy-coin-convert-message[data-tone="error"] {
    color: #fecaca;
}

.troy-coin-convert-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    gap: 8px;
    align-items: center;
}

.troy-coin-convert-input {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid rgba(220, 169, 82, 0.44);
    border-radius: 6px;
    background: rgba(10, 8, 6, 0.86);
    color: #f8e8bd;
    font-size: 14px;
    font-weight: 900;
}

.troy-coin-convert-input:disabled {
    opacity: 0.58;
}

.troy-coin-convert-button {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.42), rgba(109, 58, 11, 0.28)),
        linear-gradient(180deg, #f2c45f, #a86420);
    color: #1d0e04;
    font-size: 13px;
    font-weight: 1000;
    white-space: nowrap;
}

.troy-coin-convert-button:disabled {
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    color: #bfa97a;
    filter: saturate(0.75) brightness(0.88);
}

.troy-staff-chip-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background:
        radial-gradient(circle at 50% 55%, rgba(236, 181, 82, 0.2), transparent 42%),
        rgba(3, 5, 9, 0.82);
}

.troy-staff-chip-confirm-overlay[hidden] {
    display: none;
}

.troy-staff-chip-confirm-card {
    width: min(92vw, 420px);
    min-height: min(76vh, 520px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 30px 24px 28px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 18px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(18, 12, 5, 0.94), rgba(4, 7, 12, 0.96)),
        radial-gradient(ellipse at 50% 22%, rgba(255, 225, 130, 0.2), transparent 62%);
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.55);
    color: #fff5cf;
    text-align: center;
    transform: rotate(180deg);
}

.troy-staff-chip-confirm-title {
    color: #f7d982;
    font-size: 18px;
    font-weight: 1000;
    line-height: 1.2;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
}

.troy-staff-chip-confirm-amount {
    color: #ffffff;
    font-size: clamp(48px, 16vw, 88px);
    font-weight: 1000;
    line-height: 0.95;
    letter-spacing: 0;
    text-shadow:
        0 4px 0 rgba(0, 0, 0, 0.88),
        0 0 22px rgba(255, 207, 94, 0.28);
}

.troy-staff-chip-confirm-note {
    max-width: 15em;
    color: #ead6a4;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.45;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.troy-staff-chip-confirm-button {
    width: min(54vw, 210px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 14px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff7d7;
    font-size: 14px;
    font-weight: 1000;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.88);
    cursor: pointer;
    touch-action: manipulation;
}

.troy-staff-chip-confirm-button:focus-visible {
    outline: 3px solid rgba(255, 233, 162, 0.92);
    outline-offset: 5px;
}

.troy-staff-chip-confirm-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter:
        drop-shadow(0 8px 9px rgba(0, 0, 0, 0.58))
        drop-shadow(0 0 18px rgba(255, 214, 103, 0.26));
}

.troy-menu-board-tabs {
    display: flex;
    gap: 6px;
    margin-inline: -2px;
    padding: 0 2px 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(220, 169, 82, 0.58) rgba(10, 8, 6, 0.42);
}

.troy-menu-board-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 6px 11px 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.22), rgba(2, 6, 23, 0.42)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.06), transparent 58%);
    color: #d7c5a6;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
    box-shadow: none;
}

.troy-menu-board-tab-icon {
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    overflow: hidden;
}

.troy-menu-board-tab-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55));
}

.troy-menu-board-tab-label {
    display: block;
}

.troy-menu-board-tab.is-active {
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.34), rgba(109, 58, 11, 0.24)),
        linear-gradient(180deg, #e7b64b, #9c5c1e);
    color: #241306;
    text-shadow: 0 1px 0 rgba(255, 245, 210, 0.48);
}

.troy-menu-board-list {
    display: grid;
    gap: 8px;
}

.troy-menu-board-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 66px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-navy-wide.png") 34 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(8, 20, 32, 0.9), rgba(2, 5, 10, 0.96)),
        radial-gradient(ellipse at 50% 0%, rgba(66, 149, 196, 0.1), transparent 58%);
}

.troy-menu-board-item.is-sold-out {
    opacity: 0.58;
}

.troy-menu-board-item.is-orderable {
    cursor: pointer;
}

.troy-menu-board-item.is-orderable:active {
    filter: brightness(1.08);
}

.troy-menu-board-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 8px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(24, 31, 42, 0.66), rgba(7, 10, 15, 0.92)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
    font-size: 23px;
    line-height: 1;
}

.troy-menu-board-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

.troy-menu-modal-emoji.has-image img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
}

.troy-menu-board-body {
    min-width: 0;
}

.troy-menu-board-name {
    color: #ffe5a4;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.troy-menu-board-detail {
    margin-top: 3px;
    color: #d0b98c;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.troy-menu-board-price-wrap {
    display: grid;
    gap: 4px;
    justify-items: end;
    min-width: 112px;
}

.troy-menu-board-price {
    color: #f8f0dc;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.troy-menu-board-badge {
    width: max-content;
    max-width: 100%;
    padding: 2px 6px;
    border: 1px solid rgba(239, 68, 68, 0.42);
    border-radius: 999px;
    color: #fecaca;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.troy-menu-board-badge.is-ask {
    border-color: rgba(220, 169, 82, 0.44);
    color: #f2d394;
}

.troy-menu-board-badge.is-select {
    border-color: rgba(245, 158, 11, 0.42);
    color: #ffe5a4;
}

.troy-menu-board-order-modal {
    position: fixed;
    inset: 0;
    z-index: 18000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.58);
}

.troy-menu-board-order-modal[hidden] {
    display: none;
}

body.modal-lock .troy-menu-board-order-modal {
    pointer-events: auto;
}

.troy-menu-board-order-card {
    position: relative;
    width: min(420px, 100%);
    max-height: min(82vh, 680px);
    overflow: auto;
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 14px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(16, 10, 4, 0.88), rgba(3, 8, 15, 0.96)),
        radial-gradient(ellipse at 50% 0%, rgba(220, 169, 82, 0.16), transparent 62%);
    color: #f8e8bd;
}

.troy-menu-board-order-close {
    position: absolute;
    top: 1px;
    right: 1px;
}

.troy-menu-board-order-head {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding-right: 58px;
}

.troy-menu-board-order-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 8px / 0 stretch;
    font-size: 30px;
}

.troy-menu-board-order-icon img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    image-rendering: pixelated;
}

.troy-menu-board-order-title {
    color: #ffe5a4;
    font-size: 17px;
    font-weight: 1000;
    line-height: 1.25;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.troy-menu-board-order-detail {
    margin-top: 4px;
    color: #d0b98c;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.troy-menu-board-order-field {
    display: grid;
    gap: 7px;
}

.troy-menu-board-order-label {
    color: #f2d394;
    font-size: 12px;
    font-weight: 1000;
}

.troy-menu-board-order-select {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid rgba(220, 169, 82, 0.44);
    border-radius: 6px;
    background: rgba(10, 8, 6, 0.86);
    color: #f8e8bd;
    font-size: 14px;
    font-weight: 900;
}

.troy-menu-board-order-sizes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.troy-menu-board-size-choice {
    display: grid;
    gap: 3px;
    min-height: 54px;
    padding: 7px 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 8px / 0 stretch;
    background: rgba(10, 8, 6, 0.68);
    color: #f4d3a4;
    font-weight: 1000;
}

.troy-menu-board-size-choice strong {
    color: #f8f0dc;
    font-size: 12px;
}

.troy-menu-board-size-choice.is-active {
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
    color: #1d0e04;
}

.troy-menu-board-size-choice.is-active strong {
    color: #1d0e04;
}

.troy-menu-board-order-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 10px;
    align-items: center;
    margin-top: 2px;
}

.troy-menu-board-order-total {
    color: #fff4cf;
    font-size: 18px;
    font-weight: 1000;
}

.troy-menu-board-order-submit {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.42), rgba(109, 58, 11, 0.28)),
        linear-gradient(180deg, #f2c45f, #a86420);
    color: #1d0e04;
    font-size: 14px;
    font-weight: 1000;
}

.troy-menu-board-order-submit:disabled {
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    color: #bfa97a;
    filter: saturate(0.75) brightness(0.88);
}

.troy-calendar-item {
    display: grid;
    grid-template-columns: minmax(58px, 72px) 1fr;
    gap: 10px;
    align-items: start;
    padding: 10px;
    border: 1px solid rgba(160, 132, 79, 0.35);
    border-radius: 8px;
    background: rgba(23, 18, 13, 0.48);
}

.troy-calendar-item.is-closed {
    opacity: 0.72;
}

.troy-calendar-item.is-reservable {
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.troy-calendar-item.is-reservable:hover,
.troy-calendar-item.is-reservable:focus-visible {
    border-color: rgba(251, 191, 36, 0.78);
    background: rgba(38, 28, 16, 0.72);
    outline: none;
    transform: translateY(-1px);
}

.troy-calendar-date {
    font-weight: 800;
    color: var(--accent-color);
    white-space: nowrap;
}

.troy-calendar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.troy-calendar-status {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(160, 132, 79, 0.45);
    color: var(--accent-color);
    font-size: 0.76rem;
    font-weight: 800;
}

.troy-calendar-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.troy-calendar-actions button {
    min-height: 30px;
    padding: 4px 10px;
}

.troy-calendar-reserve-hint {
    margin-top: 6px;
    color: var(--accent-color);
    font-size: 0.78rem;
    font-weight: 800;
}

.troy-reservation-panel {
    margin-top: 12px;
}

.troy-reservation-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.troy-reservation-actions button {
    min-height: 40px;
}

.king-reservation-mount {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.king-reservation-list {
    display: grid;
    gap: 8px;
}

.king-reservation-card {
    display: grid;
    gap: 7px;
    padding: 10px 12px;
    border: 1px solid rgba(220, 169, 82, 0.35);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(16, 11, 8, 0.82), rgba(5, 7, 11, 0.9)),
        radial-gradient(ellipse at 50% 0%, rgba(220, 169, 82, 0.1), transparent 62%);
}

.king-reservation-head,
.king-reservation-meta,
.king-reservation-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.king-reservation-head {
    justify-content: space-between;
}

.king-reservation-head strong {
    color: #ffe5a4;
    font-size: 14px;
    font-weight: 1000;
}

.king-reservation-status {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(220, 169, 82, 0.18);
    color: #f8e8bd;
    font-size: 11px;
    font-weight: 900;
}

.king-reservation-card.is-pending .king-reservation-status {
    background: rgba(250, 204, 21, 0.18);
    color: #fde68a;
}

.king-reservation-card.is-approved .king-reservation-status {
    background: rgba(34, 197, 94, 0.18);
    color: #bbf7d0;
}

.king-reservation-meta,
.king-reservation-note {
    color: #d0b98c;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
}

.king-reservation-actions {
    justify-content: flex-end;
}

.king-reservation-actions button {
    min-width: 88px;
}

.home-qr-actions {
    display: grid;
    gap: 8px;
    justify-items: center;
    margin-top: 12px;
}

.home-qr-scan-btn {
    min-height: 44px;
    width: min(100%, 220px);
    border: 1px solid transparent;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(70, 181, 238, 0.22), rgba(3, 28, 45, 0.3)),
        linear-gradient(180deg, #104c70, #071b29);
    color: #eff8ff;
    font-weight: 900;
    --button-icon: var(--icon-qr-scan);
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 10px / 0 stretch;
    letter-spacing: 0;
    line-height: 1.08;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
    box-shadow: none;
    padding: 8px 14px;
    gap: 8px;
    font-size: 15px;
}

.home-qr-scan-btn:disabled {
    opacity: 0.6;
}

.home-qr-help {
    color: var(--text-sub);
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
}

.troy-primary-action-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(9, 14, 24, 0.96)),
        radial-gradient(120% 120% at 0% 0%, rgba(56, 189, 248, 0.08), transparent 48%);
}

.troy-primary-action-card.is-open {
    border-color: rgba(34, 197, 94, 0.24);
}

.troy-primary-action-card.is-member {
    border-color: rgba(251, 191, 36, 0.26);
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96)),
        radial-gradient(120% 120% at 0% 0%, rgba(245, 158, 11, 0.1), transparent 48%);
}

.troy-primary-action-title {
    color: #f8fafc;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.3;
}

.troy-primary-action-meta {
    margin-top: 3px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

.troy-primary-action-btn {
    min-width: 76px;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    background: rgba(14, 116, 144, 0.3);
    color: #e0f2fe;
    font-size: 13px;
    font-weight: 900;
    box-shadow: none;
}

.troy-primary-action-btn:disabled {
    opacity: 0.52;
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(30, 41, 59, 0.7);
    color: #94a3b8;
}

.troy-menu-note {
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.6;
}

.troy-order-inline-status {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.5;
}

.troy-order-inline-status.is-pending {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(120, 53, 15, 0.2);
    color: #fef3c7;
}

.king-troy-ops-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.king-troy-status {
    margin-top: 4px;
    color: #f8fafc;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.king-troy-status.is-open {
    color: #bbf7d0;
}

.king-menu-disable-list {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}

.king-menu-group-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.king-menu-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.king-menu-toggle-btn {
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(30, 41, 59, 0.7);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.king-menu-toggle-btn.is-sold-out {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.45);
    color: rgba(252, 165, 165, 0.75);
    text-decoration: line-through;
}

/* 本日のおすすめ */
.king-menu-specials-list {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.king-menu-specials-empty {
    font-size: 12px;
    color: var(--text-sub);
    padding: 4px 0;
}

.king-menu-special-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.4);
}

.king-menu-special-emoji {
    font-size: 18px;
    flex-shrink: 0;
}

.king-menu-special-name {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.king-menu-special-name small {
    display: block;
    margin-top: 2px;
    color: var(--text-sub);
    font-size: 10px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}

.king-menu-special-price {
    font-size: 12px;
    font-weight: 700;
    color: #fbbf24;
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .troy-order-inline-status {
        font-size: 11px;
        padding: 8px 9px;
    }
}

/* --- タロットポーカー --- */
.tarot-game-switch-wrap {
    margin-bottom: 8px;
    border-radius: 16px;
    border: 1px solid rgba(167, 139, 250, 0.28);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.18), transparent 60%),
        linear-gradient(180deg, rgba(10, 8, 28, 0.97), rgba(16, 12, 36, 0.98));
    padding: 16px;
}

.tarot-game-select-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(167, 139, 250, 0.2);
}

.tarot-game-select-icon {
    font-size: 36px;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.7));
}

.tarot-game-select-title {
    margin: 0;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #e9d5ff;
    border: none;
    padding: 0;
}

.tarot-game-select-sub {
    font-size: 11px;
    color: rgba(167, 139, 250, 0.7);
    letter-spacing: 0.06em;
    margin-top: 2px;
}

.tarot-game-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* カード型モード選択ボタン */
.tarot-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    border-radius: 14px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    background: rgba(15, 12, 36, 0.85);
    color: #c4b5fd;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.tarot-mode-card.is-active {
    border-color: rgba(167, 139, 250, 0.75);
    background:
        linear-gradient(180deg, rgba(109, 40, 217, 0.3), rgba(76, 29, 149, 0.35));
    color: #ede9fe;
    box-shadow:
        0 0 0 1px rgba(167, 139, 250, 0.3),
        0 0 20px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.tarot-mode-icon {
    font-size: 28px;
    line-height: 1;
}

.tarot-mode-card.is-active .tarot-mode-icon {
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.7));
}

.tarot-mode-name {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tarot-mode-desc {
    font-size: 10px;
    color: rgba(196, 181, 253, 0.65);
    font-weight: 500;
    letter-spacing: 0.03em;
}

.tarot-mode-card.is-active .tarot-mode-desc {
    color: rgba(221, 214, 254, 0.8);
}

.tarot-game-switch button.is-active {
    border-color: rgba(250, 204, 21, 0.75);
    background: linear-gradient(180deg, rgba(250, 204, 21, 0.25), rgba(180, 83, 9, 0.35));
    color: #fff4cf;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.28);
}

#tarotModeKingdom {
    font-size: 12px;
    letter-spacing: 0.01em;
}

.tarot-poker-root {
    overflow: visible;
    position: relative;
    --tarot-card-w: 54px;
    --tarot-card-h: 88px;
    --tarot-art-w: 48px;
    --tarot-art-h: 80px;
    --tarot-art-left: 5px;
    --tarot-art-top: 8px;
    --tarot-card-radius: 10px;
    --tarot-card-padding: 4px;
    --tarot-card-number-size: 22px;
    --tarot-card-title-size: 10px;
    --tarot-interact-border: rgba(244, 114, 182, 0.95);
    --tarot-interact-border-soft: rgba(244, 114, 182, 0.78);
    --tarot-interact-glow: rgba(236, 72, 153, 0.45);
    --tarot-interact-selected: rgba(255, 225, 244, 0.98);
}

.tarot-kingdom-root {
    --tarot-card-w: 54px;
    --tarot-card-h: 88px;
    --tarot-art-w: 48px;
    --tarot-art-h: 80px;
    --tarot-kingdom-mobile-height: auto;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 136px);
}

.tarot-kingdom-root.is-trick-shake-normal {
    animation: tarotKingdomTrickShakeNormal 100ms ease-out 1;
}

.tarot-kingdom-root.is-trick-shake-special {
    animation: tarotKingdomTrickShakeSpecial 150ms ease-out 1;
}

.tarot-kingdom-root.is-trick-shake-heavy {
    animation: tarotKingdomTrickShakeHeavy 190ms ease-out 1;
}

.tarot-kingdom-root.is-trick-shake-ultra {
    animation: tarotKingdomTrickShakeUltra 230ms cubic-bezier(0.2, 0.84, 0.24, 1) 1;
}

.tarot-kingdom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.tarot-kingdom-header h2 {
    margin: 0;
    font-size: clamp(13px, 1.7vw, 16px);
    line-height: 1.1;
}

.tarot-kingdom-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tarot-kingdom-header-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tarot-kingdom-chip {
    display: inline-flex;
    align-items: center;
    min-height: 21px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 23, 42, 0.62);
    color: #e5e7eb;
    font-size: 11px;
    font-weight: 700;
}

/* The round chip is hidden before a match starts, where there is no round to count. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomRound.tarot-kingdom-chip[hidden] {
    display: none;
}

.tarot-kingdom-chip--reverse {
    border-color: rgba(251, 191, 36, 0.78);
    background: linear-gradient(180deg, rgba(113, 63, 18, 0.7), rgba(120, 53, 15, 0.84));
    color: #fde68a;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
    box-shadow:
        0 0 0 1px rgba(251, 191, 36, 0.24),
        0 0 14px rgba(251, 191, 36, 0.26);
    animation: tarotKingdomReversePulse 1.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .tarot-kingdom-chip--reverse {
        animation: none;
    }
}

.tarot-kingdom-chip--lock {
    border-color: rgba(148, 163, 184, 0.72);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.74), rgba(15, 23, 42, 0.82));
    color: #e2e8f0;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.tarot-kingdom-chip--lock.is-lock-wand {
    border-color: rgba(220, 38, 38, 0.78);
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.76), rgba(153, 27, 27, 0.84));
    color: #fecaca;
}

.tarot-kingdom-chip--lock.is-lock-cup {
    border-color: rgba(37, 99, 235, 0.78);
    background: linear-gradient(180deg, rgba(30, 64, 175, 0.76), rgba(29, 78, 216, 0.84));
    color: #bfdbfe;
}

.tarot-kingdom-chip--lock.is-lock-sword {
    border-color: rgba(217, 119, 6, 0.78);
    background: linear-gradient(180deg, rgba(146, 64, 14, 0.78), rgba(180, 83, 9, 0.86));
    color: #fde68a;
}

.tarot-kingdom-chip--lock.is-lock-pentacle {
    border-color: rgba(22, 163, 74, 0.78);
    background: linear-gradient(180deg, rgba(21, 128, 61, 0.76), rgba(22, 163, 74, 0.84));
    color: #bbf7d0;
}

.tarot-kingdom-chip--owner {
    border-color: rgba(148, 163, 184, 0.64);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.8));
    color: #cbd5e1;
    max-width: min(58vw, 420px);
    justify-content: flex-start;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tarot-kingdom-chip--chain {
    border-color: rgba(250, 204, 21, 0.82);
    background: linear-gradient(180deg, rgba(88, 28, 135, 0.9), rgba(49, 10, 101, 0.94));
    color: #fff7c2;
    font-family: "Times New Roman", serif;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-shadow: 0 1px 2px #000, 0 0 7px rgba(250, 204, 21, 0.72);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 10px rgba(168, 85, 247, 0.38);
}

.tarot-kingdom-chip--chain[data-chain-level="3"] {
    border-color: rgba(216, 180, 254, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 0 13px rgba(192, 132, 252, 0.58);
}

.tarot-kingdom-chip--chain[data-chain-level="4"] {
    border-color: rgba(254, 240, 138, 0.96);
    background: linear-gradient(180deg, rgba(153, 27, 27, 0.94), rgba(76, 5, 25, 0.96));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 16px rgba(251, 113, 133, 0.64);
}

.tarot-kingdom-root.is-reverse .tarot-kingdom-panel {
    border-color: rgba(251, 191, 36, 0.4);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.14);
}

@keyframes tarotKingdomReversePulse {
    0%,
    100% {
        transform: translateY(0);
        filter: saturate(1);
    }
    50% {
        transform: translateY(-1px);
        filter: saturate(1.15);
    }
}

.tarot-kingdom-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 8px;
}

.tarot-kingdom-controls[hidden],
.tarot-kingdom-controls > button[hidden] {
    display: none !important;
}

.tarot-kingdom-action-popup {
    z-index: 3420;
    pointer-events: auto;
    touch-action: manipulation;
}

.tarot-kingdom-action-popup.is-human-ready {
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.35),
        0 0 20px rgba(250, 204, 21, 0.28),
        0 12px 32px rgba(0, 0, 0, 0.62);
}

.tarot-kingdom-action-popup.is-call-locked {
    filter: saturate(0.86) brightness(0.84);
    box-shadow:
        0 0 0 1px rgba(96, 165, 250, 0.25),
        0 0 22px rgba(59, 130, 246, 0.22),
        0 14px 32px rgba(0, 0, 0, 0.65);
}

.tarot-kingdom-action-popup::before {
    content: "プレイヤーアクション";
}


#tarotKingdomStartOnlineButton,
#tarotKingdomStartOfflineButton,
#tarotKingdomRetreatButton,
#tarotKingdomRestartButton {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(17, 24, 39, 0.66);
    color: #e5e7eb;
    font-weight: 700;
}

#tarotKingdomStartOnlineButton.is-selected,
#tarotKingdomStartOfflineButton.is-selected,
#tarotKingdomRestartButton.is-selected,
#tarotKingdomStartButton.is-selected {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.98));
    border-color: rgba(250, 204, 21, 0.55);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.18),
        0 8px 18px rgba(0, 0, 0, 0.32);
    color: #f8fafc;
}

#tarotKingdomStartOfflineButton.is-offline-alt {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.88), rgba(15, 23, 42, 0.92));
    border-color: rgba(148, 163, 184, 0.34);
    color: #dbeafe;
}

#tarotKingdomRetreatButton.is-retreat {
    background: linear-gradient(180deg, rgba(69, 34, 34, 0.9), rgba(31, 18, 18, 0.96));
    border-color: rgba(248, 113, 113, 0.4);
    color: #fee2e2;
}

#tarotKingdomRestartButton {
    background: linear-gradient(180deg, rgba(109, 40, 217, 0.88), rgba(59, 7, 100, 0.94));
    border-color: rgba(196, 181, 253, 0.38);
    color: #f5f3ff;
}

.tarot-kingdom-openrooms {
    margin: 8px 0 12px;
    padding: 14px 12px;
    border-radius: 13px;
    border: 1px solid rgba(230, 189, 88, 0.32);
    background: linear-gradient(135deg, rgba(25, 45, 83, 0.48), rgba(15, 28, 65, 0.44));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tarot-kingdom-openrooms-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 900;
    color: #fff4c5;
    margin-bottom: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tarot-kingdom-openrooms-title::before {
    content: '●';
    color: #e7bd58;
    font-size: 14px;
    animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.tarot-kingdom-openrooms-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #7688aa #0a0d15;
}

.tarot-kingdom-openrooms-list::-webkit-scrollbar {
    width: 6px;
}

.tarot-kingdom-openrooms-list::-webkit-scrollbar-track {
    background: transparent;
}

.tarot-kingdom-openrooms-list::-webkit-scrollbar-thumb {
    background: #7688aa;
    border-radius: 3px;
}

.tarot-kingdom-openrooms-item {
    display: flex;
    flex-direction: column;
    padding: 10px 11px;
    border-radius: 11px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: linear-gradient(135deg, rgba(35, 55, 95, 0.52), rgba(20, 35, 70, 0.48));
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
    position: relative;
}

.tarot-kingdom-openrooms-item:hover {
    border-color: rgba(230, 189, 88, 0.6);
    background: linear-gradient(135deg, rgba(50, 75, 120, 0.62), rgba(30, 50, 90, 0.58));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.tarot-kingdom-openrooms-item.is-current {
    border-color: rgba(34, 197, 94, 0.8);
    background: linear-gradient(135deg, rgba(30, 95, 55, 0.68), rgba(25, 140, 75, 0.72));
    color: #dcfce7;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

.tarot-kingdom-openrooms-item > span {
    display: block;
}

.tarot-kingdom-openrooms-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-weight: 700;
    color: #fff4c5;
}

.tarot-kingdom-openrooms-item-header::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e7bd58;
    flex-shrink: 0;
}

.tarot-kingdom-openrooms-item.is-current .tarot-kingdom-openrooms-item-header::before {
    background: #22c55e;
}

.tarot-kingdom-openrooms-item-players {
    font-size: 10px;
    color: #bac6dc;
    margin-bottom: 4px;
}

.tarot-kingdom-openrooms-item-status {
    font-size: 9px;
    color: #9099b7;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    text-align: center;
    margin-top: auto;
}

.tarot-kingdom-settlement {
    margin: 6px 0 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.68), rgba(15, 23, 42, 0.52));
    color: #e5edf7;
}

.tarot-kingdom-settlement-title {
    font-size: 12px;
    font-weight: 800;
    color: #f8d67b;
    margin-bottom: 6px;
}

.tarot-kingdom-settlement-body {
    display: grid;
    gap: 6px;
}

.tarot-kingdom-settlement-ranking {
    border: 1px solid rgba(250, 204, 21, 0.34);
    border-radius: 9px;
    padding: 6px 8px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.62), rgba(30, 41, 59, 0.48));
}

.tarot-kingdom-settlement-ranking-title {
    font-size: 11px;
    font-weight: 800;
    color: #fde68a;
    margin-bottom: 4px;
}

.tarot-kingdom-settlement-ranking-champion {
    margin-bottom: 4px;
    padding: 4px 6px;
    border-radius: 7px;
    border: 1px solid rgba(251, 191, 36, 0.5);
    background: linear-gradient(180deg, rgba(120, 53, 15, 0.42), rgba(120, 53, 15, 0.22));
    color: #fde68a;
    font-size: 12px;
    font-weight: 900;
}

.tarot-kingdom-settlement-ranking-list {
    display: grid;
    gap: 4px;
}

.tarot-kingdom-settlement-ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.44);
    padding: 4px 6px;
}

.tarot-kingdom-settlement-ranking-item.is-rank-1 {
    border-color: rgba(251, 191, 36, 0.62);
    box-shadow:
        inset 0 0 0 1px rgba(251, 191, 36, 0.2),
        0 0 12px rgba(251, 191, 36, 0.14);
}

.tarot-kingdom-settlement-ranking-item.is-rank-2 {
    border-color: rgba(203, 213, 225, 0.52);
}

.tarot-kingdom-settlement-ranking-item.is-rank-3 {
    border-color: rgba(251, 146, 60, 0.52);
}

.tarot-kingdom-settlement-ranking-item.is-champion {
    box-shadow:
        inset 0 0 0 1px rgba(251, 191, 36, 0.28),
        0 0 16px rgba(251, 191, 36, 0.18);
}

.tarot-kingdom-settlement-ranking-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tarot-kingdom-settlement-ranking-medal {
    font-size: 18px;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.tarot-kingdom-settlement-ranking-name {
    font-size: 12px;
    font-weight: 800;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tarot-kingdom-settlement-ranking-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tarot-kingdom-settlement-ranking-chips {
    font-size: 12px;
    font-weight: 800;
    color: #f8fafc;
}

.tarot-kingdom-settlement-ranking-delta {
    font-size: 11px;
    font-weight: 900;
}

.tarot-kingdom-settlement-ranking-delta.is-plus {
    color: #86efac;
}

.tarot-kingdom-settlement-ranking-delta.is-minus {
    color: #fca5a5;
}

.tarot-kingdom-settlement-head {
    font-size: 12px;
    font-weight: 700;
    color: #f8fafc;
}

.tarot-kingdom-settlement-winner {
    display: block;
    border: 1px solid rgba(245, 158, 11, 0.46);
    border-radius: 9px;
    padding: 6px 8px;
    background: linear-gradient(180deg, rgba(146, 64, 14, 0.42), rgba(120, 53, 15, 0.24));
    font-size: 12px;
    font-weight: 800;
    color: #fde68a;
    text-align: left;
}

.tarot-kingdom-settlement-winner-main {
    font-size: 12px;
    font-weight: 800;
    color: #fde68a;
}

.tarot-kingdom-settlement-winner-sub {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #fef3c7;
}

.tarot-kingdom-settlement-row {
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.42);
}

.tarot-kingdom-settlement-row-top {
    font-size: 12px;
    font-weight: 700;
    color: #dbeafe;
}

.tarot-kingdom-settlement-row-values {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 700;
    color: #fef08a;
}

.tarot-kingdom-settlement-row-formula {
    margin-top: 2px;
    font-size: 11px;
    color: #bfdbfe;
    word-break: break-word;
}

.tarot-kingdom-settlement-pot,
.tarot-kingdom-settlement-total {
    font-size: 12px;
    font-weight: 800;
    color: #fde68a;
}

/* The result button floats over the top of the field panel (idle between rounds) instead of taking
   its own row, so the field and hand do not jump down when a round ends. */
.tarot-kingdom-settlement-actions {
    --tk-settlement-actions-height: 54px;
    position: relative;
    z-index: 80;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    height: var(--tk-settlement-actions-height);
    margin: 0 0 calc(-1 * var(--tk-settlement-actions-height));
    padding: 0 8px;
    pointer-events: none;
}

.tarot-kingdom-settlement-actions > button {
    pointer-events: auto;
}

.tarot-kingdom-settlement-actions[hidden] {
    display: none;
}

#tarotKingdomSettlementConfirmButton {
    width: min(100%, 360px);
    min-height: 44px;
    min-width: 0;
    max-width: 100%;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.5);
    background: linear-gradient(180deg, #b45309, #78350f);
    color: #f8fafc;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 4px 12px rgba(0, 0, 0, 0.28);
}

#tarotKingdomSettlementConfirmButton:disabled {
    opacity: 0.45;
    filter: grayscale(0.3);
}

.tarot-kingdom-score {
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.5);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
}

.tarot-kingdom-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.tarot-kingdom-panel {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    padding: 8px;
}

.tarot-kingdom-panel-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #e5e7eb;
}

.tarot-kingdom-panel-title--actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.tarot-kingdom-trick-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tarot-kingdom-trick-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    flex-wrap: wrap;
}

.tarot-kingdom-trick-status .tarot-kingdom-chip {
    min-height: 19px;
    padding: 0 7px;
    font-size: 10px;
}

.tarot-kingdom-hand-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tarot-kingdom-hand-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.tarot-kingdom-your-turn-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px solid rgba(250, 204, 21, 0.78);
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.92), rgba(120, 53, 15, 0.94));
    color: #fff8d7;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.74),
        -1px 1px 0 rgba(0, 0, 0, 0.74),
        1px -1px 0 rgba(0, 0, 0, 0.74),
        1px 1px 0 rgba(0, 0, 0, 0.74);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.28),
        0 0 16px rgba(250, 204, 21, 0.32);
    opacity: 0;
    transform: translateY(4px) scale(0.96);
    pointer-events: none;
}

.tarot-kingdom-your-turn-badge.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: tarotKingdomYourTurnBadgePulse 0.9s ease-in-out 1;
}

.tarot-kingdom-clear-inline {
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px solid rgba(8, 145, 178, 0.5);
    background: linear-gradient(180deg, rgba(8, 145, 178, 0.9), rgba(14, 116, 144, 0.9));
    color: #ecfeff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.15;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 4px 10px rgba(0, 0, 0, 0.3);
}

.tarot-kingdom-play-inline {
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px solid rgba(147, 51, 234, 0.5);
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.92), rgba(126, 34, 206, 0.92));
    color: #f5f3ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.15;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 4px 10px rgba(0, 0, 0, 0.3);
}

.tarot-kingdom-clear-inline:disabled,
.tarot-kingdom-play-inline:disabled {
    opacity: 0.45;
    filter: grayscale(0.25);
    box-shadow: none;
}

.tarot-kingdom-hand {
    --tarot-card-w: 27px;
    --tarot-card-h: 44px;
    --tarot-card-radius: 6px;
    --tarot-art-w: 48px;
    --tarot-art-h: 80px;
    --tarot-card-padding: 2px;
    --tarot-card-number-size: 12px;
    --tarot-card-title-size: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-height: var(--tarot-card-h, 44px);
    overflow: visible;
    perspective: 700px;
}

.tarot-kingdom-hand .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    transform-origin: center center;
}

.tarot-kingdom-hand .tarot-card.is-selected {
    transform: translateY(-6px);
    border-color: var(--tarot-interact-selected, rgba(255, 225, 244, 0.98));
    box-shadow:
        0 0 0 1px var(--tarot-interact-border-soft, rgba(244, 114, 182, 0.78)),
        0 0 14px var(--tarot-interact-glow, rgba(236, 72, 153, 0.45));
}

.tarot-kingdom-hand .tarot-card.is-selected::after {
    content: "✓";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: #ffffff;
    background: rgba(16, 185, 129, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 1px rgba(5, 46, 22, 0.55),
        0 3px 10px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 6;
}

.tarot-kingdom-hand .tarot-card.is-opening-flip {
    /*
     * The sheet contains the back-to-face turn at indices 110-119, followed by
     * the complete blank face at index 105. The button itself never transforms.
     */
    animation: none !important;
    isolation: isolate;
    transform: none;
}

.tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-art:not(.tarot-card-flip-sprite),
.tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-title,
.tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-number,
.tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-ap-cost {
    animation: tarotKingdomCardFaceReveal var(--tk-card-flip-duration, 330ms) steps(1, end) both;
}

.tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-flip-sprite {
    z-index: 20;
    pointer-events: none;
    animation: tarotKingdomCardSpriteFlip var(--tk-card-flip-duration, 330ms) steps(1, end) both;
    will-change: background-position, opacity;
}

@keyframes tarotKingdomCardSpriteFlip {
    0% { background-position: 0 -880px; opacity: 1; }
    9% { background-position: -48px -880px; }
    18% { background-position: -96px -880px; }
    27% { background-position: -144px -880px; }
    36% { background-position: -192px -880px; }
    45% { background-position: -240px -880px; }
    54% { background-position: -288px -880px; }
    63% { background-position: -336px -880px; }
    72% { background-position: -384px -880px; }
    81% { background-position: -432px -880px; }
    90% { background-position: calc(var(--tarot-flip-face-x, 240px) * -1) calc(var(--tarot-flip-face-y, 800px) * -1); opacity: 1; }
    100% { background-position: calc(var(--tarot-flip-face-x, 240px) * -1) calc(var(--tarot-flip-face-y, 800px) * -1); opacity: 0; }
}

@keyframes tarotKingdomCardFaceReveal {
    0%,
    90% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-art,
    .tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-title,
    .tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-number,
    .tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-ap-cost {
        animation: none !important;
        opacity: 1;
    }

    .tarot-kingdom-hand .tarot-card.is-opening-flip > .tarot-card-flip-sprite {
        display: none;
    }
}

/* Five-card role formation: build the hand on the field before it becomes a summon seal. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-field-clearing {
    pointer-events: none;
    transform-origin: 50% 100%;
    animation: tarotKingdomRoleFieldClear var(--role-field-clear-ms, 160ms) cubic-bezier(0.4, 0, 0.78, 0.34) forwards !important;
    animation-play-state: running !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving {
    opacity: 0;
    pointer-events: none;
    transform-origin: 50% 68%;
    animation-timing-function: cubic-bezier(0.16, 0.84, 0.22, 1) !important;
    animation-fill-mode: both !important;
    animation-play-state: running !important;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-from-right {
    animation-name: tarotKingdomRoleCardFromRight !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-from-top {
    animation-name: tarotKingdomRoleCardFromTop !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-fade {
    animation-name: tarotKingdomRoleCardFade !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-slam {
    animation-name: tarotKingdomRoleCardSlam !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-orbit {
    animation-name: tarotKingdomRoleCardOrbit !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-fan-left {
    animation-name: tarotKingdomRoleCardFanLeft !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-fan-right {
    animation-name: tarotKingdomRoleCardFanRight !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-entry-converge {
    animation-name: tarotKingdomRoleCardConverge !important;
}

@keyframes tarotKingdomRoleFieldClear {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: brightness(1); }
    100% { opacity: 0; transform: translate3d(-10px, 12px, 0) scale(0.9) rotate(-2deg); filter: brightness(0.55) saturate(0.6); }
}

@keyframes tarotKingdomRoleCardFromRight {
    0% { opacity: 0; transform: translate3d(92px, -4px, 0) rotate(9deg) scale(0.9); }
    68% { opacity: 1; transform: translate3d(-3px, 0, 0) rotate(-1deg) scale(1.025); }
    100% { opacity: 1; transform: none; }
}

@keyframes tarotKingdomRoleCardFromTop {
    0% { opacity: 0; transform: translate3d(0, -82px, 0) rotate(calc(var(--role-entry-angle, 0deg) * 0.35)) scale(0.94); }
    70% { opacity: 1; transform: translate3d(0, 4px, 0) rotate(0deg) scale(1.035); }
    84% { opacity: 1; transform: translate3d(0, -2px, 0) scale(0.99); }
    100% { opacity: 1; transform: none; }
}

@keyframes tarotKingdomRoleCardFade {
    0% { opacity: 0; transform: scale(0.96); filter: brightness(1.65) saturate(0.82); }
    58% { opacity: 1; transform: scale(1.025); filter: brightness(1.24) saturate(1.08); }
    100% { opacity: 1; transform: none; filter: none; }
}

@keyframes tarotKingdomRoleCardSlam {
    0% { opacity: 0; transform: translate3d(0, -66px, 0) scale(1.08); }
    58% { opacity: 1; transform: translate3d(0, 5px, 0) scale(0.98); }
    72% { opacity: 1; transform: translate3d(calc(var(--role-entry-direction, 1) * 2px), -2px, 0) scale(1.025); }
    100% { opacity: 1; transform: none; }
}

@keyframes tarotKingdomRoleCardOrbit {
    0% {
        opacity: 0;
        transform: translate3d(calc(var(--role-entry-direction, 1) * 76px), -38px, 0)
            rotate(calc(var(--role-entry-angle, 0deg) + 34deg)) scale(0.68);
    }
    62% { opacity: 1; transform: translate3d(calc(var(--role-entry-direction, 1) * -4px), 2px, 0) rotate(-2deg) scale(1.03); }
    100% { opacity: 1; transform: none; }
}

@keyframes tarotKingdomRoleCardFanLeft {
    0% { opacity: 0; transform: translate3d(-78px, 28px, 0) rotate(-22deg) scale(0.82); }
    68% { opacity: 1; transform: translate3d(3px, -2px, 0) rotate(2deg) scale(1.025); }
    100% { opacity: 1; transform: none; }
}

@keyframes tarotKingdomRoleCardFanRight {
    0% { opacity: 0; transform: translate3d(78px, 28px, 0) rotate(22deg) scale(0.82); }
    68% { opacity: 1; transform: translate3d(-3px, -2px, 0) rotate(-2deg) scale(1.025); }
    100% { opacity: 1; transform: none; }
}

@keyframes tarotKingdomRoleCardConverge {
    0% {
        opacity: 0;
        transform: translate3d(calc(var(--role-entry-direction, 1) * 58px), -52px, 0)
            rotate(var(--role-entry-angle, 0deg)) scale(0.72);
    }
    62% { opacity: 1; transform: translate3d(0, 3px, 0) rotate(0) scale(1.06); }
    78% { opacity: 1; transform: translate3d(0, -2px, 0) scale(0.99); }
    100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
        #tarotKingdomTrick > .tarot-card:is(.is-role-field-clearing, .is-role-arriving) {
        animation: none !important;
        transform: none !important;
        filter: none !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
        #tarotKingdomTrick > .tarot-card.is-role-field-clearing {
        opacity: 0 !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
        #tarotKingdomTrick > .tarot-card.is-role-arriving {
        opacity: 1 !important;
    }
}

.tarot-kingdom-players {
    display: grid;
    gap: 6px;
}

.tarot-kingdom-players-summary {
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(96, 165, 250, 0.45);
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.32), rgba(15, 23, 42, 0.6));
    color: #dbeafe;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: normal;
}

.tarot-kingdom-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    min-height: 26px;
    padding: 3px 7px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
    min-width: 0;
}

.tarot-kingdom-player-row.is-turn {
    border-color: rgba(250, 204, 21, 0.9);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.3),
        0 0 12px rgba(250, 204, 21, 0.2);
}

.tarot-kingdom-player-row.is-turn.is-human {
    border-color: rgba(250, 204, 21, 0.96);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.5),
        0 0 20px rgba(250, 204, 21, 0.36),
        0 0 34px rgba(59, 130, 246, 0.26);
    animation: tarotKingdomHumanTurnPulse 0.95s ease-in-out infinite;
}

.tarot-kingdom-player-row.is-human {
    border-color: rgba(59, 130, 246, 0.8);
}

.tarot-kingdom-player-row.is-call-focus {
    border-color: rgba(96, 165, 250, 0.95);
    box-shadow:
        0 0 0 1px rgba(96, 165, 250, 0.45),
        0 0 22px rgba(59, 130, 246, 0.35),
        0 0 36px rgba(30, 64, 175, 0.22);
}

.tarot-kingdom-player-row.is-call-dim {
    opacity: 0.56;
    filter: saturate(0.78);
}

.tarot-kingdom-player-row.is-last-one {
    border-color: rgba(248, 113, 113, 0.95);
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.38), rgba(69, 10, 10, 0.48));
    box-shadow:
        0 0 0 1px rgba(248, 113, 113, 0.38),
        0 0 18px rgba(248, 113, 113, 0.28);
    animation: tarotKingdomLastOnePulse 1.05s ease-in-out infinite;
}

.tarot-kingdom-player-row.is-last-one .tarot-kingdom-player-name {
    color: #fee2e2;
}

.tarot-kingdom-player-row.is-last-one .tarot-kingdom-player-meta {
    color: #fecaca;
}

.tarot-kingdom-player-row.fx-action {
    border-color: rgba(250, 204, 21, 0.9);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.42),
        0 0 18px rgba(250, 204, 21, 0.28);
}

.tarot-kingdom-player-row.fx-action::after {
    content: attr(data-action);
    position: absolute;
    right: 8px;
    top: -9px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid rgba(250, 204, 21, 0.68);
    background: rgba(15, 23, 42, 0.94);
    color: #fde68a;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.65);
}

.tarot-kingdom-player-name {
    font-size: 11px;
    font-weight: 800;
    color: #f8fafc;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tarot-kingdom-player-meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #cbd5e1;
    white-space: nowrap;
    min-width: 0;
}

.tarot-kingdom-player-row.is-settlement {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 7px 7px 4px;
}

.tarot-kingdom-player-row.is-settlement.has-settle-float {
    padding-right: 74px;
}

.tarot-kingdom-player-row.is-settlement .tarot-kingdom-player-meta {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
    flex: 0 0 auto;
}

.tarot-kingdom-player-row.is-settlement .tarot-kingdom-rank-medal {
    font-size: 18px;
    margin-left: 2px;
}

.tarot-kingdom-rank-medal {
    font-size: 20px;
    line-height: 1;
    margin-left: 2px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}

.tarot-kingdom-player-row.is-rank-first {
    border-color: rgba(251, 191, 36, 0.62);
    box-shadow:
        inset 0 0 0 1px rgba(251, 191, 36, 0.18),
        0 0 12px rgba(251, 191, 36, 0.18);
}

.tarot-kingdom-player-row.is-rank-champion {
    background: linear-gradient(180deg, rgba(120, 53, 15, 0.46), rgba(92, 39, 11, 0.42));
}

.tarot-kingdom-meta-hand {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid rgba(251, 191, 36, 0.62);
    background: rgba(120, 53, 15, 0.34);
    color: #fde68a;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.01em;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.58),
        -1px 1px 0 rgba(0, 0, 0, 0.58),
        1px -1px 0 rgba(0, 0, 0, 0.58),
        1px 1px 0 rgba(0, 0, 0, 0.58);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.2),
        0 0 8px rgba(250, 204, 21, 0.22);
}

.tarot-kingdom-meta-ap {
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    border: 1px solid rgba(125, 211, 252, 0.7);
    border-radius: 999px;
    color: #e0f2fe;
    background: rgba(8, 47, 73, 0.64);
    font-weight: 900;
    letter-spacing: 0.03em;
    box-shadow: 0 0 7px rgba(56, 189, 248, 0.24);
}

.tarot-kingdom-meta-hand.is-low {
    border-color: rgba(248, 113, 113, 0.76);
    background: rgba(127, 29, 29, 0.42);
    color: #fee2e2;
    box-shadow:
        0 0 0 1px rgba(248, 113, 113, 0.28),
        0 0 10px rgba(248, 113, 113, 0.34);
}

.tarot-kingdom-meta-hand.is-critical {
    animation: tarotKingdomHandCriticalPulse 0.88s ease-in-out infinite;
}

.tarot-kingdom-meta-sep {
    opacity: 0.78;
    font-weight: 800;
}

.tarot-kingdom-meta-chips {
    color: #cbd5e1;
    font-weight: 700;
}

.tarot-kingdom-meta-chips.is-settlement {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.34);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.88));
    color: #f8fafc;
    font-size: 11px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 0 1px rgba(15, 23, 42, 0.22);
}

.tarot-kingdom-settle-float {
    position: absolute;
    top: 0;
    right: 8px;
    transform: translateY(-48%);
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.01em;
    border: 1px solid rgba(148, 163, 184, 0.42);
    background: rgba(15, 23, 42, 0.96);
    color: #e2e8f0;
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.3),
        0 4px 10px rgba(2, 6, 23, 0.42);
    pointer-events: none;
    z-index: 1;
}

.tarot-kingdom-settle-float.is-gain {
    border-color: rgba(34, 197, 94, 0.62);
    background: rgba(21, 128, 61, 0.92);
    color: #dcfce7;
}

.tarot-kingdom-settle-float.is-loss {
    border-color: rgba(248, 113, 113, 0.62);
    background: rgba(127, 29, 29, 0.92);
    color: #fee2e2;
}

.tarot-kingdom-flag {
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid rgba(248, 113, 113, 0.65);
    color: #fecaca;
    background: rgba(127, 29, 29, 0.35);
    font-size: 10px;
    font-weight: 900;
}

.tarot-kingdom-flag.is-rate {
    border-color: rgba(34, 197, 94, 0.65);
    color: #bbf7d0;
    background: rgba(20, 83, 45, 0.35);
}

.tarot-kingdom-flag.is-last-one {
    border-color: rgba(248, 113, 113, 0.82);
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.52);
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.34);
}

.tarot-kingdom-trick {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-calm-sea.webp");
    --kingdom-field-tint: linear-gradient(transparent, transparent);
    --kingdom-field-shade: linear-gradient(180deg, rgba(2, 6, 23, 0.28), rgba(2, 6, 23, 0.5));
    --kingdom-field-glow: rgba(56, 189, 248, 0.12);
    --kingdom-field-position: center, center, center;
    --kingdom-field-size: 100% 100%, 100% 100%, cover;
    --kingdom-field-motion-y: 50%;
    --kingdom-role-chain-ring-width: 0px;
    --kingdom-role-chain-ring-color: transparent;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: calc(var(--tarot-card-h, 88px) + 4px);
    position: relative;
    isolation: isolate;
    overflow: visible;
    background-color: #020617;
    background-image:
        linear-gradient(transparent, transparent),
        linear-gradient(180deg, rgba(2, 6, 23, 0.28), rgba(2, 6, 23, 0.5)),
        url("./assets/ui/tarot-kingdom/field-calm-sea.webp");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%, 100% 100%, cover;
    border-radius: 10px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        inset 0 -16px 24px rgba(2, 6, 23, 0.22),
        0 0 18px var(--kingdom-field-glow);
    transition: box-shadow 180ms ease;
}

.tarot-kingdom-field-scene-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 420ms ease-in-out;
    will-change: opacity;
}

.tarot-kingdom-field-scene-layer.is-active {
    opacity: 1;
}

.tarot-kingdom-trick:not(.is-scene-world):not(.is-scene-cut):not(.is-scene-back)
    > .tarot-kingdom-field-scene-layer.is-active {
    animation: tarotKingdomSceneGentleFlow 2.4s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.tarot-kingdom-trick > .tarot-card,
.tarot-kingdom-trick > .tarot-kingdom-field-slot {
    position: relative;
    z-index: 2;
}

.tarot-kingdom-trick.is-scene-role {
    --kingdom-field-shade: linear-gradient(180deg, rgba(2, 6, 23, 0.08), rgba(2, 6, 23, 0.34));
    --kingdom-field-glow: rgba(186, 230, 253, 0.24);
    --kingdom-role-suit-tint: rgba(186, 230, 253, 0.08);
    --kingdom-field-tint:
        radial-gradient(ellipse at 50% 58%, var(--kingdom-role-suit-tint), transparent 72%);
    --kingdom-field-position: center, center, center 58%;
    --kingdom-field-motion-y: 58%;
    animation: tarotKingdomSceneRolePulse 1.65s ease-in-out infinite alternate;
}

.tarot-kingdom-trick.is-scene-role[data-role-chain="2"] {
    --kingdom-role-chain-ring-width: 1px;
    --kingdom-role-chain-ring-color: rgba(250, 204, 21, 0.34);
}

.tarot-kingdom-trick.is-scene-role[data-role-chain="3"] {
    --kingdom-role-chain-ring-width: 2px;
    --kingdom-role-chain-ring-color: rgba(216, 180, 254, 0.46);
}

.tarot-kingdom-trick.is-scene-role[data-role-chain]:not([data-role-chain=""]):not([data-role-chain="2"]):not([data-role-chain="3"]) {
    --kingdom-role-chain-ring-width: 3px;
    --kingdom-role-chain-ring-color: rgba(254, 240, 138, 0.58);
}

.tarot-kingdom-trick.is-scene-role-straight {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-role-straight.webp?v=2");
}

.tarot-kingdom-trick.is-scene-role-flush {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-role-flush.webp");
}

.tarot-kingdom-trick.is-scene-role-full-house {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-role-full-house.webp");
}

.tarot-kingdom-trick.is-scene-role-four-kind {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-role-four-kind.webp");
}

.tarot-kingdom-trick.is-scene-role-world {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-role-world.webp");
}

.tarot-kingdom-trick.is-scene-role-straight-flush {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-role-straight-flush.webp");
}

.tarot-kingdom-trick.is-scene-role-five-kind {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-role-five-kind.webp");
}

.tarot-kingdom-trick:is(.is-scene-role-flush, .is-scene-role-straight-flush).is-scene-role-suit-wand {
    --kingdom-role-suit-tint: rgba(211, 74, 64, 0.36);
    --kingdom-field-glow: rgba(211, 74, 64, 0.28);
}

.tarot-kingdom-trick:is(.is-scene-role-flush, .is-scene-role-straight-flush).is-scene-role-suit-cup {
    --kingdom-role-suit-tint: rgba(63, 137, 207, 0.36);
    --kingdom-field-glow: rgba(63, 137, 207, 0.3);
}

.tarot-kingdom-trick:is(.is-scene-role-flush, .is-scene-role-straight-flush).is-scene-role-suit-sword {
    --kingdom-role-suit-tint: rgba(155, 114, 230, 0.38);
    --kingdom-field-glow: rgba(155, 114, 230, 0.3);
}

.tarot-kingdom-trick:is(.is-scene-role-flush, .is-scene-role-straight-flush).is-scene-role-suit-pentacle {
    --kingdom-role-suit-tint: rgba(58, 166, 109, 0.36);
    --kingdom-field-glow: rgba(58, 166, 109, 0.28);
}

.tarot-kingdom-trick.is-scene-lock {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-lock-rock.webp?v=3");
    --kingdom-field-shade: linear-gradient(180deg, rgba(15, 23, 42, 0.18), rgba(2, 6, 23, 0.42));
    --kingdom-field-glow: rgba(251, 191, 36, 0.22);
}

.tarot-kingdom-trick.is-scene-lock.is-scene-lock-wand {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-lock-lava.webp");
    --kingdom-field-shade: linear-gradient(180deg, rgba(69, 10, 10, 0.12), rgba(20, 4, 4, 0.38));
    --kingdom-field-glow: rgba(248, 113, 113, 0.3);
}

.tarot-kingdom-trick.is-scene-lock.is-scene-lock-cup {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-lock-ice.webp");
    --kingdom-field-shade: linear-gradient(180deg, rgba(14, 116, 144, 0.08), rgba(8, 47, 73, 0.38));
    --kingdom-field-glow: rgba(103, 232, 249, 0.28);
}

.tarot-kingdom-trick.is-scene-lock.is-scene-lock-sword {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-lock-storm.webp");
    --kingdom-field-shade: linear-gradient(180deg, rgba(76, 29, 149, 0.08), rgba(30, 10, 58, 0.38));
    --kingdom-field-glow: rgba(196, 181, 253, 0.3);
}

.tarot-kingdom-trick.is-scene-lock.is-scene-lock-pentacle {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-lock-rock.webp?v=3");
    --kingdom-field-shade: linear-gradient(180deg, rgba(63, 48, 24, 0.08), rgba(20, 36, 27, 0.38));
    --kingdom-field-glow: rgba(74, 222, 128, 0.26);
}

.tarot-kingdom-trick.is-scene-back {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-reverse-whirlpool.webp");
    --kingdom-field-shade: radial-gradient(circle at 50% 52%, rgba(2, 6, 23, 0.04), rgba(2, 6, 23, 0.52) 76%);
    --kingdom-field-glow: rgba(251, 191, 36, 0.2);
    --kingdom-field-size: 100% 100%, 100% 100%, 108% 112%;
    --kingdom-field-position: center, center, 48.5% 49%;
}

.tarot-kingdom-trick.is-scene-back > .tarot-kingdom-field-scene-layer.is-active {
    animation: tarotKingdomSceneBackFlow 1.2s cubic-bezier(0.42, 0.02, 0.58, 0.98) infinite;
}

.tarot-kingdom-trick.is-scene-cut {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-cut-crack.webp");
    --kingdom-field-shade: linear-gradient(180deg, rgba(2, 6, 23, 0.06), rgba(2, 6, 23, 0.4));
    --kingdom-field-glow: rgba(125, 211, 252, 0.3);
    animation: tarotKingdomSceneCutPulse 560ms ease-out 1;
}

.tarot-kingdom-trick.is-scene-cut > .tarot-kingdom-field-scene-layer {
    transition-duration: 0s;
}

.tarot-kingdom-trick.is-scene-skip {
    --kingdom-field-shade: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(2, 6, 23, 0.38));
    --kingdom-field-glow: rgba(186, 230, 253, 0.32);
}

.tarot-kingdom-trick.is-scene-skip::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: inherit;
    background: url("./assets/ui/tarot-kingdom/field-skip-wave.webp") center 26% / cover no-repeat;
    opacity: 0;
    will-change: background-position, opacity;
    animation: tarotKingdomSceneSkipWave 900ms cubic-bezier(0.32, 0.02, 0.3, 1) 1 both;
}

.tarot-kingdom-trick.is-scene-skip > .tarot-card,
.tarot-kingdom-trick.is-scene-skip > .tarot-kingdom-field-slot {
    z-index: 2;
}

.tarot-kingdom-trick.is-scene-world {
    --kingdom-field-scene: url("./assets/ui/tarot-kingdom/field-world-clock.webp?v=2");
    --kingdom-field-shade: radial-gradient(circle at 50% 64%, rgba(2, 6, 23, 0.02), rgba(2, 6, 23, 0.5) 82%);
    --kingdom-field-glow: rgba(226, 232, 240, 0.24);
    animation: tarotKingdomSceneWorldStill 1.8s ease-in-out infinite alternate;
}

@keyframes tarotKingdomSceneBackFlow {
    0% {
        background-position: center, center, 46% 47.5%;
        box-shadow:
            inset 0 0 0 1px rgba(251, 191, 36, 0.12),
            inset 0 -16px 24px rgba(2, 6, 23, 0.2),
            0 0 12px rgba(251, 191, 36, 0.12);
    }
    22% {
        background-position: center, center, 53.5% 51.5%;
    }
    48% {
        background-position: center, center, 47.2% 54%;
        box-shadow:
            inset 0 0 0 1px rgba(251, 191, 36, 0.28),
            inset 0 -16px 24px rgba(2, 6, 23, 0.32),
            0 0 24px rgba(251, 191, 36, 0.22);
    }
    72% {
        background-position: center, center, 54% 46.5%;
    }
    100% {
        background-position: center, center, 46% 47.5%;
        box-shadow:
            inset 0 0 0 1px rgba(251, 191, 36, 0.12),
            inset 0 -16px 24px rgba(2, 6, 23, 0.2),
            0 0 12px rgba(251, 191, 36, 0.12);
    }
}

@keyframes tarotKingdomSceneGentleFlow {
    0%,
    100% {
        background-position: center, center, 49.4% var(--kingdom-field-motion-y);
    }
    28% {
        background-position: center, center, 50.7% calc(var(--kingdom-field-motion-y) + 0.5%);
    }
    56% {
        background-position: center, center, 49.7% calc(var(--kingdom-field-motion-y) + 1%);
    }
    78% {
        background-position: center, center, 50.5% calc(var(--kingdom-field-motion-y) - 0.4%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-kingdom-field-scene-layer {
        transition: none;
    }

    .tarot-kingdom-trick.is-scene-back > .tarot-kingdom-field-scene-layer.is-active {
        animation: none;
        background-position: center, center, center;
    }

    .tarot-kingdom-trick:not(.is-scene-world):not(.is-scene-cut):not(.is-scene-back)
        > .tarot-kingdom-field-scene-layer.is-active {
        animation: none;
    }

    .tarot-kingdom-trick.is-scene-skip {
        animation: none;
        background-position: center, center, center;
    }

    .tarot-kingdom-trick.is-scene-skip::after {
        animation: none;
        background-position: center;
        opacity: 0.72;
    }

    .tarot-kingdom-trick.is-scene-role {
        animation: none;
        box-shadow:
            inset 0 0 0 var(--kingdom-role-chain-ring-width) var(--kingdom-role-chain-ring-color),
            inset 0 -12px 22px rgba(2, 6, 23, 0.18),
            0 0 14px var(--kingdom-field-glow);
    }
}

@keyframes tarotKingdomSceneRolePulse {
    from {
        box-shadow:
            inset 0 0 0 var(--kingdom-role-chain-ring-width) var(--kingdom-role-chain-ring-color),
            inset 0 0 0 1px rgba(186, 230, 253, 0.12),
            inset 0 -12px 22px rgba(2, 6, 23, 0.18),
            0 0 12px var(--kingdom-field-glow);
    }
    to {
        box-shadow:
            inset 0 0 0 calc(var(--kingdom-role-chain-ring-width) + 1px) var(--kingdom-role-chain-ring-color),
            inset 0 0 0 1px rgba(224, 242, 254, 0.25),
            inset 0 -12px 24px rgba(2, 6, 23, 0.28),
            0 0 24px var(--kingdom-field-glow);
    }
}

@keyframes tarotKingdomSceneCutPulse {
    0%,
    100% {
        box-shadow:
            inset 0 0 0 1px rgba(125, 211, 252, 0.12),
            0 0 14px rgba(125, 211, 252, 0.16);
    }
    50% {
        box-shadow:
            inset 0 0 0 2px rgba(224, 242, 254, 0.34),
            0 0 28px rgba(125, 211, 252, 0.38);
    }
}

@keyframes tarotKingdomSceneSkipWave {
    0% {
        background-position: center 26%;
        opacity: 0;
        box-shadow:
            inset 0 0 0 1px rgba(186, 230, 253, 0.08),
            0 0 8px rgba(186, 230, 253, 0.08);
    }
    12% {
        opacity: 0.82;
    }
    52% {
        background-position: center 78%;
        opacity: 1;
        box-shadow:
            inset 0 0 0 2px rgba(240, 249, 255, 0.4),
            0 0 32px rgba(125, 211, 252, 0.42);
    }
    86% {
        background-position: center 34%;
        opacity: 0.68;
        box-shadow:
            inset 0 0 0 1px rgba(224, 242, 254, 0.2),
            0 0 18px rgba(125, 211, 252, 0.22);
    }
    100% {
        background-position: center 26%;
        opacity: 0;
        box-shadow:
            inset 0 0 0 1px rgba(186, 230, 253, 0.1),
            0 0 12px rgba(186, 230, 253, 0.12);
    }
}

@keyframes tarotKingdomSceneWorldStill {
    from {
        box-shadow:
            inset 0 0 0 1px rgba(226, 232, 240, 0.12),
            inset 0 0 26px rgba(15, 23, 42, 0.22),
            0 0 12px rgba(226, 232, 240, 0.12);
    }
    to {
        box-shadow:
            inset 0 0 0 1px rgba(226, 232, 240, 0.26),
            inset 0 0 34px rgba(15, 23, 42, 0.38),
            0 0 22px rgba(226, 232, 240, 0.22);
    }
}

.tarot-kingdom-trick.is-clear-sweep::before {
    content: "";
    position: absolute;
    left: -14%;
    top: 6%;
    width: 42%;
    height: 88%;
    pointer-events: none;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(250, 204, 21, 0.62), rgba(255, 255, 255, 0));
    filter: blur(1px);
    opacity: 0;
    z-index: 18;
    animation: tarotKingdomClearSweepLine 420ms cubic-bezier(0.18, 0.84, 0.24, 1) 1;
}

.tarot-kingdom-trick.is-hit-stop .tarot-card {
    animation-play-state: paused !important;
}

.tarot-kingdom-trick-emphasis {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 16;
}

.tarot-kingdom-trick-emphasis-card {
    transform: translateY(4px) scale(0.92);
    opacity: 0;
    filter: saturate(1.08) brightness(1.06);
    box-shadow:
        0 10px 22px rgba(0, 0, 0, 0.42),
        0 0 0 1px rgba(255, 255, 255, 0.35),
        0 0 16px rgba(250, 204, 21, 0.28);
    z-index: 17;
}

.tarot-kingdom-trick-emphasis.run .tarot-kingdom-trick-emphasis-card {
    animation: tarotKingdomTrickWinPop 220ms cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.tarot-kingdom-trick-emphasis.is-special .tarot-kingdom-trick-emphasis-card {
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.46),
        0 0 0 1px rgba(255, 255, 255, 0.4),
        0 0 22px rgba(96, 165, 250, 0.34),
        0 0 30px rgba(250, 204, 21, 0.22);
}

.tarot-kingdom-empty {
    font-size: 12px;
    color: #94a3b8;
}

.tarot-kingdom-empty.is-leaving {
    transition: opacity 130ms ease, transform 130ms ease;
    opacity: 0.4;
    transform: translateY(-6px);
}

.tarot-kingdom-judgment {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
    --tarot-card-w: 25px;
    --tarot-card-h: 41px;
    --tarot-card-radius: 6px;
    --tarot-card-padding: 2px;
    --tarot-card-number-size: 12px;
    --tarot-card-title-size: 8px;
}

.tarot-kingdom-judgment-title {
    margin: 0 0 6px;
    font-size: 11px;
    color: #fde68a;
    font-weight: 800;
}

.tarot-kingdom-judgment-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    overflow-x: hidden;
    padding-bottom: 2px;
}

.tarot-kingdom-judgment-options.is-trash-options {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: 4px 0 6px;
}

.tarot-kingdom-judgment-options.is-trash-options > .tarot-card {
    --tarot-card-w: 38px;
    --tarot-card-h: 63px;
    --tarot-card-radius: 5px;
    --tarot-card-padding: 3px;
}

.tarot-kingdom-grave-rank-header {
    display: grid;
    grid-template-columns: repeat(14, var(--tarot-card-w, 27px));
    gap: 1px;
    width: max-content;
    max-width: 100%;
}

.tarot-kingdom-grave-rank-cell {
    font-size: 10px;
    font-weight: 700;
    color: #cbd5e1;
    text-align: center;
    opacity: 0.95;
}

.tarot-kingdom-grave-row {
    display: block;
    width: max-content;
    max-width: 100%;
}

.tarot-kingdom-grave-grid {
    display: grid;
    grid-template-columns: repeat(14, var(--tarot-card-w, 27px));
    gap: 1px;
    width: max-content;
    max-width: 100%;
}

.tarot-kingdom-grave-slot {
    width: var(--tarot-card-w, 27px);
    height: var(--tarot-card-h, 44px);
    border-radius: 6px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    background: rgba(2, 6, 23, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tarot-kingdom-grave-slot .tarot-card {
    width: var(--tarot-card-w, 27px);
    min-width: var(--tarot-card-w, 27px);
    height: var(--tarot-card-h, 44px);
    min-height: var(--tarot-card-h, 44px);
}

.tarot-kingdom-grave-slot .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    transform-origin: center center;
}

.tarot-kingdom-grave-slot-empty {
    font-size: 10px;
    color: #94a3b8;
    opacity: 0.4;
    line-height: 1;
}

.tarot-kingdom-judgment-owner {
    position: absolute;
    right: 4px;
    bottom: 14px;
    font-size: 9px;
    color: #e2e8f0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.tarot-kingdom-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.tarot-kingdom-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(var(--tarot-card-h, 88px) + 8px);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(17, 24, 39, 0.58);
    padding: 3px;
    overflow: hidden;
}

.tarot-kingdom-cell.is-player {
    border-color: rgba(59, 130, 246, 0.75);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.tarot-kingdom-cell.is-cpu {
    border-color: rgba(239, 68, 68, 0.75);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.25);
}

.tarot-kingdom-cell.is-capital::after {
    content: '★';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 11px;
    color: #fde68a;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tarot-kingdom-cell.is-targetable {
    border-color: rgba(250, 204, 21, 0.92);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.45),
        0 0 12px rgba(250, 204, 21, 0.2);
}

/* Tarot Kingdom cards use the same core card styles as Tarot Poker (.tarot-card*). */

.tarot-poker-root.is-time-stopped {
    animation: tarotTimeStopMonochrome 1.2s ease-in-out infinite;
}

@keyframes tarotTimeStopMonochrome {
    0%,
    100% {
        filter: grayscale(1) contrast(1.25) saturate(0.15);
    }
    50% {
        filter: grayscale(1) contrast(1.5) saturate(0) invert(0.06);
    }
}

.tarot-poker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 10px;
}

.tarot-poker-header h2 {
    font-size: clamp(17px, 2.2vw, 22px);
    white-space: nowrap;
    word-break: keep-all;
    line-height: 1.1;
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    flex: 0 0 auto;
}

.tarot-poker-header-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.tarot-poker-sub {
    font-size: 11px;
    color: var(--text-sub);
    white-space: nowrap;
}

.tarot-pot-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 150px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(253, 224, 71, 0.5);
    background: linear-gradient(140deg, rgba(245, 158, 11, 0.3), rgba(15, 23, 42, 0.94));
    color: #fef3c7;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.75);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15), 0 10px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: tarotPotPulse 2.2s ease-in-out infinite;
}

.tarot-pot-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    color: rgba(254, 243, 199, 0.82);
    white-space: nowrap;
}

.tarot-pot-slit {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    min-width: 52px;
    overflow: hidden;
}

.tarot-pot-value {
    display: inline-block;
    line-height: 1;
    font-size: clamp(18px, 2.6vw, 24px);
    font-weight: 900;
    color: #fff3c0;
}

.tarot-pot-unit {
    font-size: 10px;
    color: rgba(254, 243, 199, 0.74);
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.tarot-pot-chip::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-120%);
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.18) 46%, transparent 100%);
    animation: tarotPotSheen 3.2s ease-in-out infinite;
    pointer-events: none;
}

.tarot-pot-chip.is-hot {
    border-color: rgba(251, 191, 36, 0.75);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3), 0 0 20px rgba(251, 191, 36, 0.26), 0 8px 20px rgba(0, 0, 0, 0.45);
}

.tarot-pot-chip.is-rolling .tarot-pot-value {
    animation: tarotPotRoll 0.12s linear infinite;
}

.tarot-poker-controls {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.tarot-poker-controls button {
    flex: 1;
}

.tarot-poker-mode-toggle {
    flex: 0 0 auto;
    min-width: 240px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tarot-poker-mode-btn {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.98));
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tarot-poker-mode-btn.is-active {
    color: #fff3c4;
    border-color: rgba(251, 191, 36, 0.52);
    background:
        radial-gradient(140% 120% at 50% 0%, rgba(245, 158, 11, 0.2), rgba(255, 255, 255, 0) 52%),
        linear-gradient(180deg, rgba(71, 85, 105, 0.94), rgba(17, 24, 39, 0.98));
    box-shadow:
        0 0 0 1px rgba(251, 191, 36, 0.18),
        0 10px 18px rgba(2, 6, 23, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.tarot-poker-mode-btn:disabled {
    opacity: 0.58;
}

.tarot-draw-guide {
    margin: 6px 0 10px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.65);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.tarot-betting-info {
    margin: 0 0 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.45);
    padding: 6px 8px;
}

.tarot-betting-points {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #e8eef8;
    margin-bottom: 6px;
}

.tarot-betting-hint {
    font-size: 12px;
    color: #ffd98f;
    margin-bottom: 8px;
}

.tarot-betting-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tarot-betting-actions button,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton) {
    flex: 0 0 var(--tarot-card-w, 58px);
    width: var(--tarot-card-w, 58px);
    height: var(--tarot-card-h, 96px);
    min-height: var(--tarot-card-h, 96px);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.03em;
    padding: 5px 2px;
    border-radius: var(--tarot-card-radius, 10px);
    border: 1px solid rgba(255, 255, 255, 0.44);
    color: #f8fafc;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.78),
        0 0 10px rgba(255, 255, 255, 0.14);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -8px 14px rgba(0, 0, 0, 0.24),
        0 10px 18px rgba(0, 0, 0, 0.46),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: transform 0.14s ease, filter 0.2s ease, box-shadow 0.24s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-line;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.08;
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(130% 90% at 50% -20%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 44%),
        linear-gradient(180deg, #475569, #1f2937);
}

.tarot-betting-actions button::before,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton)::before {
    content: "";
    position: absolute;
    inset: -18% auto -18% -58%;
    width: 46%;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
    transform: translateX(-130%) rotate(8deg);
    z-index: -1;
    pointer-events: none;
    animation: tarotActionSheen 3.2s linear infinite;
}

.tarot-betting-actions button::after,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton)::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.12);
    pointer-events: none;
    z-index: -1;
}

.tarot-betting-actions button:not(:disabled):active,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton):not(:disabled):active {
    transform: translateY(1px) scale(0.982);
}

.tarot-betting-actions button:not(:disabled):hover,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton):not(:disabled):hover {
    filter: brightness(1.12) saturate(1.06);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.26),
        inset 0 -8px 14px rgba(0, 0, 0, 0.26),
        0 12px 22px rgba(0, 0, 0, 0.52),
        0 0 0 1px rgba(255, 255, 255, 0.16);
}

.tarot-betting-actions button.is-ready,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton).is-ready {
    border-color: rgba(250, 204, 21, 0.86);
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.42),
        0 0 18px rgba(250, 204, 21, 0.35),
        0 10px 20px rgba(0, 0, 0, 0.5);
    animation: tarotKingdomReadyButtonPulse 0.92s ease-in-out infinite;
}

/* Tarot Kingdom: 自分ターン時のアクションボタン揺れを停止（強調は維持） */
#tarotKingdomActionPopup .tarot-betting-actions button.is-ready {
    animation: none;
    transform: none;
}

.tarot-betting-actions button:disabled,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton):disabled {
    opacity: 0.42;
    filter: grayscale(0.34) brightness(0.82);
}

.tarot-betting-actions button:disabled::before,
.tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton):disabled::before {
    animation: none;
    opacity: 0;
}

#tarotBetCheck,
#tarotKingdomPassButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(226, 232, 240, 0.24), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #475569, #111827);
}

#tarotKingdomFoldButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(253, 186, 116, 0.28), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #c2410c, #7c2d12);
}

#tarotKingdomActionPopup .tarot-betting-actions > button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
}

#tarotKingdomFoldButton.is-active {
    border-color: rgba(251, 191, 36, 0.9);
    box-shadow:
        0 0 0 1px rgba(251, 191, 36, 0.52),
        0 0 20px rgba(249, 115, 22, 0.42),
        0 10px 20px rgba(0, 0, 0, 0.52);
    filter: none;
}

#tarotBetCall,
#tarotKingdomClearButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(186, 230, 253, 0.3), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #0ea5b7, #155e75);
}

#tarotBetBet,
#tarotKingdomPlayButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(233, 213, 255, 0.3), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #a855f7, #6d28d9);
}

#tarotBetRaise {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(254, 215, 170, 0.32), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #d97706, #9a3412);
}

#tarotBetFold,
#tarotKingdomFoldButton.is-major-draw {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(254, 202, 202, 0.28), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #ef4444, #991b1b);
}

#tarotKingdomPassButton.is-minor-draw {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(187, 247, 208, 0.28), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #16a34a, #14532d);
}

#tarotKingdomGraveToggleButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(199, 210, 254, 0.3), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #4f46e5, #312e81);
}

.tarot-bet-popup {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    transform: translateX(-50%);
    width: fit-content;
    max-width: calc(100% - 12px);
    z-index: 3400;
    border: 1px solid var(--action-panel-border);
    border-radius: 12px;
    background: var(--action-panel-bg);
    backdrop-filter: blur(4px);
    box-shadow: var(--action-panel-shadow);
    padding: 24px 10px 10px;
    pointer-events: auto;
    touch-action: manipulation;
}

.tarot-bet-popup::before {
    content: "ベッティングタイム";
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #fde68a;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.55);
    pointer-events: none;
    animation: tarotBettingTextPulse 0.9s ease-in-out infinite;
}

.tarot-bet-popup.tarot-kingdom-action-popup::before {
    content: "プレイヤーアクション";
}

@keyframes tarotBettingTextPulse {
    0%,
    100% {
        opacity: 0.78;
    }
    50% {
        opacity: 1;
    }
}

@keyframes tarotActionSheen {
    0% {
        transform: translateX(-130%) rotate(8deg);
        opacity: 0;
    }
    12% {
        opacity: 0.24;
    }
    36% {
        transform: translateX(320%) rotate(8deg);
        opacity: 0.12;
    }
    100% {
        transform: translateX(320%) rotate(8deg);
        opacity: 0;
    }
}

@keyframes tarotKingdomHumanTurnPulse {
    0%,
    100% {
        transform: translateY(0);
        box-shadow:
            0 0 0 1px rgba(250, 204, 21, 0.5),
            0 0 20px rgba(250, 204, 21, 0.36),
            0 0 34px rgba(59, 130, 246, 0.26);
    }
    50% {
        transform: translateY(-1px);
        box-shadow:
            0 0 0 1px rgba(250, 204, 21, 0.7),
            0 0 24px rgba(250, 204, 21, 0.46),
            0 0 40px rgba(59, 130, 246, 0.34);
    }
}

@keyframes tarotKingdomReadyButtonPulse {
    0%,
    100% {
        transform: translateY(0);
        filter: brightness(1);
    }
    50% {
        transform: translateY(-1px);
        filter: brightness(1.1);
    }
}

@keyframes tarotKingdomLastOnePulse {
    0%,
    100% {
        box-shadow:
            0 0 0 1px rgba(248, 113, 113, 0.34),
            0 0 14px rgba(248, 113, 113, 0.22);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(248, 113, 113, 0.56),
            0 0 26px rgba(248, 113, 113, 0.4);
    }
}

@keyframes tarotKingdomHandCriticalPulse {
    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.06);
        filter: brightness(1.12);
    }
}

@keyframes tarotKingdomYourTurnBadgePulse {
    0% {
        transform: translateY(4px) scale(0.92);
        opacity: 0;
    }
    55% {
        transform: translateY(0) scale(1.03);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes tarotKingdomYourTurnCutinPulse {
    0% {
        transform: translate(-50%, -12px) skewX(-12deg) scale(0.98);
        filter: brightness(0.92);
    }
    50% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1.02);
        filter: brightness(1.08);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: brightness(1);
    }
}

@media (max-width: 560px) {
    .tarot-bet-popup {
        width: calc(100% - 10px);
        padding: 22px 8px 8px;
    }

    .tarot-betting-actions button,
    .tarot-kingdom-controls button:not(#tarotKingdomStartButton):not(#tarotKingdomStartOnlineButton):not(#tarotKingdomStartOfflineButton):not(#tarotKingdomRestartButton) {
        width: var(--tarot-card-w, 58px);
        min-width: var(--tarot-card-w, 58px);
        height: var(--tarot-card-h, 96px);
        min-height: var(--tarot-card-h, 96px);
        font-size: 12px;
        padding: 4px 2px;
    }

    .tarot-kingdom-root {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 128px);
    }
}

.tarot-state-text {
    margin: 8px 0 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(10, 8, 24, 0.7);
    border: 1px solid rgba(167, 139, 250, 0.2);
    font-size: 13px;
    font-weight: 600;
    color: #dbe4f2;
    letter-spacing: 0.02em;
}

.tarot-state-text.is-error {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(30, 8, 8, 0.7);
    color: #fecaca;
    font-weight: 800;
    text-shadow:
        0 0 6px rgba(248, 113, 113, 0.4),
        0 1px 0 rgba(0, 0, 0, 0.45);
}

.tarot-participant-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
}

.tarot-participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    background: rgba(15, 23, 42, 0.7);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.tarot-participant-chip.is-player {
    border-color: rgba(52, 211, 153, 0.48);
    color: #bbf7d0;
}

.tarot-participant-chip.is-turn {
    border-color: rgba(251, 191, 36, 0.8);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3), 0 0 12px rgba(251, 191, 36, 0.25);
}

.tarot-participant-chip.is-folded {
    opacity: 0.55;
    text-decoration: line-through;
}

.tarot-participant-chip.is-display {
    border-color: rgba(96, 165, 250, 0.72);
}

.tarot-poker-board {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.tarot-board-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.tarot-fate-pane {
    flex: 0 0 auto;
    width: calc(var(--tarot-card-w, 64px) + 4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tarot-fate-label {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: #fcd34d;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tarot-fate-card {
    width: var(--tarot-card-w, 64px);
    min-width: var(--tarot-card-w, 64px);
    min-height: var(--tarot-card-h, 100px);
}

.tarot-fate-card .tarot-card {
    margin: 0;
    cursor: default;
}

.tarot-fate-card-empty {
    width: 100%;
    min-height: var(--tarot-card-h, 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--tarot-card-radius, 10px);
    border: 1px dashed rgba(148, 163, 184, 0.32);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.88)),
        radial-gradient(120% 120% at 50% 0%, rgba(148, 163, 184, 0.08), transparent 56%);
    color: #94a3b8;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.2em;
}

.tarot-board-main {
    flex: 1 1 auto;
    min-width: 0;
}

.tarot-board-main .tarot-poker-board {
    margin-bottom: 0;
}

.tarot-fate-effect {
    margin: 0 0 10px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(253, 224, 71, 0.35);
    background: rgba(15, 23, 42, 0.55);
    color: #fef3c7;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tarot-poker-root.is-no-major-arcana .tarot-fate-label {
    color: #94a3b8;
}

.tarot-poker-root .tarot-bet-popup {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: none;
    transform: none;
    margin: 0 0 10px;
    padding: 12px;
}

.tarot-poker-root .tarot-betting-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    justify-content: stretch;
    overflow: visible;
}

.tarot-poker-root .tarot-betting-actions button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 66px;
    min-height: 66px;
    padding: 8px 6px;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: normal;
    line-height: 1.12;
    font-size: 12px;
}

.tarot-fate-preview-token {
    font-weight: 900;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.75),
        -1px 1px 0 rgba(0, 0, 0, 0.75),
        1px -1px 0 rgba(0, 0, 0, 0.75),
        1px 1px 0 rgba(0, 0, 0, 0.75);
}

.tarot-fate-preview-token.is-wand {
    color: #fecaca;
}

.tarot-fate-preview-token.is-sword {
    color: #fef3c7;
}

.tarot-fate-preview-token.is-cup {
    color: #bfdbfe;
}

.tarot-fate-preview-token.is-pentacle {
    color: #bbf7d0;
}

.tarot-fate-preview-token.is-none {
    color: #e5e7eb;
}

.tarot-board-slot {
    width: var(--tarot-card-w, 64px);
    height: var(--tarot-card-h, 100px);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--tarot-card-radius, 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
}

.tarot-board-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.tarot-deck-anchor {
    width: var(--tarot-card-w, 64px);
    height: var(--tarot-card-h, 100px);
    border-radius: var(--tarot-card-radius, 10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(180deg, #334155, #1f2937);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d6dee9;
    font-size: 12px;
    font-weight: 700;
}

.tarot-deck-anchor-hidden {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    pointer-events: none;
    color: transparent;
    border-color: transparent;
    background: transparent;
}

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

.tarot-poker-column--player {
    grid-column: 1 / -1;
    border-color: rgba(244, 114, 182, 0.3);
    background: linear-gradient(180deg, rgba(10, 6, 18, 0.92), rgba(20, 8, 30, 0.94)),
        radial-gradient(circle at 50% 0%, rgba(236, 72, 153, 0.1), transparent 55%);
}

.tarot-poker-column--player .tarot-hand-grave-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.tarot-poker-column--player .tarot-grave-block,
.tarot-poker-column--player .tarot-grave-title {
    text-align: left;
}

.tarot-poker-column--player .tarot-grave-row {
    justify-content: flex-start;
}

.tarot-poker-column {
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px;
}


.tarot-poker-column--npc-mini {
    --tarot-card-w: 27px;
    --tarot-card-h: 44px;
    --tarot-card-radius: 6px;
    --tarot-art-w: 48px;
    --tarot-art-h: 80px;
    --tarot-art-left: 2px;
    --tarot-art-top: 4px;
    --tarot-card-padding: 2px;
    --tarot-card-number-size: 12px;
    --tarot-card-title-size: 8px;
    padding: 7px;
}

.tarot-poker-column--npc-mini .tarot-hand-grave-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
}

.tarot-poker-column--npc-mini .tarot-poker-column-title {
    font-size: 10px;
    margin-bottom: 5px;
}

.tarot-poker-column--npc-mini .tarot-inline-point {
    font-size: 9px;
    padding: 1px 5px;
    margin-left: 4px;
}

.tarot-poker-column--npc-mini .tarot-role-label {
    min-height: 14px;
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tarot-poker-column--npc-mini .tarot-action-label {
    min-height: 14px;
    font-size: 10px;
    margin-top: 2px;
}

.tarot-poker-column--npc-mini .tarot-card-row {
    gap: 2px;
    min-height: var(--tarot-card-h, 48px);
    justify-content: flex-start;
    overflow-x: visible;
}

.tarot-poker-column--npc-mini .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    transform-origin: center center;
}

.tarot-poker-column--npc-mini .tarot-grave-row {
    gap: 2px;
    min-height: var(--tarot-card-h, 48px);
    justify-content: flex-start;
}

.tarot-poker-column--npc-mini .tarot-grave-title {
    font-size: 10px;
    text-align: left;
}

.tarot-poker-column--npc-mini .tarot-grave-block {
    text-align: left;
}

.tarot-action-label--mini {
    letter-spacing: 0.01em;
}

.tarot-hand-grave-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}

.tarot-poker-root.is-showdown .tarot-hand-grave-wrap {
    grid-template-columns: minmax(0, 1fr);
}

.tarot-poker-root.is-showdown .tarot-grave-block {
    display: none;
}

#tabContentTarot.is-showdown .tarot-hand-grave-wrap {
    grid-template-columns: minmax(0, 1fr);
}

#tabContentTarot.is-showdown .tarot-grave-block {
    display: none;
}

.tarot-hand-block {
    min-width: 0;
}

.tarot-grave-block {
    min-width: 0;
    text-align: right;
}

.tarot-grave-title {
    text-align: right;
}

.tarot-poker-column-title {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 8px;
}

.tarot-inline-point {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    background: rgba(15, 23, 42, 0.78);
    color: #bae6fd;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tarot-inline-point.is-cpu {
    border-color: rgba(251, 146, 60, 0.35);
    color: #fed7aa;
}

.tarot-role-label {
    min-height: 18px;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #fde7a0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.tarot-action-label {
    min-height: 24px;
    margin-top: 3px;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.03em;
    color: #fef3c7;
    text-shadow:
        -1px -1px 0 #000,
        -1px 1px 0 #000,
        1px -1px 0 #000,
        1px 1px 0 #000;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 220ms ease, transform 220ms ease;
}

.tarot-action-label.show {
    opacity: 1;
    transform: translateY(0);
}

.tarot-action-label.is-player {
    color: #86efac;
}

.tarot-action-label.is-cpu {
    color: #fca5a5;
}

.tarot-outcome-badge {
    display: none;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.tarot-outcome-badge.is-win {
    display: inline-flex;
    background: rgba(34, 197, 94, 0.22);
    color: #b7ffd2;
    border: 1px solid rgba(34, 197, 94, 0.55);
}

.tarot-outcome-badge.is-lose {
    display: inline-flex;
    background: rgba(239, 68, 68, 0.2);
    color: #ffd0d0;
    border: 1px solid rgba(239, 68, 68, 0.55);
}

.tarot-outcome-badge.is-draw {
    display: inline-flex;
    background: rgba(250, 204, 21, 0.2);
    color: #ffe9a5;
    border: 1px solid rgba(250, 204, 21, 0.55);
}

.tarot-card-row {
    display: flex;
    gap: 8px;
    min-height: var(--tarot-card-h, 100px);
    margin-bottom: 8px;
    flex-wrap: nowrap;
}

.tarot-hand-block .tarot-card-row {
    flex-wrap: wrap;
    overflow-x: visible;
}

.tarot-card-row.is-draw-phase .tarot-card.is-clickable:not(.is-leaving) {
    animation: tarotDrawCardWiggle 2.6s ease-in-out infinite;
    will-change: transform;
}

.tarot-card-row.is-draw-phase .tarot-card.is-clickable:nth-child(2n):not(.is-leaving) {
    animation-delay: 0.14s;
}

.tarot-card-row.is-draw-phase .tarot-card.is-clickable:nth-child(3n):not(.is-leaving) {
    animation-delay: 0.28s;
}

.tarot-card-row.is-draw-phase .tarot-card.is-clickable:nth-child(4n):not(.is-leaving) {
    animation-delay: 0.42s;
}

.tarot-card-row.is-draw-phase .tarot-card.is-clickable:hover,
.tarot-card-row.is-draw-phase .tarot-card.is-clickable:active {
    animation-play-state: paused;
}

.tarot-card-row .tarot-card.is-selected {
    border-color: var(--tarot-interact-border);
    box-shadow:
        0 0 0 1px var(--tarot-interact-border-soft),
        0 0 16px var(--tarot-interact-glow),
        inset 0 0 0 1px rgba(255, 255, 255, 0.28);
    transform: translateY(-6px);
    animation: none !important;
}

.tarot-grave-row .tarot-card.is-selected {
    border-color: var(--tarot-interact-border);
    box-shadow:
        0 0 0 1px var(--tarot-interact-border-soft),
        0 0 14px var(--tarot-interact-glow),
        inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    transform: translateY(-4px) scale(0.92);
    animation: none !important;
}

@keyframes tarotDrawCardWiggle {
    0%,
    78%,
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    81% {
        transform: translate3d(-0.8px, 0, 0) rotate(-0.7deg);
    }
    84% {
        transform: translate3d(0.9px, -0.2px, 0) rotate(0.8deg);
    }
    87% {
        transform: translate3d(-0.6px, 0.1px, 0) rotate(-0.45deg);
    }
    90% {
        transform: translate3d(0.45px, 0, 0) rotate(0.35deg);
    }
}

@keyframes tarotCardEnterFromBottom {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
        filter: saturate(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: saturate(1);
    }
}

@keyframes tarotKingdomCallCardFromRight {
    0% {
        opacity: 0;
        transform: translateX(54px) translateY(2px) scale(0.94);
        filter: saturate(0.9);
    }
    70% {
        opacity: 1;
        transform: translateX(-3px) translateY(0) scale(1.01);
        filter: saturate(1.05);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0) scale(1);
        filter: saturate(1);
    }
}

@keyframes tarotKingdomChariotSplitLeft {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.96) rotate(0deg);
        filter: brightness(1.15) saturate(1.06);
    }
    22% {
        opacity: 1;
        transform: translate(calc(-50% - 8px), calc(-50% - 1px)) scale(1.02) rotate(-4deg);
        filter: brightness(1.26) saturate(1.16);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% - 46px), calc(-50% - 7px)) scale(0.86) rotate(-16deg);
        filter: brightness(1.03) saturate(1.02);
    }
}

@keyframes tarotKingdomChariotSplitRight {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.96) rotate(0deg);
        filter: brightness(1.15) saturate(1.06);
    }
    22% {
        opacity: 1;
        transform: translate(calc(-50% + 8px), calc(-50% - 1px)) scale(1.02) rotate(4deg);
        filter: brightness(1.26) saturate(1.16);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + 46px), calc(-50% - 7px)) scale(0.86) rotate(16deg);
        filter: brightness(1.03) saturate(1.02);
    }
}

.tarot-card-row .tarot-card,
.tarot-poker-board .tarot-card {
    flex: 0 0 var(--tarot-card-w, 64px);
}

.tarot-card {
    width: var(--tarot-card-w, 64px);
    min-width: var(--tarot-card-w, 64px);
    height: var(--tarot-card-h, 100px);
    border-radius: var(--tarot-card-radius, 10px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: var(--tarot-card-padding, 6px);
    position: relative;
    text-align: left;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 160ms ease, box-shadow 180ms ease, opacity 140ms ease, filter 180ms ease;
}

.tarot-card.wand {
    background: linear-gradient(180deg, #b11818, #7a0e0e);
}

.tarot-card.sword {
    background: linear-gradient(180deg, #c29b14, #856a06);
}

.tarot-card.cup {
    background: linear-gradient(180deg, #1e63c6, #123d7b);
}

.tarot-card.pentacle {
    background: linear-gradient(180deg, #1e8f3c, #15632b);
}

.tarot-card.none {
    background: linear-gradient(180deg, #5b6472, #343b45);
}

.tarot-card.all-suit {
    background:
        radial-gradient(circle at 10% 10%, rgba(220, 38, 38, 0.95) 0 7px, transparent 8px),
        radial-gradient(circle at 90% 10%, rgba(250, 204, 21, 0.95) 0 7px, transparent 8px),
        radial-gradient(circle at 10% 90%, rgba(59, 130, 246, 0.95) 0 7px, transparent 8px),
        radial-gradient(circle at 90% 90%, rgba(34, 197, 94, 0.95) 0 7px, transparent 8px),
        linear-gradient(180deg, #4b5563, #1f2937);
    border-color: rgba(255, 255, 255, 0.34);
}

.tarot-card.is-hidden {
    background: linear-gradient(180deg, #374151, #1f2937);
    border-color: rgba(255, 255, 255, 0.14);
}

.tarot-card.is-clickable {
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 200ms ease, opacity 120ms ease, filter 180ms ease;
    animation: none;
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.tarot-card.is-clickable:active {
    transform: translateY(1px) scale(0.97);
}

.tarot-card.is-static {
    cursor: default;
}

.tarot-card.is-arcana-match {
    box-shadow:
        0 0 0 1px rgba(239, 246, 255, 0.7),
        0 0 18px rgba(125, 211, 252, 0.32),
        0 0 26px rgba(250, 204, 21, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
    animation: tarotArcanaAura 2.9s ease-in-out infinite;
}

.tarot-card.is-arcana-match::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    z-index: 1;
    pointer-events: none;
    background:
        conic-gradient(
            from 0deg,
            rgba(56, 189, 248, 0.24),
            rgba(250, 204, 21, 0.2),
            rgba(167, 139, 250, 0.2),
            rgba(56, 189, 248, 0.24)
        );
    mix-blend-mode: screen;
    filter: blur(2px) saturate(1.1);
    opacity: 0.34;
    animation: tarotArcanaHaloSpin 7.8s linear infinite, tarotArcanaHaloBreath 2.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .tarot-card.is-arcana-match::before {
        animation: none;
    }
}

.tarot-card.is-arcana-match.is-selected::before {
    filter: saturate(1.1);
}

.tarot-card.is-arcana-match .tarot-card-number {
    will-change: filter;
    animation: tarotArcanaSparkle 2.4s ease-in-out infinite;
}

.tarot-card.is-leaving {
    transition: opacity 130ms ease, transform 130ms ease, filter 130ms ease;
    opacity: 0.58 !important;
    transform: translateY(-8px) scale(0.97) rotate(-2deg);
    filter: saturate(1.1);
}

.tarot-card.is-clear-sweep-leaving {
    pointer-events: none !important;
    will-change: transform, opacity, filter;
    animation: tarotKingdomClearSweepCard var(--clear-card-ms, 260ms) cubic-bezier(0.16, 0.84, 0.24, 1) forwards;
}

.tarot-card.is-defeat-transition {
    pointer-events: none !important;
    will-change: transform, opacity, filter;
    z-index: 4;
}

.tarot-card.is-defeat-transition::after {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    line-height: 1;
    pointer-events: none;
    text-shadow: 0 0 12px rgba(0, 0, 0, 0.52), 0 0 18px rgba(255, 255, 255, 0.24);
    opacity: 0;
}

.tarot-card.is-defeat-normal {
    animation: tarotKingdomDefeatNormal var(--defeat-card-ms, 420ms) cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.tarot-card.is-defeat-primary.is-defeat-normal::after {
    content: var(--defeat-marker-content, "💥");
    animation: tarotKingdomDefeatMarker var(--defeat-marker-ms, 820ms) ease-out forwards;
}

.tarot-card.is-defeat-slash {
    animation: tarotKingdomDefeatSlash var(--defeat-card-ms, 620ms) cubic-bezier(0.2, 0.84, 0.24, 1) forwards;
}

.tarot-card.is-defeat-primary.is-defeat-slash::after {
    content: var(--defeat-marker-content, "\1F5E1");
    left: 50%;
    top: 12%;
    font-size: 40px;
    transform-origin: 84% 14%;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.44)) drop-shadow(0 0 8px rgba(250, 204, 21, 0.28));
    animation: tarotKingdomDefeatSlashMarker var(--defeat-marker-ms, 920ms) cubic-bezier(0.16, 0.82, 0.24, 1) forwards;
}

.tarot-card.is-defeat-rock {
    animation: tarotKingdomDefeatRock var(--defeat-card-ms, 620ms) cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.tarot-card.is-defeat-primary.is-defeat-rock::after {
    content: var(--defeat-marker-content, "🪦");
    top: 44%;
    font-size: 30px;
    animation: tarotKingdomDefeatRockMarker var(--defeat-marker-ms, 900ms) ease-out forwards;
}

.tarot-card.is-defeat-water {
    animation: tarotKingdomDefeatWater var(--defeat-card-ms, 620ms) cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.tarot-card.is-defeat-primary.is-defeat-water::after {
    content: var(--defeat-marker-content, "💦");
    top: 36%;
    font-size: 30px;
    animation: tarotKingdomDefeatWaterMarker var(--defeat-marker-ms, 900ms) ease-out forwards;
}

.tarot-card.is-defeat-fire {
    animation: tarotKingdomDefeatFire var(--defeat-card-ms, 620ms) cubic-bezier(0.2, 0.84, 0.24, 1) forwards;
}

.tarot-card.is-defeat-primary.is-defeat-fire::after {
    content: var(--defeat-marker-content, "🔥");
    top: 48%;
    font-size: 30px;
    animation: tarotKingdomDefeatFireMarker var(--defeat-marker-ms, 900ms) ease-out forwards;
}

.tarot-card.is-defeat-arcana {
    animation: tarotKingdomDefeatArcana var(--defeat-card-ms, 760ms) cubic-bezier(0.18, 0.82, 0.24, 1) forwards;
}

.tarot-card.is-defeat-arcana.is-defeat-arcana-orbit { animation-name: tarotKingdomDefeatArcanaOrbit; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-float { animation-name: tarotKingdomDefeatArcanaFloat; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-slam { animation-name: tarotKingdomDefeatArcanaSlam; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-burst { animation-name: tarotKingdomDefeatArcanaBurst; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-rush { animation-name: tarotKingdomDefeatArcanaRush; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-trickster { animation-name: tarotKingdomDefeatArcanaTrickster; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-throne { animation-name: tarotKingdomDefeatArcanaThrone; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-edict { animation-name: tarotKingdomDefeatArcanaEdict; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-sanctum { animation-name: tarotKingdomDefeatArcanaSanctum; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-halo { animation-name: tarotKingdomDefeatArcanaHalo; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-verdict { animation-name: tarotKingdomDefeatArcanaVerdict; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-rift { animation-name: tarotKingdomDefeatArcanaRift; }
.tarot-card.is-defeat-arcana.is-defeat-arcana-world { animation-name: tarotKingdomDefeatArcanaWorld; }

.tarot-card.is-defeat-primary.is-defeat-arcana::after {
    content: var(--defeat-marker-content, "✦");
    left: 50%;
    top: 46%;
    font-size: 30px;
    transform: translate(-50%, -50%);
    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.56),
        0 0 18px rgba(255, 255, 255, 0.24),
        0 0 28px rgba(148, 163, 184, 0.18);
    animation: tarotKingdomDefeatArcanaMarker var(--defeat-marker-ms, 980ms) cubic-bezier(0.16, 0.82, 0.24, 1) forwards;
}

.tarot-card.is-entering {
    opacity: 0 !important;
    transform: translateY(10px) scale(0.97);
    animation: tarotCardEnterFromBottom 190ms cubic-bezier(0.2, 0.75, 0.25, 1) forwards;
}

.tarot-card.is-call-arriving {
    opacity: 0;
    transform: translateX(58px) translateY(2px) scale(0.92);
    animation: tarotKingdomCallCardFromRight 360ms cubic-bezier(0.2, 0.82, 0.24, 1) forwards;
    filter: saturate(1.18) brightness(1.08);
}

.tarot-card.is-call-arriving::after {
    content: "";
    position: absolute;
    inset: 14% 74% 14% -26%;
    border-radius: 10px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(96, 165, 250, 0), rgba(96, 165, 250, 0.34), rgba(191, 219, 254, 0));
    animation: tarotKingdomCallTrail 360ms ease-out forwards;
}

.tarot-card.is-call-source {
    z-index: 7;
    animation: tarotKingdomCallSourceLift 190ms cubic-bezier(0.2, 0.82, 0.24, 1) both;
}

.tarot-card.is-call-reused {
    z-index: 6;
    animation: tarotKingdomCallReuseSettle 460ms cubic-bezier(0.2, 0.82, 0.24, 1) both;
}

.tarot-kingdom-call-reuse-badge {
    position: absolute;
    left: 50%;
    top: -12px;
    z-index: 8;
    min-width: max-content;
    padding: 2px 6px;
    border: 1px solid rgba(250, 204, 21, 0.92);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(36, 27, 10, 0.98), rgba(10, 8, 5, 0.98));
    color: #fff2b2;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.04em;
    white-space: nowrap;
    pointer-events: none;
    transform: translateX(-50%);
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.56);
}

.tarot-kingdom-call-reuse-clone {
    position: fixed !important;
    z-index: 3658;
    margin: 0 !important;
    pointer-events: none !important;
    user-select: none;
    will-change: left, top, width, height, transform, opacity;
}

@keyframes tarotKingdomCallSourceLift {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: inherit;
    }
    100% {
        transform: translateY(-5px) scale(1.04);
        box-shadow:
            0 0 0 2px rgba(250, 204, 21, 0.88),
            0 8px 18px rgba(0, 0, 0, 0.5),
            0 0 16px rgba(250, 204, 21, 0.28);
    }
}

@keyframes tarotKingdomCallReuseSettle {
    0% {
        transform: translateY(-5px) scale(1.04);
        box-shadow:
            0 0 0 2px rgba(250, 204, 21, 0.88),
            0 8px 18px rgba(0, 0, 0, 0.5),
            0 0 16px rgba(250, 204, 21, 0.28);
    }
    72% {
        transform: translateY(1px) scale(0.99);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow:
            0 0 0 1px rgba(250, 204, 21, 0.54),
            0 4px 12px rgba(0, 0, 0, 0.42);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-card.is-entering,
    .tarot-card.is-call-arriving,
    .tarot-card.is-call-source,
    .tarot-card.is-call-reused {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .tarot-card.is-defeat-transition {
        animation: none !important;
        opacity: 0 !important;
        transform: none !important;
        filter: none !important;
    }
    .tarot-card.is-defeat-transition::after {
        animation: none !important;
        opacity: 0 !important;
    }

    .tarot-kingdom-arcana-hero,
    .tarot-kingdom-arcana-hero.run {
        animation: none !important;
        opacity: 0 !important;
    }
}

/* Tarot Kingdom opening: monster entrance, attack, then opening-card deal. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-opening-enemy-entering #tarotKingdomEnemySprite[data-facing="left"] {
    animation: tarotKingdomEnemyOpeningEntrance 860ms cubic-bezier(0.18, 0.72, 0.24, 1) both !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot[data-opening-intro-stage="enter"] #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot[data-opening-intro-stage="attack"] #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot[data-opening-intro-stage="card"] #tarotKingdomTrick > .tarot-card {
    opacity: 0 !important;
    visibility: hidden;
}

@keyframes tarotKingdomEnemyOpeningEntrance {
    0% {
        opacity: 0;
        transform: translateX(-68vw) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
        filter: brightness(0.58) saturate(0.7) drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
    }
    18% {
        opacity: 1;
    }
    78% {
        transform: translateX(8px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
    100% {
        opacity: 1;
        transform: translateX(0) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
        filter: drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage.is-opening-enemy-entering #tarotKingdomEnemySprite {
        animation: none !important;
    }
}

/* Tarot Kingdom victory: keep the winner on the same spot and repeat a joyful jump. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious {
    transform-origin: 50% 100%;
    animation:
        tarotKingdomPlayerVictoryPose 960ms cubic-bezier(0.22, 0.72, 0.26, 1) infinite,
        tarotKingdomWinnerAvatarGlow 900ms ease-out 1 both;
    filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.76));
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious::after {
    content: "";
    z-index: 0;
    top: auto;
    bottom: 8px;
    left: 50%;
    width: 48px;
    min-width: 0;
    height: 10px;
    padding: 0;
    border: 1px solid rgba(255, 229, 139, 0.86);
    border-radius: 50%;
    color: transparent;
    background: radial-gradient(ellipse at center, rgba(255, 245, 183, 0.78), rgba(231, 177, 51, 0.34) 46%, transparent 72%);
    box-shadow: 0 0 8px rgba(255, 219, 96, 0.7), inset 0 0 4px rgba(255, 249, 210, 0.62);
    opacity: 0;
    filter: none;
    transform: translateX(-50%) scaleX(1);
    animation: tarotKingdomWinnerGroundLight 900ms ease-out 1 both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious .avatar-layer[id$="-layer-hand-right"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious .avatar-layer[id$="-layer-hand-left"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious .avatar-layer[id$="-layer-weapon-right"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious .avatar-layer[id$="-layer-shield-left"] {
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-round-winner {
    z-index: 42;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-round-winner .tarot-kingdom-battle-player-info {
    border-bottom-color: rgba(255, 220, 112, 0.9);
    background: linear-gradient(90deg, transparent, rgba(85, 54, 7, 0.12) 16%, rgba(76, 47, 4, 0.6));
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage.is-victory.is-grand-final {
    border-color: rgba(236, 193, 79, 0.8);
    box-shadow: inset 0 0 54px rgba(38, 21, 3, 0.48), 0 0 24px rgba(230, 177, 55, 0.22);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage.is-grand-final .tarot-kingdom-battle-enemy {
    filter: saturate(0.65) brightness(0.48);
    transition: filter 520ms ease;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage.is-grand-final .tarot-kingdom-battle-player:not(.is-match-champion) {
    opacity: 0.42;
    filter: saturate(0.45) brightness(0.64);
    transition: opacity 420ms ease, filter 420ms ease;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-match-champion {
    z-index: 70;
    opacity: 1;
    filter: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-ceremony {
    position: absolute;
    z-index: 68;
    /* Centered on the stage with a solid backing, so the enemy HP bar and party rows do not show through the text. */
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: min(74%, 280px);
    min-width: 154px;
    padding: 12px 16px 13px;
    overflow: hidden;
    border-top: 1px solid rgba(255, 232, 157, 0.92);
    border-bottom: 1px solid rgba(194, 137, 35, 0.9);
    color: #fff5ce;
    background:
        radial-gradient(circle at 50% 30%, rgba(143, 91, 17, 0.5), transparent 70%),
        linear-gradient(90deg, rgba(13, 8, 3, 0.62), rgba(13, 8, 3, 0.94) 14% 86%, rgba(13, 8, 3, 0.62));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.58), 0 0 24px rgba(235, 184, 62, 0.2);
    text-align: center;
    text-shadow: 0 2px 1px #000, 0 0 9px rgba(236, 190, 75, 0.46);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: tarotKingdomChampionCeremonyIn 760ms cubic-bezier(0.16, 0.82, 0.22, 1) both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-ceremony[hidden] {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-eyebrow {
    color: #d8bb73;
    font: 800 8px/1 Arial, sans-serif;
    letter-spacing: 0.22em;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-rank {
    display: flex;
    align-items: flex-start;
    color: #fff0a8;
    font: 900 clamp(42px, 12vw, 68px)/0.88 Georgia, serif;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-rank small {
    margin-top: 5px;
    font: 900 12px/1 Georgia, serif;
    letter-spacing: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-title {
    margin-top: 3px;
    color: #e9c96f;
    font: 900 11px/1 Georgia, serif;
    letter-spacing: 0.18em;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-name {
    max-width: 100%;
    margin-top: 7px;
    overflow: hidden;
    color: #fff9e5;
    font: 900 clamp(13px, 3.8vw, 18px)/1.1 "Yu Gothic", "Noto Sans JP", sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-score {
    margin-top: 4px;
    color: #d5c28e;
    font: 800 10px/1 Arial, sans-serif;
    letter-spacing: 0.08em;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-standings {
    display: grid;
    width: 100%;
    margin: 9px 0 0;
    padding: 7px 0 0;
    gap: 3px;
    border-top: 1px solid rgba(216, 187, 115, 0.32);
    list-style: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-standings > li {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 6px;
    color: #e8dcb8;
    font: 800 11px/1.2 "Yu Gothic", "Noto Sans JP", sans-serif;
    text-align: left;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-standing-rank {
    color: #d8bb73;
    font: 900 11px/1 Georgia, serif;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-standing-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-standing-score {
    color: #cdbb88;
    font: 800 10px/1 Arial, sans-serif;
}

/* Defeat uses the same plate in a cold red, and waits for the last party member's retreat to finish. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-ceremony.is-defeat {
    border-top-color: rgba(254, 202, 202, 0.86);
    border-bottom-color: rgba(153, 27, 27, 0.9);
    color: #fee2e2;
    background:
        radial-gradient(circle at 50% 30%, rgba(127, 29, 29, 0.55), transparent 70%),
        linear-gradient(90deg, rgba(12, 4, 6, 0.62), rgba(12, 4, 6, 0.94) 14% 86%, rgba(12, 4, 6, 0.62));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.62), 0 0 24px rgba(220, 38, 38, 0.22);
    text-shadow: 0 2px 1px #000, 0 0 9px rgba(248, 113, 113, 0.5);
    animation-delay: 900ms;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-defeat {
    margin-top: 4px;
    color: #fecaca;
    font: 900 clamp(30px, 9vw, 46px)/1 Georgia, serif;
    letter-spacing: 0.12em;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-ceremony.is-defeat .tarot-kingdom-champion-eyebrow {
    color: #fca5a5;
}

/* Once the match is over the hand cannot be played, so it steps back instead of looking ready. */
:is(body, #tabContentTarot) #tarotKingdomRoot.is-match-over #tarotKingdomHand {
    opacity: 0.4;
    filter: grayscale(0.7);
    pointer-events: none;
    transition: opacity 320ms ease, filter 320ms ease;
}

@keyframes tarotKingdomPlayerVictoryPose {
    0%, 12%, 72%, 100% { transform: translate3d(0, 0, 0); }
    38%, 46% { transform: translate3d(0, -10px, 0); }
    80% { transform: translate3d(0, -2px, 0); }
}

@keyframes tarotKingdomWinnerGroundLight {
    0% { opacity: 0; transform: translateX(-50%) scale(0.72); }
    16% { opacity: 1; transform: translateX(-50%) scale(1); }
    58% { opacity: 0.58; transform: translateX(-50%) scale(1.08); }
    100% { opacity: 0; transform: translateX(-50%) scale(1.34); }
}

@keyframes tarotKingdomWinnerAvatarGlow {
    0%, 18% {
        filter:
            drop-shadow(0 4px 2px rgba(0, 0, 0, 0.76))
            drop-shadow(0 0 6px rgba(255, 224, 122, 0.86))
            drop-shadow(0 0 13px rgba(241, 181, 45, 0.52));
    }
    100% {
        filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.76));
    }
}

@keyframes tarotKingdomChampionCeremonyIn {
    0% {
        opacity: 0;
        clip-path: inset(0 50%);
        transform: translate(-50%, calc(-50% + 8px)) scale(0.94);
    }
    46% {
        opacity: 1;
        clip-path: inset(0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0);
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious,
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-avatar-victorious::after,
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-champion-ceremony {
        animation: none !important;
    }
}

/* Tarot Kingdom — composition matched to the shared vertical battle reference */
body.tarot-kingdom-preview-body {
    margin: 0;
    padding: 0;
    background: #03030a;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0 3px calc(env(safe-area-inset-bottom, 0px) + 4px);
    overflow-x: hidden;
    overflow-y: visible;
    border: 0;
    border-image: none;
    border-radius: 0;
    background: #03030a;
}

#tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui {
    width: 100%;
    margin-inline: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-header {
    position: absolute;
    z-index: 70;
    top: 7px;
    left: 8px;
    display: block;
    box-sizing: border-box;
    width: min(55%, 470px);
    height: auto;
    min-height: 48px;
    margin: 0;
    padding: 1px 10px 2px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid rgba(199, 164, 67, 0.62);
    background: linear-gradient(90deg, rgba(1, 17, 24, 0.94), rgba(1, 17, 24, 0.48) 72%, transparent);
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-title-wrap,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-title-copy {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-header-meta {
    display: block;
    width: 100%;
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active #tarotKingdomRound.tarot-kingdom-chip {
    display: block;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    color: #f1e49d;
    background: none;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(12px, 3.2vw, 18px);
    font-style: italic;
    font-weight: 800;
    line-height: 1.24;
    letter-spacing: 0.06em;
    white-space: pre-line;
    text-shadow: 1px 2px 0 #000;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active #tarotKingdomStateText.tarot-state-text {
    position: absolute;
    z-index: 71;
    top: 56px;
    left: 8px;
    box-sizing: border-box;
    width: min(55%, 470px);
    min-height: 22px;
    max-height: 26px;
    margin: 0;
    padding: 3px 10px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid rgba(199, 164, 67, 0.32);
    border-radius: 0;
    color: #fff;
    background: linear-gradient(90deg, rgba(1, 22, 28, 0.9), rgba(1, 22, 28, 0.28) 74%, transparent);
    font-size: 10px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage {
    margin: 0 0 4px;
    border-width: 0 0 1px;
    border-color: #635329;
    box-shadow: inset 0 -30px 38px rgba(0, 0, 0, 0.22);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
    min-height: clamp(470px, 54svh, 570px);
    background-position: 45% center;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage::before {
    z-index: 2;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.26), transparent 24%),
        linear-gradient(0deg, rgba(0, 0, 0, 0.34), transparent 25%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    top: 0;
    bottom: 28px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    width: 53%;
    padding: 85px 8px 3px;
    background-image: linear-gradient(105deg, rgba(1, 8, 18, 0.66), rgba(1, 8, 18, 0.08) 68%, transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    width: 47%;
    padding: 0;
    overflow: visible;
    background: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-side-heading {
    gap: 5px;
    margin-bottom: 2px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
    font-size: clamp(12px, 3.2vw, 17px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-hp-label {
    margin-bottom: 2px;
    font-size: 9px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-hp-track {
    height: 10px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-enemy-affinities {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    width: min(100%, 310px);
    margin-top: 5px;
    gap: 2px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-enemy-affinities > span {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    border: 1px solid #b9c5d2;
    border-radius: 3px 3px 5px 5px;
    color: #eef6ff;
    background: linear-gradient(180deg, rgba(45, 60, 78, 0.94), rgba(8, 19, 34, 0.92));
    font-family: "Yu Mincho", serif;
    font-size: clamp(7px, 2.2vw, 11px);
    font-weight: 900;
    line-height: 1;
    text-shadow: 1px 1px 0 #000;
    box-shadow: 0 2px 0 #0a4d9a;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-enemy-affinities > span.is-accent {
    border-color: #f1b19d;
    color: #ffe7de;
    background: linear-gradient(180deg, #84443b, #3d1718);
    box-shadow: 0 2px 0 #c52c1f;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
    right: -3%;
    bottom: 15px;
    left: 1%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty.tarot-kingdom-battle-party {
    position: absolute;
    inset: 96px 3px 12px 0;
    display: block;
    height: auto;
    min-height: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    position: absolute;
    right: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    grid-template-areas: "info avatar";
    align-items: end;
    box-sizing: border-box;
    width: 100%;
    min-height: 70px;
    gap: 2px;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(1) { top: 0; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(2) { top: 25%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(3) { top: 50%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(4) { top: 75%; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
    grid-area: avatar;
    align-self: end;
    justify-self: end;
    width: 56px;
    height: 68px;
    --avatar-combat-scale: 0.86;
    filter: drop-shadow(0 4px 2px #000) drop-shadow(0 0 3px rgba(170, 208, 255, 0.22));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar[data-facing="left"] {
    --avatar-facing-scale-x: -1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-kingdom-shield-defending.is-kingdom-shield-hand-left .avatar-layer[id$="-layer-hand-left"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-kingdom-shield-defending.is-kingdom-shield-hand-right .avatar-layer[id$="-layer-hand-right"] {
    z-index: 5 !important;
    transform:
        var(--avatar-layer-base-transform, translate(0px, 0px))
        translate(-8px, -1px)
        rotate(-10deg) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-kingdom-shield-defending.is-kingdom-shield-hand-left .avatar-layer[id$="-layer-shield-left"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-kingdom-shield-defending.is-kingdom-shield-hand-right .avatar-layer[id$="-layer-weapon-right"] {
    z-index: 6 !important;
    transform:
        var(--avatar-layer-base-transform, translate(0px, 0px))
        translate(-13px, -3px)
        rotate(-6deg)
        scale(1.08) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    grid-area: info;
    align-self: center;
    display: grid;
    min-width: 0;
    gap: 1px;
    padding: 3px 3px 3px 6px;
    border: 0;
    border-bottom: 1px solid rgba(229, 213, 157, 0.42);
    border-radius: 0;
    background: linear-gradient(90deg, transparent, rgba(3, 7, 17, 0.28) 14%, rgba(3, 7, 17, 0.62));
    opacity: 0.88;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-info {
    border-bottom-color: #f5ca54;
    background: linear-gradient(90deg, transparent, rgba(53, 37, 5, 0.18) 14%, rgba(60, 43, 6, 0.58));
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-avatar {
    filter: drop-shadow(0 4px 2px #000) drop-shadow(0 0 7px rgba(255, 219, 89, 0.8));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
    font-size: 10px;
    line-height: 1.05;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
    font-size: 9px;
    line-height: 1.05;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-status {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
    height: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    min-height: 28px;
    grid-template-columns: minmax(0, 1fr);
    border-top-color: rgba(232, 189, 82, 0.35);
    background: linear-gradient(90deg, rgba(5, 4, 11, 0.76), rgba(5, 4, 11, 0.48));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-turn {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-feed {
    min-height: 26px;
    max-height: 27px;
    padding: 2px 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-event {
    min-height: 0;
    padding: 3px 7px;
    overflow: hidden;
    border: 0;
    color: rgba(255, 244, 208, 0.86);
    background: rgba(7, 5, 10, 0.54);
    font-size: 9px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-layout,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-layout {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-panel--trick {
    order: 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-panel--hand {
    order: 2;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick {
    --kingdom-display-card-w: clamp(54px, 17vw, 150px);
    position: relative;
    box-sizing: border-box;
    min-height: calc(var(--kingdom-display-card-w) * 2.05 + 27px);
    padding: 25px 2px 4px;
    overflow: hidden;
    border: 1px solid rgba(126, 103, 52, 0.56);
    border-image: none;
    border-radius: 0;
    background: linear-gradient(180deg, #09080c, #030309);
    box-shadow: inset 0 0 0 1px rgba(255, 233, 154, 0.06);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-trick-title {
    position: absolute;
    z-index: 5;
    top: 3px;
    right: 3px;
    left: 3px;
    display: flex;
    min-height: 18px;
    margin: 0;
    padding: 0 4px;
    overflow: hidden;
    border: 0;
    background: linear-gradient(90deg, rgba(7, 8, 12, 0.92), rgba(7, 8, 12, 0.35), transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-panel-heading {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-trick-status {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: 3px;
    overflow: hidden;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-chip {
    min-height: 16px;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 8px;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomTrick.tarot-kingdom-trick,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards {
    display: grid;
    grid-template-columns: repeat(5, var(--kingdom-display-card-w));
    align-items: end;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-height: calc(var(--kingdom-display-card-w) * 2.05);
    gap: clamp(3px, 1vw, 8px);
    margin: 0;
    padding: 2px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards {
    position: absolute;
    z-index: 4;
    right: 0;
    bottom: 4px;
    left: 0;
    background: linear-gradient(180deg, rgba(9, 8, 12, 0.98), rgba(3, 3, 9, 0.99));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards.is-empty {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-selected-slot {
    box-sizing: border-box;
    width: var(--kingdom-display-card-w);
    min-width: var(--kingdom-display-card-w);
    height: calc(var(--kingdom-display-card-w) * 2.05);
    margin: 0;
    border-radius: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards > .tarot-card {
    border: 2px solid #d4bb78;
    transform: none;
    box-shadow: 0 0 0 1px #3f2a0c, 0 5px 8px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomTrick .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.78);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--hand {
    padding: 3px 3px 0;
    overflow: visible;
    border: 1px solid rgba(126, 103, 52, 0.56);
    border-image: none;
    background: linear-gradient(180deg, #09080c, #030309);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedEffect.tarot-kingdom-selected-effect {
    order: 2;
    width: min(100%, 760px);
    min-height: 44px;
    margin: 1px auto 4px;
    border-width: 2px;
    border-color: #dcb647;
    font-size: clamp(12px, 3.4vw, 17px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--hand .tarot-kingdom-hand-title {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand.tarot-kingdom-hand {
    order: 4;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    box-sizing: border-box;
    width: min(100%, 760px);
    min-height: 112px;
    margin: 0 auto;
    gap: 2px;
    padding: 12px 0 3px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card + .tarot-card {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 0.48;
    margin: 0;
    border: 1px solid #d7bd79;
    border-radius: 3px;
    transform-origin: center bottom;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.58);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup,
#tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    position: sticky;
    z-index: 4100;
    order: 4;
    right: auto;
    bottom: var(--nav-height, 0px);
    left: auto;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 6px 0 0;
    padding: 18px 4px 5px;
    border: 1px solid #82672c;
    background: linear-gradient(180deg, rgba(34, 25, 9, 0.99), rgba(4, 4, 8, 0.99));
    transform: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions {
    gap: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button {
    height: 54px;
    min-height: 54px;
    padding: 5px 3px;
    border-width: 2px;
    font-size: clamp(10px, 2.8vw, 14px);
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui {
        width: 100%;
        max-width: none;
        min-height: 0;
        margin: 0;
        padding: 0 2px calc(env(safe-area-inset-bottom, 0px) + 2px);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        min-height: clamp(440px, 55svh, 540px);
        background-position: 45% center;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
        width: 52%;
        padding: 82px 6px 3px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
        width: 48%;
        padding: 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty.tarot-kingdom-battle-party {
        inset: 100px 2px 10px 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: minmax(0, 1fr) 52px;
        min-height: 66px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        width: 50px;
        height: 64px;
        --avatar-combat-scale: 0.8;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
        padding: 2px 2px 2px 4px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
        font-size: 9px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
        font-size: 8px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick {
        --kingdom-display-card-w: clamp(52px, 17vw, 64px);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedEffect.tarot-kingdom-selected-effect {
        min-height: 42px;
        margin-bottom: 2px;
        font-size: 12px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand.tarot-kingdom-hand {
        min-height: 108px;
        gap: 2px;
        padding-top: 12px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
        width: 100%;
        max-width: none;
        bottom: var(--nav-height, 0px);
        margin-top: 5px;
        padding: 17px 3px 4px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button {
        height: 52px;
        min-height: 52px;
        font-size: 9px;
    }
}

/* Tarot Kingdom v14: battlefield-integrated summon and action cut-ins. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage > #tarotKingdomCutin.tarot-cutin {
    --tk-action-accent: #9ab6ce;
    --tk-action-surface: rgba(9, 17, 28, 0.92);
    position: absolute;
    z-index: 64;
    top: var(--tk-action-cutin-y, 42%);
    right: 6px;
    left: auto;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    width: min(68%, 310px);
    min-width: 0;
    max-width: calc(100% - 12px);
    min-height: 38px;
    padding: 4px 13px 5px 16px;
    overflow: hidden;
    border: 0;
    border-left: 3px solid var(--tk-action-accent);
    border-radius: 2px 0 0 2px;
    color: #f8fbff;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--tk-action-accent) 20%, transparent), transparent 42%),
        linear-gradient(90deg, var(--tk-action-surface), rgba(3, 7, 13, 0.74));
    box-shadow:
        -8px 0 18px color-mix(in srgb, var(--tk-action-accent) 24%, transparent),
        0 5px 12px rgba(0, 0, 0, 0.56);
    opacity: 0;
    transform: translate(0, -50%) scaleX(0.14);
    transform-origin: 100% 50%;
    clip-path: inset(0 0 0 86%);
    transition: none;
    animation: none !important;
    pointer-events: none;
    isolation: isolate;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage > #tarotKingdomCutin.tarot-cutin::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(112deg, transparent 0 54%, color-mix(in srgb, var(--tk-action-accent) 38%, transparent) 55% 57%, transparent 58%);
    transform: translateX(-45%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage > #tarotKingdomCutin.tarot-cutin.show {
    animation: var(--tk-action-cutin-animation, tarotKingdomActionCutinSweep) var(--tk-action-cutin-duration, 680ms) cubic-bezier(0.2, 0.78, 0.18, 1) both !important;
}

/* With reduced motion the banner keeps its full reading time but only fades in and out. */
@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage > #tarotKingdomCutin.tarot-cutin {
        --tk-action-cutin-animation: tarotKingdomActionCutinQuiet;
    }
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage > #tarotKingdomCutin.tarot-cutin.is-kingdom-rebirth {
    --tk-action-accent: #fff4bf;
    --tk-action-surface: rgba(20, 28, 52, 0.96);
    top: 43%;
    right: 6px;
    left: 6px;
    grid-template-columns: minmax(58px, auto) 1fr;
    width: auto;
    max-width: none;
    min-height: 46px;
    padding: 6px 16px;
    border-right: 3px solid var(--tk-action-accent);
    border-left-width: 3px;
    border-radius: 2px;
    box-shadow:
        0 0 24px rgba(255, 244, 191, 0.38),
        0 7px 18px rgba(0, 0, 0, 0.62);
    transform-origin: 50% 50%;
}

#tarotKingdomCutin .tarot-action-cutin-actor {
    min-width: 58px;
    max-width: 98px;
    overflow: hidden;
    color: color-mix(in srgb, var(--tk-action-accent) 72%, white);
    font: 800 9px/1.05 Arial, sans-serif;
    letter-spacing: 0.04em;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tarotKingdomCutin .tarot-action-cutin-keyword {
    min-width: 0;
    overflow: hidden;
    font: 900 clamp(18px, 4.8vw, 28px)/1 Georgia, serif;
    letter-spacing: 0.1em;
    text-align: right;
    text-overflow: ellipsis;
    text-shadow: 0 2px 1px #000, 0 0 8px var(--tk-action-accent);
    white-space: nowrap;
}

#tarotKingdomCutin.is-tone-turn,
#tarotKingdomCutin.is-tone-victory,
#tarotKingdomCutin.is-tone-clear,
#tarotKingdomCutin.is-tone-last { --tk-action-accent: #ffd765; --tk-action-surface: rgba(54, 35, 4, 0.94); }
#tarotKingdomCutin.is-tone-pass,
#tarotKingdomCutin.is-tone-defend { --tk-action-accent: #7fc8ff; --tk-action-surface: rgba(4, 31, 56, 0.94); }
#tarotKingdomCutin.is-tone-draw { --tk-action-accent: #69e5ce; --tk-action-surface: rgba(3, 44, 43, 0.94); }
#tarotKingdomCutin.is-tone-skip { --tk-action-accent: #63d9ff; --tk-action-surface: rgba(3, 42, 65, 0.94); }
#tarotKingdomCutin.is-tone-cut { --tk-action-accent: #ff85c6; --tk-action-surface: rgba(65, 4, 39, 0.94); }
#tarotKingdomCutin.is-tone-reverse { --tk-action-accent: #ffc347; --tk-action-surface: rgba(66, 29, 2, 0.95); }
#tarotKingdomCutin.is-tone-lock { --tk-action-accent: #62e595; --tk-action-surface: rgba(3, 51, 24, 0.95); }
#tarotKingdomCutin.is-tone-break { --tk-action-accent: #ff9a59; --tk-action-surface: rgba(61, 20, 2, 0.95); }
#tarotKingdomCutin.is-tone-call { --tk-action-accent: #7ba8ff; --tk-action-surface: rgba(8, 22, 65, 0.95); }
#tarotKingdomCutin.is-tone-reclaim { --tk-action-accent: #c89cff; --tk-action-surface: rgba(42, 12, 69, 0.95); }
#tarotKingdomCutin.is-tone-resonance { --tk-action-accent: #ffe38a; --tk-action-surface: rgba(58, 38, 3, 0.95); }
#tarotKingdomCutin.is-tone-defeat { --tk-action-accent: #ff6666; --tk-action-surface: rgba(66, 5, 8, 0.95); }
#tarotKingdomCutin.is-tone-danger { --tk-action-accent: #ff665e; --tk-action-surface: rgba(60, 4, 18, 0.96); }

@keyframes tarotKingdomActionCutinSweep {
    0% { opacity: 0; clip-path: inset(0 0 0 86%); transform: translate(0, -50%) scaleX(0.14); }
    16% { opacity: 1; clip-path: inset(0); transform: translate(0, -50%) scaleX(1); }
    24%, 76% { opacity: 1; clip-path: inset(0); transform: translate(0, -50%) scaleX(1); }
    100% { opacity: 0; clip-path: inset(0 15% 0 0); transform: translate(-8%, -50%) scaleX(0.92); }
}

@keyframes tarotKingdomActionCutinQuiet {
    0%, 100% { opacity: 0; transform: translate(0, -50%); }
    10%, 86% { opacity: 1; transform: translate(0, -50%); }
}

/* Tarot Kingdom combat effects: compact icon language. */
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-card {
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner {
    position: absolute;
    z-index: 46;
    left: 50%;
    bottom: 25%;
    max-width: min(76%, 300px);
    padding: 5px 15px;
    overflow: hidden;
    border: 1px solid #d8ad42;
    border-radius: 3px;
    color: #fff0b7;
    background: linear-gradient(90deg, rgba(10, 6, 15, 0.05), rgba(32, 18, 42, 0.92) 18%, rgba(32, 18, 42, 0.92) 82%, rgba(10, 6, 15, 0.05));
    box-shadow: 0 0 16px rgba(205, 152, 55, 0.4);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
    transform: translateX(-50%);
    pointer-events: none;
    animation: tarotKingdomEffectBanner 420ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner.is-awakened {
    border-color: #e8f2ff;
    color: #fff;
    background: linear-gradient(90deg, rgba(12, 18, 32, 0.06), rgba(32, 45, 67, 0.96) 18%, rgba(43, 35, 65, 0.96) 82%, rgba(12, 18, 32, 0.06));
    box-shadow: 0 0 18px rgba(199, 220, 255, 0.58);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner[data-major-tone]:not([data-major-tone=""]) {
    border-color: #f0cf6a;
    color: #fff4c9;
    background: linear-gradient(90deg, rgba(12, 7, 18, 0.06), rgba(40, 21, 54, 0.96) 18%, rgba(40, 21, 54, 0.96) 82%, rgba(12, 7, 18, 0.06));
    box-shadow: 0 0 20px rgba(199, 139, 255, 0.46), inset 0 0 8px rgba(255, 224, 125, 0.12);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-affinity-hit {
    position: absolute;
    z-index: 48;
    left: 29%;
    top: 56%;
    display: flex;
    gap: 3px;
    pointer-events: none;
    animation: tarotKingdomAffinityHit 560ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-affinity-badge {
    padding: 2px 7px;
    border: 1px solid currentColor;
    border-radius: 2px;
    background: rgba(7, 8, 14, 0.82);
    font: 900 11px/1.25 Georgia, serif;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-affinity-badge.is-weak {
    color: #ffd36d;
    text-shadow: 0 0 7px #ff6d31;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-affinity-badge.is-weapon-weak {
    color: #fff0a8;
    border-color: #ffca4f;
    background: linear-gradient(180deg, rgba(52, 34, 5, 0.96), rgba(12, 10, 8, 0.92));
    text-shadow: 0 0 7px #ff8a24;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-affinity-badge.is-resist {
    color: #8ed6ff;
    text-shadow: 0 0 7px #2879d2;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-heal-number {
    position: absolute;
    z-index: 42;
    right: 52px;
    top: 10px;
    color: #8dffb0;
    text-shadow: 0 1px #052a12, 0 0 7px rgba(84, 255, 142, 0.72);
    font: 900 15px/1 Georgia, serif;
    pointer-events: none;
    animation: tarotKingdomHealNumber 520ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number {
    position: absolute;
    z-index: 62;
    top: 8px;
    right: clamp(48px, 12vw, 66px);
    color: #fff0bd;
    font: 900 clamp(18px, 5.2vw, 28px)/1 Georgia, serif;
    text-shadow: 0 2px 1px #280400, 0 0 7px #ff683c, 0 0 14px rgba(255, 42, 25, 0.72);
    opacity: 0;
    transform: translateY(8px) scale(0.76);
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
    margin-top: 1px;
    color: #f4e7bd;
    font-size: clamp(7px, 1.7vw, 10px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    text-align: right;
    text-shadow: 0 1px 1px #000;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number.is-miss {
    color: #d9f2ff;
    font-size: clamp(13px, 3.8vw, 20px);
    letter-spacing: 0.06em;
    text-shadow: 0 2px 1px #071c2d, 0 0 8px #7edaff;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number.is-status {
    font-size: clamp(12px, 3.4vw, 18px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number.is-status-poison {
    color: #baff87;
    text-shadow: 0 2px 1px #0b2405, 0 0 7px #65d638, 0 0 13px rgba(84, 206, 46, 0.7);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number.is-status-burn {
    color: #ffc27d;
    text-shadow: 0 2px 1px #341000, 0 0 7px #ff7a2f, 0 0 13px rgba(255, 75, 29, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number:is(.is-status-confusion, .is-status-mixed) {
    color: #dfb8ff;
    text-shadow: 0 2px 1px #20062f, 0 0 7px #ad64ec, 0 0 13px rgba(153, 73, 226, 0.7);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number.is-status-effect {
    color: #bceaff;
    text-shadow: 0 2px 1px #071c2d, 0 0 7px #5bbfea, 0 0 13px rgba(71, 161, 255, 0.68);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-player-damage-number.is-show {
    animation: tarotKingdomPlayerDamagePop 520ms cubic-bezier(0.15, 0.8, 0.25, 1) both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-stack {
    position: absolute;
    z-index: 63;
    display: grid;
    justify-items: center;
    gap: 1px;
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-stack.is-enemy {
    top: 55%;
    left: 31%;
    transform: translate(-50%, -50%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-stack.is-player {
    top: 25px;
    right: clamp(47px, 12vw, 65px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-text {
    color: #f4fbff;
    font: 900 clamp(11px, 3.1vw, 17px)/1 Georgia, serif;
    letter-spacing: 0.07em;
    white-space: nowrap;
    text-shadow: 0 2px 1px #07121e, 0 0 6px #56c8ff, 0 0 13px rgba(70, 162, 255, 0.66);
    opacity: 0;
    transform: translateY(6px) scale(0.8);
    animation: tarotKingdomEffectResultPop 560ms cubic-bezier(0.15, 0.8, 0.25, 1) both;
    animation-delay: calc(var(--tk-effect-result-index, 0) * 40ms);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-text.is-negative {
    color: #ffe4c7;
    text-shadow: 0 2px 1px #260407, 0 0 7px #ff6047, 0 0 14px rgba(255, 44, 37, 0.7);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-text.is-buff {
    color: #fff0a8;
    text-shadow: 0 2px 1px #251700, 0 0 7px #ffc64f, 0 0 14px rgba(255, 199, 61, 0.68);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-text[data-status="poison"] {
    color: #baff87;
    text-shadow: 0 2px 1px #0b2405, 0 0 7px #65d638, 0 0 14px rgba(84, 206, 46, 0.7);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-text[data-status="burn"] {
    color: #fff0a4;
    text-shadow: 0 2px 1px #351000, 0 0 7px #ff7938, 0 0 14px rgba(255, 77, 34, 0.76);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-text[data-status="freeze"] {
    color: #d7f7ff;
    text-shadow: 0 2px 1px #062638, 0 0 7px #72dcff, 0 0 14px rgba(60, 173, 255, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-result-text[data-status="paralysis"] {
    color: #fff9a8;
    text-shadow: 0 2px 1px #2c2400, 0 0 7px #ffe557, 0 0 14px rgba(255, 222, 43, 0.76);
}

@keyframes tarotKingdomEffectBanner {
    from { opacity: 0; transform: translate(-50%, 7px) scale(0.94); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes tarotKingdomAffinityHit {
    from { opacity: 0; transform: translateY(7px) scale(0.82); }
    35% { opacity: 1; transform: translateY(-3px) scale(1.08); }
    to { opacity: 1; transform: translateY(-8px) scale(1); }
}

@keyframes tarotKingdomPlayerDamagePop {
    0% { opacity: 0; transform: translateY(8px) scale(0.76); }
    24% { opacity: 1; transform: translateY(-5px) scale(1.16); }
    70% { opacity: 1; transform: translateY(-10px) scale(1); }
    100% { opacity: 0; transform: translateY(-19px) scale(0.94); }
}

@keyframes tarotKingdomEffectResultPop {
    0% { opacity: 0; transform: translateY(6px) scale(0.8); }
    22% { opacity: 1; transform: translateY(-2px) scale(1.12); }
    72% { opacity: 1; transform: translateY(-8px) scale(1); }
    100% { opacity: 0; transform: translateY(-16px) scale(0.96); }
}

@keyframes tarotKingdomHealNumber {
    from { opacity: 0; transform: translateY(8px) scale(0.9); }
    35% { opacity: 1; }
    to { opacity: 0.95; transform: translateY(-10px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-effect-banner,
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-affinity-hit,
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-heal-number,
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-effect-result-text,
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-player-damage-number.is-show {
        animation: none;
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Preview-only control deck. Only the most recently selected gallery stays open. */
body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 42;
    display: grid;
    width: clamp(132px, 32vw, 174px);
    gap: 4px;
}

body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-control-picker,
body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-control-panels > [data-demo-control-panel] {
    display: grid;
    padding: 4px 6px 6px;
    gap: 2px;
    border: 1px solid rgba(216, 181, 77, 0.72);
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(19, 24, 37, 0.94), rgba(5, 8, 15, 0.92));
    box-shadow: inset 0 0 0 1px rgba(255, 239, 184, 0.08), 0 3px 10px rgba(0, 0, 0, 0.62);
    color: #ead58e;
}

body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-control-panels > [data-demo-control-panel][hidden] {
    display: none;
}

body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-role-panel,
body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-status-panel {
    gap: 5px;
}

body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-role-panel > label,
body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-status-panel > label {
    display: grid;
    min-width: 0;
    gap: 2px;
}

body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-controls label > span {
    overflow: hidden;
    font: 700 8px/1.15 "Times New Roman", serif;
    letter-spacing: 0.16em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-controls select {
    width: 100%;
    min-width: 0;
    height: 28px;
    padding: 0 22px 0 7px;
    border: 1px solid rgba(183, 148, 61, 0.9);
    border-radius: 2px;
    background: #090d18;
    color: #f6e5b0;
    font: 700 11px/1.1 "Yu Mincho", "Hiragino Mincho ProN", serif;
    cursor: pointer;
}

body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-controls select:focus-visible {
    outline: 2px solid rgba(246, 213, 114, 0.9);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-controls {
        top: 6px;
        right: 6px;
        width: 132px;
    }

    body.tarot-kingdom-preview-body #tarotKingdomBattleStage .tarot-kingdom-demo-controls select {
        height: 26px;
        font-size: 10px;
    }
}

.tarot-kingdom-skill-card-fan .tarot-card {
    transform: translateY(calc((2 - var(--skill-card-index)) * (2 - var(--skill-card-index)) * 1.5px)) rotate(calc((var(--skill-card-index) - 2) * 5deg)) scale(0.76) !important;
}

/* Tarot Kingdom v4: compact party HUD, battle statuses, and field-card staging. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp {
    display: block;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-hand-count {
    overflow: hidden;
    color: #f4e6a9;
    font-size: clamp(8px, 2vw, 10px);
    font-weight: 900;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-info {
    border: 0;
    border-bottom-color: transparent;
    background: none;
    box-shadow: none;
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn::after {
    content: none;
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-art,
.tarot-kingdom-card-deal-ghost .tarot-card-art {
    width: 48px;
    height: 80px;
    border: 0;
    border-radius: 1px;
    box-shadow: none;
    image-rendering: pixelated;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-title,
.tarot-kingdom-card-deal-ghost .tarot-card-title {
    top: auto;
    right: 1px;
    bottom: 1px;
    left: 1px;
    min-height: 9px;
    padding: 1px 1px 0;
    color: #f8e8b5;
    background: linear-gradient(180deg, rgba(13, 10, 8, 0.2), rgba(8, 5, 3, 0.9));
    font-size: clamp(5px, 1.35vw, 7px);
    line-height: 1.05;
    text-shadow: 0 1px 1px #000;
    -webkit-text-stroke: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-number,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-number.is-center-range,
.tarot-kingdom-card-deal-ghost .tarot-card-number {
    top: 1px;
    right: auto;
    bottom: auto;
    left: 1px;
    width: auto;
    max-width: calc(100% - 3px);
    padding: 1px 2px;
    border: 1px solid rgba(234, 206, 129, 0.58);
    border-radius: 2px;
    color: #fff1bd;
    background: rgba(9, 6, 4, 0.82);
    font-size: clamp(8px, 2.35vw, 11px);
    line-height: 1;
    letter-spacing: -0.03em;
    text-align: left;
    text-shadow: 0 1px 1px #000;
    -webkit-text-stroke: 0;
    transform: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards {
    grid-template-columns: repeat(5, 50px);
    justify-content: center;
    gap: clamp(3px, 1.2vw, 7px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    width: 50px !important;
    height: 82px !important;
    aspect-ratio: auto;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    border: 1px solid rgba(202, 169, 91, 0.45) !important;
    border-image: none !important;
    border-radius: 3px;
    background: rgba(14, 11, 11, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 231, 165, 0.06);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art,
.tarot-kingdom-card-deal-ghost .tarot-card-art {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: 50% 50%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
    --tk-hand-card-width: 50px;
    grid-template-columns: repeat(8, var(--tk-hand-card-width));
    justify-content: center;
    width: 100%;
    max-width: 435px;
    gap: 5px;
    overflow-x: clip;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
    width: var(--tk-hand-card-width);
    height: 82px;
    aspect-ratio: auto;
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: 50% 50%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-selected {
    z-index: 4;
    border-color: #ffe08a !important;
    box-shadow: inset 0 0 0 1px rgba(255, 248, 207, 0.45), 0 8px 8px rgba(0, 0, 0, 0.78), 0 0 8px rgba(255, 205, 75, 0.5) !important;
    transform: translateY(-9px) rotate(-1deg);
}

.tarot-kingdom-skill-cutin {
    --skill-accent: #6fb7ff;
    position: absolute;
    z-index: 52;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 12px;
    overflow: hidden;
    color: #fff;
    background: radial-gradient(circle at 50% 53%, color-mix(in srgb, var(--skill-accent) 28%, transparent), rgba(0, 0, 0, 0.84) 62%);
    pointer-events: none;
    isolation: isolate;
}

.tarot-kingdom-skill-cutin::before,
.tarot-kingdom-skill-cutin::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 42% -20%;
    border-top: 1px solid var(--skill-accent);
    border-bottom: 1px solid var(--skill-accent);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--skill-accent) 36%, transparent), transparent);
    transform: skewY(-5deg);
    filter: drop-shadow(0 0 12px var(--skill-accent));
}

.tarot-kingdom-skill-cutin::after {
    inset: 0;
    border: 0;
    background: radial-gradient(circle, transparent 42%, rgba(0, 0, 0, 0.78) 82%);
    transform: none;
    filter: none;
}

.tarot-kingdom-skill-cutin-title {
    font-family: Georgia, "Yu Mincho", serif;
    font-size: clamp(25px, 8vw, 48px);
    letter-spacing: 0.12em;
    text-shadow: 0 2px 1px #000, 0 0 8px var(--skill-accent), 0 0 18px var(--skill-accent);
}

.tarot-kingdom-skill-card-fan {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 88px;
}

.tarot-kingdom-skill-card-fan .tarot-card {
    width: 50px !important;
    height: 82px !important;
    transform: translateY(calc((2 - var(--skill-card-index)) * (2 - var(--skill-card-index)) * 1.5px)) rotate(calc((var(--skill-card-index) - 2) * 5deg)) scale(0.76);
    transform-origin: 50% 115%;
}

.tarot-kingdom-skill-cutin.is-role-flush { --skill-accent: #71e6f4; }
.tarot-kingdom-skill-cutin.is-role-full-house { --skill-accent: #ffd35e; }
.tarot-kingdom-skill-cutin.is-role-four-kind { --skill-accent: #ff554c; }
.tarot-kingdom-skill-cutin.is-role-world { --skill-accent: #c479ff; }
.tarot-kingdom-skill-cutin.is-role-straight-flush { --skill-accent: #fff7d1; }
.tarot-kingdom-skill-cutin.is-role-five-kind { --skill-accent: #9f001d; }
.tarot-kingdom-skill-cutin.is-phase-damage,
.tarot-kingdom-skill-cutin.is-phase-recover { opacity: 0.28; }

#tarotKingdomBattleStage > .tarot-kingdom-damage-layer {
    position: absolute;
    z-index: 76;
    inset: 0;
    overflow: visible;
    pointer-events: none;
}

.tarot-kingdom-damage-number {
    position: absolute;
    z-index: 58;
    left: 52%;
    top: 43%;
    color: #fff1bd;
    font-family: Georgia, serif;
    font-size: clamp(28px, 9vw, 52px);
    font-weight: 900;
    line-height: 1;
    /* A dark outline first, so the number stays readable over a bright battlefield or summon. */
    text-shadow:
        -1px -1px 0 #1a0500, 1px -1px 0 #1a0500, -1px 1px 0 #1a0500, 1px 1px 0 #1a0500,
        0 3px 1px #2a0800, 0 0 8px #ff7b33, 0 0 18px rgba(255, 44, 20, 0.8);
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.72);
    pointer-events: none;
}

.tarot-kingdom-damage-number.is-skill {
    color: #fff8d7;
    font-size: clamp(38px, 12vw, 68px);
}

.tarot-kingdom-damage-number.is-heal {
    color: #baffbb;
    text-shadow: 0 2px 1px #12371a, 0 0 8px #67e879, 0 0 16px rgba(75, 216, 111, 0.72);
}

.tarot-kingdom-damage-number.is-status {
    font-size: clamp(17px, 5.5vw, 30px);
}

.tarot-kingdom-damage-number.is-status-poison {
    color: #baff87;
    text-shadow: 0 2px 1px #0b2405, 0 0 8px #65d638, 0 0 16px rgba(84, 206, 46, 0.72);
}

.tarot-kingdom-damage-number.is-status-burn {
    color: #ffc27d;
    text-shadow: 0 2px 1px #341000, 0 0 8px #ff7a2f, 0 0 16px rgba(255, 75, 29, 0.74);
}

.tarot-kingdom-damage-number:is(.is-status-confusion, .is-status-mixed) {
    color: #dfb8ff;
    text-shadow: 0 2px 1px #20062f, 0 0 8px #ad64ec, 0 0 16px rgba(153, 73, 226, 0.72);
}

.tarot-kingdom-damage-number.is-status-effect {
    color: #bceaff;
    text-shadow: 0 2px 1px #071c2d, 0 0 8px #5bbfea, 0 0 16px rgba(71, 161, 255, 0.7);
}

.tarot-kingdom-damage-number.is-cap {
    color: #fff4aa;
    text-shadow:
        0 3px 1px #3b1900,
        0 0 9px #ffb82d,
        0 0 20px rgba(255, 83, 18, 0.9);
}

.tarot-kingdom-damage-number.is-cap::after {
    content: "MAX";
    display: block;
    margin-top: 3px;
    font-family: sans-serif;
    font-size: 0.24em;
    letter-spacing: 0.16em;
}

.tarot-kingdom-damage-number.is-miss {
    color: #d9f2ff;
    font-size: clamp(22px, 7vw, 38px);
    letter-spacing: 0.08em;
    text-shadow: 0 2px 1px #071c2d, 0 0 8px #7edaff, 0 0 16px rgba(71, 161, 255, 0.72);
}

.tarot-kingdom-damage-number.is-show {
    animation: tarotKingdomDamagePop 760ms cubic-bezier(0.15, 0.8, 0.25, 1) both;
}

#tarotKingdomBattleStage.is-battle-charging .tarot-kingdom-battle-player.is-battle-charging .tarot-kingdom-battle-player-avatar {
    filter: brightness(1.24) drop-shadow(0 0 8px #ffd66a) drop-shadow(0 0 16px rgba(255, 123, 45, 0.7));
}

#tarotKingdomBattleStage.is-battle-hit-stop :is(.tarot-kingdom-battle-player.is-battle-hit-stop .tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite) {
    animation-play-state: paused !important;
    /* softer than before: the pixel hit effect now shows the contact, so the sprite need not flash white */
    filter: brightness(1.5) contrast(1.1) drop-shadow(0 0 6px #fff3bb);
}

/* Pixel-art hit effects (tarotKingdomPixelFx.js): one small canvas scaled up, just under the damage numbers. */
#tarotKingdomBattleStage > .tarot-kingdom-pixelfx-layer {
    position: absolute;
    z-index: 57;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    image-rendering: pixelated;
}

/* Stage atmosphere (fireflies, fog, rain): over the battlefield art, under every actor.
   Screen blending drops the effects' own dark night haze and keeps only their light. */
#tarotKingdomBattleStage .tarot-kingdom-battle-arena > .tarot-kingdom-pixelfx-ambient {
    position: absolute;
    z-index: 1;
    mix-blend-mode: screen;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    image-rendering: pixelated;
}

#tarotKingdomBattleStage.is-battle-skill.is-battle-damage .tarot-kingdom-battle-arena {
    animation: tarotKingdomSkillImpact 260ms steps(2, end) both;
}

#tarotKingdomBattleStage.is-weapon-impact-shake:not(.is-battle-skill) .tarot-kingdom-battle-arena {
    animation: tarotKingdomWeaponImpactShake var(--tk-weapon-impact-duration, 180ms) steps(4, end) both;
}

@keyframes tarotKingdomDamagePop {
    0% { opacity: 0; transform: translate(-50%, 12px) scale(0.72); }
    24% { opacity: 1; transform: translate(-50%, -8px) scale(1.18); }
    68% { opacity: 1; transform: translate(-50%, -16px) scale(1); }
    100% { opacity: 1; transform: translate(-50%, -22px) scale(1); }
}

@keyframes tarotKingdomSkillImpact {
    0% { transform: translate(0, 0); filter: brightness(1); }
    25% { transform: translate(-5px, 2px); filter: brightness(1.9); }
    50% { transform: translate(5px, -2px); }
    75% { transform: translate(-3px, 1px); }
    100% { transform: translate(0, 0); filter: brightness(1); }
}

@keyframes tarotKingdomWeaponImpactShake {
    0%, 100% { transform: translate3d(0, 0, 0); filter: brightness(1); }
    18% { transform: translate3d(calc(var(--tk-weapon-impact-x, 3px) * -1), var(--tk-weapon-impact-y, 1px), 0); filter: brightness(1.28); }
    38% { transform: translate3d(var(--tk-weapon-impact-x, 3px), calc(var(--tk-weapon-impact-y, 1px) * -1), 0); }
    58% { transform: translate3d(calc(var(--tk-weapon-impact-x, 3px) * -0.55), 0, 0); }
    78% { transform: translate3d(calc(var(--tk-weapon-impact-x, 3px) * 0.3), var(--tk-weapon-impact-y, 1px), 0); filter: brightness(1.08); }
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
        --tk-hand-card-width: clamp(35px, calc((100vw - 26px) / 8), 45px);
        max-width: none;
        gap: 2px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
        height: calc(var(--tk-hand-card-width) / 0.6);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.84);
    }

}

@media (prefers-reduced-motion: reduce) {
    .tarot-kingdom-skill-cutin,
    .tarot-kingdom-damage-number.is-show,
    #tarotKingdomBattleStage.is-battle-skill.is-battle-damage .tarot-kingdom-battle-arena {
        animation: none !important;
        transition: none !important;
        transform: none;
    }

    .tarot-kingdom-skill-cutin { opacity: 0.9; }
    .tarot-kingdom-damage-number.is-show { opacity: 1; }

}

/* Tarot Kingdom v10: native-size physical tarot cards and an eight-card hand. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card {
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #c9a85c !important;
    border-image: none !important;
    border-radius: 3px;
    background: #120f0c;
    box-shadow:
        inset 0 0 0 1px rgba(255, 239, 184, 0.18),
        0 3px 5px rgba(0, 0, 0, 0.76),
        0 0 0 1px rgba(36, 22, 8, 0.78);
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.is-arcana,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.arcana-suit-hybrid {
    border-color: #e1c77b !important;
    background: #120f0c;
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.is-arcana::before {
    content: none;
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-art {
    width: 48px;
    height: 80px;
    border: 0;
    border-radius: 1px;
    box-shadow: none;
    image-rendering: pixelated;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-title {
    top: auto;
    right: 1px;
    bottom: 1px;
    left: 1px;
    min-height: 9px;
    padding: 1px 1px 0;
    color: #f8e8b5;
    background: linear-gradient(180deg, rgba(13, 10, 8, 0.2), rgba(8, 5, 3, 0.9));
    font-size: clamp(5px, 1.35vw, 7px);
    line-height: 1.05;
    text-shadow: 0 1px 1px #000;
    -webkit-text-stroke: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-number,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-number.is-center-range {
    top: 1px;
    right: auto;
    bottom: auto;
    left: 1px;
    width: auto;
    max-width: calc(100% - 3px);
    padding: 1px 2px;
    border: 1px solid rgba(234, 206, 129, 0.58);
    border-radius: 2px;
    color: #fff1bd;
    background: rgba(9, 6, 4, 0.82);
    font-size: clamp(8px, 2.35vw, 11px);
    line-height: 1;
    letter-spacing: -0.03em;
    text-align: left;
    text-shadow: 0 1px 1px #000;
    -webkit-text-stroke: 0;
    transform: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards {
    grid-template-columns: repeat(5, 50px);
    justify-content: center;
    gap: clamp(3px, 1.2vw, 7px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    width: 50px !important;
    height: 82px !important;
    aspect-ratio: auto;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    border: 1px solid rgba(202, 169, 91, 0.45) !important;
    border-image: none !important;
    border-radius: 3px;
    background: rgba(14, 11, 11, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 231, 165, 0.06);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art {
    transform: translate(-50%, -50%) scale(1);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
    --tk-hand-card-width: 50px;
    grid-template-columns: repeat(8, var(--tk-hand-card-width));
    justify-content: center;
    width: 100%;
    max-width: 435px;
    gap: 5px;
    overflow-x: clip;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
    width: var(--tk-hand-card-width);
    height: 82px;
    aspect-ratio: auto;
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
    transform: translate(-50%, -50%) scale(1);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-selected {
    z-index: 4;
    border-color: #ffe08a !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 248, 207, 0.45),
        0 8px 8px rgba(0, 0, 0, 0.78),
        0 0 8px rgba(255, 205, 75, 0.5);
    transform: translateY(-9px) rotate(-1deg);
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
        --tk-hand-card-width: clamp(35px, calc((100vw - 26px) / 8), 45px);
        max-width: none;
        gap: 2px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
        height: calc(var(--tk-hand-card-width) / 0.6);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.84);
    }
}

/* Equipped-card resonance is communicated only through the card number. */
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-card.is-arcana .tarot-card-number:not(.is-rolling) {
    animation: none;
    filter: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-resonance-affordable .tarot-card-number:not(.is-rolling) {
    animation: tarotKingdomResonanceNumberGlow 1.15s ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-resonance-insufficient .tarot-card-number:not(.is-rolling) {
    filter: drop-shadow(0 0 2px rgba(216, 180, 94, 0.58));
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card .tarot-card-ap-cost {
    position: absolute;
    z-index: 4;
    top: 17px;
    left: 2px;
    max-width: calc(100% - 4px);
    padding: 1px 2px;
    border: 1px solid rgba(226, 232, 240, 0.48);
    border-radius: 3px;
    color: #f8fafc;
    background: rgba(3, 7, 18, 0.82);
    font-size: 5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-resonance-insufficient .tarot-card-ap-cost {
    color: #d6c486;
    border-color: rgba(196, 166, 84, 0.42);
}

@keyframes tarotKingdomResonanceNumberGlow {
    0%, 100% {
        filter: drop-shadow(0 0 2px rgba(255, 248, 204, 0.82)) drop-shadow(0 0 4px rgba(244, 190, 48, 0.68));
    }
    50% {
        filter: drop-shadow(0 0 4px #fff8cc) drop-shadow(0 0 9px rgba(255, 202, 54, 0.98));
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-resonance-affordable .tarot-card-number:not(.is-rolling) {
        animation: none;
        filter: drop-shadow(0 0 3px rgba(255, 248, 204, 0.9)) drop-shadow(0 0 6px rgba(244, 190, 48, 0.82));
    }
}

/* Tarot Kingdom v7: hand-to-field deal motion for normal card plays. */
.tarot-kingdom-card-deal-ghost {
    position: fixed !important;
    z-index: 4460 !important;
    box-sizing: border-box;
    margin: 0 !important;
    pointer-events: none !important;
    transform-origin: 0 0;
    border: 10px solid transparent !important;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 10px / 0 stretch !important;
    border-radius: 0 !important;
    background-color: #0a090d !important;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.72), 0 0 10px rgba(231, 190, 83, 0.24) !important;
    will-change: transform, opacity, filter;
}

.tarot-kingdom-card-deal-ghost .tarot-card-number {
    animation: none !important;
    filter: none !important;
}

.tarot-kingdom-card-land-ring {
    position: fixed;
    z-index: 4458;
    box-sizing: border-box;
    border: 2px solid rgba(255, 229, 139, 0.88);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255, 223, 117, 0.2), transparent 68%);
    box-shadow: 0 0 8px rgba(255, 242, 184, 0.72), 0 0 18px rgba(226, 174, 50, 0.58);
    pointer-events: none;
    mix-blend-mode: screen;
    will-change: transform, opacity;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomTrick > .tarot-card.is-deal-displaced {
    pointer-events: none;
    transform-origin: 50% 100%;
    animation: tarotKingdomFieldCardDisplaceV7 var(--deal-displace-ms, 170ms) cubic-bezier(0.4, 0, 0.78, 0.34) forwards !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomTrick > .tarot-card.is-deal-settling {
    opacity: 0;
    transform-origin: 50% 100%;
    animation-name: tarotKingdomFieldCardSettleV7 !important;
    animation-timing-function: cubic-bezier(0.16, 0.84, 0.22, 1) !important;
    animation-fill-mode: forwards !important;
}

@keyframes tarotKingdomFieldCardDisplaceV7 {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
        filter: brightness(1) saturate(1);
    }
    100% {
        opacity: 0;
        transform: perspective(520px) translate3d(0, 11px, 0) rotateX(17deg) scale(0.94);
        filter: brightness(0.52) saturate(0.58) blur(0.4px);
    }
}

@keyframes tarotKingdomFieldCardSettleV7 {
    0% {
        opacity: 0.16;
        transform: perspective(520px) translate3d(0, -5px, 0) rotateX(-16deg) scale(0.965);
        filter: brightness(1.66) saturate(1.04) drop-shadow(0 8px 8px rgba(0, 0, 0, 0.68));
    }
    58% {
        opacity: 1;
        transform: perspective(520px) translate3d(0, 1px, 0) rotateX(2deg) scale(1.025);
        filter: brightness(1.24) saturate(1.08) drop-shadow(0 4px 5px rgba(230, 188, 74, 0.48));
    }
    100% {
        opacity: 1;
        transform: none;
        filter: brightness(1) saturate(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-kingdom-card-deal-ghost,
    .tarot-kingdom-card-land-ring {
        display: none !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomTrick > .tarot-card.is-deal-displaced {
        animation: none !important;
        opacity: 0 !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomTrick > .tarot-card.is-deal-settling {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }
}

/* v5: 選択カードは手札内だけで示し、場札は提出済みカード専用にする。 */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomSelectedCards {
    display: none !important;
}

/* 通常提出は旧フライト／体当たりを使わず、場の中で短く交代する。 */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card.is-field-replacing {
    pointer-events: none;
    transform-origin: 50% 100%;
    animation: tarotKingdomFieldCardExitV5 var(--field-exit-ms, 150ms) cubic-bezier(0.4, 0, 0.8, 0.3) forwards !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card.is-entering {
    opacity: 0 !important;
    transform-origin: 50% 100%;
    animation-name: tarotKingdomFieldCardLandV5 !important;
    animation-timing-function: cubic-bezier(0.16, 0.84, 0.22, 1) !important;
    animation-fill-mode: forwards !important;
}

@keyframes tarotKingdomFieldCardExitV5 {
    0% {
        opacity: 1;
        transform: none;
        filter: brightness(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(-16px, -7px, 0) scale(0.9) rotate(-3deg);
        filter: brightness(0.58) saturate(0.64);
    }
}

@keyframes tarotKingdomFieldCardLandV5 {
    0% {
        opacity: 0;
        transform: perspective(520px) translate3d(0, 24px, 0) rotateX(-68deg) scale(0.9);
        filter: brightness(1.7) saturate(0.78) drop-shadow(0 12px 8px rgba(0, 0, 0, 0.82));
    }
    58% {
        opacity: 1;
        transform: perspective(520px) translate3d(0, -4px, 0) rotateX(5deg) scale(1.025);
        filter: brightness(1.24) saturate(1.12) drop-shadow(0 0 10px rgba(239, 200, 104, 0.78));
    }
    82% {
        opacity: 1;
        transform: perspective(520px) translate3d(0, 2px, 0) rotateX(-2deg) scale(0.992);
        filter: brightness(1.06) saturate(1.04) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.68));
    }
    100% {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card.is-field-replacing {
        animation: none !important;
        opacity: 0 !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card.is-entering {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }
}

#tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-your-turn-badge,
#tarotKingdomRoot.tarot-kingdom-reference-v2 .kingdom-cutin.is-kingdom-your-turn {
    display: none !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite.is-petrified {
    animation: none !important;
    filter: grayscale(1) sepia(0.24) contrast(1.28) brightness(0.78) drop-shadow(0 0 7px rgba(173, 196, 208, 0.72));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite:is(.is-confused, [data-combat-status="confusion"]):not(.is-petrified):not(.is-hurt):not(.is-attacking) {
    --tarot-kingdom-enemy-confusion-facing-scale-x: var(--tarot-kingdom-enemy-escape-facing-scale-x, 1);
    animation: none;
    filter: hue-rotate(42deg) saturate(1.45) drop-shadow(0 0 9px rgba(205, 126, 255, 0.78));
}

@keyframes tarotKingdomAvatarTurnGlow {
    0%, 100% { filter: drop-shadow(0 4px 2px #000) drop-shadow(0 0 4px #ffe98d) drop-shadow(0 0 8px rgba(255, 205, 44, 0.72)); }
    50% { filter: drop-shadow(0 4px 2px #000) drop-shadow(0 0 8px #fff7c9) drop-shadow(0 0 16px rgba(255, 210, 64, 1)); }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-avatar,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card.is-entering {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Tarot Kingdom — 16-bit JRPG battle presentation */
.tarot-kingdom-preview-body {
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% -10%, rgba(49, 84, 157, 0.38), transparent 42%),
        linear-gradient(180deg, #071129 0%, #020511 100%);
}

#tarotKingdomRoot.tarot-kingdom-jrpg {
    --tk-window-blue: #081c68;
    --tk-window-deep: #030b36;
    --tk-window-mid: #0d2a82;
    --tk-window-line: #f4f7ff;
    --tk-window-inner: #718bd9;
    --tk-cursor: #ffe45b;
    box-sizing: border-box;
    width: 100%;
    max-width: 1120px;
    margin-inline: auto;
    padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 102px);
    overflow-x: hidden;
    color: #f8fbff;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(180deg, rgba(7, 20, 65, 0.98), rgba(1, 4, 20, 0.99));
    background-size: 4px 4px, 4px 4px, auto;
    border: 2px solid #c7d5ff;
    border-radius: 4px;
    box-shadow:
        inset 0 0 0 2px #263d91,
        inset 0 0 36px rgba(1, 4, 20, 0.72),
        0 10px 30px rgba(0, 0, 0, 0.48);
    image-rendering: pixelated;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-header {
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    padding: 5px 8px;
    border-left: 3px solid var(--tk-cursor);
    background: linear-gradient(90deg, rgba(15, 46, 132, 0.9), rgba(3, 11, 54, 0.18));
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-title-copy,
#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel-heading {
    display: grid;
    min-width: 0;
    line-height: 1.05;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-title-kicker,
#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel-eyebrow {
    color: #79bfff;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.16em;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-header h2 {
    margin: 1px 0 0;
    color: #fff;
    font-size: clamp(15px, 2.3vw, 22px);
    font-weight: 900;
    letter-spacing: 0.05em;
    text-shadow: 2px 2px 0 #02061a;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-state-text {
    margin: 4px 0 6px;
    padding: 6px 9px;
    border: 1px solid #8397d5;
    border-radius: 2px;
    color: #fff;
    background-color: #061348;
    background-image: linear-gradient(180deg, #0c287d, #061348);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    box-shadow: inset 0 0 0 1px #020827;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-chip {
    min-height: 19px;
    padding: 1px 6px;
    border: 1px solid #718bd9;
    border-radius: 2px;
    color: #fff;
    background: #061348;
    font-size: 9px;
    text-shadow: 1px 1px 0 #000;
    box-shadow: inset 0 0 0 1px #020827;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-controls,
#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-openrooms {
    margin: 4px 0 6px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-layout {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 7px;
    overflow: visible;
}

#tarotKingdomRoot.tarot-kingdom-jrpg.is-battle-active .tarot-kingdom-panel--hand {
    order: 1;
}

#tarotKingdomRoot.tarot-kingdom-jrpg.is-battle-active .tarot-kingdom-panel--trick {
    order: 2;
}

#tarotKingdomRoot.tarot-kingdom-jrpg.is-battle-active .tarot-kingdom-panel--players {
    order: 3;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel {
    box-sizing: border-box;
    min-width: 0;
    padding: 7px;
    overflow: visible;
    border: 2px solid var(--tk-window-line);
    border-radius: 3px;
    background-color: var(--tk-window-blue);
    background-image:
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 32%),
        linear-gradient(180deg, var(--tk-window-mid), var(--tk-window-deep));
    box-shadow:
        inset 0 0 0 2px var(--tk-window-inner),
        inset 0 0 0 4px #020827,
        3px 4px 0 rgba(0, 0, 0, 0.46);
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel-title {
    display: flex;
    align-items: center;
    min-height: 26px;
    gap: 7px;
    margin: 0 0 5px;
    padding: 0 3px;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    text-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-hand-count {
    position: absolute;
    top: 8px;
    right: -22px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 1px solid #fff;
    border-radius: 2px;
    color: #061348;
    background: var(--tk-cursor);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
    text-shadow: none;
    box-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-hand-title .tarot-kingdom-panel-heading {
    position: relative;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-clear-inline,
#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-play-inline,
#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-controls button {
    min-height: 30px;
    padding: 4px 8px;
    border: 2px solid #f4f7ff;
    border-radius: 2px;
    color: #fff;
    background-image: linear-gradient(180deg, #2453b5, #081c68);
    font-size: 10px;
    font-weight: 900;
    text-shadow: 1px 1px 0 #000;
    box-shadow: inset 0 0 0 1px #07123d, 2px 2px 0 rgba(0, 0, 0, 0.5);
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-play-inline:not(:disabled) {
    color: #171006;
    background-image: linear-gradient(180deg, #fff276, #e3a914);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-your-turn-badge {
    min-height: 25px;
    border-radius: 2px;
    color: #171006;
    background: var(--tk-cursor);
    text-shadow: none;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    margin: 5px 0 7px;
    padding: 7px;
    overflow: hidden;
    border: 2px solid var(--tk-window-line);
    border-radius: 3px;
    color: #fff;
    background-color: #040b2d;
    background-image:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
        radial-gradient(ellipse at 18% 75%, rgba(125, 66, 48, 0.35), transparent 31%),
        linear-gradient(180deg, #15265c 0%, #081331 56%, #040817 100%);
    box-shadow:
        inset 0 0 0 2px var(--tk-window-inner),
        inset 0 0 0 4px #020827,
        3px 4px 0 rgba(0, 0, 0, 0.48);
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage::before {
    opacity: 0.38;
    background-image:
        linear-gradient(90deg, transparent 49.7%, rgba(255, 255, 255, 0.045) 50%, transparent 50.3%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 5px);
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
    display: grid;
    grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
    grid-template-areas:
        "enemy party"
        "center center";
    align-items: stretch;
    min-height: 286px;
    gap: 6px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    grid-area: enemy;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    grid-area: party;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    grid-area: center;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    box-sizing: border-box;
    min-width: 0;
    padding: 7px;
    overflow: hidden;
    border: 1px solid #8fa5ed;
    border-radius: 2px;
    background-color: #07154d;
    background-image:
        linear-gradient(180deg, rgba(17, 48, 133, 0.88), rgba(3, 10, 43, 0.94)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 4px);
    box-shadow: inset 0 0 0 1px #020827;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    grid-template-rows: auto auto minmax(112px, 1fr);
    border-color: #c18c9f;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin: 0 0 5px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading::before {
    content: "▶";
    flex: 0 0 auto;
    color: var(--tk-cursor);
    font-size: 9px;
    text-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
    color: #fff;
    font-size: 12px;
    text-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-eyebrow {
    color: #ffb5b5;
    font-size: 8px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-party-side .tarot-kingdom-battle-eyebrow {
    color: #9fd6ff;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-hp-track,
#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
    height: 7px;
    border: 1px solid #e8efff;
    border-radius: 1px;
    background: #030619;
    box-shadow: inset 0 0 0 1px #02030a;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-hp-fill,
#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-fill {
    border-radius: 0;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
    min-height: 118px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
    --tarot-kingdom-enemy-scale: 1.75;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    min-width: 0;
    gap: 0;
    text-align: left;
    border: 2px solid #f4f7ff;
    border-radius: 3px;
    background-color: #061348;
    background-image: linear-gradient(180deg, #0c287d, #061348);
    box-shadow: inset 0 0 0 2px #718bd9, inset 0 0 0 4px #020827;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-turn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 96px;
    gap: 5px;
    padding: 8px 10px;
    border: 0;
    border-right: 1px solid #718bd9;
    border-radius: 0;
    color: #fff;
    background: transparent;
    font-size: 9px;
    text-align: left;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-battle-cursor {
    color: var(--tk-cursor);
    filter: drop-shadow(1px 1px 0 #000);
    animation: tarotKingdomCursorBlink 720ms steps(2, end) infinite;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-feed {
    display: grid;
    align-content: center;
    min-width: 0;
    min-height: 48px;
    max-height: 70px;
    padding: 5px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-event {
    min-height: 28px;
    padding: 6px 8px;
    border: 1px solid #718bd9;
    border-radius: 1px;
    color: #fff;
    background-color: #06103b;
    background-image: linear-gradient(90deg, #081b61, #06103b);
    font-size: 10px;
    font-weight: 900;
    text-align: left;
    text-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleParty.tarot-kingdom-battle-party {
    align-content: stretch;
    gap: 4px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 49px;
    gap: 3px 5px;
    padding: 3px 5px 3px 3px;
    border: 1px solid #6179c5;
    border-radius: 1px;
    background-color: #061348;
    background-image: linear-gradient(90deg, #0d2d84, #061348);
    box-shadow: inset 0 0 0 1px #020827;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn {
    border-color: var(--tk-cursor);
    background-image: linear-gradient(90deg, #514414, #0d2a82 35%, #061348);
    box-shadow: inset 3px 0 0 var(--tk-cursor), inset 0 0 0 1px #020827;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn::before {
    content: "▶";
    position: absolute;
    z-index: 5;
    left: 1px;
    top: 50%;
    color: var(--tk-cursor);
    font-size: 8px;
    transform: translateY(-50%);
    text-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
    width: 38px;
    height: 42px;
    --avatar-combat-scale: 0.61;
    image-rendering: pixelated;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    gap: 2px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
    color: #fff;
    font-size: 11px;
    text-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats {
    color: #ffe77a;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp {
    gap: 4px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand {
    --tarot-card-w: clamp(48px, 14.6vw, 68px);
    --tarot-card-h: calc(var(--tarot-card-w) * 1.62);
    --tarot-card-radius: 5px;
    --tarot-card-padding: 3px;
    --tarot-card-number-size: clamp(12px, 3.4vw, 16px);
    --tarot-card-title-size: 8px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-width: 0;
    min-height: calc(var(--tarot-card-h) + 20px);
    gap: 0;
    padding: 18px 2px 2px;
    overflow-x: hidden;
    overflow-y: visible;
    flex-wrap: nowrap;
    overscroll-behavior-x: none;
    perspective: 900px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand > .tarot-card {
    box-sizing: border-box;
    flex: 0 0 var(--tarot-card-w);
    width: var(--tarot-card-w);
    min-width: var(--tarot-card-w);
    height: var(--tarot-card-h);
    margin: 0;
    transform-origin: center bottom;
    box-shadow:
        -2px 0 0 rgba(0, 0, 0, 0.45),
        inset 0 0 0 1px rgba(255, 255, 255, 0.24),
        0 4px 6px rgba(0, 0, 0, 0.42);
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand > .tarot-card + .tarot-card {
    margin-left: calc(var(--tarot-card-w) * -0.44);
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.68);
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand > .tarot-card.is-selected {
    z-index: 50 !important;
    border-color: #fffbe0;
    transform: translateY(-16px);
    box-shadow:
        0 0 0 2px var(--tk-cursor),
        0 0 14px rgba(255, 228, 91, 0.78),
        0 6px 7px rgba(0, 0, 0, 0.5);
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand > .tarot-card.is-selected::after {
    content: "▲";
    top: auto;
    bottom: 4px;
    width: 16px;
    height: 16px;
    border-radius: 2px;
    color: #171006;
    background: var(--tk-cursor);
    font-size: 9px;
    text-shadow: none;
}

#tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-trick {
    min-height: 62px;
    align-items: center;
    justify-content: center;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    position: fixed;
    z-index: 4100;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    box-sizing: border-box;
    width: min(620px, calc(100vw - 12px));
    max-width: calc(100vw - 12px);
    padding: 22px 7px 7px;
    overflow: visible;
    border: 2px solid #f4f7ff;
    border-radius: 3px;
    background-color: #061348;
    background-image: linear-gradient(180deg, #12338d, #061348);
    backdrop-filter: none;
    box-shadow:
        inset 0 0 0 2px #718bd9,
        inset 0 0 0 4px #020827,
        3px 4px 0 rgba(0, 0, 0, 0.62);
    transform: translateX(-50%);
    pointer-events: auto;
}

#tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    bottom: calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 8px);
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup.tarot-kingdom-action-popup::before {
    content: "COMMAND";
    top: 5px;
    left: 12px;
    color: #fff;
    font-size: 9px;
    letter-spacing: 0.16em;
    transform: none;
    text-shadow: 1px 1px 0 #000;
    animation: none;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup .tarot-betting-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup .tarot-betting-actions > button {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    margin: 0;
    padding: 6px 4px;
    border: 2px solid #f4f7ff;
    border-radius: 2px;
    color: #fff;
    background-color: #102b77;
    background-image: linear-gradient(180deg, #2852b0, #0a1d61);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 1px 1px 0 #000;
    box-shadow: inset 0 0 0 1px #020827, 2px 2px 0 rgba(0, 0, 0, 0.5);
    writing-mode: horizontal-tb;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup .tarot-betting-actions > button:not(:disabled)::before {
    content: "▶";
    position: static;
    display: inline;
    margin-right: 4px;
    opacity: 1;
    color: var(--tk-cursor);
    background: none;
    box-shadow: none;
    transform: none;
}

#tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup .tarot-betting-actions > button:disabled {
    opacity: 0.48;
    filter: grayscale(0.45);
}

@keyframes tarotKingdomCursorBlink {
    0%, 48% { opacity: 1; }
    49%, 100% { opacity: 0.38; }
}

@media (min-width: 641px) {
    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand > .tarot-card + .tarot-card {
        margin-left: calc(var(--tarot-card-w) * -0.32);
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.78);
    }
}

@media (max-width: 640px) {
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg {
        height: auto;
        min-height: 0;
        max-height: none;
        overflow-x: hidden;
        overflow-y: visible;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-layout {
        flex: 0 0 auto;
        overflow: visible;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand {
        justify-content: center;
        gap: 0;
        padding-top: 18px;
        padding-bottom: 2px;
        overflow-x: hidden;
        overflow-y: visible;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: auto;
    }
}

@media (max-width: 430px) {
    #tarotKingdomRoot.tarot-kingdom-jrpg {
        width: 100%;
        padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 94px);
        border-width: 0;
        border-radius: 0;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-header {
        min-height: 32px;
        padding: 3px 5px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-header-meta {
        gap: 2px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-header-meta .tarot-kingdom-chip {
        min-height: 17px;
        padding-inline: 4px;
        font-size: 8px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-state-text {
        max-height: 44px;
        margin-block: 3px 5px;
        padding: 5px 7px;
        overflow: hidden;
        font-size: 10px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage {
        margin: 3px 0 5px;
        padding: 5px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
        grid-template-areas:
            "enemy party"
            "center center";
        min-height: 244px;
        gap: 4px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
        padding: 4px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading {
        display: flex;
        margin-bottom: 3px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
        display: block;
        font-size: 10px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-eyebrow {
        display: none;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
        --tarot-kingdom-enemy-scale: 1.38;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
        min-height: 102px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: 35px minmax(0, 1fr);
        min-height: 49px;
        gap: 2px 3px;
        padding: 2px 3px 2px 2px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        width: 34px;
        height: 42px;
        --avatar-combat-scale: 0.55;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-status {
        display: none;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats {
        overflow: hidden;
        line-height: 1.05;
        text-overflow: clip;
        white-space: nowrap;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-center {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-turn {
        display: flex;
        min-width: 0;
        padding: 6px;
        font-size: 8px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-feed {
        min-height: 42px;
        padding: 4px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-event {
        min-height: 25px;
        padding: 5px 6px;
        font-size: 9px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel {
        padding: 5px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel--hand {
        padding-right: 1px;
        padding-left: 1px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel--hand .tarot-kingdom-panel-title,
    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel--hand .tarot-kingdom-selected-effect {
        margin-right: 4px;
        margin-left: 4px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel-title {
        min-height: 24px;
        margin-bottom: 3px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-hand-actions {
        gap: 3px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-clear-inline,
    #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-play-inline {
        min-height: 28px;
        padding: 3px 5px;
        font-size: 9px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup.tarot-kingdom-action-popup {
        width: calc(100vw - 8px);
        max-width: calc(100vw - 8px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 4px);
        padding: 20px 5px 5px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup.tarot-kingdom-action-popup {
        bottom: calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 4px);
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup .tarot-betting-actions {
        gap: 3px;
    }

    #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomActionPopup .tarot-betting-actions > button {
        min-height: 48px;
        font-size: 11px;
    }
}

@keyframes tarotKingdomDefeatNormal {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    18% { opacity: 1; transform: translate3d(-2px, -1px, 0) scale(1.02) rotate(-1deg); filter: brightness(1.03); }
    52% { opacity: 0.96; transform: translate3d(6px, -4px, 0) scale(0.98) rotate(3deg); filter: brightness(0.98) saturate(1.04); }
    100% { opacity: 0; transform: translate3d(24px, -14px, 0) scale(0.86) rotate(9deg); filter: blur(0.8px) brightness(0.9); }
}

@keyframes tarotKingdomDefeatMarker {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.44); }
    22% { opacity: 1; transform: translate(-50%, -54%) scale(1.08); }
    58% { opacity: 1; transform: translate(-50%, -62%) scale(1.18); }
    100% { opacity: 0; transform: translate(-50%, -74%) scale(1.1); }
}

@keyframes tarotKingdomDefeatSlash {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    18% { opacity: 1; transform: translate3d(0, 0, 0) scale(0.996) rotate(0deg); filter: brightness(1.04); }
    28% { opacity: 0; transform: translate3d(0, 0, 0) scale(0.988) rotate(0deg); filter: saturate(1.08); }
    100% { opacity: 0; transform: translate3d(0, 0, 0) scale(0.985) rotate(0deg); filter: none; }
}

@keyframes tarotKingdomDefeatSlashMarker {
    0% {
        opacity: 0;
        transform: translate(-10%, -126%) scale(0.74) rotate(16deg);
    }
    12% {
        opacity: 1;
        transform: translate(-8%, -94%) scale(0.82) rotate(24deg);
    }
    34% {
        opacity: 1;
        transform: translate(-4%, -36%) scale(0.96) rotate(38deg);
    }
    58% {
        opacity: 1;
        transform: translate(0%, 8%) scale(1.01) rotate(56deg);
    }
    100% {
        opacity: 0;
        transform: translate(2%, 44%) scale(0.95) rotate(64deg);
    }
}

@keyframes tarotKingdomDefeatRock {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: none; }
    14% { opacity: 1; transform: translate3d(0, -2px, 0) scale(1.01); filter: none; }
    36% { opacity: 1; transform: translate3d(0, 10px, 0) scale(0.96, 0.82); filter: brightness(0.7) saturate(0.76); }
    62% { opacity: 0.96; transform: translate3d(0, 22px, 0) scale(0.82, 0.54); filter: brightness(0.48) saturate(0.56); }
    100% { opacity: 0; transform: translate3d(0, 42px, 0) scale(0.6, 0.28); filter: brightness(0.34) saturate(0.4); }
}

@keyframes tarotKingdomDefeatRockMarker {
    0% { opacity: 0; transform: translate(-50%, -186%) scale(0.48); }
    42% { opacity: 1; transform: translate(-50%, -86%) scale(0.94); }
    56% { opacity: 1; transform: translate(-50%, -40%) scale(1.08); }
    72% { opacity: 1; transform: translate(-50%, -24%) scale(0.92); }
    100% { opacity: 0; transform: translate(-50%, -12%) scale(0.78); }
}

@keyframes tarotKingdomDefeatWater {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    14% { opacity: 1; transform: translate3d(0, 0, 0) scale(1.01) rotate(0deg); filter: brightness(1.08) saturate(1.18); }
    34% { opacity: 1; transform: translate3d(0, 2px, 0) scale(0.96, 0.98) rotate(-1deg); filter: brightness(1.02) saturate(1.36) blur(0.2px); }
    58% { opacity: 0.96; transform: translate3d(0, 10px, 0) scale(0.88, 0.92) rotate(-2deg); filter: blur(1.2px) saturate(1.32); }
    100% { opacity: 0; transform: translate3d(0, 26px, 0) scale(0.68, 0.76) rotate(-4deg); filter: blur(3.4px) saturate(1.26); }
}

@keyframes tarotKingdomDefeatWaterMarker {
    0% { opacity: 0; transform: translate(-50%, -148%) scale(0.4, 0.7); }
    18% { opacity: 1; transform: translate(-50%, -92%) scale(0.82, 0.92); }
    34% { opacity: 1; transform: translate(-50%, -52%) scale(1.36, 0.78); }
    52% { opacity: 1; transform: translate(-50%, -36%) scale(1.56, 0.68); }
    100% { opacity: 0; transform: translate(-50%, -14%) scale(1.2, 0.54); }
}

@keyframes tarotKingdomDefeatFire {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: none; }
    18% { opacity: 1; transform: translate3d(0, 0, 0) scale(1.02); filter: saturate(1.22) brightness(1.08); }
    40% { opacity: 1; transform: translate3d(0, -6px, 0) scale(0.96); filter: saturate(1.56) brightness(1.04); }
    70% { opacity: 0.94; transform: translate3d(0, -12px, 0) scale(0.84); filter: saturate(0.8) brightness(0.34) contrast(1.2) sepia(0.7); }
    100% { opacity: 0; transform: translate3d(0, -20px, 0) scale(0.72); filter: blur(0.5px) saturate(0.36) brightness(0.16) contrast(1.24) sepia(0.84); }
}

@keyframes tarotKingdomTrickShakeNormal {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

@keyframes tarotKingdomTrickShakeSpecial {
    0% { transform: translateX(0) translateY(0); }
    20% { transform: translateX(-6px) translateY(1px); }
    40% { transform: translateX(6px) translateY(-1px); }
    60% { transform: translateX(-4px) translateY(1px); }
    80% { transform: translateX(4px) translateY(-1px); }
    100% { transform: translateX(0) translateY(0); }
}

@keyframes tarotKingdomTrickShakeHeavy {
    0% { transform: translateX(0) translateY(0) scale(1); }
    16% { transform: translateX(-9px) translateY(2px) scale(0.998); }
    33% { transform: translateX(9px) translateY(-2px) scale(1.002); }
    50% { transform: translateX(-7px) translateY(2px) scale(0.999); }
    66% { transform: translateX(7px) translateY(-1px) scale(1.001); }
    83% { transform: translateX(-4px) translateY(1px) scale(1); }
    100% { transform: translateX(0) translateY(0) scale(1); }
}

@keyframes tarotKingdomTrickShakeUltra {
    0% { transform: translateX(0) translateY(0) scale(1); }
    12% { transform: translateX(-12px) translateY(2px) scale(0.996); }
    24% { transform: translateX(12px) translateY(-2px) scale(1.004); }
    36% { transform: translateX(-10px) translateY(2px) scale(0.997); }
    48% { transform: translateX(10px) translateY(-2px) scale(1.003); }
    60% { transform: translateX(-8px) translateY(1px) scale(0.998); }
    72% { transform: translateX(8px) translateY(-1px) scale(1.002); }
    84% { transform: translateX(-4px) translateY(1px) scale(1); }
    100% { transform: translateX(0) translateY(0) scale(1); }
}

@keyframes tarotKingdomTrickWinPop {
    0% { opacity: 0; transform: translateY(6px) scale(0.92); }
    44% { opacity: 1; transform: translateY(-3px) scale(1.08); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tarotKingdomDefeatFireMarker {
    0% { opacity: 0; transform: translate(-50%, -34%) scale(0.52) rotate(-8deg); }
    22% { opacity: 1; transform: translate(-50%, -56%) scale(1.08) rotate(4deg); }
    48% { opacity: 1; transform: translate(calc(-50% + 2px), -78%) scale(1.18) rotate(-3deg); }
    72% { opacity: 0.86; transform: translate(calc(-50% - 3px), -94%) scale(1.02) rotate(2deg); }
    100% { opacity: 0; transform: translate(-50%, -112%) scale(0.88) rotate(-6deg); }
}

@keyframes tarotKingdomDefeatArcana {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    18% { opacity: 1; transform: translate3d(0, -2px, 0) scale(1.02) rotate(0deg); filter: saturate(1.08) brightness(1.02); }
    46% { opacity: 0.98; transform: translate3d(0, -8px, 0) scale(0.97) rotate(-1deg); filter: saturate(1.12) brightness(0.98); }
    100% { opacity: 0; transform: translate3d(0, -22px, 0) scale(0.84) rotate(2deg); filter: blur(1.1px) saturate(0.92) brightness(0.9); }
}

@keyframes tarotKingdomDefeatArcanaMarker {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.56); }
    18% { opacity: 1; transform: translate(-50%, -56%) scale(1.04); }
    48% { opacity: 1; transform: translate(-50%, -64%) scale(1.14); }
    72% { opacity: 0.94; transform: translate(-50%, -72%) scale(1.08); }
    100% { opacity: 0; transform: translate(-50%, -86%) scale(1.18); }
}

@keyframes tarotKingdomDefeatArcanaOrbit {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    28% { opacity: 1; transform: translate3d(8px, -4px, 0) scale(1) rotate(10deg); filter: saturate(1.08); }
    62% { opacity: 0.96; transform: translate3d(-10px, -16px, 0) scale(0.9) rotate(-22deg); filter: brightness(1.04) blur(0.8px); }
    100% { opacity: 0; transform: translate3d(12px, -30px, 0) scale(0.74) rotate(30deg); filter: brightness(0.92) blur(1.8px); }
}

@keyframes tarotKingdomDefeatArcanaFloat {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: none; }
    24% { opacity: 1; transform: translate3d(0, -4px, 0) scale(1.02); filter: brightness(1.06); }
    60% { opacity: 0.96; transform: translate3d(0, -22px, 0) scale(0.88); filter: blur(1px) saturate(1.1); }
    100% { opacity: 0; transform: translate3d(0, -40px, 0) scale(0.68); filter: blur(2px) brightness(0.9); }
}

@keyframes tarotKingdomDefeatArcanaSlam {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: none; }
    18% { opacity: 1; transform: translate3d(0, -4px, 0) scale(1.02); filter: none; }
    42% { opacity: 1; transform: translate3d(0, 12px, 0) scale(0.94, 0.82); filter: brightness(0.8) saturate(0.88); }
    100% { opacity: 0; transform: translate3d(0, 28px, 0) scale(0.68, 0.5); filter: brightness(0.54) saturate(0.7); }
}

@keyframes tarotKingdomDefeatArcanaBurst {
    0% { opacity: 1; transform: scale(1); filter: none; }
    24% { opacity: 1; transform: scale(0.92); filter: saturate(1.12) brightness(1.04); }
    48% { opacity: 0.98; transform: scale(1.08); filter: saturate(1.26) brightness(1.08); }
    100% { opacity: 0; transform: scale(1.34); filter: blur(2px) brightness(1.02); }
}

@keyframes tarotKingdomDefeatArcanaRush {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    22% { opacity: 1; transform: translate3d(12px, 0, 0) scale(1.02) rotate(3deg); filter: none; }
    56% { opacity: 0.96; transform: translate3d(-28px, 0, 0) scale(0.9) rotate(-10deg); filter: saturate(1.08); }
    100% { opacity: 0; transform: translate3d(40px, 0, 0) scale(0.72) rotate(14deg); filter: blur(1.6px); }
}

@keyframes tarotKingdomDefeatArcanaTrickster {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    18% { opacity: 1; transform: translate3d(-8px, -2px, 0) scale(1.02) rotate(-4deg); }
    36% { opacity: 0.86; transform: translate3d(10px, 2px, 0) scale(0.98) rotate(5deg); }
    54% { opacity: 1; transform: translate3d(-12px, -6px, 0) scale(0.92) rotate(-7deg); filter: blur(0.6px); }
    100% { opacity: 0; transform: translate3d(18px, -18px, 0) scale(0.7) rotate(10deg); filter: blur(2px); }
}

@keyframes tarotKingdomDefeatArcanaThrone {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: none; }
    26% { opacity: 1; transform: translate3d(0, -3px, 0) scale(1.04); filter: brightness(1.06); }
    60% { opacity: 0.98; transform: translate3d(0, -14px, 0) scale(0.9); filter: brightness(0.98) contrast(1.08); }
    100% { opacity: 0; transform: translate3d(0, -26px, 0) scale(0.66); filter: brightness(0.82) blur(1.4px); }
}

@keyframes tarotKingdomDefeatArcanaEdict {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    18% { opacity: 1; transform: translate3d(0, 4px, 0) scale(0.98) rotate(-1deg); filter: brightness(0.92); }
    42% { opacity: 1; transform: translate3d(0, -2px, 0) scale(1.01) rotate(1deg); filter: brightness(1.04); }
    100% { opacity: 0; transform: translate3d(0, -20px, 0) scale(0.72) rotate(-3deg); filter: blur(1.5px); }
}

@keyframes tarotKingdomDefeatArcanaSanctum {
    0% { opacity: 1; transform: scale(1); filter: none; }
    30% { opacity: 1; transform: scale(0.95); filter: brightness(1.02); }
    66% { opacity: 0.96; transform: scale(0.78); filter: brightness(0.92) saturate(0.94); }
    100% { opacity: 0; transform: scale(0.54); filter: blur(1.7px) brightness(0.82); }
}

@keyframes tarotKingdomDefeatArcanaHalo {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: none; }
    26% { opacity: 1; transform: translate3d(0, -8px, 0) scale(1.04); filter: brightness(1.1); }
    62% { opacity: 0.96; transform: translate3d(0, -20px, 0) scale(0.9); filter: brightness(1.02) blur(0.8px); }
    100% { opacity: 0; transform: translate3d(0, -36px, 0) scale(0.72); filter: blur(1.8px) brightness(0.94); }
}

@keyframes tarotKingdomDefeatArcanaVerdict {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: none; }
    22% { opacity: 1; transform: translate3d(0, 4px, 0) scale(0.98); filter: brightness(0.9); }
    48% { opacity: 1; transform: translate3d(0, 14px, 0) scale(0.88); filter: brightness(0.76); }
    100% { opacity: 0; transform: translate3d(0, 24px, 0) scale(0.64); filter: blur(1.2px) brightness(0.6); }
}

@keyframes tarotKingdomDefeatArcanaRift {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1, 1); filter: none; }
    26% { opacity: 1; transform: translate3d(-6px, 0, 0) scale(1.04, 0.98); }
    48% { opacity: 0.98; transform: translate3d(8px, 0, 0) scale(0.94, 1.02); filter: brightness(1.04); }
    100% { opacity: 0; transform: translate3d(-18px, 0, 0) scale(0.58, 0.94); filter: blur(2.2px) brightness(0.84); }
}

@keyframes tarotKingdomDefeatArcanaWorld {
    0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: none; }
    24% { opacity: 1; transform: translate3d(0, -4px, 0) scale(1.04) rotate(8deg); filter: saturate(1.08); }
    58% { opacity: 0.98; transform: translate3d(0, -14px, 0) scale(0.9) rotate(-12deg); filter: brightness(1.04) blur(0.8px); }
    100% { opacity: 0; transform: translate3d(0, -32px, 0) scale(0.64) rotate(22deg); filter: blur(1.8px) brightness(0.92); }
}


.tarot-kingdom-arcana-hero {
    position: fixed;
    z-index: 3662;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    font-size: 42px;
    line-height: 1;
    transform: translate(-50%, -50%) scale(0.78) rotate(0deg);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.34)) drop-shadow(0 0 16px rgba(59, 130, 246, 0.28));
    will-change: transform, opacity, filter;
}

.tarot-kingdom-arcana-hero.run {
    animation-duration: var(--fx-dur, 720ms);
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.22, 0.78, 0.24, 1);
}

.tarot-kingdom-arcana-hero.is-orbit.run { animation-name: tarotKingdomArcanaHeroOrbit; }
.tarot-kingdom-arcana-hero.is-float.run { animation-name: tarotKingdomArcanaHeroFloat; }
.tarot-kingdom-arcana-hero.is-slam.run { animation-name: tarotKingdomArcanaHeroSlam; }
.tarot-kingdom-arcana-hero.is-burst.run { animation-name: tarotKingdomArcanaHeroBurst; }
.tarot-kingdom-arcana-hero.is-rush.run { animation-name: tarotKingdomArcanaHeroRush; }
.tarot-kingdom-arcana-hero.is-trickster.run { animation-name: tarotKingdomArcanaHeroTrickster; }
.tarot-kingdom-arcana-hero.is-throne.run { animation-name: tarotKingdomArcanaHeroThrone; }
.tarot-kingdom-arcana-hero.is-edict.run { animation-name: tarotKingdomArcanaHeroEdict; }
.tarot-kingdom-arcana-hero.is-sanctum.run { animation-name: tarotKingdomArcanaHeroSanctum; }
.tarot-kingdom-arcana-hero.is-halo.run { animation-name: tarotKingdomArcanaHeroHalo; }
.tarot-kingdom-arcana-hero.is-verdict.run { animation-name: tarotKingdomArcanaHeroVerdict; }
.tarot-kingdom-arcana-hero.is-rift.run { animation-name: tarotKingdomArcanaHeroRift; }
.tarot-kingdom-arcana-hero.is-world.run { animation-name: tarotKingdomArcanaHeroWorld; }

.tarot-kingdom-arcana-hero.is-arcana-0 { font-size: 48px; filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.48)); }
.tarot-kingdom-arcana-hero.is-arcana-1 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(167, 139, 250, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-2 { font-size: 48px; filter: drop-shadow(0 0 16px rgba(59, 130, 246, 0.42)); }
.tarot-kingdom-arcana-hero.is-arcana-3 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(244, 114, 182, 0.42)); }
.tarot-kingdom-arcana-hero.is-arcana-4 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-5 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-6 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(244, 63, 94, 0.42)); }
.tarot-kingdom-arcana-hero.is-arcana-7 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(147, 197, 253, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-8 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-9 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(34, 197, 94, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-10 { font-size: 52px; filter: drop-shadow(0 0 18px rgba(96, 165, 250, 0.46)); }
.tarot-kingdom-arcana-hero.is-arcana-11 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.46)); }
.tarot-kingdom-arcana-hero.is-arcana-12 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(251, 146, 60, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-13 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.50)); }
.tarot-kingdom-arcana-hero.is-arcana-14 { font-size: 50px; filter: drop-shadow(0 0 16px rgba(45, 212, 191, 0.44)); }
.tarot-kingdom-arcana-hero.is-arcana-15 { font-size: 50px; filter: drop-shadow(0 0 18px rgba(217, 70, 239, 0.48)); }
.tarot-kingdom-arcana-hero.is-arcana-16 { font-size: 50px; filter: drop-shadow(0 0 18px rgba(56, 189, 248, 0.48)); }
.tarot-kingdom-arcana-hero.is-arcana-17 { font-size: 50px; filter: drop-shadow(0 0 18px rgba(59, 130, 246, 0.46)); }
.tarot-kingdom-arcana-hero.is-arcana-18 { font-size: 50px; filter: drop-shadow(0 0 18px rgba(14, 165, 233, 0.46)); }
.tarot-kingdom-arcana-hero.is-arcana-19 { font-size: 50px; filter: drop-shadow(0 0 18px rgba(250, 204, 21, 0.52)); }
.tarot-kingdom-arcana-hero.is-arcana-20 { font-size: 50px; filter: drop-shadow(0 0 18px rgba(167, 139, 250, 0.48)); }
.tarot-kingdom-arcana-hero.is-arcana-21 { font-size: 54px; filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.54)); }

@keyframes tarotKingdomArcanaHeroOrbit {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.66) rotate(-32deg); }
    24% { opacity: 1; transform: translate(calc(-50% - 12px), calc(-50% - 18px)) scale(1.06) rotate(8deg); }
    56% { opacity: 1; transform: translate(calc(-50% + 14px), calc(-50% + 8px)) scale(0.98) rotate(32deg); }
    100% { opacity: 0; transform: translate(calc(-50% - 4px), calc(-50% - 12px)) scale(1.18) rotate(60deg); }
}

@keyframes tarotKingdomArcanaHeroFloat {
    0% { opacity: 0; transform: translate(-50%, calc(-50% + 16px)) scale(0.72); }
    28% { opacity: 1; transform: translate(-50%, calc(-50% - 10px)) scale(1.06); }
    60% { opacity: 1; transform: translate(calc(-50% + 6px), calc(-50% - 20px)) scale(1.02); }
    100% { opacity: 0; transform: translate(calc(-50% - 6px), calc(-50% - 32px)) scale(1.16); }
}

@keyframes tarotKingdomArcanaHeroSlam {
    0% { opacity: 0; transform: translate(-50%, calc(-50% - 42px)) scale(0.7); }
    52% { opacity: 1; transform: translate(-50%, calc(-50% + 2px)) scale(1.18); }
    72% { opacity: 1; transform: translate(-50%, calc(-50% - 4px)) scale(1.04); }
    100% { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(0.9); }
}

@keyframes tarotKingdomArcanaHeroBurst {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.58) rotate(-20deg); }
    26% { opacity: 1; transform: translate(-50%, -50%) scale(1.26) rotate(8deg); }
    60% { opacity: 1; transform: translate(calc(-50% + 4px), calc(-50% - 4px)) scale(1.04) rotate(-6deg); }
    100% { opacity: 0; transform: translate(calc(-50% + 12px), calc(-50% - 12px)) scale(1.22) rotate(18deg); }
}

@keyframes tarotKingdomArcanaHeroRush {
    0% { opacity: 0; transform: translate(calc(-50% + 26px), calc(-50% + 2px)) scale(0.74); }
    30% { opacity: 1; transform: translate(calc(-50% - 8px), calc(-50% - 2px)) scale(1.14); }
    62% { opacity: 1; transform: translate(calc(-50% + 8px), calc(-50% + 4px)) scale(1.02); }
    100% { opacity: 0; transform: translate(calc(-50% - 18px), calc(-50% - 8px)) scale(1.12); }
}

@keyframes tarotKingdomArcanaHeroTrickster {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.68) rotate(-16deg); }
    22% { opacity: 1; transform: translate(calc(-50% - 10px), calc(-50% - 10px)) scale(1.04) rotate(14deg); }
    44% { opacity: 1; transform: translate(calc(-50% + 12px), calc(-50% + 4px)) scale(0.98) rotate(-12deg); }
    66% { opacity: 1; transform: translate(calc(-50% - 8px), calc(-50% + 10px)) scale(1.06) rotate(10deg); }
    100% { opacity: 0; transform: translate(calc(-50% + 8px), calc(-50% - 10px)) scale(1.16) rotate(26deg); }
}

@keyframes tarotKingdomArcanaHeroThrone {
    0% { opacity: 0; transform: translate(-50%, calc(-50% - 28px)) scale(0.70); }
    36% { opacity: 1; transform: translate(calc(-50% - 6px), calc(-50% - 8px)) scale(1.20); }
    70% { opacity: 1; transform: translate(calc(-50% + 8px), calc(-50% - 2px)) scale(1.08); }
    100% { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(0.90); }
}

@keyframes tarotKingdomArcanaHeroEdict {
    0% { opacity: 0; transform: translate(-50%, calc(-50% - 36px)) scale(0.66) rotate(-6deg); }
    42% { opacity: 1; transform: translate(-50%, calc(-50% + 2px)) scale(1.18) rotate(2deg); }
    72% { opacity: 1; transform: translate(calc(-50% + 4px), calc(-50% - 6px)) scale(1.04) rotate(-2deg); }
    100% { opacity: 0; transform: translate(calc(-50% - 4px), calc(-50% + 10px)) scale(0.88) rotate(0deg); }
}

@keyframes tarotKingdomArcanaHeroSanctum {
    0% { opacity: 0; transform: translate(calc(-50% + 12px), calc(-50% - 20px)) scale(0.68) rotate(-10deg); }
    34% { opacity: 1; transform: translate(calc(-50% - 8px), calc(-50% - 6px)) scale(1.12) rotate(8deg); }
    68% { opacity: 1; transform: translate(calc(-50% + 6px), calc(-50% + 6px)) scale(1.02) rotate(-6deg); }
    100% { opacity: 0; transform: translate(calc(-50% - 6px), calc(-50% + 16px)) scale(0.90) rotate(4deg); }
}

@keyframes tarotKingdomArcanaHeroHalo {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.62) rotate(-14deg); }
    26% { opacity: 1; transform: translate(calc(-50% - 8px), calc(-50% - 18px)) scale(1.16) rotate(10deg); }
    58% { opacity: 1; transform: translate(calc(-50% + 10px), calc(-50% - 8px)) scale(1.06) rotate(-8deg); }
    100% { opacity: 0; transform: translate(-50%, calc(-50% - 24px)) scale(1.20) rotate(12deg); }
}

@keyframes tarotKingdomArcanaHeroVerdict {
    0% { opacity: 0; transform: translate(calc(-50% + 22px), calc(-50% - 8px)) scale(0.74) rotate(8deg); }
    30% { opacity: 1; transform: translate(calc(-50% - 10px), calc(-50% - 2px)) scale(1.20) rotate(-6deg); }
    64% { opacity: 1; transform: translate(calc(-50% + 12px), calc(-50% + 2px)) scale(1.04) rotate(4deg); }
    100% { opacity: 0; transform: translate(calc(-50% - 20px), calc(-50% + 8px)) scale(1.12) rotate(-2deg); }
}

@keyframes tarotKingdomArcanaHeroRift {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.58) rotate(-20deg); }
    28% { opacity: 1; transform: translate(calc(-50% - 6px), calc(-50% - 6px)) scale(1.26) rotate(12deg); }
    62% { opacity: 1; transform: translate(calc(-50% + 8px), calc(-50% + 6px)) scale(1.04) rotate(-10deg); }
    100% { opacity: 0; transform: translate(calc(-50% + 14px), calc(-50% - 12px)) scale(1.22) rotate(18deg); }
}

@keyframes tarotKingdomArcanaHeroWorld {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.62) rotate(-18deg); }
    24% { opacity: 1; transform: translate(calc(-50% - 16px), calc(-50% - 18px)) scale(1.24) rotate(10deg); }
    52% { opacity: 1; transform: translate(calc(-50% + 18px), calc(-50% + 10px)) scale(1.08) rotate(36deg); }
    78% { opacity: 1; transform: translate(calc(-50% - 8px), calc(-50% + 14px)) scale(1.02) rotate(62deg); }
    100% { opacity: 0; transform: translate(-50%, calc(-50% - 8px)) scale(1.28) rotate(88deg); }
}
.tarot-kingdom-defeat-particle {
    position: fixed;
    z-index: 3660;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.84);
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.42));
    font-size: 24px;
    line-height: 1;
    will-change: transform, opacity, filter;
}

.tarot-kingdom-defeat-particle.run {
    animation-duration: var(--fx-dur, 360ms);
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.22, 0.78, 0.24, 1);
}

.tarot-kingdom-defeat-particle.is-normal.run {
    animation-name: tarotKingdomDefeatParticleNormal;
}

.tarot-kingdom-defeat-particle.is-slash.run {
    animation-name: tarotKingdomDefeatParticleSlash;
}

.tarot-kingdom-defeat-particle.is-slash-spark.run {
    animation-name: tarotKingdomDefeatParticleSpark;
}

.tarot-kingdom-defeat-particle.is-rock-main.run {
    animation-name: tarotKingdomDefeatParticleRockMain;
}

.tarot-kingdom-defeat-particle.is-rock-ground.run {
    animation-name: tarotKingdomDefeatParticleRockGround;
}

.tarot-kingdom-defeat-particle.is-rock-hit.run {
    animation-name: tarotKingdomDefeatParticleRockHit;
}

.tarot-kingdom-defeat-particle.is-water-main.run {
    animation-name: tarotKingdomDefeatParticleWaterMain;
}

.tarot-kingdom-defeat-particle.is-water-drop-a.run,
.tarot-kingdom-defeat-particle.is-water-drop-b.run,
.tarot-kingdom-defeat-particle.is-water-drop-c.run {
    animation-name: tarotKingdomDefeatParticleWaterDrop;
}

.tarot-kingdom-defeat-particle.is-fire-a.run,
.tarot-kingdom-defeat-particle.is-fire-b.run,
.tarot-kingdom-defeat-particle.is-fire-c.run {
    animation-name: tarotKingdomDefeatParticleFire;
}

.tarot-kingdom-defeat-particle.is-fire-char.run {
    animation-name: tarotKingdomDefeatParticleFireChar;
}

.tarot-kingdom-defeat-particle.is-water-main {
    font-size: 28px;
}

.tarot-kingdom-defeat-particle.is-slash-spark {
    font-size: 18px;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.75);
}

.tarot-kingdom-defeat-particle.is-water-drop-a,
.tarot-kingdom-defeat-particle.is-water-drop-b,
.tarot-kingdom-defeat-particle.is-water-drop-c {
    font-size: 16px;
}

.tarot-kingdom-defeat-particle.is-rock-ground {
    font-size: 20px;
    filter: drop-shadow(0 0 4px rgba(120, 53, 15, 0.3)) drop-shadow(0 0 8px rgba(250, 204, 21, 0.42));
}

.tarot-kingdom-defeat-particle.is-rock-main {
    font-size: 28px;
    filter: drop-shadow(0 0 4px rgba(120, 53, 15, 0.32)) drop-shadow(0 0 8px rgba(250, 204, 21, 0.48));
}

.tarot-kingdom-defeat-particle.is-fire-char {
    font-size: 15px;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.52));
}

.tarot-kingdom-slash-fragment {
    position: fixed;
    z-index: 3663;
    pointer-events: none;
    margin: 0 !important;
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    transform-origin: 50% 50%;
    will-change: transform, opacity, filter;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.38));
}

.tarot-kingdom-slash-fragment.run {
    animation-duration: var(--fx-dur, 520ms);
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.2, 0.82, 0.24, 1);
}

.tarot-kingdom-slash-fragment.is-left.run {
    animation-name: tarotKingdomSlashFragmentLeft;
}

.tarot-kingdom-slash-fragment.is-right.run {
    animation-name: tarotKingdomSlashFragmentRight;
}

@keyframes tarotKingdomDefeatParticleNormal {
    0% { opacity: 0; transform: translate(-50%, -54%) scale(0.7); }
    38% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
    100% { opacity: 0; transform: translate(-50%, -66%) scale(1.16); }
}

@keyframes tarotKingdomDefeatParticleSlash {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(-196deg) scale(0.72); }
    34% { opacity: 1; transform: translate(calc(-50% - 8px), calc(-50% - 22px)) rotate(-138deg) scale(1.06); }
    72% { opacity: 1; transform: translate(calc(-50% - 22px), calc(-50% + 2px)) rotate(-78deg) scale(1.08); }
    100% { opacity: 0; transform: translate(calc(-50% - 30px), calc(-50% + 14px)) rotate(-46deg) scale(0.94); }
}

@keyframes tarotKingdomDefeatParticleSpark {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(0deg); }
    42% { opacity: 1; transform: translate(calc(-50% - 10px), calc(-50% + 4px)) scale(1.12) rotate(-16deg); }
    100% { opacity: 0; transform: translate(calc(-50% - 20px), calc(-50% + 14px)) scale(0.9) rotate(-36deg); }
}

@keyframes tarotKingdomDefeatParticleRockMain {
    0% { opacity: 0; transform: translate(-50%, -220%) scale(0.44) rotate(-110deg); }
    38% { opacity: 1; transform: translate(-50%, -92%) scale(0.88) rotate(-22deg); }
    64% { opacity: 1; transform: translate(-50%, -18%) scale(1.04) rotate(10deg); }
    78% { opacity: 1; transform: translate(-50%, -10%) scale(0.92) rotate(38deg); }
    100% { opacity: 0; transform: translate(-50%, 6%) scale(0.72) rotate(82deg); }
}

@keyframes tarotKingdomDefeatParticleRockGround {
    0% { opacity: 0; transform: translate(-50%, -90%) scale(0.52) rotate(0deg); }
    24% { opacity: 0.9; transform: translate(calc(-50% + 10px), calc(-50% - 34px)) scale(0.82) rotate(42deg); }
    58% { opacity: 1; transform: translate(calc(-50% + 24px), calc(-50% - 2px)) scale(0.98) rotate(110deg); }
    100% { opacity: 0; transform: translate(calc(-50% + 36px), calc(-50% + 10px)) scale(0.72) rotate(182deg); }
}

@keyframes tarotKingdomDefeatParticleRockHit {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.42); }
    30% { opacity: 1; transform: translate(-50%, -56%) scale(1.12); }
    100% { opacity: 0; transform: translate(-50%, -74%) scale(1.24); }
}

@keyframes tarotKingdomDefeatParticleWaterMain {
    0% { opacity: 0; transform: translate(-50%, -154%) scale(0.46); }
    28% { opacity: 1; transform: translate(-50%, -82%) scale(0.82); }
    44% { opacity: 1; transform: translate(-50%, -42%) scale(1.34, 0.72); }
    100% { opacity: 0; transform: translate(-50%, -18%) scale(1.48, 0.6); }
}

@keyframes tarotKingdomDefeatParticleWaterDrop {
    0% { opacity: 0; transform: translate(-50%, -70%) scale(0.56); }
    24% { opacity: 1; transform: translate(-50%, -62%) scale(0.96); }
    74% { opacity: 1; transform: translate(-50%, 4%) scale(0.86); }
    100% { opacity: 0; transform: translate(-50%, 22%) scale(0.72); }
}

@keyframes tarotKingdomDefeatParticleFire {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.72); filter: brightness(1.08); }
    24% { opacity: 1; transform: translate(calc(-50% - 3px), calc(-50% - 10px)) scale(1.08); filter: brightness(1.22); }
    52% { opacity: 1; transform: translate(calc(-50% + 4px), calc(-50% - 22px)) scale(1.14); filter: brightness(1.26); }
    100% { opacity: 0; transform: translate(calc(-50% - 2px), calc(-50% - 34px)) scale(0.84); filter: brightness(0.88); }
}

@keyframes tarotKingdomDefeatParticleFireChar {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.54); filter: brightness(0.42); }
    34% { opacity: 0; transform: translate(-50%, -50%) scale(0.72); filter: brightness(0.32); }
    56% { opacity: 0.92; transform: translate(-50%, -46%) scale(0.98); filter: brightness(0.2); }
    84% { opacity: 0.74; transform: translate(calc(-50% + 1px), calc(-50% - 2px)) scale(0.92); filter: brightness(0.12); }
    100% { opacity: 0; transform: translate(calc(-50% + 2px), calc(-50% + 4px)) scale(0.82); filter: brightness(0.08); }
}

@keyframes tarotKingdomSlashFragmentLeft {
    0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); filter: brightness(1.06); }
    12% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); filter: brightness(1.12); }
    44% { opacity: 1; transform: translate3d(-6px, -2px, 0) rotate(-4deg) scale(1.01); filter: brightness(1.02); }
    100% { opacity: 0; transform: translate3d(-24px, -6px, 0) rotate(-9deg) scale(0.96); filter: brightness(0.94); }
}

@keyframes tarotKingdomSlashFragmentRight {
    0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); filter: brightness(1.02); }
    12% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); filter: brightness(1.08); }
    44% { opacity: 1; transform: translate3d(6px, 2px, 0) rotate(4deg) scale(1.01); filter: brightness(0.98); }
    100% { opacity: 0; transform: translate3d(24px, 6px, 0) rotate(9deg) scale(0.96); filter: brightness(0.9); }
}

.tarot-card.is-chariot-splitting {
    opacity: 0.34 !important;
    filter: brightness(1.2) saturate(1.15);
}

.tarot-kingdom-split-card {
    position: fixed;
    z-index: 3950;
    pointer-events: none;
    margin: 0;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.48),
        0 0 18px rgba(148, 163, 184, 0.34),
        0 0 24px rgba(56, 189, 248, 0.24);
    will-change: transform, opacity, filter;
}

.tarot-kingdom-split-card.run.is-left {
    animation: tarotKingdomChariotSplitLeft 620ms cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.tarot-kingdom-split-card.run.is-right {
    animation: tarotKingdomChariotSplitRight 620ms cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.tarot-card.is-undealt {
    opacity: 0 !important;
    transform: scale(0.96);
    pointer-events: none;
}

.tarot-card-title {
    position: absolute;
    left: 4px;
    right: 4px;
    top: 3px;
    z-index: 2;
    font-size: var(--tarot-card-title-size, 11px);
    font-weight: 700;
    opacity: 0.94;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    -webkit-text-stroke: 1px #000;
    paint-order: stroke fill;
    text-align: center;
}

.tarot-card-number {
    position: absolute;
    left: 5px;
    bottom: 3px;
    z-index: 2;
    font-size: var(--tarot-card-number-size, 24px);
    line-height: 1;
    font-weight: 900;
    text-shadow:
        -1px -1px 0 #000,
        -1px 1px 0 #000,
        1px -1px 0 #000,
        1px 1px 0 #000,
        0 1px 0 rgba(0, 0, 0, 0.45);
    -webkit-text-stroke: 1.6px #000;
    paint-order: stroke fill;
}

.tarot-card-number.is-center-range {
    left: 50%;
    right: auto;
    bottom: 4px;
    width: max-content;
    max-width: calc(100% - 8px);
    text-align: center;
    transform: translateX(-50%);
    font-size: calc(var(--tarot-card-number-size, 24px) - 2px);
    letter-spacing: -0.04em;
}

/* Reuse the existing pot-roll motion for card number value shifts. */
.tarot-card-number.is-rolling {
    animation: tarotPotRoll 0.11s linear 4;
    transform-origin: 50% 58%;
}

.tarot-card:not(.is-arcana).wand .tarot-card-number {
    color: #fecaca;
}

.tarot-card:not(.is-arcana).sword .tarot-card-number {
    color: #fde047;
}

.tarot-card:not(.is-arcana).cup .tarot-card-number {
    color: #bfdbfe;
}

.tarot-card:not(.is-arcana).pentacle .tarot-card-number {
    color: #bbf7d0;
}

.tarot-card:not(.is-arcana).all-suit .tarot-card-number {
    color: #f8fafc;
}

.tarot-card:not(.is-arcana).none .tarot-card-number {
    color: #e5e7eb;
}

.tarot-card-art {
    position: absolute;
    left: 50%;
    right: auto;
    top: 50%;
    width: var(--tarot-art-w, 48px);
    height: var(--tarot-art-h, 80px);
    margin-left: 0;
    margin-right: 0;
    transform: translate(-50%, -50%);
    transform-origin: top center;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    image-rendering: pixelated;
    background-image: var(--tarot-sprite-src);
    background-repeat: no-repeat;
    background-size: var(--tarot-sheet-w, 512px) var(--tarot-sheet-h, 1024px);
    background-position: calc(var(--tarot-x, 0px) * -1) calc(var(--tarot-y, 0px) * -1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.tarot-card.is-arcana {
    background:
        radial-gradient(circle at 16% 14%, rgba(255, 255, 255, 0.82) 0 16%, rgba(255, 255, 255, 0) 42%),
        linear-gradient(165deg, #f8fafc 0%, #eef2ff 48%, #e2e8f0 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.94);
    box-shadow:
        0 0 0 1px rgba(239, 246, 255, 0.7),
        0 0 18px rgba(125, 211, 252, 0.32),
        0 0 26px rgba(250, 204, 21, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
    animation: tarotArcanaAura 2.9s ease-in-out infinite;
}

.tarot-card.is-arcana::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    z-index: 1;
    pointer-events: none;
    background:
        conic-gradient(
            from 0deg,
            rgba(56, 189, 248, 0.24),
            rgba(250, 204, 21, 0.2),
            rgba(167, 139, 250, 0.2),
            rgba(56, 189, 248, 0.24)
        );
    mix-blend-mode: screen;
    filter: saturate(1.1);
    opacity: 0.34;
    animation: tarotArcanaHaloSpin 7.8s linear infinite, tarotArcanaHaloBreath 2.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .tarot-card.is-arcana::before {
        animation: none;
    }
}

.tarot-card.is-arcana .tarot-card-title,
.tarot-card.is-arcana .tarot-card-number {
    color: #ffffff;
}

.tarot-card.is-arcana .tarot-card-number {
    will-change: filter;
    animation: tarotArcanaSparkle 2.4s ease-in-out infinite;
}

.tarot-card.is-arcana.arcana-all-corners {
    background:
        radial-gradient(circle at 10% 10%, rgba(220, 38, 38, 0.95) 0 7px, transparent 8px),
        radial-gradient(circle at 90% 10%, rgba(250, 204, 21, 0.95) 0 7px, transparent 8px),
        radial-gradient(circle at 10% 90%, rgba(59, 130, 246, 0.95) 0 7px, transparent 8px),
        radial-gradient(circle at 90% 90%, rgba(34, 197, 94, 0.95) 0 7px, transparent 8px),
        linear-gradient(180deg, #f8fafc, #e5e7eb);
}

.tarot-card.is-arcana.arcana-suit-hybrid {
    background:
        linear-gradient(
            135deg,
            rgba(248, 250, 252, 0.98) 0 52%,
            var(--arcana-color, #b11818) 52% 100%
        ),
        linear-gradient(180deg, #f8fafc, #e5e7eb);
}

.tarot-card.is-arcana.arcana-suit-hybrid .tarot-card-title {
    color: #f8fafc;
}

.tarot-card.is-arcana.arcana-suit-hybrid .tarot-card-number {
    color: var(--arcana-number-color, #f8fafc);
    text-shadow: 0 0 8px rgba(2, 6, 23, 0.36);
}

.tarot-card.is-arcana.arcana-suit-hybrid.arcana-suit-wand {
    --arcana-number-color: #fecaca;
}

.tarot-card.is-arcana.arcana-suit-hybrid.arcana-suit-sword {
    --arcana-number-color: #fde047;
}

.tarot-card.is-arcana.arcana-suit-hybrid.arcana-suit-cup {
    --arcana-number-color: #bfdbfe;
}

.tarot-card.is-arcana.arcana-suit-hybrid.arcana-suit-pentacle {
    --arcana-number-color: #bbf7d0;
}

/* Mini tarot cards: reduce white arcana outline so suit color stays visible. */
.tarot-kingdom-hand .tarot-card.is-arcana,
.tarot-kingdom-grave-slot .tarot-card.is-arcana,
.tarot-poker-column--npc-mini .tarot-card.is-arcana {
    border-color: rgba(15, 23, 42, 0.82);
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.5),
        0 0 8px rgba(56, 189, 248, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tarot-kingdom-hand .tarot-card.is-arcana::before,
.tarot-kingdom-grave-slot .tarot-card.is-arcana::before,
.tarot-poker-column--npc-mini .tarot-card.is-arcana::before {
    opacity: 0.14;
    filter: saturate(1.02);
}

.tarot-kingdom-hand .tarot-card.is-arcana.arcana-suit-hybrid,
.tarot-kingdom-grave-slot .tarot-card.is-arcana.arcana-suit-hybrid,
.tarot-poker-column--npc-mini .tarot-card.is-arcana.arcana-suit-hybrid {
    background:
        linear-gradient(
            135deg,
            rgba(248, 250, 252, 0.96) 0 40%,
            var(--arcana-color, #b11818) 40% 100%
        ),
        linear-gradient(180deg, #f8fafc, #e5e7eb);
}

@keyframes tarotArcanaSparkle {
    0%,
    100% {
        filter:
            drop-shadow(0 0 0 rgba(255, 255, 255, 0))
            drop-shadow(0 0 0 rgba(56, 189, 248, 0));
    }
    32% {
        filter:
            drop-shadow(0 0 3px rgba(255, 255, 255, 0.9))
            drop-shadow(0 0 6px rgba(253, 224, 71, 0.75))
            drop-shadow(0 0 9px rgba(56, 189, 248, 0.52));
    }
    58% {
        filter:
            drop-shadow(0 0 1px rgba(255, 255, 255, 0.7))
            drop-shadow(0 0 4px rgba(253, 224, 71, 0.6))
            drop-shadow(0 0 6px rgba(167, 139, 250, 0.4));
    }
}

@keyframes tarotArcanaAura {
    0%,
    100% {
        box-shadow:
            0 0 0 1px rgba(239, 246, 255, 0.7),
            0 0 16px rgba(125, 211, 252, 0.28),
            0 0 24px rgba(250, 204, 21, 0.22),
            inset 0 1px 0 rgba(255, 255, 255, 0.34);
    }
    52% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.82),
            0 0 22px rgba(56, 189, 248, 0.38),
            0 0 32px rgba(250, 204, 21, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.42);
    }
}

@keyframes tarotArcanaHaloSpin {
    from {
        transform: rotate(0deg) scale(1);
    }
    to {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes tarotArcanaHaloBreath {
    0%,
    100% {
        opacity: 0.26;
    }
    50% {
        opacity: 0.46;
    }
}

@keyframes tarotArcanaMatchGlow {
    0%,
    100% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.28),
            0 0 8px rgba(255, 255, 255, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
        filter: brightness(1);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.76),
            0 0 16px rgba(255, 255, 255, 0.82),
            0 0 24px rgba(254, 240, 138, 0.66),
            inset 0 1px 0 rgba(255, 255, 255, 0.28);
        filter: brightness(1.08);
    }
}

.tarot-card-back {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: calc((var(--tarot-card-h, 100px) - 36px) / 2);
    font-size: clamp(18px, calc(var(--tarot-card-w, 64px) * 0.42), 26px);
    font-weight: 900;
    opacity: 0.8;
}

.tarot-grave-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
    min-height: var(--tarot-card-h, 100px);
}

.tarot-grave-card {
    transform: scale(0.88);
    transform-origin: top right;
    margin-left: -2px;
}

.tarot-result-text {
    margin-top: 12px;
    font-weight: 700;
    color: #ffd986;
    min-height: 20px;
}

.tarot-log {
    margin-top: 10px;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.25);
}

/* An empty log (before a Kingdom match starts) would only show a blank frame. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomLog.tarot-log:empty {
    display: none;
}

.tarot-log-row {
    font-size: 12px;
    color: #d1d8e6;
    margin-bottom: 6px;
}

.tarot-log-row:last-child {
    margin-bottom: 0;
}

.tarot-judgment-panel {
    margin-top: 8px;
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: 10px;
    padding: 10px;
    background: rgba(29, 19, 7, 0.72);
}

.tarot-judgment-title {
    font-size: 12px;
    color: #f7d188;
    margin-bottom: 8px;
}

.tarot-judgment-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.tarot-judgment-hint {
    font-size: 12px;
    color: #f7d188;
    line-height: 1.4;
}

.tarot-judgment-options button {
    width: 100%;
}

.tarot-effect-overlay {
    position: fixed;
    inset: 0;
    z-index: 3600;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: radial-gradient(circle, rgba(255, 231, 153, 0.24), rgba(0, 0, 0, 0.78));
    color: #fff;
    font-size: clamp(22px, 5vw, 42px);
    font-weight: 900;
    letter-spacing: 0.1em;
    text-shadow: 0 0 24px rgba(255, 217, 122, 0.8);
}

.tarot-effect-overlay.show {
    opacity: 1;
}

.tarot-effect-overlay.is-kingdom-clear {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.24), rgba(0, 0, 0, 0.78));
}

.tarot-effect-overlay.is-kingdom-draw {
    background: radial-gradient(circle, rgba(52, 211, 153, 0.22), rgba(0, 0, 0, 0.78));
}

.tarot-effect-overlay.is-kingdom-call {
    background:
        radial-gradient(circle at 50% 40%, rgba(96, 165, 250, 0.34), rgba(0, 0, 0, 0.82)),
        conic-gradient(from 0deg at 50% 50%, rgba(59, 130, 246, 0.22), rgba(14, 116, 144, 0.18), rgba(59, 130, 246, 0.22));
}

.tarot-effect-overlay.is-kingdom-call.is-kingdom-call-freeze {
    animation: tarotKingdomCallFreeze 640ms cubic-bezier(0.2, 0.8, 0.22, 1) 1;
}

.tarot-effect-overlay.is-kingdom-roundend {
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 239, 178, 0.34), rgba(0, 0, 0, 0.78)),
        conic-gradient(from 0deg at 50% 50%, rgba(250, 204, 21, 0.24), rgba(245, 158, 11, 0.16), rgba(250, 204, 21, 0.24));
    animation: tarotKingdomRoundEndFlash 740ms ease-out 1;
}

@media (prefers-reduced-motion: reduce) {
    .tarot-effect-overlay.is-kingdom-roundend {
        animation-duration: 240ms;
    }
}

.tarot-effect-overlay.is-kingdom-grandfinal {
    background:
        radial-gradient(circle at 50% 34%, rgba(255, 246, 201, 0.5), rgba(32, 16, 0, 0.86)),
        conic-gradient(from 0deg at 50% 50%, rgba(250, 204, 21, 0.38), rgba(245, 158, 11, 0.28), rgba(217, 119, 6, 0.34), rgba(250, 204, 21, 0.38));
    animation: tarotKingdomGrandFinalFlash 1300ms ease-out 1;
}

.tarot-cutin {
    position: fixed;
    left: 50%;
    top: clamp(56px, 16vh, 150px);
    transform: translate(-50%, -18px) skewX(-12deg);
    min-width: min(560px, calc(100% - 20px));
    max-width: calc(100% - 20px);
    text-align: center;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(120deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.92));
    color: #fff;
    font-size: clamp(18px, 4.6vw, 34px);
    font-weight: 900;
    letter-spacing: 0.08em;
    white-space: pre-line;
    text-shadow:
        -1px -1px 0 #000,
        -1px 1px 0 #000,
        1px -1px 0 #000,
        1px 1px 0 #000;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    z-index: 3590;
    pointer-events: none;
    opacity: 0;
    transition: opacity 220ms ease, transform 260ms ease;
}

.tarot-cutin.show {
    opacity: 1;
    transform: translate(-50%, 0) skewX(-12deg);
}

.tarot-cutin.is-player {
    border-color: rgba(34, 197, 94, 0.55);
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.25);
}

.tarot-cutin.is-kingdom-your-turn {
    border-color: rgba(250, 204, 21, 0.9);
    background: linear-gradient(120deg, rgba(120, 53, 15, 0.94), rgba(180, 83, 9, 0.9));
    color: #fff7d1;
    box-shadow:
        0 0 0 1px rgba(250, 204, 21, 0.45),
        0 0 28px rgba(250, 204, 21, 0.34),
        0 12px 28px rgba(0, 0, 0, 0.5);
    animation: tarotKingdomYourTurnCutinPulse 0.58s ease-out 1;
}

.tarot-cutin.is-cpu {
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25);
}

.tarot-cutin.is-kingdom-skip {
    border-color: rgba(56, 189, 248, 0.82);
    background: linear-gradient(120deg, rgba(8, 47, 73, 0.96), rgba(12, 74, 110, 0.96));
    color: #e0f2fe;
}

.tarot-cutin.is-kingdom-raid-transform {
    border-color: rgba(248, 113, 113, 0.94);
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 93, 70, 0.24), transparent 48%),
        linear-gradient(120deg, rgba(45, 5, 14, 0.98), rgba(107, 13, 29, 0.97));
    color: #fff1e6;
    box-shadow:
        0 14px 36px rgba(127, 29, 29, 0.46),
        0 0 30px rgba(248, 113, 113, 0.3);
}

.tarot-cutin.is-kingdom-cut {
    border-color: rgba(244, 114, 182, 0.85);
    background: linear-gradient(120deg, rgba(80, 7, 36, 0.96), rgba(131, 24, 67, 0.96));
    color: #fce7f3;
}

.tarot-cutin.is-kingdom-reverse {
    border-color: rgba(251, 191, 36, 0.92);
    background: linear-gradient(120deg, rgba(69, 26, 3, 0.97), rgba(120, 53, 15, 0.97));
    color: #fef3c7;
    box-shadow:
        0 14px 36px rgba(245, 158, 11, 0.38),
        0 0 28px rgba(251, 191, 36, 0.3);
}

.tarot-cutin.is-kingdom-lock {
    border-color: rgba(34, 197, 94, 0.85);
    background: linear-gradient(120deg, rgba(5, 46, 22, 0.96), rgba(22, 101, 52, 0.96));
    color: #dcfce7;
}

.tarot-cutin.is-kingdom-clear-combo {
    border-color: rgba(56, 189, 248, 0.96);
    background: linear-gradient(120deg, rgba(8, 47, 73, 0.97), rgba(3, 105, 161, 0.96));
    color: #e0f2fe;
    box-shadow:
        0 14px 36px rgba(14, 116, 144, 0.42),
        0 0 28px rgba(56, 189, 248, 0.36);
    animation: tarotKingdomClearComboCutin 860ms cubic-bezier(0.2, 0.86, 0.2, 1) 1;
}

.tarot-cutin.is-kingdom-clear-gold {
    border-color: rgba(251, 191, 36, 0.98);
    background: linear-gradient(120deg, rgba(120, 53, 15, 0.98), rgba(180, 83, 9, 0.97));
    color: #fff7db;
    box-shadow:
        0 16px 40px rgba(245, 158, 11, 0.5),
        0 0 34px rgba(251, 191, 36, 0.38);
    animation:
        tarotKingdomClearGoldCutin 980ms cubic-bezier(0.2, 0.86, 0.2, 1) 1,
        tarotKingdomClearGoldPulse 520ms ease-in-out 2;
}

.tarot-cutin.is-kingdom-call {
    border-color: rgba(59, 130, 246, 0.92);
    background: linear-gradient(120deg, rgba(15, 23, 42, 0.97), rgba(30, 64, 175, 0.97));
    color: #dbeafe;
    box-shadow:
        0 14px 36px rgba(59, 130, 246, 0.42),
        0 0 30px rgba(96, 165, 250, 0.32);
    animation: tarotKingdomCallDon 820ms cubic-bezier(0.2, 0.8, 0.2, 1) 1;
}

.tarot-cutin.is-kingdom-role {
    border-color: rgba(192, 132, 252, 0.9);
    background: linear-gradient(120deg, rgba(59, 7, 100, 0.96), rgba(88, 28, 135, 0.96));
    color: #f3e8ff;
    box-shadow:
        0 14px 36px rgba(168, 85, 247, 0.36),
        0 0 26px rgba(216, 180, 254, 0.28);
}

.tarot-cutin.is-kingdom-round-end {
    border-color: rgba(250, 204, 21, 0.96);
    background: linear-gradient(120deg, rgba(120, 53, 15, 0.97), rgba(146, 64, 14, 0.97));
    color: #fff7db;
    box-shadow:
        0 16px 40px rgba(245, 158, 11, 0.46),
        0 0 34px rgba(250, 204, 21, 0.32);
    animation: tarotKingdomRoundEndCutin 920ms cubic-bezier(0.18, 0.86, 0.22, 1) 1;
}

.tarot-cutin.is-kingdom-round-out {
    border-color: rgba(251, 191, 36, 0.96);
    background:
        linear-gradient(120deg, rgba(120, 53, 15, 0.98), rgba(180, 83, 9, 0.96));
    color: #fff9de;
    box-shadow:
        0 16px 42px rgba(245, 158, 11, 0.5),
        0 0 36px rgba(250, 204, 21, 0.36);
    animation: tarotKingdomRoundOutCutin 1100ms cubic-bezier(0.16, 0.84, 0.2, 1) 1;
}

.tarot-cutin.is-kingdom-grand-win {
    border-color: rgba(250, 204, 21, 0.98);
    background:
        linear-gradient(120deg, rgba(101, 23, 0, 0.99), rgba(146, 64, 14, 0.98));
    color: #fffbe9;
    font-size: clamp(24px, 6.3vw, 56px);
    letter-spacing: 0.1em;
    box-shadow:
        0 18px 48px rgba(245, 158, 11, 0.56),
        0 0 44px rgba(250, 204, 21, 0.42);
    animation:
        tarotKingdomGrandWinCutin 2200ms cubic-bezier(0.2, 0.86, 0.2, 1) 1,
        tarotKingdomGrandWinPulse 560ms ease-in-out 3;
}

@keyframes tarotKingdomCallDon {
    0% {
        transform: translate(-50%, 8px) skewX(-12deg) scale(0.92);
        filter: saturate(0.9) brightness(0.9);
    }
    36% {
        transform: translate(-50%, 6px) skewX(-12deg) scale(0.9);
        filter: saturate(0.95) brightness(0.95);
    }
    62% {
        transform: translate(-50%, -2px) skewX(-12deg) scale(1.08);
        filter: saturate(1.2) brightness(1.22);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: saturate(1) brightness(1);
    }
}

@keyframes tarotKingdomCallTrail {
    0% {
        opacity: 0.1;
        transform: translateX(16px) scaleX(0.92);
    }
    55% {
        opacity: 1;
        transform: translateX(4px) scaleX(1.02);
    }
    100% {
        opacity: 0;
        transform: translateX(0) scaleX(1.08);
    }
}

@keyframes tarotKingdomCallFreeze {
    0% {
        opacity: 0;
        filter: saturate(0.86) brightness(0.82);
    }
    35% {
        opacity: 1;
        filter: saturate(1.08) brightness(1.04);
    }
    100% {
        opacity: 1;
        filter: saturate(1) brightness(1);
    }
}

@keyframes tarotKingdomCallPotPulse {
    0% {
        filter: brightness(1) saturate(1);
    }
    45% {
        filter: brightness(1.22) saturate(1.2);
    }
    100% {
        filter: brightness(1) saturate(1);
    }
}

.tarot-coin-fx {
    position: fixed;
    z-index: 3605;
    pointer-events: none;
    user-select: none;
    line-height: 1;
    font-size: clamp(18px, 2.8vw, 26px);
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
    will-change: left, top, opacity, transform;
}

.tarot-coin-fx.is-player {
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.75);
}

.tarot-coin-fx.is-cpu {
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.75);
}

.tarot-coin-fx.is-payout {
    font-size: clamp(20px, 3.1vw, 30px);
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.58));
}

.tarot-coin-fx.is-call-bet {
    text-shadow:
        0 0 12px rgba(147, 197, 253, 0.85),
        0 0 24px rgba(59, 130, 246, 0.58);
}

.is-call-pulse {
    animation: tarotKingdomCallPotPulse 620ms ease-out 1;
}

.tarot-cutin.is-showdown-win {
    border-color: rgba(34, 197, 94, 0.9);
    background: linear-gradient(120deg, rgba(5, 46, 22, 0.96), rgba(20, 83, 45, 0.96));
    color: #dcfce7;
    box-shadow:
        0 14px 36px rgba(34, 197, 94, 0.4),
        0 0 28px rgba(34, 197, 94, 0.32);
    animation: tarotShowdownCutinPulse 520ms ease-out 2;
}

.tarot-cutin.is-showdown-lose {
    border-color: rgba(248, 113, 113, 0.95);
    background: linear-gradient(120deg, rgba(69, 10, 10, 0.96), rgba(127, 29, 29, 0.96));
    color: #fee2e2;
    box-shadow:
        0 14px 36px rgba(239, 68, 68, 0.4),
        0 0 28px rgba(239, 68, 68, 0.28);
    animation: tarotShowdownCutinPulse 520ms ease-out 2;
}

.tarot-cutin.is-showdown-draw {
    border-color: rgba(250, 204, 21, 0.95);
    background: linear-gradient(120deg, rgba(69, 26, 3, 0.96), rgba(120, 53, 15, 0.96));
    color: #fef3c7;
    box-shadow:
        0 14px 36px rgba(245, 158, 11, 0.38),
        0 0 28px rgba(250, 204, 21, 0.25);
    animation: tarotShowdownCutinPulse 520ms ease-out 2;
}

@keyframes tarotShowdownCutinPulse {
    0% {
        transform: translate(-50%, 4px) skewX(-12deg) scale(0.98);
        filter: saturate(1);
    }
    55% {
        transform: translate(-50%, -1px) skewX(-12deg) scale(1.03);
        filter: saturate(1.3);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: saturate(1);
    }
}

@keyframes tarotKingdomRoundEndFlash {
    0% {
        opacity: 0;
        filter: saturate(0.9) brightness(0.88);
    }
    45% {
        opacity: 1;
        filter: saturate(1.12) brightness(1.08);
    }
    100% {
        opacity: 1;
        filter: saturate(1) brightness(1);
    }
}

@keyframes tarotKingdomClearSweepLine {
    0% {
        opacity: 0;
        transform: translateX(0) skewX(-14deg);
    }
    18% {
        opacity: 1;
        transform: translateX(18%) skewX(-14deg);
    }
    100% {
        opacity: 0;
        transform: translateX(300%) skewX(-14deg);
    }
}

@keyframes tarotKingdomClearSweepCard {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: none;
    }
    26% {
        opacity: 1;
        transform: translateY(-2px) scale(0.99) rotate(-1deg);
        filter: brightness(1.06) saturate(1.08);
    }
    100% {
        opacity: 0;
        transform: translateX(24px) translateY(-8px) scale(0.9) rotate(-6deg);
        filter: brightness(1.12) saturate(1.22);
    }
}

@keyframes tarotKingdomClearComboCutin {
    0% {
        transform: translate(-50%, 8px) skewX(-12deg) scale(0.94);
        filter: saturate(0.9) brightness(0.9);
    }
    56% {
        transform: translate(-50%, -1px) skewX(-12deg) scale(1.06);
        filter: saturate(1.2) brightness(1.12);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: saturate(1) brightness(1);
    }
}

@keyframes tarotKingdomClearGoldCutin {
    0% {
        transform: translate(-50%, 10px) skewX(-12deg) scale(0.9);
        filter: saturate(0.86) brightness(0.86);
    }
    54% {
        transform: translate(-50%, -2px) skewX(-12deg) scale(1.08);
        filter: saturate(1.24) brightness(1.18);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: saturate(1) brightness(1);
    }
}

@keyframes tarotKingdomClearGoldPulse {
    0% { filter: saturate(1) brightness(1); }
    50% { filter: saturate(1.2) brightness(1.18); }
    100% { filter: saturate(1) brightness(1); }
}

@keyframes tarotKingdomRoundEndCutin {
    0% {
        transform: translate(-50%, 12px) skewX(-12deg) scale(0.92);
        filter: brightness(0.9) saturate(0.92);
    }
    55% {
        transform: translate(-50%, -2px) skewX(-12deg) scale(1.06);
        filter: brightness(1.12) saturate(1.2);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: brightness(1) saturate(1);
    }
}

@keyframes tarotKingdomRoundOutCutin {
    0% {
        transform: translate(-50%, 16px) skewX(-12deg) scale(0.88);
        filter: brightness(0.88) saturate(0.88);
    }
    48% {
        transform: translate(-50%, -4px) skewX(-12deg) scale(1.08);
        filter: brightness(1.16) saturate(1.24);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: brightness(1) saturate(1);
    }
}

@keyframes tarotKingdomGrandWinCutin {
    0% {
        transform: translate(-50%, 24px) skewX(-12deg) scale(0.84);
        filter: brightness(0.8) saturate(0.84);
    }
    30% {
        transform: translate(-50%, 2px) skewX(-12deg) scale(1.08);
        filter: brightness(1.2) saturate(1.28);
    }
    68% {
        transform: translate(-50%, -2px) skewX(-12deg) scale(1.04);
        filter: brightness(1.12) saturate(1.2);
    }
    100% {
        transform: translate(-50%, 0) skewX(-12deg) scale(1);
        filter: brightness(1) saturate(1);
    }
}

@keyframes tarotKingdomGrandWinPulse {
    0% {
        filter: brightness(1) saturate(1);
    }
    45% {
        filter: brightness(1.22) saturate(1.26);
    }
    100% {
        filter: brightness(1) saturate(1);
    }
}

@keyframes tarotKingdomGrandFinalFlash {
    0% {
        opacity: 0;
        filter: brightness(0.82) saturate(0.82);
    }
    38% {
        opacity: 1;
        filter: brightness(1.2) saturate(1.24);
    }
    100% {
        opacity: 1;
        filter: brightness(1) saturate(1);
    }
}

.tarot-card-fly {
    position: fixed;
    left: 0;
    top: 0;
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.52),
        0 0 0 1px rgba(255, 255, 255, 0.18);
    will-change: transform, opacity;
}

.tarot-kingdom-ram-card {
    z-index: 3635;
    pointer-events: none;
    filter: saturate(1.12) brightness(1.08);
}

.tarot-kingdom-ram-card::after {
    /* 衝突時のフラッシュ(トレイル)は完全廃止 */
    content: none;
    display: none;
    animation: none;
    opacity: 0;
}

.tarot-card.is-call-stolen {
    animation: tarotKingdomCallStealHit 220ms ease-out 1;
}

.tarot-kingdom-call-ghost {
    position: fixed;
    z-index: 3655;
    pointer-events: none;
    user-select: none;
    font-size: 24px;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(147, 197, 253, 0.58));
    will-change: transform, opacity, left, top;
}

.tarot-kingdom-call-ghost-taunt {
    position: fixed;
    z-index: 3657;
    pointer-events: none;
    user-select: none;
    font-size: 26px;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(191, 219, 254, 0.66));
    will-change: transform, opacity, left, top;
}

.tarot-kingdom-call-ghost-taunt.is-taunt {
    animation: tarotKingdomCallGhostTaunt 260ms ease-in-out infinite;
}

.tarot-kingdom-role-clash-card {
    z-index: 3640;
    pointer-events: none;
    filter: none;
}

.tarot-kingdom-role-clash-card::after {
    /* role clash 側もフラッシュは完全廃止 */
    content: none;
    display: none;
    animation: none;
    opacity: 0;
}

.tarot-kingdom-role-clash-particle {
    position: fixed;
    z-index: 3661;
    pointer-events: none;
    user-select: none;
    font-size: 18px;
    line-height: 1;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.82);
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.4));
    will-change: transform, opacity, filter;
}

.tarot-kingdom-role-clash-particle.run {
    animation-name: tarotKingdomRoleClashParticle;
    animation-duration: var(--fx-dur, 300ms);
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.22, 0.78, 0.24, 1);
}

@keyframes tarotKingdomCallStealHit {
    0% {
        filter: brightness(1) saturate(1);
        transform: translateY(0) scale(1);
    }
    36% {
        filter: brightness(1.34) saturate(1.18);
        transform: translateY(-1px) scale(0.96);
    }
    100% {
        filter: brightness(1) saturate(1);
        transform: translateY(0) scale(1);
    }
}

@keyframes tarotKingdomCallGhostTaunt {
    0% {
        transform: translate(-50%, -50%) rotate(-5deg) scale(0.98);
    }
    20% {
        transform: translate(calc(-50% - 1px), calc(-50% - 2px)) rotate(4deg) scale(1.02);
    }
    40% {
        transform: translate(calc(-50% + 1px), calc(-50% + 1px)) rotate(-4deg) scale(1);
    }
    60% {
        transform: translate(calc(-50% - 1px), calc(-50% - 1px)) rotate(5deg) scale(1.03);
    }
    80% {
        transform: translate(calc(-50% + 1px), calc(-50% + 1px)) rotate(-3deg) scale(1.01);
    }
    100% {
        transform: translate(-50%, -50%) rotate(3deg) scale(1.02);
    }
}

@keyframes tarotKingdomRoleClashTrail {
    0% {
        opacity: 0.16;
        transform: translateX(12px) scaleX(0.86);
    }
    56% {
        opacity: 0.9;
        transform: translateX(4px) scaleX(1.02);
    }
    100% {
        opacity: 0;
        transform: translateX(0) scaleX(1.08);
    }
}

@keyframes tarotKingdomRoleClashParticle {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.74);
    }
    36% {
        opacity: 1;
        transform: translate(-50%, -58%) scale(1.06);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -70%) scale(1.14);
    }
}

@keyframes tarotKingdomRamTrail {
    0% {
        opacity: 0.16;
        transform: translateX(10px) scaleX(0.86);
    }
    55% {
        opacity: 0.9;
        transform: translateX(3px) scaleX(1);
    }
    100% {
        opacity: 0;
        transform: translateX(0) scaleX(1.06);
    }
}

.tarot-fortune-overlay {
    position: fixed;
    inset: 0;
    z-index: 3800;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(0, 0, 0, 0.72);
    transition: background-color 420ms ease;
}

.tarot-fortune-modal {
    position: relative;
    width: min(560px, calc(100% - 12px));
    box-sizing: border-box;
    border-radius: 8px;
    border: 18px solid transparent;
    border-image: url("./assets/ui/panels/panel-blue-square.png") 24 fill / 18px / 0 stretch;
    background: transparent;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
    padding: 16px 16px 14px;
    text-align: center;
    color: #f8fbff;
    max-height: min(90dvh, 720px);
    overflow-y: auto;
    --tarot-card-w: 88px;
    --tarot-card-h: 138px;
}

.tarot-fortune-modal::before,
.tarot-fortune-modal::after {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 220ms ease;
}

.tarot-fortune-modal::before {
    background:
        repeating-conic-gradient(
            from -22deg at 50% 46%,
            rgba(255, 244, 184, 0) 0deg,
            rgba(255, 244, 184, 0.16) 11deg,
            rgba(255, 244, 184, 0) 24deg
        );
    mix-blend-mode: screen;
}

.tarot-fortune-modal::after {
    inset: 18px;
    border: 1px solid rgba(255, 232, 163, 0.38);
    box-shadow:
        inset 0 0 28px rgba(255, 232, 163, 0.12),
        0 0 26px rgba(255, 232, 163, 0.18);
}

.tarot-fortune-modal > * {
    position: relative;
    z-index: 1;
}

.tarot-fortune-modal.is-major-arcana {
    box-shadow:
        0 18px 44px rgba(0, 0, 0, 0.45),
        0 0 34px rgba(255, 232, 163, 0.2),
        0 0 58px rgba(125, 211, 252, 0.12);
}

.tarot-fortune-modal.is-major-arcana::before {
    opacity: 0.48;
    animation: tarotFortuneArcanaRays 8.5s linear infinite;
}

.tarot-fortune-modal.is-major-arcana::after {
    opacity: 1;
    animation: tarotFortuneArcanaFrame 2.8s ease-in-out infinite;
}

.tarot-fortune-close {
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
}

.tarot-fortune-kicker {
    font-size: 10px;
    font-weight: 800;
    color: rgba(219, 234, 254, 0.78);
    margin-bottom: 2px;
}

.tarot-fortune-title {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 0;
    color: #fff4b8;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.45);
    margin-bottom: 4px;
    padding-inline: 56px;
}

.tarot-fortune-sub {
    font-size: 12px;
    color: #dbeafe;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    margin-bottom: 12px;
}

.tarot-fortune-arcana-badge {
    width: max-content;
    max-width: 100%;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    padding: 3px 12px;
    border: 1px solid rgba(255, 232, 163, 0.5);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(82, 52, 18, 0.5), rgba(164, 111, 36, 0.6), rgba(82, 52, 18, 0.5));
    color: #fff4b8;
    font-size: 10px;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.62);
    box-shadow:
        inset 0 1px 0 rgba(255, 244, 184, 0.24),
        0 0 14px rgba(255, 232, 163, 0.18);
    animation: tarotFortuneArcanaBadge 1.9s ease-in-out infinite;
}

.tarot-fortune-arcana-badge[hidden] {
    display: none;
}

.tarot-fortune-stage {
    display: grid;
    grid-template-columns: minmax(96px, 0.8fr) minmax(0, 1.2fr);
    gap: 14px;
    align-items: center;
}

.tarot-fortune-card-host {
    position: relative;
    min-height: calc(var(--tarot-card-h, 138px) + 10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tarot-fortune-stage.has-choice {
    display: flex;
    flex-direction: column;
}

.tarot-fortune-stage.has-choice .tarot-fortune-reading {
    display: none;
}

.tarot-fortune-card-host.is-choice {
    width: 100%;
    gap: 10px;
}

.tarot-fortune-card-host.is-choice .tarot-fortune-card-shell {
    --tarot-card-w: clamp(60px, 23vw, 96px);
    --tarot-card-h: calc(var(--tarot-card-w) * 1.5);
}

.tarot-fortune-card-host.is-selecting .tarot-fortune-card-shell {
    transition: transform 380ms cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 320ms ease-out, filter 380ms ease-out;
}

.tarot-fortune-card-host.is-selecting .tarot-fortune-card-shell.is-selected {
    z-index: 2;
    transform: translateY(-14px) scale(1.1);
    filter: drop-shadow(0 0 18px rgba(255, 222, 142, 0.85));
}

.tarot-fortune-card-host.is-selecting .tarot-fortune-card-shell.is-not-selected {
    opacity: 0;
    transform: translateY(18px) scale(0.86) rotate(var(--tarot-fortune-sink-tilt, -6deg));
}

.tarot-fortune-card-host.is-selecting .tarot-fortune-card-shell.is-not-selected:last-child {
    --tarot-fortune-sink-tilt: 6deg;
}

.tarot-fortune-card-shell.is-revealing {
    z-index: 2;
    background: linear-gradient(145deg, #102a3c, #352c23);
}

.tarot-fortune-card-shell.is-revealing .tarot-fortune-card-art {
    visibility: hidden;
}

.tarot-fortune-card-shell.is-fortune-hovering {
    animation: tarotFortuneHover 1.6s ease-in-out infinite;
}

.tarot-fortune-card-shell.is-fortune-trembling {
    animation: tarotFortuneTremble 120ms linear infinite;
}

.tarot-fortune-card-shell.is-flip-out {
    animation: tarotFortuneFlipOut 240ms cubic-bezier(0.55, 0, 0.9, 0.4) forwards;
}

.tarot-fortune-card-shell.is-flip-in {
    animation: tarotFortuneFlipIn 340ms cubic-bezier(0.15, 0.9, 0.3, 1.25) both;
}

.tarot-fortune-card-shell.is-quiet-reveal {
    animation: tarotFortuneQuietReveal 200ms ease-out both;
}

@keyframes tarotFortuneHover {
    0%, 100% { transform: perspective(700px) translateY(-6px) rotateY(-9deg) rotateX(3deg); }
    50% { transform: perspective(700px) translateY(-12px) rotateY(9deg) rotateX(-2deg); }
}

@keyframes tarotFortuneTremble {
    0%, 100% { transform: translateY(-8px) rotate(0); }
    25% { transform: translate(-1px, -8px) rotate(-1.2deg); }
    75% { transform: translate(1px, -8px) rotate(1.2deg); }
}

@keyframes tarotFortuneFlipOut {
    from { transform: perspective(700px) translateY(-8px) rotateY(0) scale(1); }
    to { transform: perspective(700px) translateY(-4px) rotateY(90deg) scale(0.92); }
}

@keyframes tarotFortuneFlipIn {
    from { transform: perspective(700px) rotateY(-90deg) scale(0.92); }
    65% { transform: perspective(700px) rotateY(6deg) scale(1.12); }
    to { transform: perspective(700px) rotateY(0) scale(1); }
}

@keyframes tarotFortuneQuietReveal {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.tarot-fortune-fx {
    --fx-glow: 255, 214, 102;
    --fx-core: 255, 244, 194;
    position: absolute;
    inset: -40px -56px -16px;
    z-index: 1;
    pointer-events: none;
}

.tarot-fortune-fx[data-stage="moon"] {
    --fx-glow: 167, 139, 250;
    --fx-core: 236, 232, 255;
}

.tarot-fortune-fx[data-stage="blue"] {
    --fx-glow: 56, 189, 248;
    --fx-core: 224, 251, 255;
}

.tarot-fortune-fx-canvas,
.tarot-fortune-fx-rays,
.tarot-fortune-fx-bloom {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.tarot-fortune-fx-canvas {
    z-index: 3;
}

.tarot-fortune-fx-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(var(--tarot-card-w, 128px) * 1.7);
    height: calc(var(--tarot-card-w, 128px) * 1.7);
    margin: calc(var(--tarot-card-w, 128px) * -0.85) 0 0 calc(var(--tarot-card-w, 128px) * -0.85);
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(var(--fx-glow), 0.5) 0 34%, transparent 62%),
        repeating-conic-gradient(rgba(var(--fx-glow), 0.85) 0deg 3deg, transparent 3deg 15deg);
    mask: radial-gradient(circle, #000 0 60%, transparent 71%);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 360ms ease-out, transform 600ms ease-out;
}

.tarot-fortune-fx[data-stage="legend"] .tarot-fortune-fx-ring {
    background:
        radial-gradient(circle, rgba(255, 236, 160, 0.55) 0 34%, transparent 62%),
        conic-gradient(#ffd75e, #ff8fa3, #c4b5fd, #7dd3fc, #a7f3d0, #ffd75e);
}

.tarot-fortune-fx-veil {
    position: absolute;
    inset: -360px;
    background: radial-gradient(circle at 50% 46%, transparent 0 90px, rgba(2, 6, 16, 0.78) 230px);
    opacity: 0;
    transition: opacity 420ms ease-out;
}

.tarot-fortune-fx.is-charging .tarot-fortune-fx-veil,
.tarot-fortune-fx.is-imploding .tarot-fortune-fx-veil {
    opacity: 1;
}

.tarot-fortune-fx.is-charging .tarot-fortune-fx-ring {
    opacity: 1;
    transform: scale(1);
    animation: tarotFortuneRingSpin 3.2s linear infinite;
}

.tarot-fortune-fx.is-charging.is-promoting .tarot-fortune-fx-ring {
    animation: tarotFortuneRingSpin 3.2s linear infinite, tarotFortuneRingPulse 420ms ease-out;
}

.tarot-fortune-fx.is-imploding .tarot-fortune-fx-ring {
    opacity: 0;
    transform: scale(0.3);
    transition-duration: 220ms;
}

.tarot-fortune-fx-rays {
    background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(var(--fx-core), 0) 0deg, rgba(var(--fx-core), 0.22) 7deg, rgba(var(--fx-core), 0) 16deg);
    mask: radial-gradient(circle at 50% 50%, #000 0 22%, transparent 64%);
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.tarot-fortune-fx[data-tier="gold"].is-revealed .tarot-fortune-fx-rays {
    opacity: 0.8;
    animation: tarotFortuneRaysSpin 6s linear infinite, tarotFortuneRaysFade 1.8s ease-out forwards;
}

.tarot-fortune-fx.is-omen .tarot-fortune-fx-rays {
    background: repeating-conic-gradient(
        from 0deg at 50% 50%,
        hsl(45deg 100% 75% / 0%) 0deg,
        hsl(45deg 100% 75% / 32%) 6deg,
        hsl(330deg 100% 80% / 20%) 9deg,
        hsl(190deg 100% 75% / 24%) 12deg,
        hsl(45deg 100% 75% / 0%) 18deg
    );
    opacity: 1;
    animation: tarotFortuneRaysSpin 5s linear infinite;
}

.tarot-fortune-fx-bloom {
    z-index: 2;
    background: radial-gradient(ellipse 46% 52% at 50% 50%, rgba(var(--fx-core), 0.6), rgba(var(--fx-glow), 0.26) 45%, transparent 72%);
    opacity: 0;
}

.tarot-fortune-fx-bloom.is-on {
    animation: tarotFortuneBloom 520ms ease-out;
}

.tarot-fortune-fx-omen,
.tarot-fortune-fx-banner {
    position: absolute;
    left: 50%;
    z-index: 4;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.tarot-fortune-fx-omen {
    bottom: -4px;
    transform: translateX(-50%);
    color: #fff4c2;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-shadow: 0 0 10px rgba(255, 214, 102, 0.9), 0 1px 2px rgba(0, 0, 0, 0.8);
    transition: opacity 260ms ease-out;
}

.tarot-fortune-fx.is-omen:not(.is-revealed) .tarot-fortune-fx-omen {
    opacity: 1;
}

.tarot-fortune-fx-banner {
    bottom: 26px;
    transform: translateX(-50%) scale(1.8);
}

.tarot-fortune-fx-banner > span {
    display: block;
    padding: 4px 18px;
    border: 2px solid #fff1b5;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffe27a, #e8a21c 55%, #b86e0d);
    color: #3a1e00;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-shadow: 0 1px 0 rgba(255, 248, 214, 0.8);
    box-shadow: 0 0 18px rgba(255, 214, 102, 0.75), 0 4px 10px rgba(0, 0, 0, 0.5);
}

.tarot-fortune-fx.is-jackpot .tarot-fortune-fx-banner {
    animation: tarotFortuneBannerStamp 2.6s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.tarot-fortune-overlay.is-fortune-charging {
    background: rgba(0, 0, 0, 0.88);
}

.tarot-fortune-overlay.is-fortune-charging .tarot-fortune-modal > :not(.tarot-fortune-stage, .tarot-fortune-close) {
    opacity: 0.5;
    transition: opacity 360ms ease;
}

/* The choose-a-card hint is stale once a card is chosen; the wind compass takes the title row. */
.tarot-fortune-overlay.is-fortune-charging .tarot-fortune-modal > .tarot-fortune-sub,
.tarot-fortune-overlay.is-fortune-charging .tarot-fortune-modal > .tarot-fortune-title {
    opacity: 0;
}

@keyframes tarotFortuneRingSpin {
    to { rotate: 360deg; }
}

@keyframes tarotFortuneRingPulse {
    0% { scale: 1; filter: brightness(1); }
    35% { scale: 1.16; filter: brightness(1.5); }
    100% { scale: 1; filter: brightness(1); }
}

@keyframes tarotFortuneRaysSpin {
    to { rotate: 360deg; }
}

@keyframes tarotFortuneRaysFade {
    0%, 55% { opacity: 0.8; }
    100% { opacity: 0; }
}

@keyframes tarotFortuneBloom {
    0% { opacity: 0; transform: scale(0.6); }
    30% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1.3); }
}

@keyframes tarotFortuneBannerStamp {
    0% { opacity: 0; transform: translateX(-50%) scale(1.8); }
    18% { opacity: 1; transform: translateX(-50%) scale(1); }
    80% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

.tarot-fortune-stage.is-result-entering .tarot-fortune-reading {
    animation: tarotFortuneResultEnter 280ms ease-out both;
}

.tarot-fortune-modal[data-fortune-tier] .tarot-fortune-meter-segment.is-filled {
    animation: tarotFortuneMeterFill 260ms ease-out both;
    animation-delay: calc(var(--segment-index, 1) * 55ms + 160ms);
}

.tarot-fortune-modal[data-fortune-tier="gold"] .tarot-fortune-summary,
.tarot-fortune-modal[data-fortune-tier="legend"] .tarot-fortune-summary {
    box-shadow: inset 0 0 0 1px rgba(255, 214, 102, 0.55), 0 0 18px rgba(255, 214, 102, 0.28);
}

.tarot-fortune-modal[data-fortune-tier="legend"] .tarot-fortune-score {
    color: #ffe27a;
    text-shadow: 0 0 10px rgba(255, 214, 102, 0.9);
}

@keyframes tarotFortuneResultEnter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tarotFortuneMeterFill {
    from { opacity: 0.15; transform: scaleY(0.4); }
    to { opacity: 1; transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-fortune-card-host.is-selecting .tarot-fortune-card-shell { transition: none; }
    .tarot-fortune-card-shell.is-flip-out,
    .tarot-fortune-card-shell.is-flip-in,
    .tarot-fortune-card-shell.is-fortune-hovering,
    .tarot-fortune-card-shell.is-fortune-trembling,
    .tarot-fortune-stage.is-result-entering .tarot-fortune-reading,
    .tarot-fortune-modal[data-fortune-tier] .tarot-fortune-meter-segment.is-filled { animation: none; }
}

.tarot-fortune-modal.is-revisit::before,
.tarot-fortune-modal.is-revisit::after,
.tarot-fortune-modal.is-revisit * {
    animation: none;
}

.tarot-fortune-reading {
    min-height: 128px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    text-align: left;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(4, 12, 24, 0.5);
    box-shadow: inset 0 0 0 1px rgba(248, 226, 168, 0.16);
}

.tarot-fortune-modal.is-major-arcana .tarot-fortune-reading {
    background:
        linear-gradient(180deg, rgba(12, 22, 38, 0.72), rgba(4, 12, 24, 0.58)),
        repeating-linear-gradient(135deg, rgba(255, 232, 163, 0.08) 0 1px, transparent 1px 12px);
    box-shadow:
        inset 0 0 0 1px rgba(255, 232, 163, 0.3),
        inset 0 0 28px rgba(255, 232, 163, 0.08),
        0 0 18px rgba(255, 232, 163, 0.16);
}

.tarot-fortune-card-shell {
    position: relative;
    width: var(--tarot-card-w, 64px);
    min-width: var(--tarot-card-w, 64px);
    height: var(--tarot-card-h, 100px);
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tarot-fortune-card-shell.is-clickable {
    filter: drop-shadow(0 0 18px rgba(248, 226, 168, 0.22));
}

.tarot-fortune-card-shell.is-major-arcana {
    filter:
        drop-shadow(0 0 14px rgba(255, 232, 163, 0.5))
        drop-shadow(0 0 26px rgba(125, 211, 252, 0.22));
    animation: tarotFortuneArcanaCard 2.2s ease-in-out infinite;
}

.tarot-fortune-card-shell.is-major-arcana::before {
    content: "";
    position: absolute;
    inset: -11px;
    border-radius: 12px;
    pointer-events: none;
    background:
        conic-gradient(
            from 0deg,
            rgba(255, 244, 184, 0.08),
            rgba(255, 232, 163, 0.5),
            rgba(125, 211, 252, 0.22),
            rgba(255, 244, 184, 0.08)
        );
    opacity: 0.72;
    transform: rotate(0deg);
    animation: tarotFortuneArcanaHalo 3.6s linear infinite;
    z-index: -1;
}

.tarot-fortune-card-shell .tarot-fortune-card-art {
    transform-origin: center center;
}

.tarot-fortune-card-shell.is-static,
.tarot-fortune-card-shell.is-revealed {
    cursor: default;
}

.tarot-fortune-card-shell:focus-visible {
    outline: 2px solid rgba(248, 226, 168, 0.92);
    outline-offset: 4px;
}

.tarot-fortune-card-shell:disabled {
    opacity: 1;
}

.tarot-fortune-card-shell.is-reversed .tarot-fortune-card-art {
    transform: translate(-50%, -50%) rotate(180deg);
}

.tarot-fortune-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tarot-fortune-result-meta[hidden],
.tarot-fortune-reward[hidden] {
    display: none;
}

.tarot-fortune-card-name,
.tarot-fortune-orientation {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    color: #fff7cc;
    background: rgba(127, 78, 20, 0.45);
    box-shadow: inset 0 0 0 1px rgba(248, 226, 168, 0.22);
}

.tarot-fortune-orientation {
    color: #dbeafe;
    background: rgba(33, 82, 142, 0.42);
}

.tarot-fortune-modal.is-major-arcana .tarot-fortune-card-name,
.tarot-fortune-modal.is-major-arcana .tarot-fortune-orientation {
    color: #fff4b8;
    background: rgba(127, 78, 20, 0.62);
    box-shadow:
        inset 0 0 0 1px rgba(255, 232, 163, 0.34),
        0 0 12px rgba(255, 232, 163, 0.12);
}

.tarot-fortune-text {
    font-size: 14px;
    line-height: 1.68;
    color: #f8fbff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    min-height: 42px;
    overflow-wrap: break-word;
    white-space: pre-line;
}

.tarot-fortune-text.is-result {
    --fortune-tone: 125, 211, 252;
    display: grid;
    gap: 8px;
    white-space: normal;
}

.tarot-fortune-text.is-result[data-fortune-tone="excellent"] {
    --fortune-tone: 250, 204, 21;
}

.tarot-fortune-text.is-result[data-fortune-tone="favorable"] {
    --fortune-tone: 74, 222, 128;
}

.tarot-fortune-text.is-result[data-fortune-tone="caution"] {
    --fortune-tone: 251, 146, 60;
}

.tarot-fortune-text.is-result[data-fortune-tone="storm"] {
    --fortune-tone: 248, 113, 113;
}

.tarot-fortune-summary,
.tarot-fortune-reading-section {
    margin: 0;
    border-radius: 8px;
}

.tarot-fortune-summary {
    padding: 9px 10px 10px;
    background:
        linear-gradient(135deg, rgba(var(--fortune-tone), 0.18), rgba(5, 14, 28, 0.42));
    box-shadow:
        inset 0 0 0 1px rgba(var(--fortune-tone), 0.34),
        0 5px 12px rgba(0, 0, 0, 0.16);
}

.tarot-fortune-section-label {
    display: block;
    margin-bottom: 3px;
    color: rgba(219, 234, 254, 0.86);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.3;
}

.tarot-fortune-summary-value {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.tarot-fortune-wind {
    color: rgb(var(--fortune-tone));
    font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: clamp(22px, 5vw, 29px);
    line-height: 1.08;
    letter-spacing: 0.04em;
    text-shadow:
        0 2px 2px rgba(0, 0, 0, 0.72),
        0 0 12px rgba(var(--fortune-tone), 0.22);
}

.tarot-fortune-score {
    flex: 0 0 auto;
    color: #eef6ff;
    font-size: 12px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.tarot-fortune-meter {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 3px;
    margin-top: 7px;
}

.tarot-fortune-meter-segment {
    height: 5px;
    border-radius: 999px;
    background: rgba(219, 234, 254, 0.12);
    box-shadow: inset 0 0 0 1px rgba(219, 234, 254, 0.08);
}

.tarot-fortune-meter-segment.is-filled {
    background: rgb(var(--fortune-tone));
    box-shadow: 0 0 6px rgba(var(--fortune-tone), 0.44);
}

.tarot-fortune-reading-section {
    padding: 8px 10px;
    background: rgba(3, 10, 22, 0.42);
    box-shadow: inset 0 0 0 1px rgba(219, 234, 254, 0.1);
}

.tarot-fortune-reading-section p {
    margin: 0;
    color: #f8fbff;
    font-size: 14px;
    line-height: 1.62;
}

.tarot-fortune-advice {
    background:
        linear-gradient(135deg, rgba(248, 226, 168, 0.12), rgba(3, 10, 22, 0.46));
    box-shadow: inset 0 0 0 1px rgba(248, 226, 168, 0.2);
}

.tarot-fortune-advice .tarot-fortune-section-label {
    color: #ffe8a3;
}

.tarot-fortune-reward {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
    font-size: 12px;
    line-height: 1.45;
    padding-top: 8px;
    border-top: 1px solid rgba(248, 226, 168, 0.16);
    overflow-wrap: break-word;
}

.tarot-fortune-reward-label {
    color: rgba(219, 234, 254, 0.78);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.tarot-fortune-reward-value {
    color: #ffe8a3;
    font-size: 12px;
    font-weight: 900;
}

.tarot-fortune-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.tarot-fortune-done {
    min-height: 34px;
    min-width: 108px;
    border: 1px solid rgba(248, 226, 168, 0.42);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(143, 95, 32, 0.92), rgba(86, 47, 17, 0.92));
    color: #fff7cc;
    font-size: 13px;
    font-weight: 900;
    padding: 6px 16px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26);
}

@keyframes tarotFortuneArcanaRays {
    from {
        transform: rotate(0deg) scale(1);
    }
    to {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes tarotFortuneArcanaFrame {
    0%,
    100% {
        filter: brightness(1);
        opacity: 0.8;
    }
    50% {
        filter: brightness(1.2);
        opacity: 1;
    }
}

@keyframes tarotFortuneArcanaBadge {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-1px);
    }
}

@keyframes tarotFortuneArcanaHalo {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes tarotFortuneArcanaCard {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-fortune-modal.is-major-arcana::before,
    .tarot-fortune-modal.is-major-arcana::after,
    .tarot-fortune-arcana-badge,
    .tarot-fortune-card-shell.is-major-arcana,
    .tarot-fortune-card-shell.is-major-arcana::before {
        animation: none;
    }
}

@media (max-width: 520px) {
    .tarot-fortune-overlay {
        padding: 10px;
    }

    .tarot-fortune-modal {
        width: min(100%, 420px);
        padding: 14px 12px 12px;
        --tarot-card-w: 78px;
        --tarot-card-h: 122px;
    }

    .tarot-fortune-stage {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tarot-fortune-reading {
        min-height: 104px;
        text-align: left;
    }

    .tarot-fortune-result-meta {
        justify-content: center;
    }

    .tarot-fortune-arcana-badge {
        margin-bottom: 10px;
    }

    .tarot-fortune-title {
        font-size: 21px;
        padding-inline: 56px;
    }
}

@media (max-width: 900px) {
    .tarot-poker-columns {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .tarot-poker-column--player {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    #tabContentTarot .tarot-game-select-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    #tabContentTarot .tarot-game-switch {
        gap: 6px;
    }

    #tabContentTarot .tarot-game-switch button {
        min-height: 32px;
        padding: 4px 9px;
        font-size: 12px;
    }

#tabContentTarot #tarotKingdomRoot.tarot-kingdom-root {
    margin: 8px;
    padding: 10px 8px;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 86px);
    height: var(--tarot-kingdom-mobile-height, auto);
    min-height: var(--tarot-kingdom-mobile-height, auto);
    max-height: var(--tarot-kingdom-mobile-height, none);
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}

#tabContentTarot #tarotKingdomRoot .tarot-state-text {
    margin: 6px 0 8px;
    padding: 8px 10px;
    font-size: 11px;
    line-height: 1.45;
}

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-openrooms,
    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-settlement,
    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-controls {
        margin: 4px 0 6px;
    }

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-layout {
    flex: 1 1 auto;
    min-height: 0;
    gap: 4px;
    overflow: hidden;
}

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-panel {
    padding: 4px;
    border-radius: 16px;
}

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-panel-title {
    margin-bottom: 3px;
    font-size: 11px;
}

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-trick {
    min-height: calc(var(--tarot-card-h, 34px) + 0px);
    gap: 4px;
}

    #tabContentTarot #tarotKingdomRoot #tarotKingdomHand.tarot-kingdom-hand {
        gap: 4px;
    }

#tabContentTarot #tarotKingdomRoot #tarotKingdomPlayers {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
    gap: 4px;
}

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-player-row {
    min-height: 26px;
    padding: 6px 8px;
    gap: 4px;
    border-radius: 12px;
}

#tabContentTarot #tarotKingdomRoot #tarotKingdomLog.tarot-log {
    margin-top: 4px;
    max-height: 16dvh;
    padding: 20px 10px 10px;
    border-radius: 16px;
}

    #tabContentTarot #tarotKingdomRoot.is-settlement-open .tarot-kingdom-layout,
    #tabContentTarot #tarotKingdomRoot.is-settlement-open #tarotKingdomLog {
        display: none;
    }

    #tabContentTarot #tarotKingdomRoot.is-settlement-open #tarotKingdomSettlement {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        margin-bottom: 4px;
    }

    #tabContentTarot #tarotKingdomRoot.is-settlement-open .tarot-kingdom-settlement-body {
        min-height: 0;
        overflow-y: auto;
        padding-right: 2px;
    }

    #tabContentTarot .tarot-kingdom-header {
        margin-bottom: 6px;
    }

    #tabContentTarot .tarot-kingdom-header h2 {
        font-size: 14px;
    }

    #tarotModeKingdom {
        font-size: 11px;
    }

    #tabContentTarot .tarot-kingdom-chip {
        min-height: 22px;
        font-size: 11px;
        padding: 0 7px;
    }

    #tabContentTarot .tarot-kingdom-controls button {
        min-height: 32px;
        font-size: 12px;
        padding: 5px 10px;
    }

    #tabContentTarot .tarot-kingdom-trick,
    #tabContentTarot .tarot-kingdom-judgment-options {
        gap: 6px;
    }

    #tabContentTarot .tarot-kingdom-player-row {
        min-height: 32px;
        padding: 5px 7px;
    }

    #tabContentTarot .tarot-poker-root {
        margin: 8px;
        padding: 10px;
    }

    #tabContentTarot .tarot-poker-header {
        gap: 6px;
        margin-bottom: 8px;
        align-items: center;
        flex-wrap: nowrap;
    }

    #tabContentTarot .tarot-poker-header h2 {
        font-size: 16px;
        white-space: nowrap;
    }

    #tabContentTarot .tarot-poker-sub {
        font-size: 10px;
    }

    #tabContentTarot .tarot-poker-header-meta {
        gap: 4px;
        flex-wrap: nowrap;
    }

    #tabContentTarot .tarot-pot-chip {
        min-width: 122px;
        padding: 5px 8px;
        gap: 4px;
    }

    #tabContentTarot .tarot-pot-label {
        font-size: 9px;
        letter-spacing: 0.08em;
    }

    #tabContentTarot .tarot-pot-value {
        font-size: 18px;
    }

    #tabContentTarot .tarot-pot-slit {
        min-width: 42px;
    }

    #tabContentTarot .tarot-pot-unit {
        font-size: 10px;
    }

    #tabContentTarot .tarot-poker-controls {
        gap: 6px;
        margin-bottom: 8px;
    }

    #tabContentTarot .tarot-poker-controls button {
        min-height: 34px;
        padding: 6px;
        font-size: 12px;
    }

    #tabContentTarot .tarot-poker-mode-toggle {
        min-width: 0;
        width: 100%;
        gap: 6px;
    }

    #tabContentTarot .tarot-poker-mode-btn {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 11px;
    }

    #tabContentTarot .tarot-betting-info {
        margin-bottom: 8px;
        padding: 6px;
    }

    #tabContentTarot .tarot-betting-points {
        gap: 6px;
        margin-bottom: 4px;
        font-size: 11px;
    }

    #tabContentTarot .tarot-betting-hint {
        margin-bottom: 6px;
        font-size: 11px;
    }

    #tabContentTarot .tarot-state-text {
        margin: 6px 0 8px;
        font-size: 12px;
    }

    #tabContentTarot .tarot-participant-list {
        gap: 4px;
        margin: 0 0 6px;
    }

    #tabContentTarot .tarot-participant-chip {
        padding: 2px 6px;
        font-size: 10px;
    }

    #tabContentTarot .tarot-board-top {
        margin-bottom: 6px;
    }

    #tabContentTarot .tarot-poker-board {
        gap: 6px;
        margin-bottom: 0;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    #tabContentTarot .tarot-board-row {
        gap: 6px;
        margin-bottom: 6px;
    }

    #tabContentTarot .tarot-fate-pane {
        width: calc(var(--tarot-card-w, 58px) + 2px);
        gap: 3px;
    }

    #tabContentTarot .tarot-fate-label {
        font-size: 9px;
    }

    #tabContentTarot .tarot-fate-effect {
        margin-bottom: 8px;
        padding: 5px 8px;
        font-size: 11px;
    }

#tabContentTarot .tarot-poker-columns {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

    #tabContentTarot .tarot-poker-column {
        padding: 8px;
    }

    #tabContentTarot .tarot-poker-column--npc-mini {
        padding: 6px;
    }

    #tabContentTarot .tarot-poker-column--npc-mini .tarot-poker-column-title {
        font-size: 9px;
    }

    #tabContentTarot .tarot-poker-column--npc-mini .tarot-inline-point {
        font-size: 8px;
        margin-left: 3px;
    }

    #tabContentTarot .tarot-hand-grave-wrap {
        grid-template-columns: minmax(0, 1fr) max-content;
        gap: 8px;
    }

    /* NPCミニ列は常に1カラムで表示（右側の見えない空き列を防止） */
    #tabContentTarot .tarot-poker-column--npc-mini .tarot-hand-grave-wrap {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    #tabContentTarot .tarot-grave-row {
        justify-content: flex-end;
        min-height: var(--tarot-card-h, 100px);
    }

    #tabContentTarot .tarot-poker-column-title {
        margin-bottom: 6px;
        font-size: 11px;
    }

    #tabContentTarot .tarot-inline-point {
        margin-left: 6px;
        padding: 2px 6px;
        font-size: 10px;
    }

    #tabContentTarot .tarot-card-row {
        gap: 6px;
        min-height: var(--tarot-card-h, 100px);
        margin-bottom: 4px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    /* Kingdom hand uses wrapped layout; keep both axes visible to avoid
       vertical scroll indicator flicker on mobile. */
    #tabContentTarot #tarotKingdomHand.tarot-card-row {
        overflow-x: visible;
        overflow-y: visible;
        padding-bottom: 0;
    }

    #tabContentTarot .tarot-hand-block .tarot-card-row {
        overflow-x: visible;
    }

    #tabContentTarot .tarot-poker-column--npc-mini .tarot-card-row {
        overflow-x: visible;
        padding-bottom: 0;
    }

    #tabContentTarot .tarot-poker-column--npc-mini .tarot-role-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

#tabContentTarot .tarot-log {
    margin-top: 8px;
    max-height: 22dvh;
    padding: 6px;
}

    #tabContentTarot .tarot-log-row {
        margin-bottom: 4px;
        font-size: 11px;
    }
}

@media (max-width: 640px) and (max-height: 760px) {
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-root {
        padding: 8px;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 108px);
        gap: 4px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-panel {
        padding: 5px;
    }

    #tabContentTarot #tarotKingdomRoot #tarotKingdomPlayers {
        max-height: none;
    }

    #tabContentTarot #tarotKingdomRoot #tarotKingdomLog.tarot-log {
        max-height: 56px;
    }
}

@keyframes tarotPotPulse {
    0%, 100% { transform: translateY(0); filter: brightness(1); }
    50% { transform: translateY(-1px); filter: brightness(1.08); }
}

@keyframes tarotPotSheen {
    0%, 40% { transform: translateX(-120%); }
    55%, 100% { transform: translateX(140%); }
}

@keyframes tarotPotRoll {
    0% { transform: translateY(0) scale(1); filter: brightness(1); }
    50% { transform: translateY(-1px) scale(1.04); filter: brightness(1.16); }
    100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes tarotPulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
    50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
}

/* --- Mobile Shell Polish --- */


body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.04), transparent 26%);
    opacity: 0.8;
    z-index: 0;
}

#appWrapper,
#tabContainer {
    position: relative;
    z-index: 1;
}



/* Tarot Kingdom reference composition v2: rebuilt portrait battle screen */
body.tarot-kingdom-preview-body {
    background:
        radial-gradient(circle at 50% 18%, rgba(76, 37, 116, 0.18), transparent 42%),
        #020207;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 {
    --tk-v2-gold: #d8b75b;
    --tk-v2-gold-dark: #6e511a;
    --tk-v2-ink: #050409;
    box-sizing: border-box;
    width: min(100%, 640px);
    max-width: 640px;
    min-height: 0;
    margin: 0 auto;
    padding: 0;
    overflow-x: clip;
    background: var(--tk-v2-ink);
    box-shadow: 0 0 38px rgba(0, 0, 0, 0.86);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-combat-screen {
    display: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-combat-screen {
    display: block;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-header {
    top: 8px;
    left: 10px;
    width: min(52%, 310px);
    min-height: 48px;
    padding: 0 10px 3px;
    border-bottom: 1px solid rgba(210, 177, 79, 0.58);
    background: linear-gradient(90deg, rgba(1, 15, 21, 0.9), rgba(1, 15, 21, 0.28) 78%, transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active #tarotKingdomRound.tarot-kingdom-chip {
    font-size: clamp(14px, 3.9vw, 20px);
    line-height: 1.24;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active #tarotKingdomStateText.tarot-state-text {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage {
    width: 100%;
    margin: 0;
    border: 0;
    border-bottom: 2px solid #51411b;
    background: #090711;
    box-shadow: inset 0 -22px 26px rgba(0, 0, 0, 0.28);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
    position: relative;
    width: 100%;
    height: clamp(390px, 49svh, 510px);
    min-height: 0;
    overflow: hidden;
    background-color: #0a0713;
    background-image:
        var(--tarot-kingdom-battlefield-atmosphere, linear-gradient(180deg, rgba(3, 4, 12, 0.02) 48%, rgba(3, 3, 9, 0.12) 72%, rgba(1, 1, 5, 0.68) 100%)),
        var(--tarot-kingdom-battlefield-image, url("./assets/tarot-kingdom/moonlit-terrace-vertical-v3.png"));
    background-repeat: no-repeat;
    background-position: center center, var(--tarot-kingdom-battlefield-position, center center);
    background-size: cover, cover;
    image-rendering: auto;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-menu {
    z-index: 90;
    top: 12px;
    right: 12px;
    width: clamp(46px, 12vw, 60px);
    height: clamp(46px, 12vw, 60px);
    border: 3px solid #ead789;
    border-radius: 50%;
    color: #f3dea0;
    background: radial-gradient(circle at 35% 28%, #2cae83, #08745c 62%, #03493c);
    box-shadow: 0 0 0 2px #3b2c0d, 0 4px 8px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-menu > span:first-child {
    font-size: clamp(22px, 6vw, 31px);
    line-height: 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-menu-label {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    position: absolute;
    top: 0;
    bottom: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    left: 0;
    width: 55%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-side-heading {
    position: absolute;
    z-index: 35;
    top: 72px;
    left: 10px;
    display: flex;
    align-items: baseline;
    width: calc(100% - 14px);
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    text-shadow: 1px 2px 0 #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-eyebrow {
    color: #ff3939;
    font-size: 0;
    font-style: italic;
    font-weight: 900;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-eyebrow::after {
    content: none;
    font-size: inherit;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage #tarotKingdomEnemyName {
    overflow: hidden;
    color: #fff;
    font-size: clamp(12px, 3.3vw, 18px);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy > .tarot-kingdom-battle-hp {
    position: absolute;
    z-index: 35;
    top: 96px;
    left: 10px;
    width: calc(100% - 14px);
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-hp-label {
    height: 12px;
    color: #fff;
    font-size: 9px;
    line-height: 12px;
    text-shadow: 1px 1px 0 #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-hp-track {
    height: 9px;
    border: 2px solid #d8c98f;
    border-radius: 3px;
    background: #09070a;
    box-shadow: 0 0 0 1px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-hp-fill {
    background: linear-gradient(90deg, #ff2828, #ff6a16 58%, #ffc02c);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-enemy-affinities {
    position: absolute;
    z-index: 35;
    top: 124px;
    left: 10px;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    width: calc(100% - 14px);
    gap: 2px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-enemy-affinities > span {
    display: grid;
    place-items: center;
    min-width: 0;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid #bdc7dc;
    border-radius: 3px;
    color: #e8edf7;
    background: linear-gradient(180deg, #47526b, #1a2232);
    font-size: clamp(8px, 2.2vw, 12px);
    text-shadow: 1px 1px 0 #000;
    box-shadow: 0 2px 0 #0b1020;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-enemy-affinities > span.is-accent {
    border-color: #f3a598;
    background: linear-gradient(180deg, #8e4136, #48231f);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
    position: absolute;
    z-index: 20;
    right: 1%;
    bottom: 15px;
    left: 2%;
    height: 58%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    right: 0;
    width: 48%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-party-side > .tarot-kingdom-battle-side-heading {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleParty.tarot-kingdom-battle-party {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    position: absolute;
    right: 2px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(62px, 17vw, 84px);
    grid-template-areas: "info avatar";
    align-items: end;
    width: min(100%, 210px);
    min-height: clamp(64px, 16vw, 84px);
    gap: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(1) { top: 36%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(2) { top: 51%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(3) { top: 66%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(4) { top: 81%; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
    grid-area: avatar;
    align-self: end;
    justify-self: end;
    width: clamp(62px, 17vw, 84px);
    height: clamp(72px, 20vw, 98px);
    --avatar-combat-scale: 1.02;
    filter: drop-shadow(0 5px 2px #000) drop-shadow(0 0 4px rgba(153, 186, 255, 0.25));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar[data-facing="left"] {
    --avatar-facing-scale-x: -1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    grid-area: info;
    align-self: center;
    display: grid;
    min-width: 0;
    gap: 1px;
    padding: 0 2px 2px 0;
    overflow: visible;
    border: 0;
    background: none;
    opacity: 1;
    text-align: right;
    text-shadow: 1px 1px 0 #000, -1px 1px 0 #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-info {
    border: 0;
    background: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-header {
    display: block;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: clamp(8px, 2.2vw, 11px);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
    display: block;
    overflow: hidden;
    color: #f4e6a9;
    font-size: clamp(7px, 1.9vw, 9px);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
    height: 4px;
    border: 1px solid rgba(222, 220, 192, 0.75);
    background: rgba(0, 0, 0, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-status {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    gap: 0;
    overflow: visible;
    background: #050409;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-panel--trick {
    order: 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-panel--hand {
    order: 2;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-panel--players {
    order: 3;
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-panel--trick {
    --tk-v2-card-gap: clamp(3px, 1vw, 8px);
    box-sizing: border-box;
    min-height: 0;
    padding: 22px 5px 5px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid #443514;
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(19, 16, 25, 0.95), rgba(4, 3, 8, 0.99)),
        repeating-linear-gradient(90deg, transparent 0 38px, rgba(213, 181, 91, 0.03) 39px 40px);
    box-shadow: inset 0 1px 0 rgba(229, 204, 130, 0.12);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-panel--trick .tarot-kingdom-trick-title {
    position: absolute;
    z-index: 12;
    top: 2px;
    right: 5px;
    left: 5px;
    display: flex;
    min-height: 18px;
    padding: 0;
    border: 0;
    background: linear-gradient(90deg, rgba(4, 4, 9, 0.9), transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-panel--trick .tarot-kingdom-panel-heading {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-trick-status {
    width: 100%;
    gap: 3px;
    overflow: hidden;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-trick-status .tarot-kingdom-chip {
    min-height: 16px;
    padding: 1px 4px;
    border: 0;
    border-radius: 2px;
    color: #e9dba9;
    background: rgba(12, 12, 20, 0.82);
    font-size: 8px;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-card-stage {
    position: relative;
    box-sizing: border-box;
    width: min(100%, 610px);
    min-height: 0;
    margin: 0 auto;
    padding: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomTrick.tarot-kingdom-trick,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards.tarot-kingdom-selected-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    justify-content: stretch;
    box-sizing: border-box;
    width: 100%;
    min-height: 0;
    gap: var(--tk-v2-card-gap);
    margin: 0;
    padding: 0;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards.tarot-kingdom-selected-cards {
    position: absolute;
    z-index: 8;
    inset: 0;
    background: #050409;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards.is-empty {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: 0.61;
    margin: 0;
    border-radius: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    display: block;
    border: 2px solid #8b743c;
    background:
        radial-gradient(circle at 50% 43%, rgba(215, 173, 64, 0.2), transparent 27%),
        linear-gradient(135deg, transparent 46%, rgba(215, 173, 64, 0.16) 47% 50%, transparent 51%),
        linear-gradient(45deg, transparent 46%, rgba(215, 173, 64, 0.09) 47% 50%, transparent 51%),
        #121019;
    box-shadow: inset 0 0 0 2px #281d0b, 0 4px 7px rgba(0, 0, 0, 0.76);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card {
    border: 2px solid #e0c47d;
    transform: none;
    box-shadow: 0 0 0 1px #3d290b, 0 5px 8px #000;
    --tarot-card-number-size: 17px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(1.75);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-panel--hand {
    display: flex;
    flex-direction: column;
    padding: 0 5px 4px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(11, 10, 15, 0.99), rgba(4, 4, 8, 0.99)),
        repeating-linear-gradient(90deg, transparent 0 42px, rgba(211, 177, 82, 0.025) 43px 44px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedEffect.tarot-kingdom-selected-effect {
    order: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: min(calc(100% - 24px), 540px);
    min-height: 46px;
    margin: 5px auto 3px;
    padding: 7px 18px;
    border: 2px solid #d9b54d;
    border-radius: 3px;
    color: #ead89d;
    background: linear-gradient(90deg, #090703, #211707 50%, #090703);
    font-family: Georgia, "Yu Mincho", serif;
    font-size: clamp(13px, 3.5vw, 18px);
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    text-shadow: 1px 1px 0 #000;
    box-shadow: inset 0 0 0 1px #4e350a, 0 3px 5px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-panel--hand .tarot-kingdom-hand-title {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 .tarot-kingdom-hand-title .tarot-kingdom-panel-heading {
    color: #e1cc84;
    font-size: 8px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
    order: 3;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    box-sizing: border-box;
    width: min(100%, 610px);
    min-height: 0;
    margin: 0 auto;
    gap: clamp(3px, 0.8vw, 6px);
    padding: 2px 0 3px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 0.61;
    margin: 0;
    border: 2px solid #d7bd79;
    border-radius: 4px;
    --tarot-card-number-size: 14px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(1.5);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-selected {
    z-index: 12;
    border-color: #fff0a2;
    transform: translateY(-8px);
    box-shadow: 0 0 0 2px #d7ac35, 0 0 12px rgba(244, 199, 60, 0.62), 0 4px 5px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup.tarot-kingdom-action-popup,
#tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    position: relative;
    z-index: 20;
    order: 4;
    inset: auto;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 3px 0 0;
    padding: 5px 3px;
    border: 0;
    border-top: 1px solid #443514;
    border-radius: 0;
    background: linear-gradient(180deg, #15100a, #050408);
    box-shadow: none;
    transform: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup::before {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(5px, 1.5vw, 10px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions > button {
    min-width: 0;
    height: 52px;
    min-height: 52px;
    padding: 4px 2px;
    border: 3px solid #d9bd68;
    border-radius: 8px;
    color: #f4e2aa;
    background: linear-gradient(180deg, #9a6b12, #5e3c06);
    font-family: Georgia, "Yu Mincho", serif;
    font-size: clamp(10px, 2.9vw, 15px);
    font-weight: 800;
    line-height: 1.05;
    text-shadow: 1px 2px 0 #000;
    box-shadow: inset 0 0 0 2px #3e2a08, 0 3px 4px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions > button:first-of-type,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions > button:last-of-type {
    border-color: #e3ce82;
    background: linear-gradient(180deg, #138064, #075242);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active #tarotKingdomLog,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-panel--players {
    display: none;
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        height: clamp(380px, 49svh, 420px);
        min-height: 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: minmax(0, 1fr) 62px;
        min-height: 62px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        width: 62px;
        height: 72px;
        --avatar-combat-scale: 0.96;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art {
        transform: translate(-50%, -50%) scale(1.05);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.92);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions > button {
        height: 50px;
        min-height: 50px;
    }
}




#tabContainer {
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

.tab-content {
    padding-top: 6px;
}



button,
input,
select,
textarea {
    font-size: 16px;
}


input,
select,
textarea {
    border-radius: 14px;
}


.ship-exploration-panel {
    margin: 0 0 14px;
    padding: 14px;
    max-height: min(34vh, 260px);
    overflow-y: auto;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark.png") 30 fill / 12px / 0 stretch;
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%),
        linear-gradient(180deg, rgba(13, 18, 24, 0.94), rgba(4, 5, 7, 0.98));
}

#shipExplorationPanel.ship-exploration-panel.is-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 10050;
    width: min(460px, calc(100vw - 28px));
    max-height: min(78vh, 640px);
    margin: 0;
    padding: 0 16px 18px;
    transform: translate(-50%, -50%);
    overflow-y: auto;
    pointer-events: auto;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 30 fill / 12px / 0 stretch;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.62),
        0 18px 42px rgba(0, 0, 0, 0.62);
}

body.modal-lock #shipExplorationPanel.ship-exploration-panel.is-popup {
    pointer-events: auto;
}

body.home-exploration-popup-open #bottomNav {
    z-index: 10070;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.home-exploration-popup-open #tabContainer {
    z-index: 10060;
}

body.home-exploration-popup-open #globalStatusBar {
    pointer-events: none;
}

#shipExplorationPanel.ship-exploration-panel.is-popup > .home-exploration-popup-close {
    position: sticky;
    top: 8px;
    z-index: 6;
    display: block;
    margin: 10px -4px 8px auto;
}

.ship-exploration-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 224, 160, 0.14);
}

#shipExplorationPanel.ship-exploration-panel.is-popup .ship-exploration-head {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    margin: 0 -16px 12px;
    padding: 12px 12px 10px 16px;
    border-bottom-color: rgba(255, 224, 160, 0.22);
    background:
        linear-gradient(180deg, rgba(16, 11, 7, 0.98), rgba(7, 8, 11, 0.96)),
        radial-gradient(ellipse at 18% 0%, rgba(250, 204, 21, 0.14), transparent 42%);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.34);
}

#shipExplorationPanel.ship-exploration-panel.is-popup .ship-exploration-head h3 {
    grid-column: 1;
    grid-row: 1;
}

#shipExplorationPanel.ship-exploration-panel.is-popup .ship-exploration-head .ship-exploration-meta {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#shipExplorationPanel.ship-exploration-panel.is-popup .ship-exploration-head .home-exploration-popup-close {
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
    align-self: center;
}

.ship-exploration-head h3 {
    margin: 0;
    font-size: 18px;
    color: #ffe6a3;
    text-shadow: 0 1px 0 #000;
}

.ship-exploration-rescue-check {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 0 0 12px;
    padding: 10px 11px;
    border: 1px solid rgba(77, 221, 196, 0.42);
    border-radius: 7px;
    background:
        radial-gradient(circle at 12% 0%, rgba(83, 226, 201, 0.18), transparent 52%),
        linear-gradient(180deg, rgba(17, 78, 76, 0.84), rgba(7, 34, 41, 0.92));
    box-shadow:
        inset 0 1px 0 rgba(225, 255, 246, 0.12),
        0 6px 14px rgba(0, 0, 0, 0.25);
}

.ship-exploration-settings {
    margin: 0 0 10px;
    border: 1px solid rgba(226, 190, 111, 0.34);
    border-radius: 7px;
    background: rgba(15, 11, 8, 0.72);
    color: #f8e8bf;
}

.ship-exploration-settings summary {
    padding: 9px 11px;
    color: #ffe6a3;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.15;
    cursor: pointer;
}

.ship-exploration-settings fieldset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 0;
    padding: 0 9px 9px;
    border: 0;
}

.ship-exploration-settings legend {
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 5px;
    color: #cdbb91;
    font-size: 11px;
}

.ship-exploration-settings label {
    min-width: 0;
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 34px;
    padding: 6px 7px;
    border: 1px solid rgba(226, 190, 111, 0.24);
    border-radius: 5px;
    background: rgba(255, 240, 199, 0.05);
    color: #fff6dc;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
}

.ship-exploration-settings input {
    flex: 0 0 auto;
    accent-color: #d5a43c;
}

.ship-exploration-raid {
    position: relative;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 112px;
    margin: 0 0 12px;
    padding: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 99, 71, 0.55);
    border-radius: 8px;
    background:
        radial-gradient(circle at 16% 40%, rgba(178, 24, 43, 0.28), transparent 34%),
        linear-gradient(135deg, rgba(58, 8, 17, 0.96), rgba(14, 8, 17, 0.96));
    box-shadow:
        inset 0 1px 0 rgba(255, 202, 173, 0.12),
        0 8px 18px rgba(0, 0, 0, 0.34);
}

.ship-exploration-raid-visual {
    position: relative;
    width: 92px;
    height: 92px;
}

.ship-exploration-raid-visual .exploration-pixel-monster {
    position: absolute;
    left: 50%;
    bottom: var(--exploration-monster-result-bottom, 4px);
    transform:
        translateX(calc(-50% + var(--exploration-monster-anchor-offset-x, 0px)))
        scale(var(--exploration-monster-scale, 1)) !important;
}

.ship-exploration-raid-body {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.ship-exploration-raid-kicker {
    color: #ff806d;
    font-size: 10px;
    font-weight: 1000;
    letter-spacing: 0.12em;
}

.ship-exploration-raid-body strong {
    color: #fff1d2;
    font-size: 16px;
    line-height: 1.15;
    text-shadow: 0 2px 0 #000;
}

.ship-exploration-raid-body small {
    color: #dbc6ba;
    font-size: 10px;
    line-height: 1.2;
}

.ship-exploration-raid-hp {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 218, 186, 0.46);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.7);
}

.ship-exploration-raid-hp span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8f0718, #ff394d 68%, #ff8b69);
    box-shadow: 0 0 8px rgba(255, 53, 75, 0.68);
}

.ship-exploration-raid > button {
    min-width: 72px;
    min-height: 42px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 9px / 0 stretch;
    background: linear-gradient(180deg, rgba(181, 32, 48, 0.42), rgba(65, 6, 18, 0.38));
    color: #fff5e6;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
}

.ship-exploration-raid > button:disabled {
    opacity: 0.48;
}

.ship-exploration-rescue-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.ship-exploration-rescue-copy strong {
    color: #effff8;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.15;
}

.ship-exploration-rescue-copy span {
    overflow: hidden;
    color: #a9ddd3;
    font-size: 11px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ship-exploration-rescue-check button {
    min-width: 112px;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 9px / 0 stretch;
    background: linear-gradient(180deg, rgba(54, 182, 164, 0.28), rgba(5, 48, 54, 0.3));
    color: #effff8;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
    text-shadow: 0 2px 0 rgba(0, 25, 28, 0.88);
}

@media (max-width: 420px) {
    .ship-exploration-raid {
        grid-template-columns: 76px minmax(0, 1fr) 64px;
        gap: 7px;
        min-height: 96px;
        padding: 8px;
    }

    .ship-exploration-raid-visual {
        width: 76px;
        height: 78px;
    }

    .ship-exploration-raid-visual .exploration-pixel-monster {
        bottom: var(--exploration-monster-compact-result-bottom, 4px);
        transform:
            translateX(calc(-50% + var(--exploration-monster-compact-anchor-offset-x, 0px)))
            scale(var(--exploration-monster-compact-scale, 1)) !important;
    }

    .ship-exploration-raid > button {
        min-width: 64px;
        padding-inline: 5px;
        font-size: 11px;
    }

    .ship-exploration-rescue-check {
        gap: 7px;
        padding: 9px;
    }

    .ship-exploration-rescue-check button {
        min-width: 104px;
        padding-inline: 7px;
        font-size: 11px;
    }
}

.ship-exploration-empty,
.ship-exploration-meta {
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.5;
}

.ship-exploration-load-error {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(205, 160, 83, 0.55);
    border-radius: 6px;
    background: rgba(17, 10, 7, 0.76);
    color: #f2d7aa;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.ship-exploration-load-error button {
    min-height: 38px;
    border: 9px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 9px / 0 stretch;
    background: transparent;
    color: #211208;
    font: inherit;
    font-weight: 900;
}

.ship-exploration-loading {
    padding: 14px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-parchment.png") 34 fill / 12px / 0 stretch;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 238, 190, 0.32), rgba(111, 64, 27, 0.12)),
        repeating-linear-gradient(0deg, rgba(88, 47, 20, 0.06) 0 1px, transparent 1px 10px);
    color: #27160b;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.ship-exploration-loading-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.ship-exploration-loading-head strong {
    display: block;
    color: #2a1608;
    font-size: 14px;
    line-height: 1.3;
}

.ship-exploration-loading-head span:last-child {
    display: block;
    margin-top: 3px;
    color: #68421f;
    font-size: 12px;
    font-weight: 800;
}

.ship-exploration-loading-compass {
    width: 46px;
    height: 46px;
    position: relative;
    display: grid;
    place-items: center;
    border: 1px solid rgba(94, 55, 24, 0.24);
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 251, 235, 0.92), rgba(225, 177, 94, 0.5)),
        conic-gradient(from 45deg, rgba(146, 64, 14, 0.32), transparent 18%, rgba(146, 64, 14, 0.32) 50%, transparent 68%);
    box-shadow: inset 0 0 0 4px rgba(255, 251, 235, 0.48);
}

.ship-exploration-loading-compass::before {
    content: "";
    width: 4px;
    height: 20px;
    border-radius: 999px;
    background: #8a3f16;
    transform-origin: 50% 80%;
    animation: ship-exploration-loading-sweep 1.4s ease-in-out infinite;
}

.ship-exploration-loading-route {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 13px;
}

.ship-exploration-loading-route span,
.ship-exploration-loading-lines i {
    display: block;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(120, 72, 32, 0.18);
}

.ship-exploration-loading-route span {
    height: 8px;
}

.ship-exploration-loading-lines {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.ship-exploration-loading-lines i {
    height: 10px;
}

.ship-exploration-loading-lines i:nth-child(1) { width: 92%; }
.ship-exploration-loading-lines i:nth-child(2) { width: 76%; }
.ship-exploration-loading-lines i:nth-child(3) { width: 84%; }

.ship-exploration-loading-route span::after,
.ship-exploration-loading-lines i::after {
    content: "";
    display: block;
    width: 42%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 248, 220, 0.75), transparent);
    animation: ship-exploration-loading-shimmer 1.15s ease-in-out infinite;
}

@keyframes ship-exploration-loading-sweep {
    0%, 100% { transform: rotate(-34deg); }
    50% { transform: rotate(34deg); }
}

@keyframes ship-exploration-loading-shimmer {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(260%); }
}

@media (prefers-reduced-motion: reduce) {
    .ship-exploration-loading-compass::before,
    .ship-exploration-loading-route span::after,
    .ship-exploration-loading-lines i::after {
        animation: none;
    }
}

.ship-exploration-destinations {
    display: grid;
    gap: 10px;
}

.ship-exploration-destination {
    padding: 12px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-parchment.png") 34 fill / 12px / 0 stretch;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 238, 190, 0.32), rgba(111, 64, 27, 0.12)),
        repeating-linear-gradient(0deg, rgba(88, 47, 20, 0.06) 0 1px, transparent 1px 10px);
    color: #27160b;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.ship-exploration-destination.is-active {
    border-image-source: url("./assets/ui/panels/panel-dark-gold.png");
    background:
        linear-gradient(180deg, rgba(28, 19, 11, 0.88), rgba(6, 8, 12, 0.92)),
        radial-gradient(ellipse at 50% 0%, rgba(250, 204, 21, 0.14), transparent 56%);
    color: #f8fafc;
}

.ship-exploration-destination.is-locked {
    opacity: 0.78;
}

.ship-exploration-card-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.ship-exploration-mapmark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(94, 55, 24, 0.22);
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 50% 38%, rgba(255, 251, 235, 0.56), transparent 58%),
        rgba(93, 51, 21, 0.18);
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-size: 26px;
    line-height: 1;
    overflow: hidden;
}

.ship-exploration-mapmark.has-image img {
    display: block;
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.2));
}

.ship-exploration-title-group {
    min-width: 0;
}

.ship-exploration-destination .ship-exploration-meta {
    color: #5d3b1c;
}

.ship-exploration-destination.is-active .ship-exploration-meta {
    color: #cbd5e1;
}

.ship-exploration-destination strong {
    display: block;
    margin-bottom: 4px;
    color: #2a1608;
    font-size: 15px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ship-exploration-destination.is-active strong {
    color: #fff1bd;
}

.ship-exploration-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.ship-exploration-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(94, 55, 24, 0.22);
    border-radius: 999px;
    background: rgba(255, 250, 221, 0.5);
    color: #41250e;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.ship-exploration-destination.is-active .ship-exploration-badge {
    border-color: rgba(255, 224, 160, 0.22);
    background: rgba(15, 23, 42, 0.56);
    color: #fde68a;
}

.ship-exploration-badge.is-active {
    color: #bbf7d0;
}

.ship-exploration-badge.is-free {
    border-color: rgba(22, 163, 74, 0.28);
    background: rgba(187, 247, 208, 0.54);
    color: #14532d;
}

.ship-exploration-badge.is-item {
    border-color: rgba(124, 58, 237, 0.24);
    background: rgba(237, 233, 254, 0.66);
    color: #5b21b6;
}

.ship-exploration-badge.is-rarity-low {
    border-color: rgba(14, 165, 233, 0.3);
    background: rgba(186, 230, 253, 0.52);
    color: #075985;
}

.ship-exploration-badge.is-rarity-medium {
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(254, 243, 199, 0.7);
    color: #92400e;
}

.ship-exploration-badge.is-rarity-high {
    border-color: rgba(185, 28, 28, 0.28);
    background: rgba(254, 202, 202, 0.58);
    color: #991b1b;
}

.ship-exploration-badge.is-level {
    border-color: rgba(79, 70, 229, 0.24);
    background: rgba(224, 231, 255, 0.64);
    color: #3730a3;
}

.ship-exploration-badge.is-locked {
    border-color: rgba(71, 85, 105, 0.26);
    background: rgba(226, 232, 240, 0.7);
    color: #334155;
}

.ship-exploration-role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ship-exploration-role-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    max-width: 100%;
    padding: 3px 7px;
    border: 1px solid rgba(94, 55, 24, 0.18);
    border-radius: 8px;
    background: rgba(255, 251, 235, 0.46);
    color: #3f2410;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.ship-exploration-role-chip.is-role {
    border-color: rgba(37, 99, 235, 0.22);
    color: #1e3a8a;
}

.ship-exploration-role-chip.is-slot {
    border-color: rgba(15, 118, 110, 0.22);
    color: #115e59;
}

.ship-exploration-role-chip.is-risk {
    border-color: rgba(217, 119, 6, 0.26);
    color: #92400e;
}

.ship-exploration-role-chip.is-reward {
    border-color: rgba(22, 163, 74, 0.24);
    color: #166534;
}

.ship-exploration-role-chip.is-boss {
    border-color: rgba(185, 28, 28, 0.22);
    color: #991b1b;
}

.ship-exploration-boss-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
}

.ship-exploration-boss-list.is-single {
    grid-template-columns: 1fr;
}

.ship-exploration-boss-chip {
    min-width: 0;
    min-height: 72px;
    display: grid;
    grid-template-rows: 34px auto auto;
    justify-items: center;
    align-content: center;
    gap: 2px;
    padding: 6px 4px;
    border: 1px solid rgba(94, 55, 24, 0.2);
    border-radius: 8px;
    background: rgba(255, 251, 235, 0.42);
    text-align: center;
}

.ship-exploration-boss-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.28));
    overflow: hidden;
}

.ship-exploration-boss-image {
    width: 100%;
    height: 100%;
}

.exploration-pixel-monster {
    display: block;
    flex: 0 0 auto;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    transform-origin: center bottom;
    filter: drop-shadow(0 8px 7px rgba(0, 0, 0, 0.42));
}

.ship-exploration-boss-chip b {
    min-width: 28px;
    padding: 1px 6px;
    border-radius: 999px;
    color: #fff7ed;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.25;
}

.ship-exploration-boss-chip span:last-child {
    max-width: 100%;
    color: #321b0a;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ship-exploration-boss-chip.is-weak b { background: #15803d; }
.ship-exploration-boss-chip.is-medium b { background: #c2410c; }
.ship-exploration-boss-chip.is-strong b { background: #b91c1c; }
.ship-exploration-boss-chip.is-unknown b { background: #475569; }

.ship-exploration-boss-chip.is-weak {
    border-color: rgba(34, 197, 94, 0.28);
}

.ship-exploration-boss-chip.is-medium {
    border-color: rgba(249, 115, 22, 0.3);
}

.ship-exploration-boss-chip.is-strong {
    border-color: rgba(239, 68, 68, 0.32);
}

.ship-exploration-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.ship-exploration-actions button,
.ship-exploration-start {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    margin-top: 10px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.28), rgba(109, 58, 11, 0.2)),
        linear-gradient(180deg, #e7b64b, #9c5c1e);
    color: #211208;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255, 236, 179, 0.5);
}

.ship-exploration-actions button:disabled,
.ship-exploration-start:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.24);
}

.ship-exploration-actions .ship-exploration-retreat {
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    background:
        linear-gradient(180deg, rgba(210, 225, 236, 0.12), rgba(8, 15, 25, 0.28)),
        linear-gradient(180deg, #344455, #131d29);
    color: #f4f7fb;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.ship-exploration-start.is-loading {
    cursor: wait;
    filter: saturate(0.72) brightness(0.92);
}

.ship-exploration-payment-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(8, 13, 24, 0.72);
}

.ship-exploration-payment-dialog {
    width: min(94vw, 430px);
    max-height: min(82vh, 620px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 12px;
    padding: 14px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 34 fill / 14px / 0 stretch;
    border-radius: 8px;
    color: #f8fafc;
    background:
        linear-gradient(180deg, rgba(30, 20, 12, 0.94), rgba(9, 13, 20, 0.96)),
        radial-gradient(ellipse at 50% 0%, rgba(250, 204, 21, 0.15), transparent 58%);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
}

.ship-exploration-payment-head {
    display: grid;
    gap: 4px;
}

.ship-exploration-payment-head strong {
    color: #fff1bd;
    font-size: 16px;
    line-height: 1.25;
}

.ship-exploration-payment-head span,
.ship-exploration-payment-summary {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

.ship-exploration-payment-summary {
    display: grid;
    gap: 6px;
}

.ship-exploration-payment-effects {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ship-exploration-payment-effects span {
    padding: 3px 7px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 999px;
    color: #bfdbfe;
    background: rgba(14, 116, 144, 0.18);
    font-size: 11px;
    line-height: 1.2;
}

.ship-exploration-payment-list {
    display: grid;
    gap: 8px;
    overflow-y: auto;
    padding-right: 2px;
}

.ship-exploration-payment-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 92px;
    gap: 8px;
    align-items: center;
    min-height: 56px;
    padding: 7px;
    border: 1px solid rgba(255, 224, 160, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.56);
}

.ship-exploration-payment-item-image {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 251, 235, 0.12);
    overflow: hidden;
}

.ship-exploration-payment-item-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ship-exploration-payment-item-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.ship-exploration-payment-item-copy strong {
    color: #fff7ed;
    font-size: 12px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ship-exploration-payment-item-copy span {
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
}

.ship-exploration-payment-stepper {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 4px;
}

.ship-exploration-payment-stepper button,
.ship-exploration-payment-buttons button {
    min-height: 30px;
    border: 1px solid rgba(255, 224, 160, 0.2);
    border-radius: 8px;
    background: rgba(250, 204, 21, 0.18);
    color: #fff7ed;
    font-weight: 900;
}

.ship-exploration-payment-stepper button:disabled,
.ship-exploration-payment-buttons button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ship-exploration-payment-stepper span {
    color: #fde68a;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
}

.ship-exploration-payment-buttons {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

@media (max-width: 420px) {
    .ship-exploration-payment-buttons {
        grid-template-columns: 1fr;
    }

    .ship-exploration-payment-item {
        grid-template-columns: 40px minmax(0, 1fr) 88px;
    }
}

/* Tarot Kingdom fixed exploration stages */
.ship-exploration-stage {
    overflow: hidden;
}

.ship-exploration-stage-label {
    display: block;
    color: #e5bd63;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.ship-exploration-stage-monsters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin-top: 9px;
    padding: 6px;
    border: 1px solid rgba(88, 49, 19, 0.2);
    border-radius: 7px;
    background:
        linear-gradient(180deg, rgba(255, 248, 218, 0.34), rgba(76, 43, 19, 0.1));
}

.ship-exploration-stage-monster {
    min-width: 0;
    display: grid;
    grid-template-rows: 48px auto;
    justify-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    color: inherit;
    font: inherit;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ship-exploration-stage-monster:active {
    background: rgba(76, 43, 19, 0.12);
}

.ship-exploration-stage-monster:focus-visible {
    outline: 2px solid #c79c47;
    outline-offset: 1px;
}

.ship-exploration-stage-monster-visual {
    position: relative;
    width: 100%;
    height: 48px;
    overflow: hidden;
}

.ship-exploration-stage-monster-sprite {
    position: absolute;
    z-index: 1;
    bottom: var(--exploration-monster-compact-result-bottom, 4px);
    left: 50%;
    transform-origin: center bottom;
    transform:
        translateX(calc(-50% + var(--exploration-monster-compact-anchor-offset-x, 0px)))
        scale(var(--exploration-monster-compact-scale, 1)) !important;
}

.ship-exploration-stage-monster.is-silhouette .ship-exploration-stage-monster-sprite {
    opacity: 0.74;
    filter:
        brightness(0)
        saturate(0)
        drop-shadow(0 3px 2px rgba(0, 0, 0, 0.54));
}

.ship-exploration-stage-monster.is-revealed .ship-exploration-stage-monster-sprite {
    filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.38));
}

.ship-exploration-stage-monster-defeat {
    position: absolute;
    top: 0;
    right: 1px;
    z-index: 3;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 1px solid #f7dca1;
    border-radius: 50%;
    background: #9f241f;
    color: #fff8df;
    font-family: serif;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 0 #3a0806;
    box-shadow: 0 2px 4px rgba(42, 11, 7, 0.46);
    transform: rotate(-8deg);
}

.ship-exploration-stage-monster-name {
    width: 100%;
    overflow: hidden;
    color: #4b2b15;
    font-size: 9px;
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ship-exploration-stage-monster.is-silhouette .ship-exploration-stage-monster-name {
    color: #695642;
    letter-spacing: 0.06em;
}

/* Monster detail: opened from a monster in a stage's list */
.ship-exploration-monster-detail {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 10px;
}

.ship-exploration-monster-detail-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ship-exploration-monster-detail-head strong {
    color: #fff1bd;
    font-size: 17px;
    line-height: 1.25;
}

.ship-exploration-monster-detail-badge {
    padding: 2px 7px;
    border-radius: 999px;
    color: #fff8df;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    background: #9f241f;
}

.ship-exploration-monster-detail-badge.is-defeated {
    background: #4b5563;
}

.ship-exploration-monster-detail-stage {
    position: relative;
    height: 118px;
    overflow: hidden;
    border: 1px solid rgba(211, 179, 102, 0.28);
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 50% 92%, rgba(0, 0, 0, 0.38) 0 22%, transparent 23%),
        linear-gradient(180deg, rgba(57, 45, 30, 0.6), rgba(22, 18, 14, 0.85));
}

.ship-exploration-monster-detail-sprite {
    position: absolute;
    bottom: var(--exploration-monster-result-bottom, 6px);
    left: 50%;
    transform-origin: center bottom;
}

.ship-exploration-monster-detail-stage.is-silhouette .ship-exploration-monster-detail-sprite {
    opacity: 0.8;
    filter: brightness(0) saturate(0);
}

.ship-exploration-monster-detail-body {
    min-height: 0;
    overflow-y: auto;
}

.ship-exploration-monster-detail-look {
    margin: 0 0 8px;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.5;
}

.ship-exploration-monster-detail-stats {
    display: grid;
    gap: 5px;
    margin: 0;
}

.ship-exploration-monster-detail-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(211, 179, 102, 0.16);
}

.ship-exploration-monster-detail-row dt {
    color: #d3b366;
    font-size: 11px;
    font-weight: 900;
}

.ship-exploration-monster-detail-row dd {
    min-width: 0;
    margin: 0;
    color: #f8fafc;
    font-size: 13px;
    line-height: 1.45;
}

.ship-exploration-monster-detail-row small {
    display: block;
    color: #cbd5e1;
    font-size: 11px;
}

.ship-exploration-monster-element {
    display: inline-block;
    min-width: 28px;
    padding: 1px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    background: #6b7280;
}

/* the Kingdom card colors of each element's suit: Wand red, Cup blue, Sword purple, Pentacle green */
.ship-exploration-monster-element.is-fire {
    background: #b83a31;
}

.ship-exploration-monster-element.is-water {
    background: #2f6fae;
}

.ship-exploration-monster-element.is-wind {
    background: #7d55c9;
}

.ship-exploration-monster-element.is-earth {
    background: #2e8556;
}

.ship-exploration-monster-element.is-light {
    color: #3b2f05;
    background: #facc15;
}

/* darker than wind's purple so the two read apart */
.ship-exploration-monster-element.is-dark {
    border: 1px solid #8048b8;
    background: #2c1a4a;
}

/* the weather's element power, in the same element colors, beside the enemy's name */
.tarot-kingdom-weather-element-badge {
    display: flex;
    flex: none;
    gap: 3px;
    align-self: center;
}

.tarot-kingdom-weather-element-badge[hidden] {
    display: none;
}

.tarot-kingdom-weather-element {
    padding: 0 5px;
    border: 1px solid rgb(255 255 255 / 45%);
    border-radius: 999px;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.4;
    background: #6b7280;
}

.tarot-kingdom-weather-element.is-fire {
    background: #b83a31;
}

.tarot-kingdom-weather-element.is-water {
    background: #2f6fae;
}

.tarot-kingdom-weather-element.is-wind {
    background: #7d55c9;
}

.tarot-kingdom-weather-element.is-earth {
    background: #2e8556;
}

.ship-exploration-monster-detail-close {
    min-height: 40px;
    border: 1px solid #c79c47;
    border-radius: 8px;
    color: #fff3c4;
    font: inherit;
    font-weight: 900;
    background: rgba(94, 67, 18, 0.5);
}

.ship-exploration-stage-supply-slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}

.ship-exploration-stage-supply-slots span {
    min-width: 0;
    padding: 6px 4px;
    overflow: hidden;
    border: 1px dashed rgba(211, 179, 102, 0.35);
    color: #8d846f;
    font-size: 10px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ship-exploration-stage-supply-slots span.is-filled {
    border-style: solid;
    border-color: #c79c47;
    color: #f0dfaa;
    background: rgba(94, 67, 18, 0.24);
}

@media (min-width: 521px) {
    .ship-exploration-stage-monster-sprite {
        bottom: var(--exploration-monster-result-bottom, 5px);
        transform:
            translateX(calc(-50% + var(--exploration-monster-anchor-offset-x, 0px)))
            scale(var(--exploration-monster-scale, 1)) !important;
    }
}

body[data-tarot-kingdom-atmosphere-tone="tropical-wilds"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(23, 76, 50, 0.04) 34%, rgba(33, 96, 61, 0.12) 67%, rgba(5, 19, 13, 0.5) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="sunlit-coral"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(74, 159, 196, 0.03) 28%, rgba(228, 168, 83, 0.08) 65%, rgba(14, 43, 52, 0.42) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="open-sea"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(61, 137, 183, 0.04) 27%, rgba(31, 88, 121, 0.1) 65%, rgba(4, 27, 42, 0.54) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="moonlit-gothic"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(70, 40, 121, 0.04) 28%, rgba(53, 32, 96, 0.1) 64%, rgba(7, 4, 19, 0.62) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="verdant-ruins"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(26, 100, 63, 0.05) 29%, rgba(71, 113, 43, 0.16) 66%, rgba(5, 27, 16, 0.58) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="poison-mist"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(54, 11, 75, 0.04) 34%, rgba(55, 110, 46, 0.14) 67%, rgba(12, 15, 8, 0.62) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="siege"] #tarotKingdomRoot .tarot-kingdom-battle-arena,
body[data-tarot-kingdom-atmosphere-tone="storm-machinery"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(24, 31, 49, 0.05) 34%, rgba(70, 53, 32, 0.12) 68%, rgba(3, 5, 11, 0.64) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="arcane-blue"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(4, 48, 116, 0.05) 30%, rgba(16, 87, 154, 0.13) 68%, rgba(1, 7, 28, 0.64) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="infernal-red"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(90, 9, 9, 0.05) 30%, rgba(135, 37, 8, 0.16) 67%, rgba(23, 2, 3, 0.7) 100%) !important;
}

body[data-tarot-kingdom-atmosphere-tone="final-eclipse"] #tarotKingdomRoot .tarot-kingdom-battle-arena {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(29, 4, 61, 0.08) 27%, rgba(65, 12, 91, 0.18) 64%, rgba(4, 1, 12, 0.76) 100%) !important;
}

.sheet-handle {
    width: 42px;
    height: 5px;
    margin: 4px auto 14px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.52);
}

.item-detail-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.item-detail-icon-frame {
    width: 72px;
    height: 108px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96)),
        rgba(2, 6, 23, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.item-detail-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

#itemDetailIcon {
    width: 48px;
    height: 80px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    flex: 0 0 auto;
}

#itemDetailName {
    margin: 0;
    color: var(--accent-color);
    font-size: 18px;
    line-height: 1.25;
}

#itemDetailCategory {
    margin: 0;
    font-size: 12px;
    color: var(--text-sub);
}

#itemDetailDescription {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.22);
    font-size: 14px;
    line-height: 1.65;
}

#itemDetailStats {
    margin: 0 0 18px;
    font-weight: 700;
    line-height: 1.7;
}

.player-profile-sheet {
    gap: 0;
}

.player-profile-head {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.player-profile-avatar-shell {
    width: 112px;
    min-width: 112px;
    height: 128px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background:
        radial-gradient(circle at top, rgba(251, 191, 36, 0.12), transparent 52%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(9, 14, 24, 0.98));
    overflow: hidden;
}

#playerProfileAvatar.player-profile-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0;
    transform: translateY(7px) scale(1.18);
    transform-origin: center center;
    image-rendering: pixelated;
}

.player-profile-ship {
    width: 92px;
    min-height: 112px;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(250, 204, 21, 0.28);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.58);
}

.player-profile-ship:empty {
    display: none;
}

.player-profile-ship-icon {
    width: 64px;
    height: 64px;
    background: url("./Sprites/Ships/ships.png") var(--player-ship-sprite-x, -64px) 0 / 2048px 1024px no-repeat;
    image-rendering: pixelated;
}

.player-profile-ship-icon.is-boat { --player-ship-sprite-x: -64px; }
.player-profile-ship-icon.is-explorer { --player-ship-sprite-x: -448px; }
.player-profile-ship-icon.is-defender { --player-ship-sprite-x: -832px; }
.player-profile-ship-icon.is-fighter { --player-ship-sprite-x: -1216px; }
.player-profile-ship-icon.is-merchant { --player-ship-sprite-x: -1600px; }
.player-profile-ship-icon.is-guild {
    --guild-hull-frame-x: -64px;
    --guild-sail-frame-x: -64px;
    --guild-top-y: -64px;
    position: relative;
    overflow: hidden;
    background: none;
}

.player-profile-ship-name {
    color: #fde68a;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.player-profile-ship-meta {
    color: var(--text-sub);
    font-size: 10px;
}

#playerProfileName {
    margin: 0;
    color: var(--accent-color);
    font-size: 18px;
    line-height: 1.25;
}

#playerProfileNation {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
}

#playerProfileMeta {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-sub);
    word-break: break-all;
}

.player-profile-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.player-profile-action-btn {
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.18);
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.92), rgba(120, 53, 15, 0.98));
    color: #fff7ed;
    font-size: 12px;
    font-weight: 800;
}

.player-profile-action-btn.player-profile-action-btn-secondary {
    border-color: rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.98));
    color: #e2e8f0;
}

.player-profile-action-btn.is-active {
    border-color: rgba(250, 204, 21, 0.5);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.14), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.player-profile-action-btn[disabled] {
    opacity: 0.56;
}

.player-profile-transfer-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(8, 15, 29, 0.62);
}

.player-profile-transfer-title {
    font-size: 12px;
    font-weight: 800;
    color: #f8fafc;
}

.player-profile-transfer-quick-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.player-profile-transfer-quick-btn {
    min-height: 34px;
    padding: 6px 4px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.78);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 800;
}

.player-profile-transfer-quick-btn.reset {
    color: #94a3b8;
}

.player-profile-transfer-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.72);
}

.player-profile-transfer-input-row input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: #f8fafc;
    font-size: 16px;
    font-weight: 800;
}

.player-profile-transfer-input-row span {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

.player-profile-transfer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.player-profile-transfer-submit,
.player-profile-transfer-cancel {
    min-height: 40px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
}

.player-profile-transfer-submit {
    border: 1px solid rgba(125, 211, 252, 0.34);
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.92), rgba(2, 132, 199, 0.96));
    color: #eff6ff;
}

.player-profile-transfer-cancel {
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.82);
    color: #cbd5e1;
}

.player-profile-equipment {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.player-profile-equip-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(8, 15, 29, 0.58);
}

.player-profile-equip-row span {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
}

.player-profile-equip-row strong {
    min-width: 0;
    font-size: 13px;
    color: #f8fafc;
    line-height: 1.5;
    word-break: break-word;
}

.player-profile-empty {
    padding: 14px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.6;
    background: rgba(8, 15, 29, 0.34);
}

#itemDetailButtons {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
}

#itemDetailButtons button {
    width: 100%;
}

.item-detail-close {
    width: 100%;
    margin-top: 8px;
    background: #4b5563;
}

.item-detail-action-note {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    text-align: left;
    font-size: 12px;
    line-height: 1.5;
    color: #dbeafe;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

#battleModal.melee-battle-overlay {
    align-items: center;
    justify-content: center;
    padding: calc(10px + var(--safe-top)) 10px calc(10px + var(--safe-bottom));
    background: linear-gradient(180deg, rgba(5, 8, 14, 0.9), rgba(2, 6, 12, 0.96));
}

#battleModal .melee-battle-shell {
    width: min(96vw, 840px);
    max-width: 840px;
    max-height: min(94dvh, 780px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 14px / 0 stretch;
    border-radius: 0;
    color: #f8fafc;
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.56);
}

.melee-battle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 50px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 11px / 0 stretch;
}

.melee-battle-kicker {
    color: #f8d888;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.melee-battle-title-block h2 {
    margin: 0;
    color: #fff7d6;
    font-size: 22px;
    line-height: 1.1;
    letter-spacing: 0;
}

.melee-battle-mode {
    flex: 0 0 auto;
    min-width: 58px;
    padding: 7px 9px;
    text-align: center;
    color: #27160b;
    font-size: 11px;
    font-weight: 900;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 9px / 0 stretch;
}

#battleStage.melee-battle-stage {
    flex: 0 0 auto;
    min-height: clamp(390px, 58dvh, 520px);
    display: block;
    padding: 0;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-navy-wide.png") 34 / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(2, 7, 12, 0.08) 0%, rgba(7, 18, 24, 0.16) 42%, rgba(19, 12, 6, 0.72) 100%),
        linear-gradient(90deg, rgba(44, 12, 18, 0.34), transparent 28%, transparent 72%, rgba(10, 36, 32, 0.3)),
        url("./Sprites/background/deck.webp") center bottom / auto 150% no-repeat;
    box-shadow:
        inset 0 0 0 1px rgba(255, 240, 180, 0.08),
        inset 0 -64px 120px rgba(0, 0, 0, 0.54),
        0 18px 52px rgba(0, 0, 0, 0.44);
}

#battleStage.melee-battle-stage.is-damage-shake {
    animation: meleeDamageShake var(--melee-shake-duration, 260ms) cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#battleStage.melee-battle-stage::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 47%;
    z-index: 4;
    width: min(150px, 18%);
    height: 78%;
    display: none;
    place-items: center;
    transform: translate(-50%, -50%);
    border-left: 0;
    background:
        linear-gradient(90deg, transparent, rgba(248, 216, 136, 0.14), transparent),
        linear-gradient(180deg, transparent, rgba(248, 216, 136, 0.24), transparent);
    opacity: 0.88;
    pointer-events: none;
}

@keyframes meleeDamageShake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    18% { transform: translate3d(calc(var(--melee-shake-x, 5px) * -1), var(--melee-shake-y, 1px), 0); }
    36% { transform: translate3d(var(--melee-shake-x, 5px), calc(var(--melee-shake-y, 1px) * -1), 0); }
    54% { transform: translate3d(calc(var(--melee-shake-x, 5px) * -0.62), 0, 0); }
    72% { transform: translate3d(calc(var(--melee-shake-x, 5px) * 0.62), var(--melee-shake-y, 1px), 0); }
}

#battleStage.melee-battle-stage.is-camera-hit-zoom {
    animation: meleeCameraHitZoom 260ms cubic-bezier(0.22, 0.8, 0.32, 1) both;
}

#battleStage.melee-battle-stage.is-camera-hit-zoom-crit {
    animation: meleeCameraHitZoomCrit 420ms cubic-bezier(0.18, 0.85, 0.28, 1) both;
}

@keyframes meleeCameraHitZoom {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.045); }
    100% { transform: scale(1); }
}

@keyframes meleeCameraHitZoomCrit {
    0%   { transform: translate3d(0,0,0) scale(1); }
    12%  { transform: translate3d(-6px,1px,0) scale(1.09); }
    28%  { transform: translate3d(6px,-1px,0) scale(1.06); }
    46%  { transform: translate3d(-3px,0,0) scale(1.02); }
    70%  { transform: translate3d(2px,1px,0) scale(1); }
    100% { transform: translate3d(0,0,0) scale(1); }
}

#battleStage.melee-battle-stage.is-camera-hit-zoom-crit::before {
    display: grid;
    background: radial-gradient(circle at center, rgba(255,238,180,0.55), transparent 70%);
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    transform: none;
    animation: meleeCritFlash 420ms ease-out both;
}

@keyframes meleeCritFlash {
    0%   { opacity: 0; }
    12%  { opacity: 1; }
    100% { opacity: 0; }
}

#battleStage.melee-battle-stage::after {
    content: "";
    position: absolute;
    inset: 8px;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 54%, rgba(0, 0, 0, 0.3));
    box-shadow:
        inset 0 0 46px rgba(0, 0, 0, 0.48),
        inset 0 0 0 1px rgba(255, 240, 180, 0.08);
}

.battle-player-area.melee-combatant {
    width: calc(50% + 28px);
    height: 100%;
    min-width: 0;
    position: absolute;
    top: 0;
    bottom: 0;
    display: block;
    overflow: visible;
    padding: 0;
    z-index: 3;
    border: 0;
}

.melee-combatant-enemy {
    left: 0;
}

.melee-combatant-player {
    right: 0;
}

.battle-player-area.melee-combatant::before {
    content: none;
    position: absolute;
    left: 50%;
    bottom: 110px;
    width: 156px;
    height: 24px;
    transform: translateX(-50%);
    border-radius: 50%;
    background:
        radial-gradient(ellipse, rgba(0, 0, 0, 0.56), transparent 72%),
        radial-gradient(ellipse, rgba(248, 216, 136, 0.16), transparent 58%);
    z-index: 1;
    pointer-events: none;
}

.battle-player-area.melee-combatant::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.melee-combatant-enemy.battle-player-area::after {
    background: linear-gradient(90deg, rgba(127, 29, 29, 0.22), transparent 58%);
}

.melee-combatant-player.battle-player-area::after {
    background: linear-gradient(270deg, rgba(20, 83, 72, 0.22), transparent 58%);
}

.melee-combatant-enemy.battle-player-area::before {
    left: 40%;
}

.melee-combatant-player.battle-player-area::before {
    left: 60%;
}

.battle-avatar-container.melee-avatar {
    --avatar-combat-scale: 2.18;
    --avatar-combat-scale-hit: var(--avatar-combat-scale);
    --avatar-foot-shadow-width: 70px;
    --avatar-foot-shadow-height: 14px;
    --avatar-foot-shadow-bottom: -5px;
    --avatar-attack-start-x: -50%;
    --avatar-attack-x: 38px;
    --avatar-attack-recoil-x: 24px;
    --avatar-attack-y: 0px;
}

.melee-combatant-enemy .battle-avatar-container.melee-avatar {
    --avatar-attack-x: 38px;
    --avatar-attack-recoil-x: 24px;
    --avatar-facing-scale-x: -1;
    left: 40%;
}

.melee-combatant-player .battle-avatar-container.melee-avatar {
    --avatar-attack-x: -38px;
    --avatar-attack-recoil-x: -24px;
    --avatar-facing-scale-x: 1;
    left: 60%;
    bottom: 118px;
}

.battle-avatar-container.melee-avatar.is-avatar-attack-left {
    --avatar-attack-x: -38px;
    --avatar-attack-recoil-x: -24px;
}

.battle-avatar-container.melee-avatar.is-avatar-attack-right {
    --avatar-attack-x: 38px;
    --avatar-attack-recoil-x: 24px;
}

.melee-status-tray {
    position: absolute;
    left: 50%;
    bottom: 86px;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 30px;
    min-height: 24px;
    padding: 3px 5px;
    border: 1px solid rgba(105, 78, 45, 0.58);
    border-radius: 5px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 44%),
        rgba(8, 10, 14, 0.72);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 18px rgba(0, 0, 0, 0.34);
    transform: translateX(-50%);
    pointer-events: none;
}

.melee-status-tray.is-empty {
    opacity: 0;
}

.melee-status-tray.is-enemy-side {
    left: 20%;
}

.melee-status-tray.is-player-side {
    left: 80%;
}

.melee-status-tray .melee-status-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    filter:
        drop-shadow(0 1px 0 rgba(0, 0, 0, 0.9))
        drop-shadow(0 0 5px rgba(240, 211, 142, 0.28));
}

.melee-minor-arcana-effect {
    position: absolute;
    left: 50%;
    top: 50%;
    bottom: auto;
    z-index: 2;
    display: grid;
    justify-items: center;
    gap: 7px;
    width: 150px;
    --minor-entry-x: 0px;
    --minor-exit-x: 0px;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.52));
    animation: meleeMinorArcanaCenter 2800ms cubic-bezier(0.16, 0.72, 0.22, 1) both;
}

.melee-minor-arcana-effect.is-enemy-side {
    left: 50%;
    --minor-entry-x: clamp(-220px, -18vw, -118px);
    --minor-exit-x: -18px;
}

.melee-minor-arcana-effect.is-player-side {
    left: 50%;
    --minor-entry-x: clamp(118px, 18vw, 220px);
    --minor-exit-x: 18px;
}

.melee-minor-arcana-card {
    position: relative;
    width: 90px;
    aspect-ratio: 48 / 80;
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 35%, rgba(255, 242, 178, 0.28), transparent 62%),
        rgba(9, 14, 24, 0.56);
    box-shadow:
        0 0 0 2px rgba(35, 20, 8, 0.72),
        0 0 24px rgba(244, 211, 126, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

.melee-minor-arcana-art {
    border-color: rgba(255, 236, 174, 0.86);
    border-radius: 8px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.26),
        0 0 16px rgba(244, 211, 126, 0.34);
}

.melee-minor-arcana-name {
    max-width: 166px;
    padding: 5px 9px 6px;
    overflow: hidden;
    border: 1px solid rgba(244, 211, 126, 0.62);
    border-radius: 7px;
    background: rgba(16, 10, 5, 0.9);
    color: #ffe8a8;
    font-size: 12px;
    font-weight: 1000;
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px #000;
    white-space: nowrap;
}

.melee-sprite-attack-effect {
    position: absolute;
    left: 50%;
    top: 43%;
    z-index: 9;
    display: grid;
    place-items: center;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.78);
    animation: meleeElementalAttackBurst 1320ms cubic-bezier(0.16, 0.72, 0.22, 1) both;
}

.melee-sprite-attack-effect.is-enemy-side {
    left: 34%;
}

.melee-sprite-attack-effect.is-player-side {
    left: 66%;
}

.melee-attack-effect-sprite {
    display: block;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    filter:
        drop-shadow(0 0 12px rgba(255, 242, 178, 0.28))
        drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
}

.melee-sprite-attack-effect[data-element="wind"] .melee-attack-effect-sprite {
    filter:
        drop-shadow(0 0 12px rgba(186, 230, 253, 0.34))
        drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
}

.melee-sprite-attack-effect[data-element="earth"] .melee-attack-effect-sprite {
    filter:
        drop-shadow(0 0 12px rgba(187, 247, 208, 0.3))
        drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
}

.melee-sprite-attack-effect[data-element="water"] .melee-attack-effect-sprite {
    filter:
        drop-shadow(0 0 12px rgba(125, 211, 252, 0.34))
        drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
}

@keyframes meleeElementalAttackBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 18px)) scale(0.64);
    }
    12% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.08);
    }
    74% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - 6px)) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, calc(-50% - 16px)) scale(0.9);
    }
}

@keyframes meleeMinorArcanaCenter {
    0% {
        opacity: 0;
        transform: translate(calc(-50% + var(--minor-entry-x)), calc(-50% + 12px)) scale(0.88);
    }
    16% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - 2px)) scale(1.06);
    }
    72% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - 8px)) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--minor-exit-x)), calc(-50% - 18px)) scale(0.96);
    }
}

#battleLogContainer.melee-battle-log {
    flex: 1 1 auto;
    min-height: 96px;
    max-height: 20dvh;
    overflow: auto;
    padding: 30px 12px 12px;
    color: #e8edf4;
    font-size: 12px;
    line-height: 1.45;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 12px / 0 stretch;
}

.dice-sprite {
    aspect-ratio: 1 / 1;
    display: block;
    height: auto;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.weapon-sprite {
    aspect-ratio: 48 / 80;
    display: block;
    height: auto;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.dice-sprite[data-die="1"] { background-image: url("./assets/ui/melee/dice/die-1.png"); }
.dice-sprite[data-die="2"] { background-image: url("./assets/ui/melee/dice/die-2.png"); }
.dice-sprite[data-die="3"] { background-image: url("./assets/ui/melee/dice/die-3.png"); }
.dice-sprite[data-die="4"] { background-image: url("./assets/ui/melee/dice/die-4.png"); }
.dice-sprite[data-die="5"] { background-image: url("./assets/ui/melee/dice/die-5.png"); }
.dice-sprite[data-die="6"] { background-image: url("./assets/ui/melee/dice/die-6.png"); }

.weapon-sprite[data-weapon="staff"] { background-image: url("./assets/ui/melee/weapons/staff.png"); }
.weapon-sprite[data-weapon="wand"] { background-image: url("./assets/ui/melee/weapons/wand.png"); }
.weapon-sprite[data-weapon="axe"] { background-image: url("./assets/ui/melee/weapons/axe.png"); }
.weapon-sprite[data-weapon="axe_big"] { background-image: url("./assets/ui/melee/weapons/axe_big.png"); }
.weapon-sprite[data-weapon="blunt"] { background-image: url("./assets/ui/melee/weapons/blunt.png"); }
.weapon-sprite[data-weapon="dagger"] { background-image: url("./assets/ui/melee/weapons/dagger.png"); }
.weapon-sprite[data-weapon="polearm"] { background-image: url("./assets/ui/melee/weapons/polearm.png"); }
.weapon-sprite[data-weapon="shield"] { background-image: url("./assets/ui/melee/weapons/shield.png"); }
.weapon-sprite[data-weapon="sword"] { background-image: url("./assets/ui/melee/weapons/sword.png"); }
.weapon-sprite[data-weapon="sword_big"] { background-image: url("./assets/ui/melee/weapons/sword_big.png"); }
.weapon-sprite[data-weapon="bow"] { background-image: url("./assets/ui/melee/weapons/bow.png"); }
.weapon-sprite[data-weapon="gun"] { background-image: url("./assets/ui/melee/weapons/gun.png"); }
.weapon-sprite[data-weapon="gun_big"] { background-image: url("./assets/ui/melee/weapons/gun_big.png"); }

.melee-slot-icon {
    display: block;
    justify-self: center;
    align-self: center;
}

.melee-slot-icon.weapon-sprite {
    width: 30px;
    border-radius: 5px;
    background-color: rgba(6, 10, 15, 0.76);
    filter: drop-shadow(0 7px 8px rgba(0, 0, 0, 0.36));
}

.melee-slot-tarot {
    position: relative;
    width: 30px;
    aspect-ratio: 48 / 80;
    overflow: hidden;
    border-radius: 5px;
    background: rgba(241, 245, 249, 0.08);
    box-shadow: 0 7px 10px rgba(0, 0, 0, 0.32);
}

.melee-slot-tarot .tarot-card-art {
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.melee-replay-panel {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 0 10px;
    padding: 8px;
    border: 1px solid rgba(248, 216, 136, 0.24);
    border-radius: 8px;
    background: rgba(8, 13, 22, 0.94);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.melee-replay-header,
.melee-replay-combatant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.melee-replay-title {
    color: #fff7d6;
    font-size: 12px;
    font-weight: 900;
}

.melee-replay-round,
.melee-replay-weapon,
.melee-replay-action-meta,
.melee-replay-hp-text {
    color: #aebdd0;
    font-size: 10px;
    font-weight: 700;
}

.melee-replay-action {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin-top: 7px;
}

.melee-replay-die {
    width: 44px;
    display: grid;
    place-items: center;
    color: #f8d888;
    font-size: 13px;
    font-weight: 1000;
    border-radius: 8px;
    background-color: rgba(12, 6, 15, 0.72);
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.36));
}

.melee-replay-die.is-rolling {
    filter: drop-shadow(0 0 12px rgba(248, 216, 136, 0.72));
    transform: translateY(-1px);
}

.melee-replay-die[data-die] {
    color: transparent;
    font-size: 0;
}

.melee-replay-action-text {
    min-width: 0;
}

.melee-technique-banner {
    position: absolute;
    top: 38%;
    left: 50%;
    z-index: 6;
    transform: translate(-50%, -50%) skewX(-8deg);
    padding: 6px 22px;
    font-size: 22px;
    font-weight: 1000;
    letter-spacing: 0.06em;
    color: #fff7d6;
    text-shadow: 0 2px 0 rgba(0,0,0,0.6), 0 0 18px rgba(248,216,136,0.5);
    background: linear-gradient(90deg, rgba(20,10,4,0) 0%, rgba(20,10,4,0.82) 18%, rgba(20,10,4,0.82) 82%, rgba(20,10,4,0) 100%);
    pointer-events: none;
    animation: meleeTechniqueBannerSlam 1100ms cubic-bezier(0.16, 0.9, 0.2, 1) both;
}

.melee-technique-banner.is-enemy-side {
    color: #ffd7d7;
}

@keyframes meleeTechniqueBannerSlam {
    0%   { opacity: 0; transform: translate(-72%, -50%) skewX(-8deg) scale(1.3); }
    8%   { opacity: 1; transform: translate(-50%, -50%) skewX(-8deg) scale(1.04); }
    14%  { transform: translate(-50%, -50%) skewX(-8deg) scale(1); }
    78%  { opacity: 1; transform: translate(-50%, -50%) skewX(-8deg) scale(1); }
    100% { opacity: 0; transform: translate(-28%, -50%) skewX(-8deg) scale(0.96); }
}

.melee-replay-action-title {
    overflow: hidden;
    color: #f8d888;
    font-size: 13px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.melee-replay-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.melee-replay-combatant {
    min-width: 0;
    padding: 7px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.62);
}

.melee-replay-combatant.is-acting {
    border-color: rgba(248, 216, 136, 0.58);
    box-shadow: inset 0 0 0 1px rgba(248, 216, 136, 0.16);
}

.melee-replay-combatant-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.melee-replay-weapon-icon {
    flex: 0 0 auto;
    width: 18px;
    border-radius: 5px;
    background-color: rgba(10, 6, 14, 0.74);
}

.melee-replay-name {
    overflow: hidden;
    color: #f8fafc;
    font-size: 11px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.melee-replay-hp {
    height: 6px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.melee-replay-hp-fill {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2dd4bf, #f8d888);
    transition: width 0.22s ease;
}

.melee-replay-slots {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    margin-top: 6px;
    overflow: hidden;
    border: 1px solid rgba(248, 216, 136, 0.26);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 34%),
        rgba(5, 12, 18, 0.84);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 18px rgba(0, 0, 0, 0.3);
}

.melee-replay-slot {
    min-width: 0;
    min-height: 72px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    place-items: center;
    gap: 2px;
    padding: 4px;
    border: 0;
    border-left: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0;
    background: transparent;
    color: #cbd5e1;
}

.melee-replay-slot:first-child {
    border-left: 0;
}

.melee-replay-slots:has(.melee-replay-slot.is-active) {
    border-color: rgba(248, 216, 136, 0.7);
}

.melee-replay-slot.has-card {
    box-shadow: inset 0 2px 0 rgba(125, 211, 252, 0.26);
}

.melee-replay-slot.is-unlocked {
    background: rgba(14, 116, 144, 0.28);
}

.melee-replay-slot.is-spent {
    opacity: 0.72;
}

.melee-replay-slot.is-active {
    background:
        radial-gradient(circle at 50% 12%, rgba(248, 216, 136, 0.28), transparent 45%),
        rgba(217, 119, 6, 0.22);
    opacity: 1;
}

.melee-replay-slot-die {
    width: 20px;
    display: block;
    justify-self: center;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.32));
}

.melee-replay-slot-name {
    display: none;
    overflow: hidden;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.melee-damage-pop {
    position: absolute;
    top: calc(42% + var(--feedback-y, 0px) + var(--feedback-stack-y, 0px));
    z-index: 11;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 58px;
    min-height: 34px;
    padding: 0 4px;
    text-align: center;
    color: #f4e8bd;
    font-size: 28px;
    font-weight: 1000;
    line-height: 1;
    white-space: nowrap;
    text-shadow:
        0 1px 0 #3b2413,
        1px 0 0 #140b08,
        -1px 0 0 #140b08,
        0 -1px 0 #140b08,
        0 3px 0 #2a130d,
        0 0 8px rgba(164, 120, 55, 0.42),
        0 10px 18px rgba(0, 0, 0, 0.56);
    pointer-events: none;
    transform-origin: center;
    isolation: isolate;
    animation: meleeDamageNumberPop 2200ms cubic-bezier(0.2, 0.72, 0.18, 1) both;
}

.melee-damage-pop::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: -1;
    width: 64px;
    height: 30px;
    border-radius: 50%;
    opacity: 0;
    background:
        radial-gradient(ellipse, rgba(215, 174, 96, 0.28), rgba(96, 54, 24, 0.16) 44%, transparent 74%);
    transform: translate(-50%, -50%) scale(0.5);
}

.melee-feedback-icon {
    --icon-col: 0;
    --icon-row: 0;
    --icon-col-pos: 0%;
    --icon-row-pos: 0%;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background-image: url("./Sprites/items/icons.png");
    background-size: 1600% 6400%;
    background-position: var(--icon-col-pos) var(--icon-row-pos);
    background-repeat: no-repeat;
    image-rendering: pixelated;
    filter:
        drop-shadow(0 1px 0 rgba(0, 0, 0, 0.88))
        drop-shadow(0 0 6px rgba(255, 240, 175, 0.42));
}

.melee-feedback-text {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
}

.melee-feedback-digit,
.melee-feedback-sign {
    display: inline-block;
    transform-origin: center bottom;
}

.melee-feedback-digit {
    animation: meleeDamageDigitSnap 420ms cubic-bezier(0.22, 0.72, 0.2, 1) var(--digit-delay, 0ms) both;
}

.melee-feedback-sign {
    margin-right: 1px;
    opacity: 0.92;
}

.melee-damage-pop.is-damage {
    z-index: 14;
}

.melee-damage-pop.is-damage::before {
    animation: meleeDamageImpactRing 420ms ease-out 80ms both;
}

.melee-damage-pop.is-heavy-hit {
    font-size: 34px;
    min-width: 68px;
    text-shadow:
        0 1px 0 #3b2413,
        1px 0 0 #100806,
        -1px 0 0 #100806,
        0 -1px 0 #100806,
        0 4px 0 #2a130d,
        0 0 12px rgba(180, 118, 48, 0.58),
        0 12px 20px rgba(0, 0, 0, 0.62);
}

.melee-damage-pop.is-damage .melee-feedback-icon,
.melee-damage-pop.is-heal .melee-feedback-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
}

.melee-damage-pop.is-heal {
    --feedback-y: -20px;
    z-index: 13;
    color: #c9e8c7;
    font-size: 26px;
    animation-name: meleeHealNumberPop;
    text-shadow:
        0 1px 0 #102d1e,
        1px 0 0 #08130d,
        -1px 0 0 #08130d,
        0 3px 0 #102d1e,
        0 0 10px rgba(109, 162, 107, 0.46),
        0 8px 16px rgba(0, 0, 0, 0.5);
}

.melee-damage-pop.is-miss {
    --feedback-y: -32px;
    z-index: 13;
    min-width: 66px;
    min-height: 26px;
    padding: 4px 9px;
    color: #c2cad8;
    font-size: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
        rgba(12, 17, 28, 0.94);
    border: 1px solid rgba(122, 137, 163, 0.62);
    border-radius: 4px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 10px 18px rgba(0, 0, 0, 0.42);
    animation-name: meleeStatusCardPop;
    text-shadow:
        0 2px 0 #1e293b,
        0 0 14px rgba(147, 197, 253, 0.58),
        0 8px 16px rgba(0, 0, 0, 0.42);
}

.melee-damage-pop.is-miss .melee-feedback-icon,
.melee-damage-pop.is-status .melee-feedback-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.melee-damage-pop.is-status {
    --feedback-y: -58px;
    z-index: 12;
    min-width: 78px;
    min-height: 26px;
    padding: 4px 9px;
    color: #d7b2a2;
    font-size: 12px;
    letter-spacing: 0.06em;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
        rgba(30, 18, 16, 0.94);
    border: 1px solid rgba(146, 96, 78, 0.62);
    border-radius: 4px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 10px 18px rgba(0, 0, 0, 0.42);
    text-shadow:
        0 2px 0 #2a130d,
        0 0 8px rgba(125, 70, 50, 0.42),
        0 8px 16px rgba(0, 0, 0, 0.5);
    animation-name: meleeStatusCardPop;
}

.melee-damage-pop[data-feedback-tone="buff"] {
    color: #b6d3c7;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
        rgba(12, 38, 35, 0.94);
    border-color: rgba(92, 142, 134, 0.66);
    text-shadow:
        0 2px 0 #0f2925,
        0 0 8px rgba(80, 138, 128, 0.42),
        0 8px 16px rgba(0, 0, 0, 0.5);
}

.melee-damage-pop[data-feedback-tone="debuff"] {
    color: #d7a196;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
        rgba(47, 16, 14, 0.94);
    border-color: rgba(148, 82, 72, 0.66);
}

.melee-damage-pop[data-feedback-tone="ailment"] {
    color: #d9bf86;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
        rgba(42, 26, 42, 0.94);
    border-color: rgba(137, 106, 158, 0.62);
    text-shadow:
        0 2px 0 #2c1738,
        0 0 8px rgba(133, 101, 160, 0.42),
        0 8px 16px rgba(0, 0, 0, 0.5);
}

.melee-damage-pop[data-feedback-tone="advantage"] {
    color: #ead9a5;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 42%),
        rgba(57, 35, 16, 0.94);
    border-color: rgba(164, 124, 61, 0.72);
}

.melee-damage-pop[data-feedback-tone="resist"],
.melee-damage-pop[data-feedback-tone="miss"] {
    color: #b6c4d7;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
        rgba(15, 21, 32, 0.94);
    border-color: rgba(95, 113, 141, 0.66);
}

.melee-damage-pop.is-enemy-side {
    left: 34%;
}

.melee-damage-pop.is-player-side {
    left: 66%;
}

@keyframes meleeDamageNumberPop {
    0% {
        opacity: 0;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), 8px) scale(0.86);
    }
    18% {
        opacity: 1;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -7px) scale(1.08);
    }
    34% {
        opacity: 1;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -2px) scale(1);
    }
    76% {
        opacity: 1;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -26px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -38px) scale(0.98);
    }
}

@keyframes meleeHealNumberPop {
    0% {
        opacity: 0;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), 8px) scale(0.86);
    }
    20% {
        opacity: 1;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -6px) scale(1.06);
    }
    76% {
        opacity: 1;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -24px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -38px) scale(0.98);
    }
}

@keyframes meleeStatusCardPop {
    0% {
        opacity: 0;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), 6px) scale(0.92);
    }
    18% {
        opacity: 1;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -2px) scale(1.02);
    }
    28% {
        transform: translate(calc(-50% + var(--feedback-x, 0px)), 0) scale(1);
    }
    82% {
        opacity: 1;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -16px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--feedback-x, 0px)), -28px) scale(0.98);
    }
}

@keyframes meleeDamageDigitSnap {
    0% {
        transform: translateY(8px) scale(0.88);
        opacity: 0;
    }
    60% {
        transform: translateY(-2px) scale(1.05);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes meleeDamageImpactRing {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    35% {
        opacity: 0.42;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.08);
    }
}

#battleStage > .melee-replay-panel {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 14px;
    z-index: 8;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, 0.95fr);
    align-items: end;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

#battleStage > .melee-replay-panel .melee-replay-header {
    display: none;
}

#battleStage > .melee-replay-panel .melee-replay-title {
    display: none;
}

#battleStage > .melee-replay-panel .melee-replay-round {
    color: #f8d888;
    font-size: 10px;
}

#battleStage > .melee-replay-panel .melee-replay-action {
    min-height: 78px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 12px / 0 stretch;
    background:
        linear-gradient(90deg, rgba(248, 216, 136, 0.14), transparent 34%),
        rgba(5, 10, 16, 0.92);
    grid-template-columns: 52px minmax(0, 1fr);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 16px 30px rgba(0, 0, 0, 0.34);
    pointer-events: auto;
}

#battleStage > .melee-replay-panel .melee-replay-die {
    width: 48px;
}

#battleStage > .melee-replay-panel .melee-replay-action-title {
    font-size: 15px;
    white-space: normal;
    text-shadow: 0 2px 10px rgba(248, 216, 136, 0.28);
}

#battleStage > .melee-replay-panel .melee-replay-action-meta {
    margin-top: 3px;
    font-size: 11px;
}

#battleStage > .melee-replay-panel .melee-replay-board {
    margin: 0;
    display: grid;
    gap: 6px;
}

#battleStage > .melee-replay-panel .melee-replay-combatant {
    min-height: 76px;
    display: grid;
    align-content: start;
    padding: 8px;
    border-radius: 8px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 12px 24px rgba(0, 0, 0, 0.28);
    pointer-events: auto;
}

#battleStage > .melee-replay-panel .melee-replay-combatant.is-player-side {
    order: 2;
    border: 1px solid rgba(142, 230, 183, 0.3);
    background: rgba(4, 18, 24, 0.82);
}

#battleStage > .melee-replay-panel .melee-replay-combatant.is-enemy-side {
    order: 1;
    border: 1px solid rgba(239, 141, 127, 0.28);
    background: rgba(28, 10, 14, 0.78);
}

#battleStage > .melee-replay-panel .melee-replay-combatant-row {
    margin-bottom: 5px;
}

#battleStage > .melee-replay-panel .melee-replay-weapon {
    display: none;
}

#battleStage > .melee-replay-panel .melee-replay-hp-text {
    display: none;
}

#battleStage > .melee-replay-panel .melee-replay-hp {
    display: block;
    height: 6px;
    margin: 0 0 6px;
    border-color: rgba(248, 216, 136, 0.18);
    background: rgba(2, 6, 12, 0.72);
}

#battleStage > .melee-replay-panel .melee-replay-slots {
    margin-top: 0;
}

#battleStage > .melee-replay-panel .melee-replay-slot {
    min-height: 68px;
}

#battleStage > .melee-replay-panel .melee-replay-slot-name {
    color: #dbeafe;
}

#battleCommandArea.melee-battle-command {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 12px / 0 stretch;
}




#mapSelectModal {
    align-items: flex-end !important;
}

#mapSelectModal > div {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    max-height: 84dvh;
    overflow: auto;
    border-radius: 24px 24px 0 0 !important;
    padding: 14px 16px calc(18px + var(--safe-bottom)) !important;
}

#mapSelectModal > div::before {
    content: '';
    display: block;
    width: 42px;
    height: 5px;
    margin: 0 auto 14px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.52);
}


.home-qr-card {
    padding-top: 14px;
    --home-card-icon: var(--icon-compass);
}

.home-card-note {
    position: relative;
    z-index: 1;
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(226, 232, 240, 0.78);
}


#myQrCanvas,
#guildQrCanvas {
    width: min(64vw, 220px);
    height: auto;
    background: #fff;
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 18px 28px rgba(2, 6, 23, 0.28);
}

.king-troy-entry-qr-modal {
    width: min(92vw, 420px);
    max-width: 420px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 14px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(11, 8, 6, 0.78), rgba(4, 4, 5, 0.96)),
        repeating-linear-gradient(90deg, rgba(101, 58, 25, 0.12) 0 28px, rgba(16, 10, 6, 0.12) 28px 56px);
}

.king-troy-entry-qr-modal h2 {
    margin: 0 0 14px;
    color: #f7d68d;
    font-size: 22px;
    font-weight: 900;
}

.king-troy-entry-qr-canvas {
    width: min(74vw, 300px);
    height: auto;
    padding: 10px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.34);
}

.king-troy-entry-qr-value {
    display: block;
    width: 100%;
    margin-top: 14px;
    box-sizing: border-box;
    text-align: center;
    font-size: 12px;
}


.transfer-input-row span {
    font-size: 12px;
    font-weight: 700;
    color: #cbd5e1;
    letter-spacing: 0.08em;
}


#tabContentQr .content-area,
#tabContentRanking .content-area {
    padding-top: 18px;
}


.battle-entry-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.9)),
        radial-gradient(circle at 50% 0%, rgba(239, 68, 68, 0.14), transparent 56%);
    border: 1px solid rgba(248, 113, 113, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.battle-entry-btn {
    width: 100%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.9), rgba(153, 27, 27, 0.98));
    border-color: rgba(252, 165, 165, 0.3);
    color: #fff;
}

.battle-entry-result {
    min-height: 18px;
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    color: #cbd5e1;
}

.equipment-gacha-entry {
    display: grid;
    grid-template-columns: minmax(96px, 132px) 1fr;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.94)),
        radial-gradient(circle at 18% 0%, rgba(250, 204, 21, 0.2), transparent 58%);
    border: 1px solid rgba(250, 204, 21, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.equipment-gacha-chest-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.34);
    border: 1px solid rgba(148, 163, 184, 0.16);
    overflow: hidden;
}

.equipment-gacha-chest {
    width: min(104px, 80%);
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
    background-repeat: no-repeat;
    background-size: 800% 100%;
    background-position: 0 0;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
}

.equipment-gacha-chest.is-idle {
    background-image: url("./Sprites/items/Chest/chest1_idle_strip8.png");
    animation: equipment-gacha-idle 900ms steps(8) infinite;
}

.equipment-gacha-chest.is-opening {
    background-image: url("./Sprites/items/Chest/chest1_open_strip8.png");
    animation: equipment-gacha-open 720ms steps(8) 1 forwards;
}

.equipment-gacha-chest.is-open {
    background-image: url("./Sprites/items/Chest/chest1_open_strip8.png");
    background-position: 100% 0;
}

.equipment-gacha-btn {
    min-height: 54px;
    align-self: end;
    border-radius: 12px;
    color: #111827;
    background: linear-gradient(180deg, #facc15, #d97706);
    border-color: rgba(253, 224, 71, 0.5);
    font-weight: 800;
}

.equipment-gacha-btn:disabled {
    opacity: 0.72;
}

.equipment-gacha-result {
    grid-column: 2;
    min-height: 20px;
    margin: -4px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: #fde68a;
}

@keyframes equipment-gacha-idle {
    from { background-position: 0 0; }
    to { background-position: 100% 0; }
}

@keyframes equipment-gacha-open {
    from { background-position: 0 0; transform: scale(1); }
    55% { transform: scale(1.08); }
    to { background-position: 100% 0; transform: scale(1); }
}

@media (max-width: 520px) {
    .equipment-gacha-entry {
        grid-template-columns: 96px 1fr;
    }

    .equipment-gacha-result {
        grid-column: 1 / -1;
    }
}

.guild-empty-state,
.guild-joined-panel {
    position: relative;
    z-index: 1;
}

.guild-empty-copy {
    margin: 4px 0 14px;
    text-align: center;
    color: var(--text-sub);
}

.guild-entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.guild-entry-btn {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 12px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98)),
        radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.1), transparent 56%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #f8fafc;
}

.guild-summary-card {
    padding: 16px;
    border-radius: 20px;
    margin-bottom: 16px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.92)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 58%);
    border: 1px solid rgba(125, 211, 252, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.guild-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.guild-role-pill {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.84);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.guild-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
}

.guild-stat {
    padding: 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.guild-exp-card {
    margin-top: 8px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.guild-exp-head {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.guild-exp-track {
    background: rgba(2, 6, 23, 0.54);
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
}

.guild-qr-section {
    margin: 18px 0;
    padding: 14px;
    text-align: center;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.guild-qr-copy {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--text-sub);
}

.guild-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.guild-action-btn {
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.16);
    color: #f8fafc;
}

.guild-action-btn-danger {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.92), rgba(153, 27, 27, 0.98));
    border-color: rgba(248, 113, 113, 0.28);
}


#rankingToggleButtons::-webkit-scrollbar {
    display: none;
}



.ranking-refresh-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    margin: 0 0 14px;
}

.ranking-game-caption {
    margin: 2px 0 8px;
    color: var(--text-sub);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.ranking-refresh-btn {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 14px;
    background: linear-gradient(180deg, rgba(42, 31, 24, 0.95), rgba(15, 12, 10, 0.96));
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #f7e8c1;
    box-shadow: none;
    border-color: rgba(220, 169, 82, 0.34);
    min-width: 96px;
    --button-icon: var(--icon-refresh);
}

.ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-state {
    padding: 14px 12px;
    border-radius: 16px;
    text-align: center;
    color: var(--text-sub);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.ranking-row {
    display: grid;
    grid-template-columns: 68px 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(8, 11, 15, 0.9), rgba(3, 5, 8, 0.96)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
    border: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.08);
    border-color: rgba(150, 135, 109, 0.36);
    min-height: 94px;
    border-image: url("./assets/ui/panels/panel-dark.png") 30 fill / 12px / 0 stretch;
}

.ranking-row.myRank {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow:
        0 10px 24px rgba(217, 119, 6, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* --- ランキング ヘッダー --- */
.ranking-content-area {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(3, 4, 6, 0.88) 36%, rgba(2, 3, 5, 0.96)),
        url("./assets/ui/bg-tavern.png") center top / cover no-repeat,
        linear-gradient(180deg, #050608, #020303);
    border-color: rgba(220, 169, 82, 0.42);
    min-height: calc(100vh - var(--nav-height) - 132px);
    padding: 16px 14px 96px;
}

.ranking-header {
    display: grid;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.18);
    border-radius: 0;
    border: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.56)),
        url("./assets/ui/bg-tavern.png") center / cover no-repeat;
    min-height: 160px;
    margin: 0 -4px 12px;
    padding: 20px 16px;
    grid-template-columns: 82px minmax(0, 1fr);
    box-shadow: inset 0 -1px 0 rgba(220, 169, 82, 0.24);
}

.ranking-header-icon {
    font-size: 0;
    line-height: 1;
    filter: drop-shadow(0 0 18px rgba(255, 207, 103, 0.7));
    width: 76px;
    height: 76px;
    display: block;
    background: url("./assets/ui/icons/056.png") center / contain no-repeat;
    color: transparent;
    background-image: var(--icon-trophy);
}

.ranking-header-title {
    font-size: clamp(38px, 11vw, 64px);
    font-weight: 900;
    letter-spacing: 0;
    color: #ffe188;
    font-family: Georgia, "Times New Roman", serif;
    text-shadow: 0 3px 0 #241204, 0 0 16px rgba(255, 207, 103, 0.42);
    line-height: 1;
}

.ranking-header-sub {
    font-size: 15px;
    color: #d0b98c;
    letter-spacing: 0;
    margin-top: 12px;
    font-weight: 800;
}

/* --- 1〜3位 強調 --- */
.ranking-row-top-1 {
    border-color: rgba(255, 221, 142, 0.84);
    background: linear-gradient(180deg, rgba(54, 34, 8, 0.36), rgba(5, 4, 3, 0.68)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.14), transparent 58%);
    box-shadow: 0 0 18px rgba(217, 164, 65, 0.28), inset 0 1px 0 rgba(255, 247, 214, 0.18);
    border-image-source: url("./assets/ui/panels/panel-dark-gold.png");
    border-image-slice: 32 fill;
    border-image-width: 13px;
}

.ranking-row-top-1 .ranking-rank-badge {
    background: url("./assets/ui/icons/049.png") center / contain no-repeat;
    border-color: rgba(251, 191, 36, 0.5);
}

.ranking-row-top-1 .ranking-rank-medal {
    font-size: 20px;
}

.ranking-row-top-1 .ranking-row-name {
    color: #fde68a;
}

.ranking-row-top-2 {
    border-color: rgba(200, 205, 212, 0.56);
    background: linear-gradient(180deg, rgba(42, 45, 50, 0.34), rgba(4, 5, 7, 0.72)),
        radial-gradient(ellipse at 50% 0%, rgba(214, 221, 232, 0.1), transparent 58%);
    box-shadow: 0 0 0 1px rgba(203, 213, 225, 0.16),
        0 6px 18px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    border-image-source: url("./assets/ui/panels/panel-dark-silver.png");
}

.ranking-row-top-2 .ranking-rank-badge {
    background: url("./assets/ui/icons/054.png") center / contain no-repeat;
    border-color: rgba(203, 213, 225, 0.4);
}

.ranking-row-top-2 .ranking-row-name {
    color: #e2e8f0;
}

.ranking-row-top-3 {
    border-color: rgba(193, 104, 42, 0.58);
    background: linear-gradient(180deg, rgba(71, 32, 10, 0.26), rgba(5, 4, 3, 0.7)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 183, 116, 0.08), transparent 58%);
    box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.16),
        0 4px 14px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-image-source: url("./assets/ui/panels/panel-dark.png");
}

.ranking-row-top-3 .ranking-rank-badge {
    background: url("./assets/ui/icons/055.png") center / contain no-repeat;
    border-color: rgba(251, 146, 60, 0.38);
}

.ranking-row-top-3 .ranking-row-name {
    color: #fed7aa;
}

/* --- ランクバッジ・アバター --- */
.ranking-rank-badge {
    display: grid;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: url("./assets/ui/icons/089.png") center / contain no-repeat;
    border: 0;
    position: relative;
    place-items: center;
}

.ranking-rank-medal {
    font-size: 16px;
    line-height: 1;
    display: none;
}

.ranking-rank-number {
    font-size: 18px;
    font-weight: 900;
    color: #ffe7a6;
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: Georgia, "Times New Roman", serif;
    text-shadow: 0 2px 0 #201004;
    width: auto;
    line-height: 1;
    text-align: center;
    transform: translateY(-2px);
}

.ranking-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(242, 219, 168, 0.72);
    background: #f2ead8;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.38);
}

.ranking-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #f8fafc;
    background:
        linear-gradient(180deg, rgba(59, 130, 246, 0.88), rgba(30, 64, 175, 0.96)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
}

.ranking-row-main {
    min-width: 0;
}

.ranking-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 22px;
    font-weight: 800;
    color: #ffe2a0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

.ranking-row-meta {
    margin-top: 6px;
    font-size: 13px;
    color: #a99777;
    font-weight: 800;
}

.ranking-row-score {
    text-align: right;
    white-space: nowrap;
    min-width: 118px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.ranking-row-score-value {
    display: inline-block;
    font-size: 24px;
    font-weight: 900;
    color: #ffe188;
    min-width: 74px;
    text-align: right;
    font-family: Arial, "Helvetica Neue", "Yu Gothic", sans-serif;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 2px 0 #201004;
}

.ranking-row-top-1 .ranking-row-score-value {
    font-size: 24px;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}

@media (min-width: 420px) {
    .ranking-toggle-btn {
        min-width: 120px;
    }
}

#tabContentKing .king-card,
#tabContentKing .king-editor-card,
#tabContentKing .troy-admin-card,
#tabContentKing .troy-admin-details {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow:
        0 16px 28px rgba(2, 6, 23, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.92)),
        radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.08), transparent 62%) !important;
}

#tabContentKing .king-card::after,
#tabContentKing .king-editor-card::after,
#tabContentKing .troy-admin-card::after,
#tabContentKing .troy-admin-details::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.04) 45%, transparent 74%);
}

#troyKingControls input,
#troyKingControls textarea,
#tabContentKing input,
#tabContentKing textarea {
    border-radius: 14px !important;
    border: 1px solid rgba(148, 163, 184, 0.16) !important;
    background: rgba(15, 23, 42, 0.86) !important;
    color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#troyKingControls button,
#tabContentKing button {
    min-height: 44px;
    border-radius: 14px !important;
}

.king-section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 8px;
}

#tabContentKing .king-section-tabs button {
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px !important;
    border: 1px solid rgba(220, 169, 82, 0.28);
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#tabContentKing .king-section-tabs button.is-active {
    border-color: rgba(251, 191, 36, 0.72);
    background:
        linear-gradient(180deg, rgba(251, 191, 36, 0.28), rgba(146, 64, 14, 0.34)),
        rgba(15, 23, 42, 0.72);
    color: #fff7ed;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.72);
}

.king-section-panel[hidden] {
    display: none !important;
}

.king-page-message {
    min-height: 22px;
    margin: 6px 0 4px;
    font-size: 12px;
    font-weight: 800;
}


#kingAnnouncementCurrent {
    line-height: 1.65;
    color: #f8fafc;
}

#kingAnnouncementMeta,
#kingPageMessage,
#kingGrantPreview {
    line-height: 1.6;
}

.king-war-card {
    overflow: hidden;
}

.king-war-capital-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.king-war-capital-chip {
    padding: 12px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.king-war-capital-chip.is-high {
    border-color: rgba(16, 185, 129, 0.34);
}

.king-war-capital-chip.is-medium {
    border-color: rgba(245, 158, 11, 0.34);
}

.king-war-capital-chip.is-low {
    border-color: rgba(239, 68, 68, 0.34);
}

.king-war-capital-label {
    font-size: 12px;
    color: var(--text-sub);
}

.king-war-capital-value {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.king-war-capital-band {
    margin-top: 2px;
    font-size: 11px;
    color: #cbd5e1;
}

.king-war-forms {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.king-war-form-card,
.king-war-block {
    padding: 12px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.king-war-form-card {
    display: grid;
    gap: 8px;
}

.king-war-select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(2, 6, 23, 0.84);
    color: #fff;
    font-size: 14px;
}

.king-war-action-btn {
    width: 100%;
    min-height: 44px;
    border-radius: 14px;
    background: var(--accent-color);
    color: #fff;
    font-weight: 700;
}

.king-war-action-btn.is-attack {
    background: var(--danger-color);
}

.king-war-action-btn.is-muted {
    background: rgba(71, 85, 105, 0.92);
}

.king-war-system-list,
.king-war-incoming-list,
.king-war-enemy-list,
.king-war-log-list {
    display: grid;
    gap: 10px;
}

.king-war-system-card,
.king-war-incoming-card,
.king-war-enemy-card,
.king-war-log-entry {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.king-war-system-main,
.king-war-log-main {
    display: grid;
    gap: 4px;
    color: #f8fafc;
    font-size: 13px;
}

.king-war-system-main span,
.king-war-log-meta,
.king-war-incoming-meta {
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.5;
}

.king-war-system-meta {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: #cbd5e1;
    font-size: 11px;
}

.king-war-system-meta span,
.king-war-incoming-meta span {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.88);
}

.king-war-incoming-title {
    font-size: 14px;
    font-weight: 800;
    color: #f8fafc;
}

.king-war-enemy-head,
.king-war-enemy-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.king-war-enemy-head {
    color: #f8fafc;
    font-size: 13px;
}

.king-war-enemy-head span,
.king-war-enemy-foot span {
    color: #94a3b8;
    font-size: 11px;
}

.king-war-enemy-parts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.king-war-enemy-part {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.88);
    color: #e2e8f0;
    font-size: 11px;
}

.king-war-enemy-part.is-high {
    border: 1px solid rgba(16, 185, 129, 0.34);
}

.king-war-enemy-part.is-medium {
    border: 1px solid rgba(245, 158, 11, 0.34);
}

.king-war-enemy-part.is-low {
    border: 1px solid rgba(239, 68, 68, 0.34);
}

.king-war-enemy-foot .king-war-action-btn {
    width: auto;
    min-width: 112px;
}

.king-war-incoming-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.king-war-intercept-row {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.king-war-log-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.king-war-empty {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.56);
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.6;
}

#tabContentTarot {
    --tarot-mobile-shell-bg:
        linear-gradient(180deg, rgba(9, 14, 24, 0.98), rgba(17, 24, 39, 1)),
        radial-gradient(120% 120% at 50% 0%, rgba(245, 158, 11, 0.12), transparent 42%);
}

#tabContentTarot #tarotSpinRoot.tarot-spin-root {
    --spin-tarot-mobile-action-offset: calc(var(--nav-height) + var(--safe-bottom) + 8px);
    --spin-tarot-mobile-action-space: calc(var(--nav-height) + var(--safe-bottom) + 88px);
}

#tabContentTarot .content-area {
    overflow: visible;
}

#tabContentTarot .tarot-game-switch-wrap {
    position: sticky;
    top: calc(62px + var(--safe-top));
    z-index: 35;
    padding: 14px;
    background: linear-gradient(180deg, rgba(7, 13, 24, 0.94), rgba(10, 16, 27, 0.88)),
        radial-gradient(120% 120% at 50% 0%, rgba(59, 130, 246, 0.12), transparent 40%);
    backdrop-filter: blur(16px);
    min-height: auto;
}

#tabContentTarot .tarot-game-select-title {
    margin-bottom: 8px;
}

.tarot-game-select-note {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(226, 232, 240, 0.76);
}

#tabContentTarot .tarot-game-switch {
    padding: 4px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

/* tarot-mode-card の active 状態（高specificity版） */
#tabContentTarot .tarot-game-switch .tarot-mode-card.is-active,
#tabContentTarot .tarot-game-switch .tarot-mode-card[aria-selected="true"] {
    border-color: rgba(167, 139, 250, 0.75);
    background:
        linear-gradient(180deg, rgba(109, 40, 217, 0.3), rgba(76, 29, 149, 0.35));
    color: #ede9fe;
    box-shadow:
        0 0 0 1px rgba(167, 139, 250, 0.3),
        0 0 20px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#tabContentTarot .tarot-poker-root,
#tabContentTarot #tarotKingdomRoot.tarot-kingdom-root {
    background: var(--tarot-mobile-shell-bg);
    border-color: rgba(148, 163, 184, 0.14);
    box-shadow:
        0 18px 32px rgba(2, 6, 23, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#tabContentTarot .tarot-poker-header,
#tabContentTarot .tarot-kingdom-header {
    gap: 10px;
    align-items: flex-start;
}

#tabContentTarot .tarot-poker-header-meta,
#tabContentTarot .tarot-kingdom-header-meta {
    margin-left: auto;
}

#tabContentTarot .tarot-state-text {
    margin: 8px 0 10px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.55;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#tabContentTarot .tarot-participant-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

#tabContentTarot .tarot-participant-list::-webkit-scrollbar {
    display: none;
}

#tabContentTarot .tarot-participant-chip {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

#tabContentTarot .tarot-draw-guide,
#tabContentTarot .tarot-fate-effect,
#tabContentTarot .tarot-judgment-panel,
#tabContentTarot .tarot-kingdom-openrooms,
#tabContentTarot .tarot-kingdom-settlement,
#tabContentTarot .tarot-kingdom-judgment {
    border-radius: 16px;
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#tabContentTarot .tarot-poker-column,
#tabContentTarot .tarot-kingdom-panel {
    border-radius: 18px;
    border-color: rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.84)),
        radial-gradient(120% 120% at 50% 0%, rgba(245, 158, 11, 0.08), transparent 52%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#tabContentTarot .tarot-poker-column-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

#tabContentTarot .tarot-role-label {
    line-height: 1.45;
}

#tabContentTarot .tarot-action-label {
    min-height: 18px;
    line-height: 1.35;
}

#tabContentTarot .tarot-log {
    position: relative;
    margin-top: 10px;
    max-height: 24dvh;
    padding: 28px 12px 12px;
    border-radius: 18px;
    border-color: rgba(148, 163, 184, 0.16);
    background:
        linear-gradient(180deg, rgba(8, 15, 28, 0.88), rgba(15, 23, 42, 0.92)),
        radial-gradient(120% 120% at 50% 0%, rgba(59, 130, 246, 0.08), transparent 48%);
}

#tabContentTarot .tarot-log::before {
    position: absolute;
    left: 12px;
    top: 10px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #94a3b8;
}

#tabContentTarot .tarot-log--poker::before {
    content: "POKER LOG";
}

#tabContentTarot .tarot-log--kingdom::before {
    content: "KINGDOM LOG";
}

#tabContentTarot .tarot-bet-popup {
    left: 8px;
    right: 8px;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
    width: auto;
    max-width: none;
    transform: none;
    padding: 26px 10px 10px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(7, 13, 24, 0.96), rgba(11, 18, 31, 0.96)),
        radial-gradient(120% 120% at 50% 0%, rgba(245, 158, 11, 0.12), transparent 40%);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 18px 34px rgba(2, 6, 23, 0.48);
}

#tabContentTarot .tarot-betting-actions {
    gap: 8px;
    justify-content: flex-start;
    scroll-snap-type: x proximity;
}

#tabContentTarot .tarot-betting-actions button {
    scroll-snap-align: start;
}

#tabContentTarot #tarotPokerRoot .tarot-bet-popup {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
    width: auto;
    max-width: none;
    transform: none;
    margin: 0;
    padding: 26px 10px 10px;
}

#tabContentTarot #tarotPokerRoot .tarot-betting-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}

#tabContentTarot #tarotPokerRoot .tarot-betting-actions button {
    flex: 0 0 var(--tarot-card-w, 58px);
    width: var(--tarot-card-w, 58px);
    min-width: var(--tarot-card-w, 58px);
    height: var(--tarot-card-h, 96px);
    min-height: var(--tarot-card-h, 96px);
    padding: 5px 2px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: pre-line;
    font-size: 12px;
    line-height: 1.08;
}

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-hand-title,
#tabContentTarot #tarotKingdomRoot .tarot-kingdom-trick-title {
    flex-wrap: wrap;
}

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-hand-actions {
    width: 100%;
    justify-content: flex-end;
}

#tabContentTarot #tarotKingdomRoot .tarot-kingdom-player-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 14px;
}

@media (max-width: 640px) {

    #tabContentTarot .tarot-poker-column--player {
        grid-column: 1 / -1;
    }

    #tabContentTarot .tarot-poker-column--npc-mini:last-child {
        grid-column: 1 / -1;
    }

    #tabContentTarot .tarot-poker-root,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-root {
        margin: 8px;
        padding: 12px 10px;
    }

    #tabContentTarot #tarotPokerRoot .tarot-poker-mode-toggle {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


}

@media (min-width: 641px) {
    #tabContentTarot #tarotPokerRoot .tarot-bet-popup {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        max-width: none;
        transform: none;
        margin: 0 0 10px;
        padding: 12px;
    }

    #tabContentTarot #tarotPokerRoot .tarot-betting-actions {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
        justify-content: stretch;
        overflow: visible;
    }

    #tabContentTarot #tarotPokerRoot .tarot-betting-actions button {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        height: 66px;
        min-height: 66px;
        padding: 8px 6px;
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        white-space: normal;
        line-height: 1.12;
        font-size: 12px;
    }
}

.king-page-note {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-sub);
}

.king-card,
.troy-admin-card {
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.25);
    padding: 12px;
    border-radius: 10px;
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.troy-king-priority-card {
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 12px 24px rgba(2, 6, 23, 0.28);
}

.troy-admin-details {
    margin-top: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.5);
    overflow: hidden;
}

.troy-admin-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 10px 12px;
    cursor: pointer;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 800;
    list-style: none;
}

.troy-admin-details summary::-webkit-details-marker {
    display: none;
}

.troy-admin-details summary::after {
    content: '+';
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.troy-admin-details[open] summary::after {
    content: '-';
}

.troy-admin-details > .troy-admin-card {
    margin: 0;
    border-radius: 0;
    border-width: 1px 0 0;
    background: rgba(0, 0, 0, 0.18);
}

.king-card-label,
.king-field-label,
.troy-admin-label,
.troy-admin-field-label {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.king-card-label,
.troy-admin-label {
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.king-inline-actions,
.troy-admin-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.king-inline-actions button,
.troy-admin-actions button {
    flex: 1 1 132px;
}

.king-help-text,
.troy-admin-help {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-sub);
    line-height: 1.55;
}

.king-announcement-current {
    margin-top: 4px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.12);
    white-space: pre-wrap;
    font-size: 14px;
}

.king-announcement-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-sub);
}

.king-editor-card {
    padding: 14px;
    border-radius: 18px;
    margin-top: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.88)),
        radial-gradient(120% 120% at 50% 0%, rgba(245, 158, 11, 0.08), transparent 58%);
    box-shadow:
        0 16px 28px rgba(2, 6, 23, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#kingPageMessage {
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent-color);
}

.troy-admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.troy-admin-actions-wide {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* Admin form inputs */
.admin-input,
.admin-textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #111827;
    color: var(--text-main);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
}

.admin-textarea {
    resize: vertical;
}

/* Admin status text */
#kingTroyStatus,
#kingWarSummary {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

/* Button color variants */
.btn-open {
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.42), rgba(109, 58, 11, 0.28)),
        linear-gradient(180deg, #f2c45f, #a86420);
    color: #1d0e04;
    text-shadow:
        0 1px 0 rgba(255, 247, 205, 0.72),
        0 0 2px rgba(255, 247, 205, 0.48);
}

.btn-muted {
    background: #4b5563;
}

.btn-scan {
    background: #374151;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.battle-status-card {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
    min-width: 0;
    padding: 8px 9px 7px;
    z-index: 5;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 9px / 0 stretch;
    background: rgba(6, 10, 16, 0.62);
    box-shadow: none;
}

.battle-status-card-enemy {
    --battle-side-color: #ef8d7f;
    left: 18px;
    right: auto;
    top: 18px;
    width: min(280px, calc(100% - 30px));
}

.battle-status-card-player {
    --battle-side-color: #8ee6b7;
    left: auto;
    right: 18px;
    top: 18px;
    width: min(300px, calc(100% - 30px));
}

.battle-status-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-size: 12px;
    font-weight: 900;
    color: #f8fafc;
}

.battle-status-card-player .battle-status-name,
.battle-status-card-player .battle-health-text {
    text-align: right;
}

.battle-health-track {
    width: 100%;
    height: 8px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(9, 15, 24, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.battle-health-fill {
    height: 100%;
    width: 100%;
    border-radius: inherit;
    transition: width 0.3s ease;
}

.battle-health-fill-enemy {
    background: linear-gradient(90deg, #b74135, #ef8d7f);
}

.battle-health-fill-player {
    background: linear-gradient(90deg, #188f5a, #8ee6b7);
}

.battle-health-text {
    margin-top: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #cbd5e1;
}

#battlePlayerA .battle-health-text {
    display: none;
}

.battle-atb-track {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 18px;
    width: auto;
    height: 7px;
    z-index: 5;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(9, 15, 24, 0.88);
    border: 1px solid rgba(248, 216, 136, 0.18);
}

#battleModal.melee-battle-overlay .battle-atb-track {
    display: none;
}

.battle-atb-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #d18b2c, #f8d888);
    transition: width 0.1s linear;
}

.battle-log-shell {
    position: relative;
}

.battle-log-shell::before {
    content: 'BATTLE LOG';
    position: absolute;
    left: 12px;
    top: 10px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #f8d888;
}

.battle-command-shell {
    position: relative;
}

.battle-command-placeholder {
    margin: 0;
    color: #d7e1ed !important;
    font-size: 12px !important;
    font-weight: 800;
}

.battle-action-callout {
    margin: 0;
    color: #f8d888;
    font-size: 18px;
    font-weight: 1000;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.battle-result-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 1000;
    letter-spacing: 0.04em;
    text-align: center;
}

.battle-result-title-win {
    color: #f8d888;
}

.battle-result-title-lose {
    color: #ef8d7f;
}

#battleCommandArea button {
    min-width: 120px;
    min-height: 40px;
    padding: 8px 18px;
    color: #27160b;
    font-size: 14px;
    font-weight: 900;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    background: transparent;
    box-shadow: none;
}

@media (max-width: 420px) {
    #battleModal .melee-battle-shell {
        width: 98vw;
        padding: 10px;
        gap: 8px;
    }

    #battleStage.melee-battle-stage {
        min-height: 356px;
    }

    .battle-player-area.melee-combatant {
        padding-inline: 7px;
    }

    .battle-avatar-container.melee-avatar {
        --avatar-combat-scale: 1.72;
        --avatar-combat-scale-hit: var(--avatar-combat-scale);
        width: 60px;
        height: 60px;
        bottom: 142px;
    }

    .battle-player-area.melee-combatant::before {
        bottom: 134px;
        width: 132px;
        height: 20px;
    }

    .melee-combatant-player .battle-avatar-container.melee-avatar {
        bottom: 142px;
    }

    .melee-status-tray {
        bottom: 112px;
        gap: 3px;
        min-height: 22px;
        padding: 2px 4px;
    }

    .melee-status-tray.is-enemy-side {
        left: 21%;
    }

    .melee-status-tray.is-player-side {
        left: 79%;
    }

    .melee-status-tray .melee-status-icon {
        width: 18px;
        height: 18px;
        flex-basis: 18px;
    }

    .melee-minor-arcana-effect {
        top: 52%;
        bottom: auto;
        width: 112px;
    }

    .melee-minor-arcana-effect.is-enemy-side {
        left: 50%;
        --minor-entry-x: -92px;
        --minor-exit-x: -14px;
    }

    .melee-minor-arcana-effect.is-player-side {
        left: 50%;
        --minor-entry-x: 92px;
        --minor-exit-x: 14px;
    }

    .melee-minor-arcana-name {
        max-width: 124px;
        padding: 4px 7px 5px;
        font-size: 10px;
    }

    .melee-sprite-attack-effect {
        top: 49%;
    }

    .melee-attack-effect-sprite {
        transform: scale(0.82);
    }

    .battle-status-card-enemy,
    .battle-status-card-player {
        top: 12px;
        width: min(168px, calc(100% - 18px));
        padding: 7px 8px 6px;
    }

    .battle-status-card-enemy {
        left: 10px;
    }

    .battle-status-card-player {
        right: 10px;
    }

    #battleStage > .melee-replay-panel {
        left: 10px;
        right: 10px;
        bottom: 10px;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    #battleStage > .melee-replay-panel .melee-replay-action {
        min-height: 64px;
        padding: 8px 10px;
        grid-template-columns: 44px minmax(0, 1fr);
    }

    #battleStage > .melee-replay-panel .melee-replay-die {
        width: 40px;
    }

    #battleStage > .melee-replay-panel .melee-replay-combatant,
    #battleStage > .melee-replay-panel .melee-replay-combatant.is-player-side {
        min-height: 56px;
        padding: 6px;
    }

    #battleStage > .melee-replay-panel .melee-replay-slot {
        min-height: 66px;
    }

    #battleStage > .melee-replay-panel .melee-slot-icon.weapon-sprite {
        width: 23px;
    }

    #battleStage > .melee-replay-panel .melee-slot-tarot {
        width: 23px;
    }

    #battleStage > .melee-replay-panel .melee-replay-slot-die {
        width: 16px;
    }
}

@media (max-width: 640px) {
#bottomNav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-content: stretch;
    gap: 4px;
    overflow: hidden;
    padding: 6px 5px calc(6px + var(--safe-bottom));
    height: calc(78px + var(--safe-bottom));
    padding-left: max(4px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    padding-top: 6px;
    padding-bottom: calc(6px + var(--safe-bottom));
}

.nav-button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 58px;
    padding: 3px 1px;
    border-radius: 8px;
    font-size: 10px;
}

    .nav-button span:last-child {
        font-size: 8px;
        line-height: 1.05;
        letter-spacing: 0;
        white-space: nowrap;
    }

#tabContentTarot .tarot-bet-popup {
    padding: 20px 8px 8px;
}

    #tabContentTarot .tarot-betting-actions {
        overflow: visible;
        justify-content: space-between;
        gap: 4px;
    }

#tabContentTarot .tarot-betting-actions button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 46px;
    min-height: 46px;
    padding: 4px 1px;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: normal;
    word-break: keep-all;
    line-height: 1.08;
    font-size: 9px;
    letter-spacing: -0.01em;
}

    #tabContentTarot #tarotPokerRoot .tarot-bet-popup {
        padding: 24px 8px 8px;
    }

    #tabContentTarot #tarotPokerRoot .tarot-betting-actions {
        overflow: visible;
        justify-content: space-between;
        gap: 4px;
    }

    #tabContentTarot #tarotPokerRoot .tarot-betting-actions button {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        height: 50px;
        min-height: 50px;
        padding: 4px 1px;
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        white-space: normal;
        font-size: 10px;
        line-height: 1.12;
    }

    #tabContentTarot #tarotKingdomPassButton {
        flex: 1 1 0;
        width: auto;
    }







    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-trick-status {
        gap: 3px;
        margin-left: 2px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-trick-status .tarot-kingdom-chip {
        min-height: 17px;
        padding: 0 5px;
        font-size: 9px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-hand-title,
    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-trick-title {
        gap: 4px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-hand-actions {
        gap: 4px;
    }


    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-players-summary {
        padding: 3px 7px;
        font-size: 10px;
        line-height: 1.3;
    }


    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-meta-hand {
        padding: 1px 6px;
        font-size: 10px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-panel-title--actions {
        gap: 6px;
    }

    #tabContentTarot #tarotKingdomRoot #tarotKingdomSettlementConfirmButton {
        padding: 8px 12px;
        font-size: 11px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-player-row.is-settlement {
        gap: 6px;
        padding-top: 10px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-player-row.is-settlement.has-settle-float {
        padding-right: 8px;
        padding-left: 62px;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-player-row.is-settlement .tarot-kingdom-player-meta {
        min-width: max-content;
        max-width: none;
        overflow: visible;
    }

    #tabContentTarot #tarotKingdomRoot .tarot-kingdom-settle-float {
        left: 8px;
        right: auto;
        top: 4px;
        transform: translateY(-50%);
    }


    #tabContentTarot #tarotKingdomRoot #tarotKingdomLog.tarot-log::before {
        top: 8px;
        left: 10px;
    }



    #tabContentTarot #tarotKingdomHand.tarot-kingdom-hand {
        gap: 1px;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding-top: 4px;
        padding-bottom: 2px;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    #tabContentTarot #tarotKingdomHand.tarot-kingdom-hand .tarot-card.is-selected {
        transform: translateY(-3px);
    }

    #tabContentTarot #tarotKingdomHand.tarot-kingdom-hand .tarot-card.is-selected::after {
        width: 10px;
        height: 10px;
        font-size: 7px;
    }

    .troy-admin-grid {
        grid-template-columns: 1fr !important;
    }

    .troy-admin-actions-wide {
        align-items: stretch !important;
    }

    .troy-admin-actions-wide > div:last-child {
        width: 100%;
    }

.king-inline-actions button,
.troy-admin-actions button {
        flex-basis: 100%;
    }

}

.tarot-combat-disclosure {
    margin-top: 12px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.76), rgba(17, 24, 39, 0.88));
    overflow: hidden;
}

.tarot-combat-disclosure > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-main);
}

.tarot-combat-disclosure > summary::-webkit-details-marker {
    display: none;
}

.tarot-combat-disclosure > summary::after {
    content: '＋';
    float: right;
    color: var(--accent-color);
}

.tarot-combat-disclosure[open] > summary::after {
    content: '－';
}

.tarot-combat-disclosure .tarot-combat-grid {
    padding: 0 14px 14px;
    margin-top: 0;
}

#tabContentInventory .avatar-card {
    padding: 14px 10px 16px;
    gap: 10px;
    overflow: visible;
}


@media (max-width: 640px) {
    .favorite-players-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .player-profile-head {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        text-align: center;
    }

    .player-profile-avatar-shell {
        width: 100%;
        max-width: 200px;
    }

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

    #btnPlayerProfileCopyId {
        grid-column: 1 / -1;
    }

    .player-profile-transfer-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .player-profile-equip-row {
        grid-template-columns: 68px minmax(0, 1fr);
    }
}



#tabContentMap .map-nav-pill {
    position: absolute;
    top: 10px;
    left: 50%;
    z-index: 1200;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: min(320px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(8, 15, 28, 0.92), rgba(15, 23, 42, 0.96)),
        radial-gradient(120% 120% at 50% 0%, rgba(56, 189, 248, 0.1), transparent 44%);
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.34);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
}

#tabContentMap .map-nav-pill[hidden] {
    display: none;
}

#tabContentMap .map-nav-pill-arrow {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #7dd3fc;
    font-size: 13px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: transform 0.2s ease;
}

#tabContentMap .map-nav-pill-copy {
    min-width: 0;
    flex: 1 1 auto;
}

#tabContentMap .map-nav-pill-label {
    color: #f8fafc;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tabContentMap .map-nav-pill-label.is-long {
    font-size: 10px;
    letter-spacing: 0.02em;
}

#tabContentMap .map-nav-pill-label.is-very-long {
    font-size: 8px;
    letter-spacing: 0;
}

#tabContentMap .map-nav-pill-distance {
    margin-top: 1px;
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.2;
}

#tabContentMap .map-nav-pill-clear {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(248, 250, 252, 0.14);
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 800;
    box-shadow: none;
}

#tabContentMap .map-action-bar {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 20;
    width: auto;
    max-width: none;
    transform: none;
    margin: 8px 16px 12px;
    padding: 10px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(7, 13, 24, 0.96), rgba(11, 18, 31, 0.96)),
        radial-gradient(120% 120% at 50% 0%, rgba(245, 158, 11, 0.12), transparent 42%);
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 30px rgba(2, 6, 23, 0.42);
}

#tabContentMap .map-secondary-actions {
    margin: 0 16px 12px;
}

#tabContentMap .map-secondary-action-btn {
    width: 100%;
    min-height: 44px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.78);
    color: #e2e8f0;
    box-shadow: none;
}

#tabContentMap:not(.map-ready) .map-action-bar {
    display: none;
}

#tabContentMap:not(.map-ready) .map-secondary-actions {
    display: none;
}

#tabContentMap .map-action-bar::before {
    display: none;
}

.secondary-screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.secondary-screen-header h2 {
    margin-bottom: 0;
}

.secondary-screen-back {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.88);
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: none;
    white-space: nowrap;
}

#tabContentMap .map-action-meta {
    margin-bottom: 8px;
}

#tabContentMap .map-action-bar .ship-combat-resource-status {
    max-width: none;
    color: rgba(226, 232, 240, 0.94);
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
}

#tabContentMap .map-action-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: stretch;
    overflow: visible;
    padding-bottom: 0;
}

#tabContentMap .map-action-slot {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
}

#tabContentMap .map-action-buttons > .map-action-slot > button {
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 46px;
    padding: 10px 6px;
    border-radius: 16px;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
}

#tabContentMap #createIslandButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(125, 211, 252, 0.24), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #0f766e, #134e4a);
}

#tabContentMap #shipSideCannonButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(253, 186, 116, 0.28), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #c2410c, #7c2d12);
}

#tabContentMap #shipActionButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(226, 232, 240, 0.24), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #475569, #111827);
}

#tabContentMap .map-action-status-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

#tabContentMap .map-action-status-chip {
    min-height: 18px;
    padding: 4px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.76);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tabContentMap .map-action-status-chip:empty {
    opacity: 0.34;
}

/* ── スキルトグルボタン ────────────────────────────── */
#tabContentMap #shipSkillToggleButton {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(167, 139, 250, 0.32), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #5b21b6, #1e1b4b);
    border-color: rgba(167, 139, 250, 0.45);
}
#tabContentMap #shipSkillToggleButton[aria-expanded="true"] {
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(251, 191, 36, 0.32), rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, #78350f, #1c1917);
    border-color: rgba(251, 191, 36, 0.5);
}

/* ── 船スキルシート ────────────────────────────────── */
.ship-skill-sheet {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 4100;
    max-height: 80vh;
    overflow-y: auto;
    background:
        linear-gradient(180deg, rgba(7, 10, 20, 0.98), rgba(10, 14, 28, 0.98)),
        radial-gradient(120% 80% at 50% 0%, rgba(139, 92, 246, 0.15), transparent 50%);
    border-top: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 24px 24px 0 0;
    padding: 0 16px 32px;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
}
.ship-skill-sheet.is-open {
    transform: translateY(0);
}
.ship-skill-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.3);
    margin: 12px auto 8px;
}
.ship-skill-sheet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0 14px;
}
.ship-skill-sheet-title {
    font-size: 14px;
    font-weight: 900;
    color: #e2e8f0;
    letter-spacing: 0.02em;
}
.ship-skill-role-badge {
    flex: 1;
    font-size: 10px;
    font-weight: 700;
    color: rgba(251, 191, 36, 0.9);
    letter-spacing: 0.04em;
}
.ship-skill-sheet-close {
    margin: -10px -10px -10px 0;
}

/* ── スキルグリッド ───────────────────────────────── */
.ship-skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

/* ── スキルカード ─────────────────────────────────── */
.ship-skill-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 10px 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.7);
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}
.ship-skill-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0.15;
    transition: opacity 0.2s;
    pointer-events: none;
}
.ship-skill-card:active {
    transform: scale(0.96);
}
.ship-skill-card:disabled,
.ship-skill-card[data-ct-remaining]:not([data-ct-remaining="0"]) {
    cursor: not-allowed;
}
.ship-skill-card[data-ct-remaining]:not([data-ct-remaining="0"]) .ship-skill-card-name,
.ship-skill-card[data-ct-remaining]:not([data-ct-remaining="0"]) .ship-skill-card-desc {
    opacity: 0.5;
}

/* 属性別カラー */
.ship-skill-card[data-element="fire"] {
    border-color: rgba(251, 146, 60, 0.45);
    background: linear-gradient(160deg, rgba(120, 53, 15, 0.6), rgba(15, 23, 42, 0.7));
}
.ship-skill-card[data-element="fire"]::before {
    background: radial-gradient(80% 60% at 50% 0%, rgba(251, 146, 60, 1), transparent);
}
.ship-skill-card[data-element="wind"] {
    border-color: rgba(99, 102, 241, 0.45);
    background: linear-gradient(160deg, rgba(30, 27, 75, 0.7), rgba(15, 23, 42, 0.7));
}
.ship-skill-card[data-element="wind"]::before {
    background: radial-gradient(80% 60% at 50% 0%, rgba(129, 140, 248, 1), transparent);
}
.ship-skill-card[data-element="water"] {
    border-color: rgba(14, 165, 233, 0.45);
    background: linear-gradient(160deg, rgba(8, 47, 73, 0.7), rgba(15, 23, 42, 0.7));
}
.ship-skill-card[data-element="water"]::before {
    background: radial-gradient(80% 60% at 50% 0%, rgba(56, 189, 248, 1), transparent);
}
.ship-skill-card[data-element="earth"] {
    border-color: rgba(34, 197, 94, 0.45);
    background: linear-gradient(160deg, rgba(20, 83, 45, 0.6), rgba(15, 23, 42, 0.7));
}
.ship-skill-card[data-element="earth"]::before {
    background: radial-gradient(80% 60% at 50% 0%, rgba(74, 222, 128, 1), transparent);
}
.ship-skill-card[data-element="none"] {
    border-color: rgba(251, 191, 36, 0.45);
    background: linear-gradient(160deg, rgba(69, 26, 3, 0.6), rgba(15, 23, 42, 0.7));
}
.ship-skill-card[data-element="none"]::before {
    background: radial-gradient(80% 60% at 50% 0%, rgba(251, 191, 36, 0.8), rgba(167, 139, 250, 0.6), transparent);
}

/* CTリング */
.ship-skill-ct-ring-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.ship-skill-ct-ring-wrap svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.ship-skill-ct-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 3;
}
.ship-skill-ct-ring-fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s linear;
}
.ship-skill-card[data-element="fire"]    .ship-skill-ct-ring-fill { stroke: #fb923c; }
.ship-skill-card[data-element="wind"]   .ship-skill-ct-ring-fill { stroke: #818cf8; }
.ship-skill-card[data-element="water"]  .ship-skill-ct-ring-fill { stroke: #38bdf8; }
.ship-skill-card[data-element="earth"]  .ship-skill-ct-ring-fill { stroke: #4ade80; }
.ship-skill-card[data-element="none"]   .ship-skill-ct-ring-fill { stroke: #fbbf24; }

.ship-skill-ct-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
}
.ship-skill-ct-icon {
    font-size: 18px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}
.ship-skill-ct-sec {
    font-size: 9px;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.85);
    letter-spacing: -0.02em;
    min-height: 11px;
}

/* カード情報 */
.ship-skill-card-name {
    font-size: 13px;
    font-weight: 900;
    color: #f1f5f9;
    text-align: center;
    letter-spacing: 0.02em;
    transition: opacity 0.2s;
}
.ship-skill-card-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}
.ship-skill-card-range {
    font-size: 9px;
    color: rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
    padding: 1px 5px;
}
.ship-skill-card-cast {
    font-size: 9px;
    color: rgba(148, 163, 184, 0.8);
}
.ship-skill-card-desc {
    font-size: 9px;
    color: rgba(148, 163, 184, 0.75);
    text-align: center;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: opacity 0.2s;
}

/* 自動発動バッジ */
.ship-skill-auto-badge {
    position: absolute;
    top: 7px;
    right: 7px;
    font-size: 8px;
    font-weight: 700;
    color: rgba(251, 191, 36, 0.95);
    background: rgba(69, 26, 3, 0.85);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 6px;
    padding: 1px 5px;
    letter-spacing: 0.04em;
    pointer-events: none;
}

/* READY フラッシュ */
@keyframes ship-skill-ready-flash {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.ship-skill-card.is-ready-flash {
    animation: ship-skill-ready-flash 0.6s ease-out;
}

.ship-skill-empty-msg {
    text-align: center;
    color: rgba(148, 163, 184, 0.5);
    font-size: 12px;
    padding: 24px 0;
}

/* ═══════════════════════════════════════════════════════
   バトルタブ
═══════════════════════════════════════════════════════ */
.battle-tab-header {
    padding: 16px 0 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 12px;
}
.battle-tab-title {
    font-size: 18px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 4px;
}
.battle-tab-hint {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}
.battle-territory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.battle-territory-loading {
    text-align: center;
    color: #64748b;
    font-size: 13px;
    padding: 24px 0;
}
.battle-territory-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1a2535;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px 12px;
    transition: border-color 0.15s;
}
.battle-territory-card:active {
    border-color: rgba(255,255,255,0.2);
}
.battle-territory-card-left {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.battle-territory-symbol {
    font-size: 22px;
    line-height: 1;
}
.battle-territory-card-body {
    flex: 1;
    min-width: 0;
}
.battle-territory-name {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.battle-territory-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}
.battle-territory-arcana {
    font-size: 10px;
    color: #94a3b8;
}
.battle-territory-element {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    color: #cbd5e1;
}
.battle-element-fire   { color: #fb923c; background: rgba(251,146,60,0.15); }
.battle-element-wind   { color: #67e8f9; background: rgba(103,232,249,0.12); }
.battle-element-water  { color: #60a5fa; background: rgba(96,165,250,0.15); }
.battle-element-earth  { color: #86efac; background: rgba(134,239,172,0.15); }
.battle-territory-owner {
    font-size: 11px;
    color: #64748b;
}
.battle-territory-owner.is-occupied {
    color: #f59e0b;
}
.battle-territory-card-right {
    flex-shrink: 0;
}
.battle-territory-btn {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.battle-territory-btn:active {
    opacity: 0.75;
}
.battle-territory-btn:disabled {
    cursor: default;
    opacity: 0.48;
    filter: grayscale(0.35);
}

/* ── 週次争奪バナー ──────────────────────────────────────────── */
.weekly-contest-banner {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 14px 14px 12px;
    margin-bottom: 14px;
}
.weekly-contest-banner.is-open {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245,158,11,0.25);
}
.weekly-contest-banner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.weekly-contest-banner-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #f59e0b;
    text-transform: uppercase;
}
.weekly-contest-banner-timer {
    font-size: 11px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}
.weekly-contest-banner-territory {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 10px;
}
.weekly-contest-damage-label {
    font-size: 10px;
    color: #64748b;
    margin-bottom: 5px;
}
.weekly-contest-damage-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.weekly-contest-damage-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.weekly-contest-damage-nation {
    font-size: 10px;
    color: #94a3b8;
    width: 50px;
    flex-shrink: 0;
}
.weekly-contest-damage-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
}
.weekly-contest-damage-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.weekly-contest-damage-fill.fire  { background: #fb923c; }
.weekly-contest-damage-fill.water { background: #60a5fa; }
.weekly-contest-damage-fill.wind  { background: #67e8f9; }
.weekly-contest-damage-fill.earth { background: #86efac; }
.weekly-contest-damage-val {
    font-size: 10px;
    color: #64748b;
    width: 36px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.weekly-contest-banner-next {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}
.weekly-contest-banner-next strong {
    color: #e2e8f0;
}

/* インベントリフィードバックバナー */
.inventory-feedback {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #34d399;
    background: rgba(52,211,153,0.1);
    border: 1px solid rgba(52,211,153,0.25);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    animation: feedbackFadeIn 0.2s ease;
}
.inventory-feedback.is-error {
    color: #f87171;
    background: rgba(248,113,113,0.1);
    border-color: rgba(248,113,113,0.25);
}
@keyframes feedbackFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 争奪中カードのハイライト */
.battle-territory-card.is-contested {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245,158,11,0.2);
}
.battle-territory-contest-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #f59e0b;
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 4px;
    vertical-align: middle;
}

/* Companions */
.companion-page {
    padding: 16px;
}
.companion-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.companion-page-header h2 {
    margin: 0 0 4px;
    color: #f8fafc;
    font-size: 22px;
}
.companion-page-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
}
.companion-page-message {
    min-height: 20px;
    color: #34d399;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}
.companion-page-message.is-error {
    color: #f87171;
}
.companion-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}
.companion-create-panel,
.companion-list-panel {
    background: #111827;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    padding: 14px;
}
.companion-create-panel h3,
.companion-list-panel h3 {
    margin: 0 0 12px;
    color: #e5e7eb;
    font-size: 16px;
}
.companion-host-note {
    margin: -2px 0 12px;
    color: #fbbf24;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}
.companion-list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.companion-list-head h3 {
    margin: 0;
}
.companion-list-head span {
    color: #94a3b8;
    font-size: 12px;
}
.reservation-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.companion-create-panel label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
}
.companion-create-panel label.is-wide {
    grid-column: 1 / -1;
}
.companion-create-panel input,
.companion-create-panel select,
.companion-create-panel textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    background: #0b1220;
    color: #f8fafc;
    padding: 9px 10px;
    font-size: 14px;
}
.companion-create-panel textarea {
    min-height: 94px;
    resize: vertical;
}
.companion-note {
    margin: 10px 0 12px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}
.crew-create-options {
    display: grid;
    gap: 8px;
    margin: 10px 0 8px;
}

.crew-create-options[hidden] {
    display: none;
}

#crewNameHint {
    margin: 0;
    color: #cbd5e1;
}
#crewCreatePreview {
    color: #fff1c2;
    font-size: 13px;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}
.companion-create-btn,
.companion-refresh-btn,
.companion-action-btn {
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: #2563eb;
    font-weight: 700;
    cursor: pointer;
}
.companion-create-btn {
    width: 100%;
    min-height: 44px;
    font-size: 15px;
}
.companion-refresh-btn {
    min-height: 38px;
    padding: 0 14px;
    background: #334155;
}

.companion-refresh-btn::before,
.troy-orders-refresh::before {
    content: "";
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 6px;
    vertical-align: -4px;
    background: url("./assets/ui/buttons/action-refresh.png") center / contain no-repeat;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}
.companion-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.companion-card {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: #0b1220;
    padding: 12px;
}
.companion-card.is-pending {
    border-color: rgba(245, 158, 11, 0.45);
}
.companion-card.is-rejected {
    opacity: 0.68;
}
.companion-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.companion-card-type {
    color: #38bdf8;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 3px;
}
.companion-card h3 {
    margin: 0;
    color: #f8fafc;
    font-size: 16px;
    line-height: 1.3;
}
.companion-status {
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.14);
    color: #6ee7b7;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
}
.companion-card.is-pending .companion-status {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
}
.companion-card.is-rejected .companion-status {
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
}
.companion-card-time {
    margin-top: 8px;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 700;
}
.companion-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.companion-card-meta span {
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    padding: 4px 7px;
    font-size: 12px;
}
.companion-card-desc {
    margin: 10px 0 8px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
}
.companion-card-participants {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.45;
}
.companion-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.companion-action-btn {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
}
.companion-action-btn.is-join {
    background: #059669;
}
.companion-action-btn.is-approve {
    background: #2563eb;
}
.companion-action-btn.is-reject {
    background: #b91c1c;
}
.companion-create-btn:disabled,
.companion-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.56;
}
.companion-action-note {
    color: #6ee7b7;
    font-size: 13px;
    font-weight: 700;
}
.companion-empty {
    color: #94a3b8;
    text-align: center;
    padding: 28px 8px;
}
.crew-invite-panel,
.crew-join-panel {
    margin-top: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: #0b1220;
    padding: 12px;
}
.crew-join-panel .companion-action-btn {
    width: 100%;
    margin-top: 12px;
}
.crew-recruitment-role-select,
.crew-invite-panel select,
.crew-application-role-row select {
    min-height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    background: #111827;
    color: #f8fafc;
    padding: 7px 9px;
    font-size: 13px;
}
.crew-recruitment-role-select {
    flex: 1 1 180px;
}
.crew-application-role-row {
    margin-top: 10px;
}
.crew-application-role-row label {
    display: grid;
    gap: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
}
.crew-invite-panel label {
    display: grid;
    gap: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
}
.crew-invite-title {
    color: #f8fafc;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 10px;
}
.crew-invite-qr {
    display: block;
    width: 160px;
    height: 160px;
    max-width: 100%;
    margin: 0 auto 10px;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}
.crew-invite-value {
    overflow-wrap: anywhere;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    padding: 8px;
    font-size: 12px;
    text-align: center;
}
.crew-join-confirm-body {
    display: grid;
    gap: 10px;
}
.crew-system-help {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 12px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%),
        linear-gradient(180deg, rgba(8, 12, 18, 0.88), rgba(2, 5, 9, 0.96));
    color: #f7e8c1;
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.08);
}
.crew-system-help summary {
    cursor: pointer;
    color: #fff1c2;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}
.crew-system-help-body {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}
.crew-system-help-body p {
    margin: 0;
    color: #d7c7a4;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.55;
}
.crew-warehouse-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
    margin-top: 12px;
}
.crew-warehouse-actions.is-item {
    grid-template-columns: minmax(0, 1fr) auto;
}
.crew-warehouse-actions label {
    display: grid;
    gap: 5px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}
.crew-warehouse-actions input,
.crew-warehouse-actions select {
    min-height: 36px;
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    background: #111827;
    color: #f8fafc;
    padding: 7px 9px;
    font-size: 13px;
}
.crew-warehouse-title-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}
.crew-warehouse-title-row > div {
    min-width: 0;
}
.crew-warehouse-thumb {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 7px;
    border: 1px solid rgba(255, 230, 170, 0.35);
    background: rgba(8, 12, 18, 0.45);
    box-shadow: inset 0 0 10px rgba(255, 218, 144, 0.08);
}
.crew-warehouse-thumb img {
    display: block;
    width: 34px;
    height: 34px;
    object-fit: contain;
}

@media (max-width: 720px) {
    .companion-page {
        padding: 12px;
    }
    .companion-page-header {
        align-items: flex-start;
    }
    .companion-layout,
    .reservation-form-grid {
        grid-template-columns: 1fr;
    }
    .companion-list-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
    .companion-card-head {
        flex-direction: column;
        gap: 8px;
    }
    .crew-warehouse-actions,
    .crew-warehouse-actions.is-item {
        grid-template-columns: 1fr;
    }
}

.troy-orders-body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(180deg, rgba(10, 7, 4, 0.82), rgba(15, 9, 4, 0.95)),
        radial-gradient(ellipse at 20% 0%, rgba(182, 130, 48, 0.26), transparent 38%),
        repeating-linear-gradient(90deg, #1a0f07 0 44px, #0f0905 44px 88px);
    color: #f8e8bd;
    overflow-x: hidden;
}

.troy-orders-body.is-troy-ticket-open {
    overflow: hidden;
}

.troy-orders-shell {
    width: min(1220px, calc(100vw - 32px));
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 20px) 0 32px;
}

.troy-orders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 8px 2px;
}

.troy-orders-kicker {
    font-size: 12px;
    font-weight: 800;
    color: #e1b35a;
    letter-spacing: 0;
}

.troy-orders-header h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.15;
}

.troy-orders-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.troy-orders-auth-name {
    max-width: 220px;
    color: #c8b184;
    font-size: 13px;
    text-align: right;
}

.troy-orders-refresh,
.troy-orders-sound-toggle {
    border: 0;
    border-radius: 8px;
    background: linear-gradient(180deg, #f3c46d, #b77321);
    color: #261407;
    font-weight: 900;
    cursor: pointer;
    min-height: 42px;
    padding: 0 18px;
    box-shadow: inset 0 1px 0 rgba(255, 246, 207, 0.5), 0 6px 14px rgba(0, 0, 0, 0.28);
}

.troy-orders-sound-toggle {
    background: rgba(28, 18, 9, 0.72);
    color: #f0d7a0;
    border: 1px solid rgba(226, 179, 90, 0.36);
}

.troy-orders-sound-toggle.is-enabled {
    background: linear-gradient(180deg, #71d58b, #248143);
    color: #081b0d;
}

.troy-orders-sound-toggle.is-pending {
    background: linear-gradient(180deg, #f5d774, #b98220);
    color: #211204;
}

.troy-orders-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.troy-orders-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 16px solid transparent;
    border-image: url('/assets/ui/panels/panel-wood-large.png') 32 fill / 16px / 0 stretch;
    color: #f8e8bd;
}

.troy-orders-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d7bd82;
    font-size: 13px;
}

.troy-orders-toolbar select {
    min-height: 34px;
    border: 1px solid rgba(226, 179, 90, 0.42);
    border-radius: 7px;
    background: rgba(24, 14, 6, 0.82);
    color: #f8e8bd;
    padding: 0 10px;
}

.troy-orders-serve-summary {
    color: #ffd67b;
    font-size: 14px;
    font-weight: 800;
}

.troy-orders-request-panel {
    margin-bottom: 14px;
    padding: 12px;
    border: 18px solid transparent;
    border-image: url('/assets/ui/panels/panel-wood-large.png') 32 fill / 18px / 0 stretch;
    animation: troyOrdersRequestPulse 1.6s ease-in-out infinite;
}

.troy-orders-request-panel .troy-orders-section-head strong {
    color: #ffd67b;
    font-size: 20px;
    font-weight: 1000;
}

.troy-orders-request-list {
    display: grid;
    gap: 8px;
}

.troy-orders-request {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    min-height: 62px;
    padding: 9px 10px;
    border: 1px solid rgba(226, 179, 90, 0.28);
    border-radius: 8px;
    background: rgba(35, 19, 8, 0.74);
}

.troy-orders-request.is-processing {
    opacity: 0.72;
}

.troy-orders-request-thumb {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: rgba(9, 6, 3, 0.45);
}

.troy-orders-request-thumb img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    image-rendering: pixelated;
}

.troy-orders-request-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.troy-orders-request-main strong {
    overflow: hidden;
    color: #ffe0a0;
    font-size: 15px;
    font-weight: 1000;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-request-main span {
    overflow: hidden;
    color: #c9ad72;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-request-total {
    color: #f8e8bd;
    font-size: 18px;
    font-weight: 1000;
    white-space: nowrap;
}

.troy-orders-request-actions {
    display: inline-flex;
    gap: 7px;
}

.troy-orders-request-actions button {
    min-height: 34px;
    min-width: 62px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-image: url('/assets/ui/buttons/button-gold-large.png') 24 fill / 10px / 0 stretch;
    background: linear-gradient(180deg, #f2c45f, #a86420);
    color: #1d0e04;
    font-size: 13px;
    font-weight: 1000;
}

.troy-orders-request-actions button.is-cancel {
    border-image-source: url('/assets/ui/buttons/button-dark-large.png');
    background: rgba(24, 14, 6, 0.78);
    color: #f0d7a0;
}

@keyframes troyOrdersRequestPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.08); }
}

.troy-orders-summary-item {
    min-height: 72px;
    padding: 13px 14px;
    border: 16px solid transparent;
    border-image: url('/assets/ui/panels/panel-wood-large.png') 32 fill / 16px / 0 stretch;
}

.troy-orders-summary-item span {
    display: block;
    margin-bottom: 6px;
    color: #d2b679;
    font-size: 12px;
}

.troy-orders-summary-item strong {
    font-size: 22px;
}

.troy-orders-summary-item .is-open {
    color: #8af0a4;
}

.troy-orders-summary-item .is-close {
    color: #f99282;
}

.troy-orders-message {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(75, 183, 105, 0.34);
    border-radius: 8px;
    background: rgba(19, 77, 39, 0.34);
    color: #d3ffd7;
}

.troy-orders-message:empty,
.troy-orders-message[hidden] {
    display: none;
}

.troy-orders-message.is-error {
    border-color: rgba(248, 113, 113, 0.44);
    background: rgba(127, 29, 29, 0.36);
    color: #ffd0c7;
}

.troy-orders-coin-log-panel {
    margin-bottom: 14px;
    padding: 12px;
    border: 18px solid transparent;
    border-image: url('/assets/ui/panels/panel-wood-large.png') 32 fill / 18px / 0 stretch;
}

.troy-orders-sales-panel {
    margin-bottom: 14px;
    padding: 12px;
    border: 18px solid transparent;
    border-image: url('/assets/ui/panels/panel-wood-large.png') 32 fill / 18px / 0 stretch;
}

.troy-orders-sales-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.troy-orders-payouts {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.troy-orders-payout-card {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 13px 14px;
    border: 1px solid rgba(226, 179, 90, 0.26);
    border-radius: 8px;
    background: rgba(255, 226, 151, 0.1);
}

.troy-orders-payout-card span {
    color: #d8bd80;
    font-size: 13px;
    font-weight: 900;
}

.troy-orders-payout-card strong {
    color: #ffe0a0;
    font-size: 28px;
    font-weight: 1000;
    line-height: 1;
}

.troy-orders-payout-card em {
    min-width: 0;
    overflow: hidden;
    color: #bda16a;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-payout-card.is-master strong {
    color: #9ef7b0;
}

.troy-orders-payout-card.is-dealer strong {
    color: #ffd67b;
}

.troy-orders-sales-column {
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(226, 179, 90, 0.18);
    border-radius: 8px;
    background: rgba(22, 13, 6, 0.62);
}

.troy-orders-sales-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.troy-orders-sales-column-head strong {
    color: #ffe0a0;
    font-size: 14px;
    font-weight: 900;
}

.troy-orders-sales-column-head span {
    color: #bda16a;
    font-size: 12px;
    font-weight: 800;
}

.troy-orders-sales-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    min-height: 34px;
    padding: 7px 8px;
    border-radius: 7px;
    background: rgba(255, 226, 151, 0.08);
}

.troy-orders-sales-rank {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    background: rgba(226, 179, 90, 0.18);
    color: #ffe0a0;
    font-size: 12px;
    font-weight: 1000;
}

.troy-orders-sales-name {
    min-width: 0;
    overflow: hidden;
    color: #f7e8bd;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-sales-quantity {
    color: #bda16a;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.troy-orders-sales-row strong {
    color: #ffd67b;
    font-size: 14px;
    font-weight: 1000;
    white-space: nowrap;
}

.troy-orders-sales-empty {
    min-height: 34px;
    display: grid;
    place-items: center start;
    color: #bda16a;
    font-size: 13px;
}

.troy-orders-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.troy-orders-section-title {
    color: #ffe0a0;
    font-weight: 900;
}

.troy-orders-section-sub {
    color: #c1a56e;
    font-size: 12px;
    margin-top: 2px;
}

.troy-orders-coin-log {
    display: grid;
    gap: 8px;
}

.troy-orders-coin-log-empty {
    color: #bda16a;
    font-size: 13px;
}

.troy-orders-coin-log-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(22, 13, 6, 0.68);
    border: 1px solid rgba(226, 179, 90, 0.18);
}

.troy-orders-coin-log-name {
    color: #f7e8bd;
    font-size: 14px;
    font-weight: 800;
}

.troy-orders-coin-log-time {
    color: #bda16a;
    font-size: 12px;
}

.troy-orders-coin-log-amount {
    grid-row: 1 / span 2;
    grid-column: 2;
    color: #ffd67b;
    font-size: 20px;
    font-weight: 1000;
    white-space: nowrap;
}

.troy-orders-ticket-board {
    margin: 0 0 14px;
    padding: 18px;
    border: 20px solid transparent;
    border-image: url('/assets/ui/panels/panel-wood-large.png') 32 fill / 20px / 0 stretch;
}

.troy-orders-ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
    padding: 4px 2px 2px;
}

.troy-orders-ticket {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 246px;
    flex-direction: column;
    gap: 8px;
    padding: 16px 15px 14px;
    border: 28px solid transparent;
    border-image: url('/assets/ui/panels/panel-parchment-large.png') 36 fill / 28px / 0 stretch;
    background: transparent;
    color: #35230f;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 16px 26px rgba(0, 0, 0, 0.28);
    transform-origin: 50% 30%;
    transition: transform 0.12s ease, filter 0.12s ease;
    user-select: none;
    touch-action: none;
}

.troy-orders-ticket:hover,
.troy-orders-ticket:focus-visible {
    filter: brightness(1.05);
    transform: translateY(-2px);
    outline: none;
}

.troy-orders-ticket.is-tilt-left {
    rotate: -0.7deg;
}

.troy-orders-ticket.is-tilt-right {
    rotate: 0.7deg;
}

.troy-orders-ticket.is-selected {
    filter: brightness(1.08) saturate(1.05);
}

.troy-orders-ticket.is-dragging {
    z-index: 20;
    cursor: grabbing;
    filter: brightness(1.08) saturate(1.06);
    box-shadow: 0 24px 44px rgba(0, 0, 0, 0.46);
}

.troy-orders-ticket.is-drop-group {
    filter: brightness(1.12) saturate(1.12);
    outline: 3px solid rgba(174, 106, 32, 0.72);
    outline-offset: 4px;
}

.troy-orders-ticket.is-drop-before::before,
.troy-orders-ticket.is-drop-after::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    width: 6px;
    border-radius: 999px;
    background: #f2c56c;
    box-shadow: 0 0 0 2px rgba(60, 31, 8, 0.28), 0 0 14px rgba(242, 197, 108, 0.72);
    z-index: 4;
}

.troy-orders-ticket.is-drop-before::before {
    left: -10px;
}

.troy-orders-ticket.is-drop-after::before {
    right: -10px;
}

.troy-orders-ticket.is-grouped {
    min-height: 270px;
    filter: saturate(1.04);
    z-index: 0;
}

.troy-orders-ticket.is-grouped::after {
    content: "";
    position: absolute;
    inset: 12px -10px -12px 12px;
    z-index: -1;
    border: 28px solid transparent;
    border-image: url('/assets/ui/panels/panel-parchment-large.png') 36 fill / 28px / 0 stretch;
    opacity: 0.82;
    transform: rotate(2.2deg);
    pointer-events: none;
}

.troy-orders-group-ungroup {
    align-self: flex-end;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid rgba(98, 47, 17, 0.32);
    border-radius: 8px;
    background: rgba(92, 47, 20, 0.12);
    color: #5c3012;
    font-size: 12px;
    font-weight: 1000;
    cursor: pointer;
}

.troy-orders-ticket.has-order .troy-orders-ticket-pin {
    background: radial-gradient(circle at 34% 30%, #ffdf87, #b94a2a 46%, #5d1c12 100%);
}

.troy-orders-ticket-pin {
    position: absolute;
    top: -10px;
    right: 24px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #f7d48a, #7d3a22 54%, #3e170d 100%);
    box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.25), 0 5px 12px rgba(0, 0, 0, 0.32);
}

.troy-orders-ticket-kicker,
.troy-orders-ticket-meta,
.troy-orders-ticket-foot em,
.troy-orders-ticket-note {
    color: #6f5534;
    font-size: 12px;
    font-weight: 800;
}

.troy-orders-ticket-kicker {
    display: block;
}

.troy-orders-ticket-name {
    display: block;
    min-height: 50px;
    color: #2b1a0b;
    font-size: 22px;
    font-weight: 1000;
    line-height: 1.12;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.troy-orders-ticket-meta {
    display: block;
    min-height: 32px;
    line-height: 1.35;
}

.troy-orders-ticket-preview {
    display: block;
    flex: 1;
    margin: 4px 0;
    padding-top: 8px;
    border-top: 1px dashed rgba(90, 63, 31, 0.36);
}

.troy-orders-ticket-items {
    display: grid;
    gap: 6px;
}

.troy-orders-ticket-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    color: #3b2b17;
    font-size: 13px;
}

.troy-orders-ticket-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-ticket-item strong {
    white-space: nowrap;
}

.troy-orders-ticket-foot {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
    border-top: 1px solid rgba(90, 63, 31, 0.2);
    padding-top: 10px;
}

.troy-orders-ticket-foot strong {
    color: #4a2107;
    font-size: 25px;
    font-weight: 1000;
    line-height: 1;
}

.troy-orders-ticket-foot em {
    font-style: normal;
    white-space: nowrap;
}

.troy-orders-ticket-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(9, 6, 3, 0.78);
}

.troy-orders-ticket-modal[hidden] {
    display: none;
}

.troy-orders-ticket-modal-panel {
    position: relative;
    width: min(1120px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding: 22px;
    border: 32px solid transparent;
    border-image: url('/assets/ui/panels/panel-parchment-large.png') 36 fill / 32px / 0 stretch;
    color: #2d1b0b;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.55);
}

.troy-orders-ticket-close {
    position: sticky;
    top: 0;
    float: right;
    z-index: 2;
    margin: -8px -6px 0 10px;
}

.troy-orders-ticket-detail-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 2px solid rgba(89, 54, 22, 0.28);
}

.troy-orders-ticket-detail-kicker {
    color: #8a5d2c;
    font-size: 13px;
    font-weight: 900;
}

.troy-orders-ticket-detail h2 {
    margin: 4px 0 4px;
    color: #231305;
    font-size: 34px;
    line-height: 1.08;
}

.troy-orders-ticket-detail p {
    margin: 0;
    color: #6b4c2b;
    font-size: 13px;
    font-weight: 800;
}

.troy-orders-total {
    color: #4b2108;
    font-size: 32px;
    font-weight: 1000;
}

.troy-orders-total-wrap {
    text-align: right;
}

.troy-orders-total-wrap span {
    display: inline-flex;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.troy-orders-total-wrap .is-pending-serve {
    background: rgba(178, 64, 38, 0.18);
    color: #8b2c17;
}

.troy-orders-total-wrap .is-served-all {
    background: rgba(47, 125, 74, 0.16);
    color: #286b38;
}

.troy-orders-ticket-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(310px, 400px);
    gap: 20px;
    align-items: start;
}

.troy-orders-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 32px;
    margin-bottom: 10px;
    color: #2b1a0b;
}

.troy-orders-subhead strong {
    font-size: 18px;
    font-weight: 1000;
}

.troy-orders-subhead span {
    color: #8a653b;
    font-size: 12px;
    font-weight: 900;
}

.troy-orders-items {
    display: grid;
    gap: 7px;
    margin: 0 0 14px;
}

.troy-orders-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px 86px 94px 62px;
    gap: 10px;
    align-items: center;
    min-height: 42px;
    border-bottom: 1px solid rgba(91, 61, 28, 0.18);
    color: #30200f;
    font-size: 15px;
}

.troy-orders-item-row.is-empty {
    grid-template-columns: 1fr;
    color: #7a613d;
    font-weight: 800;
}

.troy-orders-item-row.is-served {
    color: #7b6a4f;
}

.troy-orders-item-row.is-served span {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

.troy-orders-quantity-control {
    display: inline-flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    min-width: 96px;
}

.troy-orders-quantity-control em {
    color: #6a4a25;
    font-style: normal;
    text-align: right;
    min-width: 28px;
    font-weight: 900;
}

.troy-orders-quantity-control button {
    width: 31px;
    min-width: 31px;
    min-height: 31px;
    padding: 0;
    border-color: rgba(42, 96, 54, 0.38);
    border-radius: 999px;
    background: rgba(42, 96, 54, 0.18);
    color: #1d6030;
    font-size: 18px;
    line-height: 1;
}

.troy-orders-quantity-control button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.troy-orders-quantity-control.is-locked {
    padding-right: 37px;
}

.troy-orders-item-row strong {
    text-align: right;
    white-space: nowrap;
}

.troy-orders-item-row [data-toggle-served],
.troy-orders-item-row [data-remove-item] {
    min-height: 31px;
    border: 1px solid rgba(153, 52, 30, 0.34);
    border-radius: 7px;
    background: rgba(176, 66, 36, 0.14);
    color: #843018;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.troy-orders-item-row [data-remove-item] {
    color: #7f1d1d;
    background: rgba(153, 27, 27, 0.12);
}

.troy-orders-item-row.is-served [data-toggle-served] {
    border-color: rgba(47, 125, 74, 0.34);
    background: rgba(47, 125, 74, 0.14);
    color: #286b38;
}

.troy-orders-settle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 142px;
    gap: 10px;
    align-items: end;
}

.troy-orders-group-settle {
    margin: 0 0 14px;
    border-top: 1px solid rgba(91, 61, 28, 0.18);
    border-bottom: 1px solid rgba(91, 61, 28, 0.18);
}

.troy-orders-group-settle summary {
    padding: 10px 2px;
    color: #5c3a17;
    font-size: 14px;
    font-weight: 1000;
    cursor: pointer;
}

.troy-orders-group-body {
    display: grid;
    gap: 8px;
    padding: 0 0 12px;
}

.troy-orders-group-total {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid rgba(91, 61, 28, 0.28);
    border-radius: 8px;
    background: rgba(255, 244, 211, 0.42);
}

.troy-orders-group-total span,
.troy-orders-group-total em {
    color: #7c5a32;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.troy-orders-group-total strong {
    color: #2d1b0b;
    font-size: 22px;
    font-weight: 1000;
    text-align: right;
}

.troy-orders-group-list {
    display: grid;
    gap: 6px;
}

.troy-orders-group-current {
    display: grid;
    gap: 7px;
    padding: 9px;
    border: 1px solid rgba(91, 61, 28, 0.22);
    border-radius: 8px;
    background: rgba(255, 244, 211, 0.3);
}

.troy-orders-group-current-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.troy-orders-group-current-head span {
    color: #6b421c;
    font-size: 12px;
    font-weight: 1000;
}

.troy-orders-group-current-head button {
    min-height: 28px;
    padding: 3px 9px;
    border: 1px solid rgba(98, 47, 17, 0.3);
    border-radius: 8px;
    background: rgba(92, 47, 20, 0.12);
    color: #5c3012;
    font-size: 12px;
    font-weight: 1000;
    cursor: pointer;
}

.troy-orders-group-current-list {
    display: grid;
    gap: 5px;
}

.troy-orders-group-current-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 42px;
    padding: 6px 8px;
    border-radius: 7px;
    background: rgba(255, 248, 225, 0.36);
}

.troy-orders-group-current-row span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.troy-orders-group-current-row strong,
.troy-orders-group-current-row b {
    color: #2d1b0b;
    font-size: 14px;
    font-weight: 1000;
}

.troy-orders-group-current-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-group-current-row em {
    overflow: hidden;
    color: #7c5a32;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-group-current-row b {
    white-space: nowrap;
}

.troy-orders-group-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 86px;
    gap: 8px;
    align-items: center;
    min-height: 48px;
    padding: 7px 9px;
    border: 1px solid rgba(108, 61, 18, 0.22);
    border-radius: 8px;
    background: rgba(255, 248, 225, 0.26);
    color: #2d1b0b;
    cursor: pointer;
}

.troy-orders-group-row input {
    width: 18px;
    height: 18px;
    accent-color: #ad6720;
}

.troy-orders-group-row span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.troy-orders-group-row strong {
    overflow: hidden;
    color: #2d1b0b;
    font-size: 14px;
    font-weight: 1000;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-group-row em {
    overflow: hidden;
    color: #7c5a32;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.troy-orders-group-row b {
    color: #3b1d09;
    font-size: 14px;
    font-weight: 1000;
    text-align: right;
    white-space: nowrap;
}

.troy-orders-settle label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 46px;
    padding: 0 10px;
    border: 1px solid rgba(91, 61, 28, 0.28);
    border-radius: 8px;
    background: rgba(255, 244, 211, 0.42);
}

.troy-orders-settle label span {
    color: #7c5a32;
    font-size: 12px;
    font-weight: 900;
}

.troy-orders-settle input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: #2d1b0b;
    font-size: 20px;
    font-weight: 900;
    text-align: right;
    outline: none;
}

.troy-orders-settle button {
    min-height: 46px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(180deg, #f2c56c, #ad6720);
    color: #211206;
    font-size: 15px;
    font-weight: 1000;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 246, 207, 0.48), 0 6px 14px rgba(0, 0, 0, 0.22);
}

.troy-orders-settle button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.7);
    opacity: 0.48;
}

.troy-orders-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: #c7aa72;
    font-size: 18px;
    font-weight: 800;
}

.troy-orders-empty[hidden] {
    display: none;
}

.troy-orders-pos-category {
    border-top: 1px solid rgba(91, 61, 28, 0.18);
}

.troy-orders-pos-category summary {
    padding: 10px 2px;
    color: #5c3a17;
    font-size: 14px;
    font-weight: 1000;
    cursor: pointer;
}

.troy-orders-pos-category summary::marker {
    color: #9a6325;
}

.troy-orders-pos-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
    gap: 8px;
    padding: 2px 0 12px;
}

.troy-orders-pos-btn {
    display: grid;
    min-height: 66px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
    padding: 8px 9px;
    border: 1px solid rgba(108, 61, 18, 0.34);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(92, 50, 19, 0.9), rgba(49, 25, 10, 0.94));
    color: #fff0c8;
    font-size: 13px;
    font-weight: 900;
    text-align: left;
    line-height: 1.28;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 230, 168, 0.18), 0 4px 10px rgba(0, 0, 0, 0.18);
}

.troy-orders-pos-btn:active {
    transform: translateY(1px);
}

.troy-orders-pos-thumb {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 214, 123, 0.2);
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 50% 20%, rgba(255, 230, 168, 0.2), transparent 62%),
        rgba(24, 15, 8, 0.62);
    color: #ffe2a0;
    font-size: 22px;
    line-height: 1;
    overflow: hidden;
}

.troy-orders-pos-thumb img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    image-rendering: pixelated;
}

.troy-orders-pos-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.troy-orders-pos-name {
    color: #fff0c8;
    font-size: 12px;
    font-weight: 1000;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.troy-orders-pos-price {
    color: #ffd67b;
    font-size: 11px;
    font-weight: 1000;
    white-space: nowrap;
}

.troy-orders-pos-btn small {
    display: block;
    color: rgba(255, 240, 200, 0.78);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.troy-orders-custom-item {
    display: grid;
    gap: 10px;
    padding: 2px 0 14px;
}

.troy-orders-custom-price-row {
    display: grid;
    grid-template-columns: 54px 54px minmax(118px, 1fr) 54px 54px;
    gap: 7px;
    align-items: stretch;
}

.troy-orders-custom-price-row button,
.troy-orders-custom-presets button,
.troy-orders-custom-add {
    min-height: 44px;
    border: 1px solid rgba(108, 61, 18, 0.34);
    border-radius: 8px;
    background: rgba(91, 52, 18, 0.16);
    color: #4e2b0f;
    font-size: 13px;
    font-weight: 1000;
    cursor: pointer;
}

.troy-orders-custom-price-row label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid rgba(108, 61, 18, 0.34);
    border-radius: 8px;
    background: rgba(255, 244, 211, 0.58);
}

.troy-orders-custom-price-row label span {
    color: #7c5a32;
    font-size: 12px;
    font-weight: 900;
}

.troy-orders-custom-price-row input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: #2d1b0b;
    font-size: 20px;
    font-weight: 1000;
    text-align: right;
    outline: none;
}

.troy-orders-custom-presets {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.troy-orders-custom-add {
    min-height: 50px;
    border: 0;
    background: linear-gradient(180deg, #f2c56c, #ad6720);
    color: #211206;
    font-size: 15px;
    box-shadow: inset 0 1px 0 rgba(255, 246, 207, 0.48), 0 5px 12px rgba(0, 0, 0, 0.18);
}

.troy-orders-confirm {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(9, 6, 3, 0.82);
}

.troy-orders-confirm[hidden] {
    display: none;
}

.troy-orders-confirm-panel {
    width: min(620px, calc(100vw - 28px));
    max-height: 92vh;
    overflow: auto;
    padding: 18px;
    border: 30px solid transparent;
    border-image: url('/assets/ui/panels/panel-parchment-large.png') 36 fill / 30px / 0 stretch;
    color: #2d1b0b;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.troy-orders-confirm-kicker {
    color: #8a5d2c;
    font-size: 13px;
    font-weight: 900;
}

.troy-orders-confirm-panel h2 {
    margin: 8px 0 0;
    color: #231305;
    font-size: 30px;
}

.troy-orders-confirm-total {
    margin: 12px 0;
    padding: 14px;
    border-radius: 8px;
    background: rgba(112, 69, 26, 0.13);
    color: #4b2108;
    font-size: 44px;
    font-weight: 1000;
    text-align: center;
}

.troy-orders-confirm-items {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.troy-orders-confirm-items div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    min-height: 30px;
    color: #3a2713;
    font-size: 14px;
}

.troy-orders-confirm-items .troy-orders-confirm-customer-row {
    align-items: center;
    min-height: 34px;
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(92, 58, 23, 0.16);
    color: #2c1809;
    font-size: 15px;
    font-weight: 1000;
}

.troy-orders-confirm-items .troy-orders-confirm-item-row {
    align-items: center;
    padding: 6px 2px;
    border-bottom: 1px solid rgba(91, 61, 28, 0.16);
}

.troy-orders-confirm-items .troy-orders-confirm-item-row span {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.troy-orders-confirm-items .troy-orders-confirm-item-row b {
    min-width: 0;
    overflow-wrap: anywhere;
}

.troy-orders-confirm-items .troy-orders-confirm-item-row em {
    flex: 0 0 auto;
    color: #8a5d2c;
    font-style: normal;
    font-weight: 900;
}

.troy-orders-confirm-items .troy-orders-confirm-chip-row {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(30, 87, 67, 0.14);
    color: #143d2f;
    font-weight: 900;
}

.troy-orders-payment-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 0.72fr);
    gap: 10px;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid rgba(91, 61, 28, 0.24);
    border-radius: 8px;
    background: rgba(255, 244, 211, 0.38);
}

.troy-orders-payment-input {
    display: grid;
    gap: 6px;
    color: #4c2a10;
    font-size: 14px;
    font-weight: 900;
}

.troy-orders-payment-input input {
    width: 100%;
    min-height: 50px;
    border: 2px solid rgba(91, 61, 28, 0.28);
    border-radius: 8px;
    background: rgba(255, 253, 242, 0.92);
    color: #241304;
    font-size: 28px;
    font-weight: 1000;
    text-align: right;
}

.troy-orders-payment-presets {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.troy-orders-payment-presets button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: #684021;
    color: #fff0c8;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
}

.troy-orders-change-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: column;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(49, 30, 12, 0.11);
}

.troy-orders-change-row span {
    color: #5f3717;
    font-size: 15px;
    font-weight: 900;
}

.troy-orders-change-row strong {
    color: #1c5f41;
    font-size: 32px;
    font-weight: 1000;
}

.troy-orders-change-row strong.is-shortage {
    color: #a12b1f;
}

.troy-orders-payment-note {
    min-height: 20px;
    margin: 0;
    color: #5f3717;
    font-size: 13px;
    font-weight: 800;
}

.troy-orders-payment-note.is-shortage {
    color: #a12b1f;
}

.troy-orders-confirm-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin: 10px 0 12px;
    padding: 10px;
    border: 1px solid rgba(91, 61, 28, 0.28);
    border-radius: 8px;
    background: rgba(255, 244, 211, 0.42);
    font-size: 16px;
    font-weight: 800;
}

.troy-orders-confirm-check input {
    width: 22px;
    height: 22px;
}

.troy-orders-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 10px;
}

.troy-orders-confirm-actions button {
    min-height: 50px;
    border: 0;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
}

.troy-orders-confirm-actions .is-cancel {
    background: #5b3519;
    color: #fff0c8;
}

.troy-orders-confirm-actions button:not(.is-cancel) {
    background: linear-gradient(180deg, #f2c56c, #ad6720);
    color: #211206;
}

.troy-orders-confirm-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.44;
}

body.is-new-order-flash::before {
    content: '新規注文';
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.28);
    color: #fff7ed;
    font-size: clamp(42px, 8vw, 96px);
    font-weight: 900;
    pointer-events: none;
    animation: troyOrderFlash 1.8s ease-out both;
}

@keyframes troyOrderFlash {
    0%, 35%, 70% { opacity: 1; }
    18%, 52%, 100% { opacity: 0; }
}

@media (max-width: 980px) {
    .troy-orders-ticket-detail-layout {
        grid-template-columns: 1fr;
    }

    .troy-orders-ticket-menu {
        border-top: 2px solid rgba(89, 54, 22, 0.22);
        padding-top: 14px;
    }
}

@media (max-width: 720px) {
    .troy-orders-shell {
        width: min(100vw - 20px, 1180px);
    }

    .troy-orders-header,
    .troy-orders-header-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .troy-orders-auth-name {
        max-width: none;
        text-align: left;
    }

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

    .troy-orders-sales-breakdown {
        grid-template-columns: 1fr;
    }

    .troy-orders-payouts {
        grid-template-columns: 1fr;
    }

    .troy-orders-payout-card em {
        white-space: normal;
    }

    .troy-orders-sales-row {
        grid-template-columns: 22px minmax(0, 1fr) auto;
    }

    .troy-orders-sales-row strong {
        grid-column: 2 / -1;
        justify-self: end;
    }

    .troy-orders-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .troy-orders-request {
        grid-template-columns: 42px minmax(0, 1fr) auto;
    }

    .troy-orders-request-actions {
        grid-column: 2 / -1;
        justify-content: flex-end;
    }

    .troy-orders-ticket-board {
        padding: 12px;
    }

    .troy-orders-ticket-grid {
        grid-template-columns: 1fr;
    }

    .troy-orders-ticket-modal {
        align-items: stretch;
        padding: 8px;
    }

    .troy-orders-ticket-modal-panel {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        padding: 16px;
        border-width: 24px;
        border-image: url('/assets/ui/panels/panel-parchment-large.png') 36 fill / 24px / 0 stretch;
    }

    .troy-orders-ticket-detail-head {
        grid-template-columns: 1fr;
    }

    .troy-orders-total-wrap {
        text-align: left;
    }

    .troy-orders-confirm-total {
        font-size: 40px;
    }

    .troy-orders-payment-presets {
        grid-column: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .troy-orders-payment-box {
        grid-template-columns: 1fr;
    }

    .troy-orders-change-row strong {
        font-size: 28px;
    }

    .troy-orders-item-row {
        grid-template-columns: minmax(0, 1fr) 82px 78px;
    }

    .troy-orders-item-row [data-toggle-served],
    .troy-orders-item-row [data-remove-item] {
        grid-column: span 1;
    }

    .troy-orders-settle {
        grid-template-columns: 1fr;
    }

    .troy-orders-group-row {
        grid-template-columns: 22px minmax(0, 1fr);
    }

    .troy-orders-group-current-head {
        align-items: stretch;
        flex-direction: column;
    }

    .troy-orders-group-current-head button {
        width: 100%;
    }

    .troy-orders-group-current-row {
        grid-template-columns: 1fr;
    }

    .troy-orders-group-current-row b {
        text-align: left;
    }

    .troy-orders-group-row b {
        grid-column: 2;
        text-align: left;
    }

    .troy-orders-custom-price-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .troy-orders-custom-price-row label {
        grid-column: 1 / -1;
        order: -1;
    }

    .troy-orders-custom-presets {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .troy-orders-confirm-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .troy-orders-summary {
        grid-template-columns: 1fr;
    }

    .troy-orders-header h1 {
        font-size: 30px;
    }

    .troy-orders-ticket-name {
        min-height: 0;
        font-size: 20px;
    }

    .troy-orders-pos-items {
        grid-template-columns: 1fr;
    }
}

/* --- Pirate tavern visual pass --- */




.app-title-plaque {
    justify-self: stretch;
    width: 100%;
    min-height: 66px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(67, 38, 18, 0.2), rgba(18, 10, 6, 0.38)),
        repeating-linear-gradient(0deg, rgba(111, 66, 30, 0.2) 0 1px, transparent 1px 14px);
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.22),
        inset 0 -8px 16px rgba(0, 0, 0, 0.22),
        0 8px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    border-image: url("./assets/ui/panels/panel-wood.png") 38 fill / 12px / 0 stretch;
    max-width: none;
}

.app-title-plaque strong {
    display: block;
    color: #ffe7a6;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 4.2vw, 38px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 2px 0 #3c210d, 0 0 12px rgba(255, 207, 103, 0.28);
}

.app-title-plaque span {
    margin-top: 4px;
    color: #f2cf8a;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(11px, 1.8vw, 16px);
    font-weight: 800;
    letter-spacing: 0;
}

.app-shop-link {
    color: #ffe7a6;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.app-shop-link:hover,
.app-shop-link:focus-visible {
    color: #fff5d6;
}






.currency-display::before {
    content: "";
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: url("./assets/ui/icons/002.png") center / contain no-repeat;
    color: #5c3510;
    font-weight: 900;
    box-shadow: none;
    flex: 0 0 30px;
    background-position: center;
    background-size: 30px 30px;
    background-image: var(--icon-coin);
}









#inventoryMobileSwitch,
#inventoryPrimaryTabs,
#tabContentInventory #inventoryTabs,
#rankingToggleButtons {
    border: 1px solid rgba(220, 169, 82, 0.34);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(14, 17, 20, 0.92), rgba(8, 9, 11, 0.94));
    padding: 6px;
}

.inventory-mobile-switch-btn,
.inventory-primary-tab-btn,
#tabContentInventory .inventory-tab-btn,
.ranking-toggle-btn {
    border-radius: 8px;
    border-color: rgba(220, 169, 82, 0.28);
    background: linear-gradient(180deg, rgba(32, 26, 21, 0.96), rgba(10, 11, 13, 0.96));
    color: #d9c5a1;
}

.inventory-mobile-switch-btn.active,
.inventory-primary-tab-btn.active,
#tabContentInventory .inventory-tab-btn.active,
.ranking-toggle-btn.active {
    border-color: rgba(255, 221, 142, 0.62);
    background:
        linear-gradient(180deg, rgba(26, 87, 113, 0.95), rgba(9, 43, 65, 0.98)),
        linear-gradient(180deg, rgba(245, 204, 102, 0.22), transparent);
    color: #ffe6a9;
    box-shadow: inset 0 1px 0 rgba(255, 247, 214, 0.16), 0 8px 18px rgba(0, 0, 0, 0.32);
}

.inventory-grid,
.equipment-slot-card,
.inventory-item-card,
.item-card {
    border-color: rgba(220, 169, 82, 0.34);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(244, 220, 165, 0.94), rgba(170, 122, 63, 0.92)),
        repeating-linear-gradient(0deg, rgba(75, 44, 22, 0.1) 0 1px, transparent 1px 8px);
    color: #211208;
}

.equipment-slot-card,
.inventory-item-card,
.item-card {
    background: linear-gradient(180deg, rgba(18, 24, 31, 0.95), rgba(10, 11, 13, 0.98));
    color: #f7e8c1;
}





.ranking-row.myRank,
.ranking-row-top-1 {
    border-color: rgba(255, 221, 142, 0.72);
    box-shadow: 0 0 18px rgba(217, 164, 65, 0.22), inset 0 1px 0 rgba(255, 247, 214, 0.14);
}

.ranking-row-score-value,
.ranking-row-name {
    color: #ffe2a0;
}




@media (max-width: 640px) {
    #globalStatusBar {
        padding: 8px 8px 6px;
        gap: 6px;
    }

.app-title-plaque {
    width: 100%;
    min-height: 52px;
    padding: 6px 12px;
}

    #globalPlayerInfoTop {
        min-height: 42px;
        padding: 6px 8px;
    }

    .currency-display {
        min-width: 88px;
        min-height: 36px;
        font-size: 17px;
        padding: 4px 8px;
    }

    .currency-display::before {
        width: 24px;
        height: 24px;
    }

    .home-ship-bob {
        min-height: 280px;
    }


}

.global-menu-button {
    position: absolute;
    left: 12px;
    top: 16px;
    z-index: 1;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(235, 194, 116, 0.46);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(5, 6, 8, 0.08), rgba(0, 0, 0, 0.36));
    color: #f8e6bc;
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 #000;
    display: none;
}


.currency-display::after {
    content: none;
    width: 30px;
    height: 30px;
    display: none;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 229, 149, 0.64);
    background: linear-gradient(180deg, rgba(255, 227, 139, 0.18), rgba(86, 48, 12, 0.28));
    color: #fff1bd;
    font-size: 22px;
    line-height: 1;
    text-shadow: 0 1px 0 #000;
}


.home-specialty-chip span {
    width: 33px;
    height: 22px;
    display: block;
    color: transparent;
    font-size: 0;
    border-radius: 999px;
    background-color: #080706;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    box-shadow: inset 0 0 0 1px rgba(226, 177, 84, 0.26),
        0 1px 2px rgba(0, 0, 0, 0.42);
    flex: 0 0 33px;
    flex-basis: 29px;
    aspect-ratio: 3 / 2;
}

.home-specialty-chip[title="火薬系"] span {
    background-image: url("./assets/ui/icons/special-chili.png?v=20260602");
}

.home-specialty-chip[title="石材系"] span {
    background-image: url("./assets/ui/icons/special-rock.png?v=20260602");
}

.home-specialty-chip[title="キノコ系"] span {
    background-image: url("./assets/ui/icons/special-mushroom.png?v=20260602");
}

.home-specialty-chip[title="水系"] span {
    background-image: url("./assets/ui/icons/special-vial.png?v=20260602");
}

.nav-button span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

/* --- Ranking tab reference style --- */







.ranking-toggle-btn:last-child {
    border-right: 0;
}

.ranking-toggle-btn::before {
    content: "";
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.58));
}

#btnShowPsRanking::before {
    background-image: url("./assets/ui/icons/002.png");
}

#btnShowBountyRanking::before {
    background-image: url("./assets/ui/icons/001.png");
}

#btnShowDartsRanking::before {
    background-image: url("./assets/ui/icons/042.png");
}

#btnShowBilliardsRanking::before {
    background-image: url("./assets/ui/icons/047.png");
}

#btnShowKaraokeRanking::before {
    background-image: url("./assets/ui/icons/044.png");
}

#btnShowGameRanking::before {
    background-image: url("./assets/ui/icons/041.png");
}


.ranking-toggle-btn.active::before {
    color: #fff1c2;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.72));
}



.ranking-refresh-btn::before {
    content: "";
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 6px;
    vertical-align: -4px;
    background: url("./assets/ui/buttons/action-refresh.png") center / contain no-repeat;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}
















.ranking-row-score::before {
    content: "";
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    background: url("./assets/ui/icons/004.png") center / contain no-repeat;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.42));
}



@media (max-width: 420px) {
    .ranking-content-area {
        padding-inline: 10px;
    }

    .ranking-header {
        min-height: 136px;
        grid-template-columns: 68px minmax(0, 1fr);
        padding: 16px 12px;
    }

    .ranking-header-icon {
        width: 62px;
        height: 62px;
    }

    .ranking-toggle-btn {
        min-height: 54px;
        gap: 4px;
        font-size: 13px;
    }

    .ranking-row {
        grid-template-columns: 56px 46px minmax(0, 1fr) auto;
        min-height: 82px;
        gap: 7px;
        padding: 10px 8px;
    }

    .ranking-rank-badge {
        width: 52px;
        height: 52px;
    }

    .ranking-rank-number {
        font-size: 24px;
    }

    .ranking-avatar {
        width: 46px;
        height: 46px;
    }

    .ranking-row-name {
        font-size: 19px;
    }

    .ranking-row-score {
        min-width: 74px;
    }

    .ranking-row-score::before {
        display: none;
    }

    .ranking-row-score-value {
        min-width: 68px;
        font-size: 20px;
    }

    .ranking-row-top-1 .ranking-row-score-value {
        font-size: 20px;
    }

    #bountyRankingList .ranking-row {
        grid-template-columns: 56px 46px minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    #bountyRankingList .ranking-rank-badge,
    #bountyRankingList .ranking-avatar {
        grid-row: 1 / 3;
    }

    #bountyRankingList .ranking-row-main {
        grid-column: 3;
        grid-row: 1;
    }

    #bountyRankingList .ranking-row-score {
        grid-column: 3;
        grid-row: 2;
        justify-self: start;
        min-width: 0;
        max-width: 100%;
        margin-top: 4px;
    }

    #bountyRankingList .ranking-row-score-value {
        min-width: 0;
        font-size: 18px;
        text-align: left;
    }
}

/* --- Inventory tab reference style --- */
#tabContentInventory {
    padding-bottom: calc(var(--nav-height) + 22px);
    --inventory-panel-bg: linear-gradient(180deg, rgba(7, 8, 10, 0.9), rgba(3, 4, 6, 0.98));
    --inventory-gold: #ffe4a0;
    --inventory-ink: #261306;
    --inventory-sticky-top: calc(134px + var(--safe-top));
    --inventory-switch-sticky-height: 56px;
    --inventory-selection-bar-height: 68px;
}

#tabContentInventory .inventory-mobile-switch {
    position: sticky;
    top: var(--inventory-sticky-top);
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    margin: 6px var(--app-gutter) 0;
    padding: 3px;
    overflow: visible;
    border-radius: 8px;
    border: 8px solid transparent;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 221, 142, 0.14), transparent 62%),
        var(--inventory-panel-bg);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.3);
    backdrop-filter: none;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 8px / 0 stretch;
}

#tabContentInventory .inventory-panel-btn {
    min-width: 0;
    min-height: 44px;
    padding: 4px 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid transparent;
    border-right: 1px solid rgba(220, 169, 82, 0.22);
    border-radius: 7px;
    color: #d8c39b;
    font-size: 12px;
    font-weight: 900;
    text-shadow: 0 1px 0 #000;
    background: linear-gradient(180deg, rgba(18, 20, 24, 0.74), rgba(3, 4, 6, 0.88));
    box-shadow: none;
    flex-direction: row;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 9px / 0 stretch;
    line-height: 1;
}

#tabContentInventory .inventory-panel-btn:last-child {
    border-right: 0;
}

#tabContentInventory .inventory-panel-btn::before {
    content: "";
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 22px 22px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.62));
    flex-basis: 22px;
}

#tabContentInventory .inventory-panel-btn[data-inventory-group-switch="Equipment"]::before {
    background-image: var(--icon-slot-equipment);
}

#tabContentInventory .inventory-panel-btn[data-inventory-group-switch="Tarot"]::before {
    background-image: var(--icon-slot-tarot);
}

#tabContentInventory .inventory-panel-btn[data-inventory-group-switch="All"]::before {
    background-image: var(--icon-slot-all);
}

#tabContentInventory .inventory-panel-btn.active {
    color: #d8c39b;
    background: radial-gradient(circle at 50% 18%, rgba(255, 249, 211, 0.38), transparent 45%),
        linear-gradient(180deg, rgba(230, 176, 66, 0.92), rgba(142, 82, 21, 0.96));
    border-color: rgba(255, 229, 149, 0.42);
    border-image: url("./assets/ui/panels/panel-gold-square.png") 24 fill / 9px / 0 stretch;
    text-shadow: 0 1px 0 #000;
}

#tabContentInventory .avatar-card.inventory-section {
    display: block;
    margin: 0 var(--app-gutter) 6px;
    padding: 6px;
    position: relative;
    overflow: hidden;
}

#tabContentInventory .avatar-card.inventory-section:not(.active) {
    display: block;
}

#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Tarot"] .avatar-card.inventory-section {
    display: none;
}

#tabContentInventory .inventory-loadout-stats {
    display: none;
}

#tabContentInventory .inventory-avatar-stage {
    position: absolute;
    z-index: 3;
    top: 82px;
    bottom: 24px;
    left: 50%;
    width: 32%;
    display: grid;
    place-items: center;
    transform: translateX(-50%);
    pointer-events: none;
}

#tabContentInventory .inventory-avatar-stage .avatar-container {
    margin: 0;
    transform: scale(2.2);
    filter: drop-shadow(0 7px 7px rgba(0, 0, 0, 0.82));
}

#tabContentInventory .avatar-card.inventory-section::before {
    content: "現在の装備";
    position: relative;
    inset: auto;
    z-index: 4;
    display: grid;
    width: min(310px, 78%);
    height: auto;
    min-height: 46px;
    margin: 0 auto 3px;
    padding: 3px 26px 7px;
    place-items: center;
    border: 0;
    border-radius: 0;
    color: #f7d997;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1;
    text-shadow: 0 2px 0 #240500, 0 0 8px rgba(255, 202, 92, 0.28);
    background: url("./assets/ui/banners/banner-red.png") center / 100% 100% no-repeat;
    box-sizing: border-box;
}

#tabContentInventory #equipmentGrid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 31%) minmax(0, 38%) minmax(0, 31%);
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 8% 0;
    min-height: 0;
    aspect-ratio: 44 / 35;
    margin: 0;
    padding: 5.7% 3.5% 4.5%;
    border: 0;
    border-radius: 0;
    background: url("./assets/ui/inventory/loadout-stage-3d.webp") center / 100% 100% no-repeat;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.46);
}

#tabContentInventory .equip-slot {
    min-width: 0;
    min-height: 0;
    padding: 3% 8% 4%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 17% 45% 23% 15%;
    align-content: start;
    justify-items: center;
    gap: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

#tabContentInventory .armor-slot {
    grid-column: 1;
    grid-row: 1;
}

#tabContentInventory .weapon-slot {
    grid-column: 3;
    grid-row: 1;
}

#tabContentInventory .shield-slot {
    grid-column: 1;
    grid-row: 2;
}

#tabContentInventory .accessory-slot {
    grid-column: 3;
    grid-row: 2;
}

#tabContentInventory .equip-slot-icon {
    display: none;
}

#tabContentInventory .weapon-slot .equip-slot-icon {
    background-image: var(--icon-slot-weapon);
}

#tabContentInventory .shield-slot .equip-slot-icon {
    background-image: var(--icon-slot-shield);
}

#tabContentInventory .armor-slot .equip-slot-icon {
    background-image: var(--icon-slot-head),
        radial-gradient(circle at 50% 50%, rgba(255, 226, 142, 0.2), rgba(20, 14, 8, 0.92) 62%, transparent 64%),
        linear-gradient(180deg, rgba(168, 104, 35, 0.86), rgba(74, 42, 16, 0.94));
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-size: 74% 74%, 100% 100%, 100% 100%;
}

#tabContentInventory .accessory-slot .equip-slot-icon {
    background-image: var(--icon-slot-accessory);
}

#tabContentInventory .equip-slot-content {
    min-width: 0;
    display: contents;
}

#tabContentInventory .equip-slot-label {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    color: #f1d69a;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 0 #000;
}

#tabContentInventory .equip-slot-name {
    grid-column: 1;
    grid-row: 3;
    align-self: start;
    color: #fff1c8;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 13px;
    font-weight: 900;
    display: block;
    width: 100%;
    max-width: 100%;
    line-height: 1.2;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 0 #000;
    text-align: center;
    position: relative;
    z-index: 3;
}

#tabContentInventory .equip-slot-stats {
    grid-column: 1;
    grid-row: 4;
    align-self: end;
    justify-content: center;
    min-height: 14px;
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 5px;
    color: #f4efe3;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.94), 0 0 5px rgba(0, 0, 0, 0.72);
    position: relative;
    z-index: 3;
}

#tabContentInventory .inventory-section.active[data-panel="items"] {
    margin: 0 var(--app-gutter);
    padding: 9px;
}

#tabContentInventory .inventory-section[data-panel="items"] > .section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

#tabContentInventory .inventory-browse-tools {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 112px auto;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
}

#tabContentInventory .inventory-search-field {
    position: relative;
    min-width: 0;
}

#tabContentInventory .inventory-search-input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 8px 38px 8px 12px;
    border: 1px solid rgba(220, 169, 82, 0.34);
    border-radius: 6px;
    background: rgba(4, 6, 9, 0.86);
    color: #f8edcb;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

#tabContentInventory .inventory-search-input::placeholder {
    color: #9d8d70;
    opacity: 1;
}

#tabContentInventory .inventory-search-clear {
    position: absolute;
    top: 50%;
    right: 2px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(220, 169, 82, 0.34);
    border-radius: 6px;
    background: rgba(4, 6, 9, 0.86);
    color: #f8edcb;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

#tabContentInventory .inventory-search-clear[hidden] {
    display: none;
}

#tabContentInventory .inventory-section[data-panel="items"] > .section-header::before {
    content: "";
    width: 48px;
    height: 48px;
    grid-row: 1 / span 2;
    align-self: center;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 46%, rgba(16, 12, 9, 0.84) 0 52%, transparent 54%),
        url("./assets/ui/icons/020.png") center / 82% 82% no-repeat;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.48));
    display: none;
}

#tabContentInventory .inventory-section[data-panel="items"] .section-header h2 {
    grid-column: 1;
    color: #ffe5a4;
    font-size: 22px;
    line-height: 1.05;
    letter-spacing: 0;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.78);
}

#tabContentInventory .sort-select {
    width: 100%;
    min-height: 40px;
    border-radius: 8px;
    border-color: rgba(76, 45, 20, 0.44);
    background: linear-gradient(180deg, rgba(70, 181, 238, 0.16), rgba(4, 30, 48, 0.28)),
        linear-gradient(180deg, #104c70, #071b29);
    color: #eff8ff;
    font-weight: 900;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 10px / 0 stretch;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#inventoryPrimaryTabs,
#tabContentInventory #inventoryTabs {
    position: static;
    display: grid;
    gap: 7px;
    margin: 0 0 10px;
    padding: 6px;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(8, 10, 12, 0.88), rgba(2, 3, 5, 0.94));
}

#inventoryPrimaryTabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

#tabContentInventory #inventoryTabs {
    grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
    margin-bottom: 9px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 34 fill / 10px / 0 stretch;
    background: linear-gradient(180deg, rgba(5, 7, 10, 0.74), rgba(2, 3, 5, 0.88));
}

#tabContentInventory .inventory-primary-tab-btn,
#tabContentInventory .inventory-tab-btn {
    min-width: 0;
    min-height: 36px;
    padding: 5px 4px;
    border-radius: 8px;
    color: #d9c5a1;
    font-size: 13px;
    font-weight: 900;
    background:
        linear-gradient(180deg, rgba(27, 22, 18, 0.88), rgba(5, 5, 6, 0.96));
}

#tabContentInventory .inventory-primary-tab-btn.active,
#tabContentInventory .inventory-tab-btn.active {
    color: #ffe8aa;
    background:
        linear-gradient(180deg, rgba(38, 150, 205, 0.14), rgba(2, 12, 18, 0.28));
}

@media (max-width: 420px) {
#tabContentInventory .inventory-panel-btn {
    min-height: 44px;
    gap: 2px;
    font-size: 11px;
    white-space: nowrap;
}

#tabContentInventory .inventory-panel-btn::before {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
    background-size: 16px 16px;
}

    #tabContentInventory .avatar-card.inventory-section,
    #tabContentInventory .inventory-section.active[data-panel="items"] {
        margin-left: 8px;
        margin-right: 8px;
    }

    #inventoryPrimaryTabs,
    #tabContentInventory #inventoryTabs {
        gap: 5px;
        padding: 5px;
    }

    #tabContentInventory .inventory-primary-tab-btn,
    #tabContentInventory .inventory-tab-btn {
        font-size: 11px;
    }
}

/* --- Remaining tabs pirate tavern pass --- */
#tabContentTroy,
#tabContentCompanions,
#tabContentQr,
#tabContentBattle,
#tabContentTarot,
#tabContentKing {
    padding-bottom: calc(var(--nav-height) + 22px);
}

#tabContentTroy .content-area,
#tabContentCompanions .content-area,
#tabContentQr .content-area,
#tabContentBattle .content-area,
#tabContentTarot .content-area,
#tabContentTroy .content-area,
#tabContentCompanions .content-area,
#tabContentQr .content-area,
#tabContentBattle .content-area,
#tabContentTarot .content-area,
#tabContentKing .content-area {
    border-color: rgba(220, 169, 82, 0.42);
    background: linear-gradient(180deg, rgba(11, 8, 6, 0.3), rgba(4, 4, 5, 0.62)),
        repeating-linear-gradient(90deg, rgba(101, 58, 25, 0.12) 0 28px, rgba(16, 10, 6, 0.12) 28px 56px);
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 14px / 0 stretch;
}

#tabContentTroy .troy-status-row,
#tabContentCompanions .companion-page-header,
#tabContentBattle .content-area > h2:first-child,
#tabContentKing .content-area > h2:first-child,
#tabContentQr .content-area > h2:first-child,
#tabContentTarot .tarot-game-switch-wrap {
    min-height: 128px;
    margin: 0 0 12px;
    padding: 18px 16px;
    display: grid;
    align-items: center;
    border-radius: 8px;
    border: 1px solid rgba(220, 169, 82, 0.28);
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0.58)),
        url("./assets/ui/bg-tavern.png") center / cover no-repeat;
    box-shadow: inset 0 -1px 0 rgba(220, 169, 82, 0.24);
}

#tabContentTroy .troy-status-row {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 88px;
    padding: 8px 14px;
}

#tabContentTroy .troy-title-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

#tabContentTroy .troy-status-actions {
    display: grid;
    gap: 6px;
    justify-items: end;
    align-content: center;
}

#tabContentTroy .troy-title,
#tabContentCompanions .companion-page-header h2,
#tabContentBattle .content-area > h2:first-child,
#tabContentKing .content-area > h2:first-child,
#tabContentQr .content-area > h2:first-child {
    color: #ffe188;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 10vw, 58px);
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 3px 0 #241204, 0 0 16px rgba(255, 207, 103, 0.42);
}

#tabContentTroy .troy-title::before {
    content: "";
    width: 56px;
    height: 56px;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
    background: var(--icon-pirate-flag) center / contain no-repeat;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.52));
}

#tabContentTroy .troy-map-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 4px 10px;
    border: 8px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/panels/panel-gold-square.png") 24 fill / 8px / 0 stretch;
    color: #fff1b8;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    text-decoration: none;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.78), 0 0 8px rgba(255, 215, 128, 0.34);
}

#tabContentTroy .troy-map-link::before {
    content: "";
    width: 16px;
    height: 16px;
    margin-right: 5px;
    background: var(--icon-action-map) center / contain no-repeat;
    filter: drop-shadow(0 1px 0 rgba(255, 238, 178, 0.32));
}

#tabContentCompanions .companion-page-header h2::before {
    content: "";
    width: 54px;
    height: 54px;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
    background: var(--icon-skull) center / contain no-repeat;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.52));
}

#tabContentCompanions .companion-page-header p,
#tabContentKing .king-page-note,
#tabContentTroy .troy-calendar-meta,
#tabContentTroy .troy-entry-empty,
#tabContentCompanions .companion-empty,
#tabContentQr .content-area p {
    color: #d0b98c;
    font-weight: 800;
}

#tabContentTroy .troy-state-badge,
#tabContentCompanions .companion-host-note,
#tabContentCompanions .companion-status,
#tabContentKing .king-troy-status {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(220, 169, 82, 0.4);
    background:
        linear-gradient(180deg, rgba(27, 22, 18, 0.88), rgba(5, 5, 6, 0.96));
    color: #f2d394;
    font-weight: 900;
}

#tabContentTroy .troy-state-badge.open,
#tabContentKing .king-troy-status.is-open {
    border-color: rgba(52, 211, 153, 0.48);
    color: #86efac;
}

#tabContentTroy .troy-entry-section,
#tabContentTroy .troy-calendar-section,
#tabContentTroy .troy-menu-board-section,
#tabContentCompanions .companion-list-panel,
#tabContentCompanions .companion-create-panel,
#tabContentKing .king-card,
#tabContentKing .king-editor-card,
#tabContentKing .troy-admin-card,
#tabContentKing .troy-admin-details,
#tabContentQr .qr-battle-card,
#tabContentQr .equipment-gacha-card,
#tabContentQr .guild-card,
#tabContentBattle .content-area,
#tabContentTarot .tarot-poker-root,
#tabContentTarot .tarot-kingdom-root {
    border: 1px solid rgba(220, 169, 82, 0.34);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(10, 14, 19, 0.9), rgba(4, 5, 7, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.08);
}

#tabContentTroy .troy-menu-title,
#tabContentTroy .troy-entry-title,
#tabContentCompanions .companion-list-head h3,
#tabContentCompanions .companion-create-panel h3,
#tabContentKing .king-card-label,
#tabContentKing .troy-admin-label,
#tabContentQr .content-area h2,
#tabContentTarot .tarot-poker-header h2,
#tabContentTarot .tarot-kingdom-header h2 {
    color: #f7d68d;
    font-size: 20px;
    font-weight: 900;
    text-shadow: 0 1px 0 #000;
}

#tabContentTroy .troy-calendar-item,
#tabContentTroy .troy-menu-board-item,
#tabContentTroy .troy-entry-item,
#tabContentCompanions .companion-card,
#tabContentKing .king-announcement-current,
#tabContentKing .king-menu-specials-list,
#tabContentKing .king-menu-disable-list,
#tabContentTarot .tarot-poker-column,
#tabContentTarot .tarot-kingdom-panel,
#tabContentTarot .tarot-log,
#tabContentQr .guild-entry-grid > *,
#tabContentQr .battle-entry-card,
#tabContentQr .equipment-gacha-entry {
    border: 1px solid rgba(220, 169, 82, 0.28);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(13, 19, 27, 0.84), rgba(5, 7, 10, 0.94));
}

#tabContentCompanions .companion-create-panel,
#tabContentTroy .troy-reservation-panel,
#tabContentKing .king-editor-card {
    background:
        linear-gradient(180deg, rgba(255, 244, 208, 0.18), rgba(104, 61, 23, 0.18));
    color: #241306;
}

#tabContentCompanions .companion-create-panel h3,
#tabContentCompanions .companion-create-panel label,
#tabContentTroy .troy-reservation-panel h3,
#tabContentKing .king-editor-card,
#tabContentKing .king-editor-card .king-field-label {
    color: #241306;
    text-shadow: 0 1px 0 rgba(255, 245, 210, 0.44);
}

#tabContentCompanions input,
#tabContentCompanions select,
#tabContentCompanions textarea,
#tabContentTroy input,
#tabContentTroy select,
#tabContentTroy textarea,
#tabContentKing input,
#tabContentKing select,
#tabContentKing textarea {
    border-radius: 8px;
    border: 1px solid rgba(76, 45, 20, 0.36);
    background:
        linear-gradient(180deg, rgba(34, 28, 23, 0.95), rgba(10, 9, 8, 0.98));
    color: #f7e8c1;
}

#tabContentCompanions .companion-create-btn,
#tabContentCompanions .companion-refresh-btn,
#tabContentCompanions .companion-action-btn,
#tabContentTroy .troy-entry-btn,
#tabContentTroy .troy-reservation-actions button,
#tabContentKing .king-inline-actions button,
#tabContentKing .troy-admin-actions button,
#tabContentQr .battle-entry-btn,
#tabContentQr .equipment-gacha-btn,
#tabContentQr .guild-action-btn,
#tabContentBattle button,
#tabContentTarot button:not(.ui-modal-close) {
    border-radius: 8px;
    border-color: rgba(255, 229, 149, 0.56);
    background:
        linear-gradient(180deg, rgba(255, 227, 139, 0.18), rgba(86, 48, 12, 0.2));
    color: #241306;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255, 245, 210, 0.45);
}

#tabContentTroy .troy-entry-btn.alt,
#tabContentCompanions .companion-action-btn:not(.is-join):not(.is-approve),
#tabContentKing .troy-admin-actions .btn-muted,
#tabContentTarot button.btn-muted {
    background:
        linear-gradient(180deg, rgba(27, 22, 18, 0.88), rgba(5, 5, 6, 0.96));
    color: #f2d394;
}

#tabContentCompanions .companion-layout {
    gap: 12px;
}

#tabContentCompanions .companion-card h3,
#tabContentTroy .troy-calendar-date,
#tabContentTroy .troy-entry-item b {
    color: #ffe2a0;
}

#tabContentCompanions .companion-card-type,
#tabContentTroy .troy-calendar-status {
    border-color: rgba(220, 169, 82, 0.34);
    background: rgba(220, 169, 82, 0.12);
    color: #f2d394;
}


#tabContentTarot .tarot-game-switch-wrap button,
#tabContentTarot .tarot-poker-mode-toggle button {
    min-height: 48px;
}

@media (max-width: 640px) {
    #tabContentTroy .troy-status-row,
    #tabContentCompanions .companion-page-header,
    #tabContentBattle .content-area > h2:first-child,
    #tabContentKing .content-area > h2:first-child,
    #tabContentQr .content-area > h2:first-child {
        min-height: 112px;
        padding: 14px 12px;
    }

    #tabContentTroy .troy-status-row {
        min-height: 86px;
        padding: 8px 10px;
    }

    #tabContentTroy .troy-title,
    #tabContentCompanions .companion-page-header h2,
    #tabContentBattle .content-area > h2:first-child,
    #tabContentKing .content-area > h2:first-child,
    #tabContentQr .content-area > h2:first-child {
        font-size: clamp(30px, 9vw, 46px);
    }

    #tabContentTroy .troy-title-wrap {
        gap: 8px;
    }

    #tabContentTroy .troy-map-link {
        min-height: 32px;
        padding-inline: 10px;
        font-size: 12px;
    }
}


.home-exploration-btn {
    width: min(224px, 100%);
    margin: 6px auto 0;
    min-height: 40px;
    margin-top: 14px;
    font-size: clamp(18px, 5vw, 24px);
    grid-area: button;
    padding: 8px 12px;
    color: #211208;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.08;
    text-shadow: 0 1px 0 rgba(255, 236, 179, 0.58);
    cursor: pointer;
    --button-icon: var(--icon-compass);
}

.home-exp-actions {
    grid-area: button;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 14px;
}

.home-exp-actions .home-exploration-btn {
    grid-area: auto;
    width: 100%;
    min-width: 0;
    margin: 0;
    font-size: clamp(14px, 3.8vw, 18px);
}

.home-exp-actions .home-plunder-btn {
    --button-icon: var(--icon-pirate-flag);
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    background:
        linear-gradient(180deg, rgba(254, 202, 202, 0.2), rgba(127, 29, 29, 0.16)),
        linear-gradient(180deg, #8f352d, #3e1715);
    color: #fff0d2;
    text-shadow: 0 2px 0 rgba(54, 8, 8, 0.82);
}

.home-exp-actions .home-plunder-btn[hidden] {
    display: none;
}

.home-exp-actions .home-rescue-btn {
    --button-icon: var(--icon-action-crew);
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    background:
        radial-gradient(circle at 50% 0%, rgba(80, 220, 190, 0.24), transparent 58%),
        linear-gradient(180deg, #196c68, #0c343d);
    color: #effff8;
    text-shadow: 0 2px 0 rgba(0, 25, 28, 0.88);
}

.home-exp-actions .home-rescue-btn[hidden] {
    display: none !important;
}

.home-exp-actions:has(.home-rescue-btn[hidden]) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-rescue-overlay[hidden] {
    display: none;
}

.home-rescue-overlay {
    position: fixed;
    inset: 0;
    z-index: 10120;
    display: grid;
    place-items: center;
    padding:
        max(18px, env(safe-area-inset-top, 0px))
        14px
        max(18px, env(safe-area-inset-bottom, 0px));
    background:
        radial-gradient(circle at 50% 28%, rgba(26, 116, 113, 0.22), transparent 36%),
        rgba(2, 5, 8, 0.82);
    backdrop-filter: blur(4px);
}

.home-rescue-dialog {
    width: min(440px, 100%);
    max-height: min(680px, calc(100dvh - 36px));
    overflow: hidden;
    padding: 16px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 12px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(49, 184, 170, 0.14), transparent 45%),
        linear-gradient(180deg, rgba(15, 18, 20, 0.98), rgba(5, 7, 9, 0.99));
    box-shadow:
        0 0 0 1px rgba(234, 199, 112, 0.24),
        0 18px 50px rgba(0, 0, 0, 0.72);
}

.home-rescue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 2px 10px;
    border-bottom: 1px solid rgba(221, 183, 94, 0.32);
}

.home-rescue-head small {
    display: block;
    margin-bottom: 2px;
    color: #64d8ca;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.18em;
}

.home-rescue-head h2 {
    margin: 0;
    color: #fff0bd;
    font-size: 22px;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.home-rescue-lead {
    margin: 12px 2px 9px;
    color: #d9cba8;
    font-size: 12px;
}

.home-rescue-list {
    display: grid;
    gap: 8px;
    max-height: min(470px, calc(100dvh - 230px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px;
}

.home-rescue-status {
    min-height: 110px;
    display: grid;
    place-items: center;
    padding: 20px;
    border: 1px dashed rgba(121, 204, 192, 0.32);
    color: #c7d7d1;
    font-size: 13px;
    text-align: center;
}

.home-rescue-status.is-loading::before {
    content: "";
    width: 22px;
    height: 22px;
    margin-right: 8px;
    border: 2px solid rgba(100, 216, 202, 0.22);
    border-top-color: #64d8ca;
    border-radius: 50%;
    animation: home-rescue-spin 0.8s linear infinite;
}

.home-rescue-status.is-empty {
    color: #a9a18e;
}

.home-rescue-status.is-error {
    color: #ffc7b7;
    border-color: rgba(239, 111, 82, 0.34);
}

.home-rescue-room {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 74px;
    align-items: center;
    gap: 10px;
    min-height: 104px;
    padding: 11px 10px 11px 13px;
    border: 1px solid rgba(85, 197, 183, 0.42);
    background:
        linear-gradient(90deg, rgba(18, 76, 77, 0.54), rgba(10, 13, 17, 0.92) 62%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 9px);
    box-shadow: inset 3px 0 0 rgba(92, 220, 201, 0.72);
}

.home-rescue-room-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.home-rescue-room-stage {
    color: #6bddd0;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.home-rescue-room-copy strong {
    overflow: hidden;
    color: #fff0c6;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-rescue-room-monster {
    overflow: hidden;
    color: #f2e5c4;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-rescue-room-copy small {
    overflow: hidden;
    margin-top: 3px;
    color: #9eb2ad;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-rescue-join,
.home-rescue-footer button {
    min-height: 38px;
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    background: linear-gradient(180deg, rgba(255, 235, 173, 0.34), rgba(104, 58, 14, 0.2));
    color: #2a1708;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255, 239, 183, 0.62);
    cursor: pointer;
}

.home-rescue-join:disabled,
.home-rescue-footer button:disabled {
    filter: grayscale(0.7);
    opacity: 0.66;
    cursor: wait;
}

.home-rescue-footer {
    display: flex;
    justify-content: center;
    padding-top: 12px;
}

.home-rescue-footer button {
    min-width: 136px;
    color: #f8efd9;
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
}

@keyframes home-rescue-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .home-rescue-status.is-loading::before {
        animation: none;
    }
}

@media (max-width: 640px) {
    .home-hero-card,
    body[data-sea-tone] .home-hero-card {
        background-position: center top;
    }

    .home-ship-stage {
        min-height: 448px;
        margin-top: 14px;
    }
}

@media (max-width: 380px) {
    .home-hero-card,
    body[data-sea-tone] .home-hero-card {
        padding-inline: 10px;
    }

    .home-ship-stage {
        margin-top: 8px;
    }
}

/* --- Reference layout and sliced frame refinement --- */

#globalPlayerInfoTop,
.currency-display,
.global-rank-badge,
.ranking-row,
.equipment-slot-card,
.inventory-item-card,
.item-card,
#inventoryMobileSwitch,
#inventoryPrimaryTabs,
#tabContentInventory #inventoryTabs,
#rankingToggleButtons,
#tabContentInventory .sort-select,
#tabContentInventory .inventory-item-cell,
#tabContentTroy .troy-state-badge,
#tabContentCompanions .companion-host-note,
#tabContentCompanions .companion-status,
#tabContentKing .king-troy-status,
#tabContentTroy .troy-entry-section,
#tabContentTroy .troy-calendar-section,
#tabContentTroy .troy-menu-board-section,
#tabContentCompanions .companion-list-panel,
#tabContentCompanions .companion-create-panel,
#tabContentKing .king-card,
#tabContentKing .king-editor-card,
#tabContentKing .troy-admin-card,
#tabContentKing .troy-admin-details,
#tabContentQr .qr-battle-card,
#tabContentQr .equipment-gacha-card,
#tabContentQr .guild-card,
#tabContentTarot .tarot-poker-root,
#tabContentTarot .tarot-kingdom-root {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark.png") 30 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(13, 18, 24, 0.94), rgba(4, 5, 7, 0.98)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
}

#tabContentTroy .content-area,
#tabContentCompanions .content-area,
#tabContentQr .content-area,
#tabContentBattle .content-area,
#tabContentTarot .content-area,

.home-ps-card {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-parchment.png") 34 fill / 14px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 238, 190, 0.36), rgba(111, 64, 27, 0.12)),
        repeating-linear-gradient(0deg, rgba(88, 47, 20, 0.06) 0 1px, transparent 1px 10px);
}

.nav-button:not(.active),
.inventory-mobile-switch-btn:not(.active),
.inventory-primary-tab-btn:not(.active),
#tabContentInventory .inventory-tab-btn:not(.active),
.ranking-toggle-btn:not(.active),
.ranking-refresh-btn {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-wood.png") 34 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(49, 27, 13, 0.44), rgba(7, 6, 5, 0.42)),
        repeating-linear-gradient(0deg, rgba(119, 68, 30, 0.14) 0 1px, transparent 1px 12px);
}

.home-exploration-btn,
.nav-button.active {
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 11px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.34), rgba(109, 58, 11, 0.24)),
        linear-gradient(180deg, #e7b64b, #9c5c1e);
}

.inventory-mobile-switch-btn.active,
.inventory-primary-tab-btn.active,
#tabContentInventory .inventory-tab-btn.active,
.ranking-toggle-btn.active,
#tabContentInventory .inventory-panel-btn.active {
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 11px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(70, 181, 238, 0.24), rgba(3, 28, 45, 0.32)),
        linear-gradient(180deg, #104c70, #071b29);
}

.home-hero-card,
.home-hero-card,
body[data-sea-tone] .home-hero-card {
    min-height: 620px;
    padding: 14px 12px 20px;
    position: relative;
    overflow: hidden;
    border-color: rgba(220, 169, 82, 0.5);
    background: linear-gradient(180deg, rgba(2, 4, 7, 0.02) 0%, rgba(3, 4, 5, 0.1) 38%, rgba(4, 3, 2, 0.04) 39%, rgba(5, 3, 2, 0.16) 100%),
        url("./home-ui-sheet.png") calc(50% - 24px) top / auto var(--home-hero-bg-height, 620px) no-repeat;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.44);
    --home-hero-bg-height: 620px;
    padding-top: 10px;
    padding-bottom: 12px;
}

.home-hero-card::after {
    display: none;
}

.home-hero-top,
.home-ship-stage,
#shipExplorationPanel {
    position: relative;
    z-index: 1;
}













.home-hero-card .home-ship-bob {
    width: min(420px, 100%);
    height: 146px;
    min-height: 146px;
    margin-top: 0;
    animation: none;
}

.home-hero-card .home-ship-avatar {
    left: 61%;
    top: 49%;
    transform: translate(-50%, -50%) translateY(0) scale(1.62);
    z-index: 3;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.home-hero-card .home-ship-avatar[data-sea-tone] {
    background: transparent;
    box-shadow: none;
}

.pixel-monster-companion {
    position: absolute;
    width: 96px;
    height: 96px;
    pointer-events: none;
}

.pixel-monster-companion[hidden] {
    display: none !important;
}

.pixel-monster-companion-shadow {
    position: absolute;
    z-index: 0;
    bottom: 8px;
    left: 50%;
    width: var(--pixel-monster-companion-shadow-width, 48px);
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.82) 0 34%, rgba(0, 0, 0, 0.44) 56%, transparent 78%);
    filter: blur(1px);
    opacity: 0.68;
    transform: translateX(-50%) scaleY(0.66);
}

.pixel-monster-companion[data-monster-anchor="air"] .pixel-monster-companion-shadow {
    bottom: 0;
    opacity: 0.4;
    filter: blur(3px);
}

.pixel-monster-companion-sprite {
    position: absolute;
    z-index: 1;
    bottom: 12px;
    left: 50%;
    transform:
        translateX(calc(-1 * var(--pixel-monster-companion-anchor-x, 24px)))
        translateY(var(--pixel-monster-companion-offset-y, 0px))
        scaleX(var(--pixel-monster-companion-scale-x, 1))
        scaleY(var(--pixel-monster-companion-scale-y, 1))
        scale(calc(var(--pixel-monster-companion-scale, 1) * var(--pixel-monster-context-scale, 1)));
    transform-origin: var(--pixel-monster-companion-anchor-x, 50%) var(--pixel-monster-companion-origin-y, 100%);
}

.pixel-monster-companion[data-monster-anchor="ground"] .pixel-monster-companion-sprite {
    bottom: calc(
        12px
        + var(--pixel-monster-companion-anchor-y, var(--pixel-monster-companion-frame-height, 48px))
        - var(--pixel-monster-companion-frame-height, 48px)
    );
}

.home-hero-card .home-ship-stage.has-pet-companion .home-ship-avatar {
    left: 49%;
}

.home-hero-card .home-pet-companion {
    --pixel-monster-context-scale: 1.62;
    z-index: 3;
    top: 49%;
    left: 68%;
    transform: translate(-50%, -50%);
}

.home-hero-card .home-player-ship-frame {
    position: absolute;
    right: 9px;
    top: -108px;
    transform: none;
    width: 90px;
    min-height: 166px;
    padding: 10px 5px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 4;
}


.home-player-ship-title {
    color: rgba(239, 222, 188, 0.84);
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.86);
}

.home-player-ship-head strong,
.home-player-ship-head strong,
.home-player-ship-name {
    color: #ffe188;
    font-family: "Noto Sans JP", system-ui, sans-serif;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.05;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.92), 0 0 8px rgba(255, 222, 128, 0.22);
}




.home-player-ship-final,
.home-player-ship-final,
.home-player-ship-empty {
    color: rgba(239, 222, 188, 0.88);
    font-size: 10px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    width: 96px;
    transform: translateX(-50%);
    line-height: 1.25;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.86);
}




.currency-display b {
    min-width: 0;
    overflow: visible;
    color: inherit;
    font-family: inherit;
    font-size: clamp(25px, 5vw, 34px);
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: inherit;
}

.currency-display::before,
.currency-display::after {
    flex: 0 0 auto;
}




@media (max-width: 420px) {
.home-hero-card,
.home-hero-card,
    body[data-sea-tone] .home-hero-card {
    min-height: 606px;
    padding-inline: 10px;
    --home-hero-bg-height: 606px;
}

.home-hero-top {
    min-height: 124px;
}

.home-ps-card {
    width: min(292px, calc(100% - 96px));
    min-height: 124px;
    padding: 14px 12px 11px;
    gap: 8px;
    grid-template-columns: 52px minmax(0, 1fr);
    column-gap: 8px;
}

.home-ps-icon {
    width: 49px;
    height: 49px;
    flex-basis: 50px;
}

.home-ps-value {
    font-size: clamp(48px, 14vw, 62px);
}

.home-specialty-chip {
    min-width: 32px;
    font-size: 12px;
    width: 32px;
    height: 24px;
    flex-basis: 32px;
}

.home-hero-card .home-ship-bob {
    height: 138px;
    min-height: 138px;
    margin-top: 2px;
}

    .home-hero-card .home-ship-avatar {
        left: 60%;
        top: calc(42% + 44px);
        transform: translate(-50%, -50%) translateY(0) scale(1.36);
    }

    .home-hero-card .home-ship-stage.has-pet-companion .home-ship-avatar {
        left: 46%;
    }

    .home-hero-card .home-pet-companion {
        --pixel-monster-context-scale: 1.36;
        top: calc(42% + 47px);
        left: 66%;
    }

.home-hero-card .home-player-ship-frame {
    right: 4px;
    top: -104px;
    width: 84px;
    min-height: 158px;
    padding: 9px 4px 6px;
    gap: 4px;
}

    .home-player-ship-icon {
        width: 58px;
        height: 58px;
    }

.home-exp-card {
    width: min(344px, calc(100% - 22px));
    min-height: 204px;
    margin-top: 18px;
    grid-template-columns: 90px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 7px;
    padding: 12px 12px 14px;
}

.currency-display {
    min-width: 112px;
    padding-inline: 8px;
}

    .currency-display b {
        font-size: 28px;
    }
}

@media (max-width: 360px) {
    .home-ps-card {
        width: min(270px, calc(100% - 86px));
        gap: 6px;
    }

    .home-ps-icon {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
    }

    .home-ps-value {
        font-size: 46px;
    }

    .home-hero-card .home-player-ship-frame {
        width: 82px;
        right: 4px;
    }

    .home-player-ship-title {
        font-size: 10px;
    }

    .home-player-ship-head strong,
    .home-player-ship-name {
        font-size: 14px;
    }
}

/* --- Header simplification and owned ship motion --- */




.home-hero-card .home-player-ship-icon {
    width: 64px;
    height: 64px;
    background: url("./Sprites/Ships/ships.png") var(--player-ship-sprite-x, -64px) var(--player-ship-sprite-y, -64px) / 2048px 1024px no-repeat;
    transform-origin: center center;
    filter: drop-shadow(0 0 0 white) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.78));
}

.home-hero-card .home-player-ship-icon.is-boat { --player-ship-group-x: 0px; --player-ship-sprite-x: -64px; }
.home-hero-card .home-player-ship-icon.is-explorer { --player-ship-group-x: -384px; --player-ship-sprite-x: -448px; }
.home-hero-card .home-player-ship-icon.is-defender { --player-ship-group-x: -768px; --player-ship-sprite-x: -832px; }
.home-hero-card .home-player-ship-icon.is-fighter { --player-ship-group-x: -1152px; --player-ship-sprite-x: -1216px; }
.home-hero-card .home-player-ship-icon.is-merchant { --player-ship-group-x: -1536px; --player-ship-sprite-x: -1600px; }
.home-hero-card .home-player-ship-icon.is-guild {
    --player-ship-group-x: 0px;
    --player-ship-sprite-x: -64px;
    background: none;
}

.home-player-ship-frame:not(.is-exploring) .home-player-ship-icon {
    animation: homePlayerShipFrameStep 300ms steps(3) infinite;
}

.home-hero-card .home-player-ship-icon[data-player-ship-tap] {
    cursor: pointer;
    touch-action: manipulation;
}

.home-hero-card .home-player-ship-icon[data-player-ship-tap]:focus-visible {
    outline: 2px solid rgba(255, 237, 151, 0.9);
    outline-offset: 4px;
    border-radius: 8px;
}

@keyframes homePlayerShipFrameStep {
    from {
        background-position: var(--player-ship-animation-x, 0px) var(--player-ship-sprite-y, -64px);
    }
    to {
        background-position: calc(var(--player-ship-animation-x, 0px) - 192px) var(--player-ship-sprite-y, -64px);
    }
}

@media (max-width: 640px) {
}

@media (max-width: 420px) {

.home-hero-card .home-player-ship-icon {
    width: 64px;
    height: 64px;
}
}

/* --- Current icon sheet alignment --- */







.ranking-toggle-btn::before,
.ranking-row-score::before,
#tabContentInventory .inventory-panel-btn::before,
#tabContentInventory .equip-slot-icon {
    background-position: center;
}



@media (max-width: 420px) {
.home-specialty-row {
    margin-left: 0;
    width: 184px;
    max-width: 184px;
    gap: 3px;
}
}

/* --- Home reference tightening --- */
#tabContentHome {
    min-height: calc(100vh - var(--nav-height));
}


.home-announcement-panel {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    width: min(430px, calc(100% - 20px));
    min-height: 44px;
    margin: 8px auto 6px;
    padding: 12px 24px 10px;
    border: 1px solid transparent;
    border-image: var(--panel-sheet-plaque-gold) 38 32 30 32 fill / 18px 17px 15px 17px / 0 stretch;
    background: rgba(7, 6, 5, 0.16);
    color: #f9edcf;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.34);
}

.home-announcement-panel[hidden] {
    display: none;
}

.home-announcement-title {
    margin: 0;
    color: #ffe0a3;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-align: left;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
    white-space: nowrap;
}

.home-announcement-list {
    min-width: 0;
    display: block;
}

.home-announcement-item {
    min-width: 0;
    display: block;
}

.home-announcement-message {
    min-width: 0;
    display: block;
    position: relative;
    color: #fff7df;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-announcement-marquee-text {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-announcement-message.is-marquee {
    text-overflow: clip;
}

.home-announcement-message.is-marquee .home-announcement-marquee-text {
    display: inline-block;
    min-width: max-content;
    overflow: visible;
    text-overflow: clip;
    animation: homeAnnouncementMarquee var(--home-announcement-marquee-duration, 24s) linear infinite;
    animation-delay: var(--home-announcement-marquee-delay, -6s);
    will-change: transform;
}

@keyframes homeAnnouncementMarquee {
    from {
        transform: translateX(var(--home-announcement-marquee-start, 100%));
    }
    to {
        transform: translateX(var(--home-announcement-marquee-end, -100%));
    }
}

.home-hero-card .home-ship-image {
    display: none;
}




.home-player-ship-head strong,





.home-exp-rank {
    width: 96px;
    min-height: 134px;
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 10px 8px;
    border: 10px solid transparent;
    border-image: url("./assets/ui/panels/panel-gold-square.png") 24 fill / 10px / 0 stretch;
    background: linear-gradient(180deg, rgba(20, 16, 12, 0.96), rgba(4, 4, 5, 0.98)),
        radial-gradient(ellipse at 50% 36%, rgba(255, 206, 91, 0.18), transparent 58%);
    color: #e8d0a0;
    font-size: 13px;
    line-height: 1.1;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 232, 158, 0.08),
        0 8px 18px rgba(0, 0, 0, 0.28);
}

.home-exp-rank::after {
    content: "";
    width: 58px;
    height: 58px;
    display: block;
    background: var(--home-rank-icon, url("./assets/ui/icons/091.png")) center / contain no-repeat;
    filter:
        drop-shadow(0 2px 0 #251204)
        drop-shadow(0 0 10px rgba(235, 186, 74, 0.38));
}

.home-exp-rank span {
    display: block;
    color: #ffe188;
    font-family: Georgia, "Times New Roman", "Yu Mincho", serif;
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.home-exp-rank[data-rank-tier="apprentice"] {
    --home-rank-icon: url("./assets/ui/icons/091.png");
}

.home-exp-rank[data-rank-tier="navigator"] {
    --home-rank-icon: url("./assets/ui/icons/052.png");
}

.home-exp-rank[data-rank-tier="captain"] {
    --home-rank-icon: url("./assets/ui/icons/051.png");
}

.home-exp-rank[data-rank-tier="admiral"] {
    --home-rank-icon: url("./assets/ui/icons/053.png");
}

.home-exp-rank[data-rank-tier="pirate-king"] {
    --home-rank-icon: url("./assets/ui/icons/050.png");
}

.home-exp-rank[data-rank-tier="king"] {
    --home-rank-icon: url("./assets/ui/icons/093.png");
}



.home-stat-panel {
    grid-area: vitals;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    align-self: stretch;
}

.home-stat-chip {
    min-width: 0;
    min-height: 44px;
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 5px 3px;
    border: 1px solid rgba(218, 181, 103, 0.34);
    border-radius: 7px;
    background:
        linear-gradient(180deg, rgba(33, 28, 20, 0.82), rgba(7, 8, 11, 0.9)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 222, 141, 0.12), transparent 58%);
    box-shadow: inset 0 1px 0 rgba(255, 241, 190, 0.14);
}

.home-stat-chip span {
    color: #b9d7ef;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.home-stat-chip b {
    min-width: 0;
    color: #fff0bf;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.home-stat-chip-hp b {
    font-size: 15px;
}




.nav-button:not(.active) {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.18), rgba(2, 6, 23, 0.34));
}


@media (max-width: 420px) {
    .home-ship-stage {
        min-height: 396px;
        margin-top: -10px;
    }




    .home-exp-rank {
        width: 88px;
        min-height: 126px;
        font-size: 12px;
    }

    .home-exp-rank::after {
        width: 50px;
        height: 50px;
    }

    .home-exp-rank span {
        font-size: 23px;
    }

    .home-stat-panel {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .home-stat-chip {
        min-height: 39px;
        padding: 4px 2px;
    }

    .home-stat-chip span {
        font-size: 11px;
    }

    .home-stat-chip b {
        font-size: 16px;
    }

    .home-stat-chip-hp b {
        font-size: 12px;
    }

    .home-exploration-btn {
        min-height: 42px;
        font-size: clamp(19px, 5.6vw, 24px);
    }

    .home-exp-actions .home-exploration-btn {
        font-size: clamp(14px, 4vw, 17px);
    }

}

/* --- Home screenshot corrections --- */









.home-hero-card .home-player-ship-frame:not(.is-exploring) .home-player-ship-icon {
    animation: homePlayerShipFrameStep 300ms steps(3) infinite !important;
}

.home-hero-card .home-player-ship-frame.is-exploring .home-player-ship-icon {
    animation: none !important;
}



.home-player-ship-owner {
    position: absolute;
    top: 6px;
    left: 50%;
    width: calc(100% - 10px);
    max-height: 24px;
    overflow: hidden;
    transform: translateX(-50%);
    color: #ffffff;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-shadow:
        0 2px 0 rgba(0, 0, 0, 0.95),
        0 0 6px rgba(0, 0, 0, 0.78);
    z-index: 3;
}


.home-player-ship-head strong,

.home-player-ship-name:disabled {
    cursor: default;
    text-decoration: none;
}





.home-player-ship-upgrades button:disabled {
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(94, 101, 112, 0.25), rgba(17, 24, 39, 0.42)),
        linear-gradient(180deg, #4b5563, #1f2937);
    color: rgba(255, 255, 255, 0.72);
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.home-player-ship-upgrades button .home-player-ship-evolve-main,
.home-player-ship-upgrades button .home-player-ship-evolve-cost {
    display: block;
    margin-top: 0;
}

.home-player-ship-upgrades button .home-player-ship-evolve-cost {
    font-size: 11px;
    font-weight: 800;
    line-height: 1.05;
    white-space: nowrap;
    opacity: 0.86;
}

.home-player-ship-final,


@media (max-width: 420px) {



    .home-specialty-label {
        font-size: 12px;
    }


.home-specialty-chip span {
    width: 32px;
    height: 21px;
    flex-basis: 32px;
    background-position: center;
    background-size: contain;
}

    .home-specialty-chip b {
        min-width: 15px;
        height: 16px;
        line-height: 14px;
        font-size: 10px;
    }


    .home-player-ship-head strong,
    .home-player-ship-name {
        font-size: 17px;
    }


    .home-player-ship-upgrades button {
        min-height: 34px;
        padding-inline: 6px;
        font-size: 14px;
    }

    .home-player-ship-upgrades button .home-player-ship-evolve-cost {
        font-size: 9px;
    }
}







@media (max-width: 420px) {


}

/* --- Shared icon map and final icon placement --- */

#navHome { --nav-icon-image: var(--icon-nav-home); }
#navTroy { --nav-icon-image: var(--icon-nav-troy); }
#navCompanions { --nav-icon-image: var(--icon-nav-companions); }
#navInventory { --nav-icon-image: var(--icon-nav-inventory); }
#navRanking { --nav-icon-image: var(--icon-nav-ranking); }


.nav-button .nav-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 1px;
    background-image: var(--nav-icon-image);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    color: transparent;
    font-size: 0;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.62));
}

@media (max-width: 640px) {
    .nav-button .nav-icon {
        width: 32px;
        height: 32px;
    }
}

.nav-button.active .nav-icon {
    filter:
        drop-shadow(0 0 7px rgba(255, 219, 120, 0.5))
        drop-shadow(0 2px 2px rgba(0, 0, 0, 0.66));
}

.home-card-emoji,
.tarot-game-select-icon,
.tarot-mode-icon {
    width: 34px;
    height: 34px;
    display: inline-block;
    flex: 0 0 34px;
    background: var(--home-card-icon, var(--icon-anchor)) center / contain no-repeat;
    color: transparent;
    font-size: 0;
    vertical-align: middle;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55));
}

.home-social-card { --home-card-icon: var(--icon-pirate-flag); }
.tarot-game-select-icon,
#tarotModePoker .tarot-mode-icon,
#tarotModeSpin .tarot-mode-icon { --home-card-icon: var(--icon-tarot); }
#tarotModeKingdom .tarot-mode-icon { --home-card-icon: var(--icon-nav-king); }

.home-qr-scan-btn,
.king-chip-return-btn,
.home-exploration-btn,
.ranking-toggle-btn,
.ranking-refresh-btn,
#tabContentInventory .inventory-primary-tab-btn,
#tabContentQr .battle-entry-btn,
#tabContentQr .equipment-gacha-btn,
#tabContentQr .guild-entry-btn,
#tabContentQr .guild-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.home-qr-scan-btn::before,
.king-chip-return-btn::before,
.home-exploration-btn::before,
.ranking-toggle-btn::before,
.ranking-refresh-btn::before,
#tabContentInventory .inventory-primary-tab-btn::before,
#tabContentQr .equipment-gacha-btn::before,
#tabContentQr .guild-action-btn::before {
    content: "";
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background: var(--button-icon, var(--icon-anchor)) center / contain no-repeat;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.58));
}

.home-exploration-btn::before {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.home-exploration-btn[data-plunder-paused="true"] {
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    color: #d8c8a0;
    filter: saturate(0.82) brightness(0.92);
}

.home-exp-actions .home-fortune-btn {
    --button-icon: var(--icon-tarot);
    font-size: clamp(14px, 4vw, 16px);
    gap: 4px;
    white-space: nowrap;
    border-image-source: url("./assets/ui/buttons/button-blue-large.png");
    background:
        linear-gradient(180deg, rgba(209, 187, 255, 0.3), rgba(57, 29, 104, 0.3)),
        linear-gradient(180deg, #7250a4, #2b1747);
    color: #fff4cf;
    text-shadow: 0 2px 0 rgba(24, 8, 43, 0.82);
}

.home-exp-actions .home-fortune-btn:disabled {
    cursor: wait;
    opacity: 0.72;
    filter: saturate(0.72);
}

#btnShowPsRanking { --button-icon: var(--icon-coin-stack); }
#btnShowDartsRanking { --button-icon: var(--icon-dart); }
#btnShowKaraokeRanking { --button-icon: var(--icon-microphone); }
#tabContentQr .equipment-gacha-btn { --button-icon: var(--icon-chest-gold); }

#tabContentInventory .inventory-primary-tab-btn[data-group="All"] { --button-icon: var(--icon-slot-all); }
#tabContentInventory .inventory-primary-tab-btn[data-group="Equipment"] { --button-icon: var(--icon-slot-equipment); }
#tabContentInventory .inventory-primary-tab-btn[data-group="Tarot"] { --button-icon: var(--icon-slot-tarot); }
#tabContentInventory .inventory-primary-tab-btn[data-group="Consumable"] { --button-icon: var(--icon-potion-blue); }

#tabContentQr .guild-action-btn:nth-child(1) { --button-icon: var(--icon-pirate-flag); }
#tabContentQr .guild-action-btn:nth-child(2) { --button-icon: var(--icon-tarot); }
#tabContentQr .guild-action-btn:nth-child(3) { --button-icon: var(--icon-chest); }
#tabContentQr .guild-action-btn:nth-child(4) { --button-icon: var(--icon-settings); }

#tabContentQr .battle-entry-btn > span,
#tabContentQr .guild-entry-btn > span {
    width: 28px;
    height: 28px;
    display: inline-block;
    flex: 0 0 28px;
    background: var(--button-icon, var(--icon-anchor)) center / contain no-repeat;
    color: transparent;
    font-size: 0 !important;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.58));
}

#tabContentQr .battle-entry-btn { --button-icon: var(--icon-swords); }
#btnCreateGuild { --button-icon: var(--icon-pirate-flag); }
#btnScanJoinGuild { --button-icon: var(--icon-compass); }



.home-qr-scan-btn::before {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
}

#tabContentQr .qr-battle-card > h2::before,
#tabContentQr .equipment-gacha-card > h2::before,
#tabContentQr .guild-card > h2::before,
#tabContentBattle .content-area > h2:first-child::before,
#tabContentKing .content-area > h2:first-child::before {
    content: "";
    width: 48px;
    height: 48px;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
    background: var(--section-icon, var(--icon-anchor)) center / contain no-repeat;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.52));
}

#tabContentQr .qr-battle-card > h2 {
    --section-icon: var(--icon-swords);
    --section-banner: var(--banner-sheet-swords);
}
#tabContentQr .equipment-gacha-card > h2 {
    --section-icon: var(--icon-chest-gold);
    --section-banner: var(--icon-chest-gold);
}
#tabContentQr .guild-card > h2 {
    --section-icon: var(--icon-pirate-flag);
    --section-banner: var(--banner-sheet-skull);
}
#tabContentBattle .content-area > h2:first-child {
    --section-icon: var(--icon-swords);
    --section-banner: var(--banner-sheet-swords);
}
#tabContentKing .content-area > h2:first-child {
    --section-icon: var(--icon-nav-king);
    --section-banner: var(--icon-crown);
}









@media (max-width: 640px) {
    .home-exploration-btn::before {
        width: 18px;
        height: 18px;
        flex-basis: 18px;
    }
}

/* --- Rich banner and panel treatment from numbered icon assets --- */

.home-card-header,
#tabContentInventory .inventory-section[data-panel="items"] > .section-header,
#tabContentTroy .troy-entry-header,
#tabContentTroy .troy-calendar-head,
#tabContentTroy .troy-menu-board-head,
#tabContentTroy .troy-reservation-panel h3,
#tabContentCompanions .companion-list-head,
#tabContentCompanions .companion-create-panel h3,
#tabContentQr .guild-summary-header,
.tarot-loadout-header {
    position: relative;
    min-height: 44px;
    padding: 8px 14px;
    border: 12px solid transparent;
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(10, 7, 4, 0.2), rgba(0, 0, 0, 0.36));
    border-image-source: var(--panel-sheet-rule);
    border-image-slice: 22 84 22 fill;
    border-image-width: 12px 24px;
    border-image-outset: 0;
    border-image-repeat: stretch;
    box-shadow: none;
}

.home-card-header::after,
#tabContentInventory .inventory-section[data-panel="items"] > .section-header::after,
#tabContentTroy .troy-entry-header::after,
#tabContentTroy .troy-calendar-head::after,
#tabContentTroy .troy-menu-board-head::after,
#tabContentCompanions .companion-list-head::after,
#tabContentQr .guild-summary-header::after,
.tarot-loadout-header::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -14px;
    width: min(190px, calc(100% - 28px));
    height: 18px;
    box-sizing: border-box;
    pointer-events: none;
    border: 0;
    background: var(--panel-sheet-rule) center / contain no-repeat;
    opacity: 0.82;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
    transform: translateX(-50%);
    display: none;
}

.home-card-title,
#tabContentTroy .troy-menu-title,
#tabContentTroy .troy-entry-title,
#tabContentTroy .troy-reservation-panel h3,
#tabContentCompanions .companion-list-head h3,
#tabContentCompanions .companion-create-panel h3,
#tabContentQr .guild-summary-header h3,
.tarot-loadout-header h3 {
    color: #ffe5a4;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.78);
}

#tabContentTroy .troy-calendar-head,
#tabContentTroy .troy-menu-board-head,
#tabContentCompanions .companion-list-head,
.tarot-loadout-header {
    background: linear-gradient(180deg, rgba(10, 7, 4, 0.2), rgba(0, 0, 0, 0.36));
    border-image-source: var(--panel-sheet-rule);
    border-image-slice: 22 84 22 fill;
}

#tabContentTroy .troy-reservation-panel,
#tabContentTroy .troy-reservation-panel h3,
#tabContentTroy .troy-reservation-panel label,
#tabContentTroy .troy-reservation-panel .troy-calendar-meta,
#tabContentTroy .troy-reservation-panel .companion-host-note {
    color: #241306;
    text-shadow: 0 1px 0 rgba(255, 245, 210, 0.44);
}

#tabContentTroy .troy-reservation-panel h3 {
    background:
        linear-gradient(180deg, rgba(255, 244, 208, 0.14), rgba(104, 61, 23, 0.08)),
        url("./assets/ui/banners/banner-rule.png") center / 100% 100% no-repeat;
}

#tabContentTroy .troy-reservation-panel .troy-reservation-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

#tabContentTroy #btnCancelTroyReservation {
    min-width: 96px;
    min-height: 40px;
    padding-inline: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

#tabContentTroy #btnCancelTroyReservation::before {
    display: none;
}

#tabContentInventory .inventory-section[data-panel="items"] > .section-header,
#tabContentCompanions .companion-create-panel h3 {
    background: linear-gradient(180deg, rgba(10, 7, 4, 0.2), rgba(0, 0, 0, 0.36));
    border-image-source: var(--panel-sheet-rule);
    border-image-slice: 22 84 22 fill;
}

#tabContentQr .qr-battle-card > h2,
#tabContentQr .equipment-gacha-card > h2,
#tabContentQr .guild-card > h2,
#tabContentQr .content-area > h2:first-child,
#tabContentBattle .content-area > h2:first-child,
#tabContentKing .content-area > h2:first-child {
    position: relative;
    display: flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    min-height: 58px;
    margin-bottom: 18px;
    padding: 7px 18px 8px 12px;
    border: 16px solid transparent;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(11, 9, 7, 0.18), rgba(0, 0, 0, 0.36));
    border-image-source: var(--panel-sheet-plaque-gold);
    border-image-slice: 32 52 34 fill;
    border-image-width: 16px 24px;
    border-image-outset: 0;
    border-image-repeat: stretch;
}

#tabContentQr .qr-battle-card > h2::after,
#tabContentQr .equipment-gacha-card > h2::after,
#tabContentQr .guild-card > h2::after,
#tabContentQr .content-area > h2:first-child::after,
#tabContentBattle .content-area > h2:first-child::after,
#tabContentKing .content-area > h2:first-child::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -17px;
    width: min(230px, calc(100% - 18px));
    height: 24px;
    box-sizing: border-box;
    border: 0;
    background: var(--panel-sheet-divider) center / contain no-repeat;
    opacity: 0.86;
    transform: translateX(-50%);
}

#tabContentQr .battle-entry-card,
#tabContentQr .equipment-gacha-entry,
#tabContentQr .guild-entry-grid > *,
#tabContentTroy .troy-calendar-item,
#tabContentTroy .troy-menu-board-item,
#tabContentTroy .troy-entry-item,
#tabContentCompanions .companion-card,
#tabContentKing .king-card,
#tabContentKing .troy-admin-card {
    border-color: rgba(235, 190, 103, 0.42);
    border: 13px solid transparent;
    background: linear-gradient(180deg, rgba(12, 15, 20, 0.86), rgba(3, 4, 6, 0.96));
    border-image-source: var(--panel-sheet-frame);
    border-image-slice: 28 34 fill;
    border-image-width: 13px;
    border-image-outset: 0;
    border-image-repeat: stretch;
    box-shadow:
        inset 0 1px 0 rgba(255, 239, 190, 0.12),
        0 10px 20px rgba(0, 0, 0, 0.24);
}

.home-qr-card,
.home-social-card {
    border: 13px solid transparent;
    border-radius: 8px;
    border-image-source: var(--panel-sheet-frame);
    border-image-slice: 28 34 fill;
    border-image-width: 13px;
    border-image-outset: 0;
    border-image-repeat: stretch;
    background:
        linear-gradient(180deg, rgba(12, 15, 20, 0.86), rgba(3, 4, 6, 0.96)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
}


.home-qr-area,
.transfer-input-row,
.line-friend-promo,
.favorite-players-section {
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(9, 14, 22, 0.74), rgba(3, 5, 8, 0.88)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.07), transparent 58%);
}





/* --- Rich chat treatment --- */





.map-chat-empty {
    width: max-content;
    max-width: 100%;
    margin: 26px auto;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/speech-parchment.png") 30 fill / 12px / 0 stretch;
    background: linear-gradient(180deg, rgba(255, 244, 208, 0.2), rgba(104, 61, 23, 0.12)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.12), transparent 58%);
    color: #241306;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255, 245, 210, 0.44);
}

.map-chat-message {
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/speech-dark.png") 30 fill / 10px / 0 stretch;
    background: linear-gradient(180deg, rgba(13, 19, 27, 0.86), rgba(4, 6, 10, 0.94)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.06), transparent 58%);
}

.map-chat-message-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.map-chat-message-name {
    min-width: 0;
    color: #ffe5a4;
    font-size: 12px;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.map-chat-message-time {
    flex: 0 0 auto;
    color: rgba(239, 222, 188, 0.72);
    font-size: 10px;
    font-weight: 800;
}

.map-chat-message-body {
    color: #f8f0dc;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}



#chatInput::placeholder {
    color: rgba(239, 222, 188, 0.58);
}

#btnSendChat {
    min-width: 72px;
    min-height: 42px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(70, 181, 238, 0.24), rgba(3, 28, 45, 0.32)),
        linear-gradient(180deg, #104c70, #071b29);
    color: #eff8ff;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
    box-shadow: none;
}

.home-ps-lamp,
.home-ps-card.is-low .home-ps-lamp {
    display: none !important;
    animation: none !important;
    box-shadow: none !important;
}





#tabContentInventory .inventory-item-badge.is-active {
    display: none;
}

#tabContentInventory .inventory-item-cell.is-equipment-equipped .inventory-item-icon-frame {
    position: static;
}

#tabContentInventory .inventory-item-cell.is-equipment-equipped,
#tabContentInventory .inventory-item-cell.has-stat-badges {
    position: relative;
    overflow: visible;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-equipped {
    position: relative;
    overflow: visible;
}

#tabContentInventory .inventory-item-cell.is-equipment-equipped::after,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-equipped::after {
    content: "E";
    position: absolute;
    top: 3px;
    left: 4px;
    right: auto;
    bottom: auto;
    z-index: 12;
    width: auto;
    height: auto;
    display: block;
    color: #fff;
    background: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.88);
    pointer-events: none;
}

#tabContentInventory .inventory-item-main {
    align-items: flex-start;
    width: 100%;
    height: 100%;
    min-width: 0;
    display: grid;
    place-items: center;
    place-content: center;
}

#tabContentInventory .inventory-item-copy {
    min-width: 0;
    flex: 1 1 0;
    display: grid;
    gap: 3px;
    text-align: center;
}

#tabContentInventory .inventory-item-name {
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-break: break-word;
}

#tabContentInventory #inventoryGrid[data-layout="consumable"],
#tabContentInventory #inventoryGrid[data-layout="mixed"] {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    align-items: start;
    gap: 8px;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"],
#tabContentInventory #inventoryGrid[data-layout="tarot"] {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] {
    gap: 7px;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] {
    grid-template-columns: repeat(auto-fill, 48px);
    justify-content: center;
    gap: 12px 10px;
}

#tabContentInventory .inventory-item-cell {
    position: relative;
    min-height: 0;
    aspect-ratio: 1 / 1;
    padding: 7px;
    display: grid;
    place-items: center;
    place-content: center;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    /* Long-press starts multi-select, so keep the OS text selection and callout away. */
    -webkit-touch-callout: none;
    user-select: none;
    border: 11px solid transparent;
    scroll-margin-top: calc(var(--inventory-sticky-top) + var(--inventory-switch-sticky-height) + 18px);
    scroll-margin-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background: radial-gradient(circle at 50% 18%, rgba(255, 224, 142, 0.1), transparent 48%),
        linear-gradient(180deg, rgba(10, 14, 19, 0.8), rgba(3, 4, 6, 0.94));
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell {
    aspect-ratio: 3 / 4;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell.is-equipment-card {
    touch-action: manipulation;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 20%, rgba(255, 226, 151, 0.14), transparent 58%),
        linear-gradient(180deg, rgba(14, 17, 22, 0.9), rgba(3, 4, 7, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 244, 205, 0.07),
        0 7px 15px rgba(0, 0, 0, 0.3);
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell.is-equipment-card::before {
    content: "";
    position: absolute;
    inset: 8px 8px 31px;
    z-index: 0;
    border: 1px solid rgba(255, 226, 151, 0.24);
    border-radius: 6px;
    background:
        linear-gradient(180deg, rgba(255, 244, 207, 0.06), transparent 32%),
        linear-gradient(180deg, rgba(9, 12, 17, 0.74), rgba(1, 2, 4, 0.9));
    pointer-events: none;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell.is-equipment-card[data-equipment-state="equipped"] {
    border-image-source: url("./assets/ui/panels/panel-gold-square.png");
    filter: saturate(1.06) brightness(1.04);
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card {
    --tarot-suit-glow: rgba(218, 231, 246, 0.42);
    --tarot-suit-line: #edf3fb;
    width: 48px;
    height: 80px;
    aspect-ratio: auto;
    padding: 0;
    touch-action: manipulation;
    overflow: visible;
    z-index: 1;
    border: 0;
    border-image: none;
    border-radius: 3px;
    background: transparent;
    box-shadow: none;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card:hover,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card:focus-within,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-deck-state="equipped"] {
    z-index: 4;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card::before {
    content: none;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card::after {
    z-index: 8;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-suit="wand"] {
    --tarot-suit-glow: rgba(211, 74, 64, 0.38);
    --tarot-suit-line: #d34a40;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-suit="pentacle"] {
    --tarot-suit-glow: rgba(58, 166, 109, 0.4);
    --tarot-suit-line: #3aa66d;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-suit="sword"] {
    --tarot-suit-glow: rgba(155, 114, 230, 0.42);
    --tarot-suit-line: #9b72e6;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-suit="cup"] {
    --tarot-suit-glow: rgba(63, 137, 207, 0.4);
    --tarot-suit-line: #3f89cf;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-suit="all"] {
    --tarot-suit-glow: rgba(228, 216, 168, 0.34);
    --tarot-suit-line: #f5e2a0;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-deck-state="equipped"] {
    filter: saturate(1.1) brightness(1.04);
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell.is-tarot-card[data-deck-state="equipped"]::before {
    content: none;
}

#tabContentInventory .inventory-item-detail-trigger:focus-visible {
    outline: 2px solid rgba(255, 225, 134, 0.92);
    outline-offset: 2px;
}

#tabContentInventory .inventory-item-detail-trigger {
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

#tabContentInventory .inventory-item-head {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
    display: block;
    pointer-events: none;
}

#tabContentInventory .inventory-item-head > .inventory-item-badge,
#tabContentInventory .inventory-item-head-meta .inventory-item-badge:not(.is-count):not(.is-new) {
    display: none;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-copy,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-copy,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell.is-equipment-card .inventory-item-copy,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell.is-tarot-card .inventory-item-copy {
    display: none;
}

#tabContentInventory .inventory-item-tail {
    position: relative;
    z-index: 3;
    width: 100%;
    margin-top: 4px;
    display: grid;
    gap: 4px;
}

#tabContentInventory .inventory-item-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

#tabContentInventory .inventory-item-quick-action {
    min-width: 46px;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid rgba(255, 226, 151, 0.34);
    border-radius: 4px;
    background: rgba(5, 7, 10, 0.88);
    color: #f4dfae;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.86);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 2px 5px rgba(0, 0, 0, 0.34);
}

#tabContentInventory .inventory-item-quick-action.is-equip {
    background: linear-gradient(180deg, rgba(70, 181, 238, 0.86), rgba(12, 78, 118, 0.94));
    color: #eff8ff;
}

#tabContentInventory .inventory-item-quick-action.is-remove {
    background: linear-gradient(180deg, rgba(170, 56, 49, 0.9), rgba(83, 19, 19, 0.94));
    color: #fff1e8;
}

#tabContentInventory .inventory-item-quick-action.is-disabled,
#tabContentInventory .inventory-item-quick-action:disabled {
    opacity: 0.62;
    color: #a89978;
    filter: grayscale(0.35);
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell.is-equipment-card:active,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell[data-deck-state="available"]:active,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell[data-deck-state="equipped"]:active {
    transform: translateY(1px);
}

#tabContentInventory .inventory-item-head-meta {
    display: contents;
}

#tabContentInventory .inventory-item-head-meta .inventory-item-badge.is-count {
    min-width: 22px;
    min-height: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: rgba(8, 10, 13, 0.88);
    border-color: rgba(255, 226, 151, 0.42);
    color: #ffe7a3;
    font-size: 10px;
    line-height: 1;
}

#tabContentInventory .inventory-item-head-meta .inventory-item-badge.is-new {
    min-width: 30px;
    min-height: 18px;
    display: inline-grid;
    place-items: center;
    padding: 1px 5px;
    border: 1px solid rgba(255, 238, 159, 0.84);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 126, 67, 0.96), rgba(177, 43, 31, 0.96));
    color: #fff9e5;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 0 rgba(58, 12, 8, 0.92);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell .inventory-item-head,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMajor"] .inventory-item-head,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMinor"] .inventory-item-head {
    inset: 0;
    z-index: 9;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-head-meta .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell > .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-icon-frame > .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMajor"] .inventory-item-head-meta .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMajor"] > .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMajor"] .inventory-item-icon-frame > .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMinor"] .inventory-item-head-meta .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMinor"] > .inventory-item-badge.is-count,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMinor"] .inventory-item-icon-frame > .inventory-item-badge.is-count {
    position: absolute;
    left: 50%;
    right: auto;
    top: calc(100% - 8px);
    bottom: auto;
    transform: translateX(-50%);
    z-index: 40;
    min-width: 26px;
    min-height: 14px;
    padding: 0 5px;
    border: 1px solid rgba(255, 226, 151, 0.34);
    border-radius: 999px;
    background: rgba(3, 5, 8, 0.94);
    color: #fff1c2;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    -webkit-text-stroke: 0;
    paint-order: normal;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.86);
}

#tabContentInventory .inventory-item-stat-badges {
    position: absolute;
    left: 4px;
    bottom: -4px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    pointer-events: none;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell .inventory-item-stat-badges {
    bottom: 8px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    flex-direction: row;
    justify-content: center;
    align-items: center;
}


#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell .inventory-item-stat-badges {
    left: 0;
    right: auto;
    top: -10px;
    bottom: auto;
    transform: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    z-index: 40;
}

#tabContentInventory .inventory-item-stat-badge {
    min-width: 34px;
    min-height: 16px;
    padding: 2px 6px 3px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: url("./assets/ui/icons/badge-green.png") center / 100% 100% no-repeat;
    color: #fff7ed;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.84);
    box-shadow: none;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-stat-badge.is-enhancement {
    min-width: 0;
    padding: 1px 3px;
    background: none;
    color: #f6d47f;
    font-size: 8px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-stat-badge.is-random-option {
    min-width: 0;
    padding: 1px 3px;
    background: none;
    color: #86efac;
    font-size: 8px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell .inventory-item-stat-badge {
    font-family: Arial, Helvetica, sans-serif;
    -webkit-text-stroke: 0;
    paint-order: normal;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.86);
    min-width: 0;
    min-height: 13px;
    padding: 0 3px;
    border: 1px solid rgba(255, 226, 151, 0.3);
    border-radius: 999px;
    background: rgba(3, 5, 8, 0.94);
    color: #fff1c2;
    font-size: 9px;
}

#tabContentInventory .inventory-item-stat-badge.is-blue {
    background-image: url("./assets/ui/icons/badge-blue.png");
}

#tabContentInventory .inventory-item-stat-badge.is-purple {
    background-image: url("./assets/ui/icons/badge-purple.png");
}

#tabContentInventory .inventory-item-stat-badge.is-red {
    background-image: url("./assets/ui/icons/badge-red.png");
}

#tabContentInventory .inventory-item-stat-badge.is-green {
    background-image: url("./assets/ui/icons/badge-green.png");
}



#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell .inventory-item-main {
    position: relative;
    z-index: 1;
    transform: translateY(-5px);
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell .inventory-item-main {
    margin-top: 0;
    transform: translateY(3px);
}

#tabContentInventory .inventory-item-icon-frame {
    width: 100%;
    height: 100%;
    max-width: 66px;
    max-height: 66px;
    flex: none;
    display: grid;
    place-items: center;
    justify-self: center;
    align-self: center;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

#tabContentInventory .inventory-item-icon {
    margin: 0 !important;
    justify-self: center;
    align-self: center;
}

#tabContentInventory .inventory-item-icon.is-image-icon {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: none !important;
    image-rendering: auto;
}

#tabContentInventory .inventory-item-icon.is-image-icon img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.48));
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="Weapon"] .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="Shield"] .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="Offhand"] .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="Armor"] .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="Accessory"] .inventory-item-icon {
    transform: scale(1.28);
    transform-origin: center;
}

#tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell[data-category="Armor"] .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="Armor"] .inventory-item-icon {
    transform: translateY(-6px) scale(1.28);
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-icon-frame,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMajor"] .inventory-item-icon-frame,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMinor"] .inventory-item-icon-frame {
    position: relative;
    z-index: 20;
    width: 48px;
    height: 80px;
    max-width: 48px;
    max-height: 80px;
    box-sizing: border-box;
    border: 1px solid var(--tarot-suit-line, #edf3fb);
    border-radius: 3px;
    background: #120f0c;
    box-shadow:
        inset 0 0 0 1px rgba(255, 248, 219, 0.12),
        0 3px 5px rgba(0, 0, 0, 0.78),
        0 0 4px var(--tarot-suit-glow, rgba(218, 231, 246, 0.42));
    overflow: visible;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-cell[data-deck-state="equipped"] .inventory-item-icon-frame {
    box-shadow:
        inset 0 0 0 1px rgba(255, 248, 219, 0.2),
        0 4px 7px rgba(0, 0, 0, 0.82),
        0 0 8px var(--tarot-suit-glow, rgba(218, 231, 246, 0.56));
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-icon-frame .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMajor"] .inventory-item-icon-frame .inventory-item-icon,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMinor"] .inventory-item-icon-frame .inventory-item-icon {
    filter:
        drop-shadow(0 5px 8px rgba(0, 0, 0, 0.56))
        drop-shadow(0 0 7px var(--tarot-suit-glow, rgba(255, 226, 151, 0.16)));
}

#tabContentInventory .tarot-number-badge {
    --tarot-badge-color: #edf3fb;
    position: absolute;
    left: auto;
    right: -6px;
    top: -6px;
    bottom: auto;
    z-index: 4;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 3px;
    box-sizing: border-box;
    border: 2px solid var(--tarot-badge-color);
    border-radius: 3px;
    background: rgba(8, 7, 10, 0.9);
    color: #f8fbff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
    width: max-content;
    -webkit-text-stroke: 0;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.82),
        1px -1px 0 rgba(0, 0, 0, 0.82),
        -1px 1px 0 rgba(0, 0, 0, 0.82),
        1px 1px 0 rgba(0, 0, 0, 0.82),
        0 2px 2px rgba(0, 0, 0, 0.78);
    box-shadow: 0 0 3px color-mix(in srgb, var(--tarot-badge-color) 58%, transparent);
    pointer-events: none;
}

#tabContentInventory .tarot-number-badge::after {
    content: none;
}

#tabContentInventory #inventoryGrid[data-layout="tarot"] .inventory-item-icon-frame .tarot-number-badge,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMajor"] .inventory-item-icon-frame .tarot-number-badge,
#tabContentInventory #inventoryGrid[data-layout="mixed"] .inventory-item-cell[data-category="TarotMinor"] .inventory-item-icon-frame .tarot-number-badge {
    z-index: 40;
    right: 0;
    top: 0;
    min-width: 18px;
    height: 18px;
    padding-inline: 3px;
    font-size: 11px;
}

#tabContentInventory .tarot-number-badge.is-wand {
    --tarot-badge-color: #d34a40;
}

#tabContentInventory .tarot-number-badge.is-pentacle {
    --tarot-badge-color: #3aa66d;
}

#tabContentInventory .tarot-number-badge.is-sword {
    --tarot-badge-color: #9b72e6;
    color: #e9ddff;
}

#tabContentInventory .tarot-number-badge.is-cup {
    --tarot-badge-color: #3f89cf;
}

#tabContentInventory .tarot-number-badge.is-all {
    --tarot-badge-color: #f5e2a0;
}

/* --- Inventory usability pass --- */




#tabContentInventory .inventory-panel-btn[data-inventory-group-switch="Consumable"]::before {
    background-image: var(--icon-potion-blue);
}


#tabContentInventory[data-inventory-panel] .avatar-card.inventory-section {
    display: none;
}

#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .avatar-card.inventory-section,
#tabContentInventory[data-inventory-panel="loadout"] .avatar-card.inventory-section {
    display: block;
}

#tabContentInventory .avatar-card.inventory-section,
#tabContentInventory .inventory-section.active[data-panel="items"],
#tabContentInventory .inventory-section.active[data-panel="tarot"] {
    margin: 6px var(--app-gutter) 0;
    padding: 8px;
    border: 11px solid transparent;
    border-radius: 9px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 11px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 222, 144, 0.12), transparent 58%),
        var(--inventory-panel-bg);
}

#tabContentInventory[data-inventory-panel="tarot"] .inventory-section.active[data-panel="tarot"] {
    position: static;
    top: auto;
    z-index: auto;
    box-shadow: none;
    padding: 6px 8px;
}

#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .avatar-card.inventory-section {
    position: relative;
    top: auto;
    z-index: auto;
    box-shadow: none;
}

#tabContentInventory .inventory-section[data-panel="items"] > .section-header,
#tabContentInventory .inventory-section[data-panel="tarot"] > .section-header,
#tabContentInventory .tarot-loadout-header {
    min-height: 28px;
    margin: 0 0 5px;
    padding: 2px 6px;
    border: 6px solid transparent;
    border-radius: 6px;
    border-image-source: var(--panel-sheet-rule);
    border-image-slice: 22 84 22 fill;
    border-image-width: 6px 12px;
    border-image-repeat: stretch;
    background: linear-gradient(180deg, rgba(18, 10, 4, 0.12), rgba(0, 0, 0, 0.28));
    color: var(--inventory-gold);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.74);
}


#tabContentInventory .inventory-section[data-panel="items"] > .section-header,
#tabContentInventory .inventory-section[data-panel="tarot"] > .section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .inventory-section[data-panel="items"] > .section-header,
#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] #inventoryListSummary,
#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] #inventoryTabHint {
    display: none;
}

#avatarStyleModal {
    position: fixed;
    inset: auto;
    top: var(--avatar-style-viewport-top, 0px);
    left: var(--avatar-style-viewport-left, 0px);
    width: var(--avatar-style-viewport-width, 100vw);
    height: var(--avatar-style-viewport-height, 100dvh);
    box-sizing: border-box;
    padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: hidden;
    overscroll-behavior: contain;
}

#avatarStyleModal .avatar-style-sheet {
    width: min(360px, calc(var(--avatar-style-viewport-width, 100vw) - 28px));
    max-width: 360px;
    max-height: calc(var(--avatar-style-viewport-height, 100dvh) - 20px);
    padding: 14px;
    overflow-y: auto;
    border: 15px solid transparent;
    border-radius: 9px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 15px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 222, 144, 0.12), transparent 58%),
        var(--inventory-panel-bg);
    text-align: left;
}

#avatarStyleModal .avatar-style-panel {
    display: block;
    margin: 0 0 12px;
    padding: 10px;
    border: 13px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 13px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.1), transparent 58%),
        linear-gradient(180deg, rgba(19, 12, 6, 0.88), rgba(4, 6, 10, 0.94));
    color: var(--inventory-gold);
}

#avatarStyleModal .avatar-style-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
}

#avatarStyleModal .avatar-style-head h3 {
    margin: 0;
    color: var(--inventory-gold);
    font-size: 18px;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#avatarStyleModal .avatar-style-head span {
    color: #f3d58a;
    font-size: 12px;
    font-weight: 800;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.72);
    white-space: nowrap;
}

#avatarStyleModal .avatar-style-notice {
    margin: 0 0 10px;
    color: #d8c39b;
    font-size: 12px;
    line-height: 1.45;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.72);
}

#avatarStyleModal .avatar-style-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

#avatarStyleModal .avatar-style-action {
    width: 100%;
    min-height: 50px;
    padding: 7px 8px;
    border: 10px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/panels/panel-navy-wide.png") 34 fill / 10px / 0 stretch;
    background: linear-gradient(180deg, rgba(7, 12, 20, 0.52), rgba(0, 0, 0, 0.32));
    color: #ead7ad;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.18;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#avatarStyleModal .avatar-style-action span {
    display: inline-block;
    margin-top: 2px;
    color: #f5c85b;
    font-size: 12px;
    font-weight: 900;
}

#avatarStyleModal .avatar-style-action:not(:disabled) {
    border-image: url("./assets/ui/panels/panel-gold-square.png") 24 fill / 10px / 0 stretch;
    color: #2a1606;
    text-shadow: 0 1px 0 rgba(255, 238, 178, 0.45);
}

#avatarStyleModal .avatar-style-action:not(:disabled) span {
    color: #3a1b05;
}

#avatarStyleModal .avatar-style-action:disabled {
    opacity: 0.58;
}

#sellConfirmationModal {
    position: fixed;
    inset: auto;
    top: var(--sell-confirmation-viewport-top, 0px);
    left: var(--sell-confirmation-viewport-left, 0px);
    width: var(--sell-confirmation-viewport-width, 100vw);
    height: var(--sell-confirmation-viewport-height, 100dvh);
    box-sizing: border-box;
    padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: hidden;
    overscroll-behavior: contain;
}

#sellConfirmationModal .modal-content {
    width: min(360px, calc(var(--sell-confirmation-viewport-width, 100vw) - 20px));
    max-height: calc(var(--sell-confirmation-viewport-height, 100dvh) - 20px);
    overflow-y: auto;
}

#tabContentInventory .inventory-section[data-panel="items"] .section-header h2,
#tabContentInventory .inventory-section[data-panel="tarot"] .section-header h2,
#tabContentInventory .tarot-loadout-header h3 {
    color: var(--inventory-gold);
    font-size: 21px;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.78);
}

#tabContentInventory .inventory-section[data-panel="tarot"] .section-header h2 {
    margin: 0;
}

.tarot-loadout-catalog-button,
.tarot-deck-toolbar-button {
    align-self: center;
    min-width: 78px;
    min-height: 36px;
    padding: 4px 8px;
    border: 7px solid transparent;
    border-image: url("./assets/ui/buttons/button-blue-large.png") 28 fill / 7px / 0 stretch;
    color: #fff1c7;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
}

.arcana-resonance-catalog {
    position: fixed;
    inset: auto;
    top: var(--arcana-resonance-viewport-top, 0px);
    left: var(--arcana-resonance-viewport-left, 0px);
    width: var(--arcana-resonance-viewport-width, 100vw);
    height: var(--arcana-resonance-viewport-height, 100dvh);
    box-sizing: border-box;
    padding: 12px;
    overflow: hidden;
    overscroll-behavior: contain;
    background: rgba(0, 0, 0, 0.84);
}

.arcana-resonance-sheet {
    width: min(540px, calc(var(--arcana-resonance-viewport-width, 100vw) - 20px));
    max-height: min(calc(var(--arcana-resonance-viewport-height, 100dvh) - 24px), 760px);
    padding: 12px;
    border: 14px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 14px / 0 stretch;
    overflow: hidden;
    color: #f4e4bd;
    background: linear-gradient(180deg, rgba(8, 12, 18, 0.98), rgba(2, 3, 5, 0.99));
}

.arcana-resonance-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.arcana-resonance-head h3 {
    margin: 0;
    color: #ffe4a0;
    font-size: 20px;
}

.arcana-resonance-head p {
    margin: 3px 0 0;
    color: #bda980;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
}

.arcana-resonance-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    margin: 10px 0;
}

.arcana-resonance-filters {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: -2px 0 9px;
}

.arcana-resonance-filters button {
    min-width: 68px;
    min-height: 44px;
    padding: 4px 10px;
    border: 1px solid rgba(211, 175, 104, 0.28);
    border-radius: 999px;
    color: #bbaa86;
    background: rgba(4, 8, 13, 0.76);
    font-size: 11px;
    font-weight: 900;
}

.arcana-resonance-filters button.is-active {
    border-color: rgba(244, 208, 122, 0.72);
    color: #fff1c2;
    background: rgba(108, 73, 19, 0.72);
}

.arcana-resonance-tabs button {
    min-width: 0;
    min-height: 44px;
    padding: 4px 2px;
    border: 1px solid rgba(211, 175, 104, 0.4);
    color: #d8c8a7;
    background: rgba(12, 18, 27, 0.9);
    font-size: 11px;
    font-weight: 800;
}

.arcana-resonance-tabs button.is-active {
    border-color: #f4d07a;
    color: #241508;
    background: #e4bd63;
}

.arcana-resonance-list {
    display: grid;
    gap: 7px;
    max-height: calc(min(var(--arcana-resonance-viewport-height, 100dvh), 760px) - 220px);
    overflow: auto;
}

.arcana-resonance-row {
    --arcana-list-accent: rgba(213, 181, 112, 0.5);
    padding: 8px 9px;
    border: 1px solid rgba(213, 181, 112, 0.24);
    border-left: 3px solid var(--arcana-list-accent);
    border-radius: 5px;
    background: rgba(11, 16, 23, 0.84);
}

.arcana-resonance-row[role="button"] {
    cursor: pointer;
}

.arcana-resonance-row[role="button"]:is(:hover, :focus-visible) {
    outline: 2px solid color-mix(in srgb, var(--arcana-list-accent) 72%, white);
    outline-offset: 1px;
    filter: brightness(1.08);
}

.arcana-resonance-row[data-suit="cup"] {
    --arcana-list-accent: #74a9ea;
}

.arcana-resonance-row[data-suit="wand"] {
    --arcana-list-accent: #dc766c;
}

.arcana-resonance-row[data-suit="sword"] {
    --arcana-list-accent: #9c78d5;
}

.arcana-resonance-row[data-suit="pentacle"] {
    --arcana-list-accent: #6fba7d;
}

.arcana-resonance-row[data-suit="major"] {
    --arcana-list-accent: #e8e7e2;
}

.arcana-resonance-row.is-equipped {
    border-color: rgba(255, 218, 120, 0.84);
    box-shadow: inset 0 0 14px rgba(221, 166, 58, 0.16);
}

.arcana-resonance-row.is-unowned {
    opacity: 0.56;
}

.arcana-resonance-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #ffe6a7;
}

.arcana-resonance-row p {
    margin: 4px 0 0;
    color: #e7dcc6;
    font-size: 12px;
    line-height: 1.45;
}

.arcana-resonance-row small {
    display: block;
    margin-top: 4px;
    color: #a9c9df;
    font-size: 11px;
}

.arcana-resonance-empty {
    margin: 18px 0;
    color: #b7a47d;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}







#tabContentInventory .equip-slot-stats span {
    color: inherit;
}

#tabContentInventory .equip-slot-stats .stat-atk {
    color: #ffd08a;
}

#tabContentInventory .equip-slot-stats .stat-def {
    color: #b9dcff;
}

#tabContentInventory .equip-slot-item-art {
    grid-column: 1;
    grid-row: 2;
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    justify-self: center;
    align-self: center;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    opacity: 0.36;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

#tabContentInventory .equip-slot-item-art.has-item {
    opacity: 1;
}

#tabContentInventory .equip-slot-item-sprite {
    background-repeat: no-repeat;
    image-rendering: pixelated;
    transform-origin: center;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.65));
    position: relative;
    z-index: 1;
}

#tabContentInventory .equip-slot:hover {
    filter: brightness(1.08);
}

#tabContentInventory .equip-slot:focus-visible {
    outline: 2px solid rgba(255, 224, 142, 0.82);
    outline-offset: 2px;
}

#tabContentInventory .inventory-list-summary {
    min-height: 18px;
    margin: -2px 0 8px;
    color: #b8a47c;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
}

#tabContentInventory .inventory-list-summary[hidden] {
    display: none;
}


#tabContentInventory #inventoryTabs[hidden] {
    display: none;
}

#tabContentInventory .inventory-tab-btn {
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 9px / 0 stretch;
    background: linear-gradient(180deg, rgba(16, 18, 22, 0.72), rgba(3, 4, 6, 0.86));
}

#tabContentInventory .inventory-tab-btn.active {
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 9px / 0 stretch;
}


#tabContentInventory #inventoryGrid {
    display: grid;
    padding: 4px 0 0;
}


#tabContentInventory #inventoryGrid[data-layout="consumable"],


#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .inventory-item-cell {
    scroll-margin-top: calc(var(--inventory-sticky-top) + var(--inventory-switch-sticky-height) + 18px);
}

#tabContentInventory .inventory-item-cell.is-equipped {
    border-image-source: url("./assets/ui/panels/panel-gold-square.png");
}

#tabContentInventory .inventory-sell-controls {
    display: grid;
    grid-template-columns: repeat(2, auto);
    align-items: center;
    gap: 5px;
    margin: 0;
}

#tabContentInventory .inventory-sell-controls[hidden] {
    display: none;
}

#tabContentInventory .inventory-sell-control-btn {
    min-height: 40px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 8px / 0 stretch;
    background: linear-gradient(180deg, rgba(28, 31, 38, 0.84), rgba(7, 9, 13, 0.92));
    color: #f8edcb;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#tabContentInventory .inventory-sell-control-btn.is-active,
#tabContentInventory .inventory-sell-control-btn.is-sell {
    border-image-source: url("./assets/ui/buttons/button-blue-large.png");
}

#tabContentInventory .inventory-sell-control-btn:disabled {
    opacity: 0.48;
    filter: grayscale(0.35);
}

#tabContentInventory .inventory-selection-bar {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 32px);
    z-index: 890;
    width: min(640px, calc(100vw - 16px));
    min-height: var(--inventory-selection-bar-height);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 10px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 10px / 0 stretch;
    background: rgba(4, 6, 9, 0.94);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48);
    transform: translateX(-50%);
}

#tabContentInventory .inventory-selection-bar[hidden] {
    display: none;
}

#tabContentInventory .inventory-selection-bar .inventory-sell-control-btn {
    min-height: 42px;
    padding-inline: 9px;
    white-space: nowrap;
}

#tabContentInventory .inventory-selection-summary {
    min-width: 0;
    color: #ffe5a4;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

#tabContentInventory.is-sell-selection-active #inventoryGrid {
    padding-bottom: calc(var(--inventory-selection-bar-height) + 18px);
}

#tabContentInventory .inventory-item-cell.is-sell-mode {
    touch-action: manipulation;
}

#tabContentInventory .inventory-item-cell.is-sell-mode.is-not-sellable {
    opacity: 0.54;
    filter: grayscale(0.45);
}

#tabContentInventory .inventory-item-cell.is-sell-selected {
    box-shadow:
        0 0 0 2px rgba(89, 203, 255, 0.86),
        0 0 14px rgba(62, 166, 255, 0.46),
        inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

#tabContentInventory .inventory-sell-check {
    position: absolute;
    top: 4px;
    right: 4px;
    left: auto;
    z-index: 12;
    width: 28px;
    height: 28px;
    /* The shared button touch-target min-height would stretch the circle into an oval. */
    min-width: 28px;
    min-height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 2px solid rgba(255, 244, 205, 0.82);
    border-radius: 50%;
    background: rgba(3, 5, 8, 0.86);
    color: #ffffff;
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.4);
}

#tabContentInventory .inventory-sell-check[aria-pressed="true"] {
    background: linear-gradient(180deg, #35a8f1, #086ba8);
    border-color: rgba(218, 245, 255, 0.96);
}

#tabContentInventory .inventory-sell-check:disabled {
    opacity: 0.55;
}

.black-market-panel {
    position: fixed;
    inset: auto;
    top: var(--black-market-viewport-top, 0px);
    left: var(--black-market-viewport-left, 0px);
    z-index: 10080;
    width: var(--black-market-viewport-width, 100vw);
    height: var(--black-market-viewport-height, 100dvh);
    box-sizing: border-box;
    display: grid;
    place-items: center;
    padding: max(12px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: hidden;
    overscroll-behavior: contain;
    background:
        radial-gradient(ellipse at 50% 18%, rgba(224, 171, 72, 0.2), transparent 42%),
        rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.black-market-panel[hidden] {
    display: none;
}

.black-market-sheet {
    width: min(560px, calc(var(--black-market-viewport-width, 100vw) - 16px));
    max-height: min(calc(var(--black-market-viewport-height, 100dvh) - 24px), 680px);
    margin: 0 auto;
    padding: 9px 12px 12px;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 16px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 224, 140, 0.12), transparent 58%),
        linear-gradient(180deg, rgba(5, 8, 12, 0.96), rgba(2, 3, 5, 0.98));
    color: #f4e4bd;
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.62);
}

.black-market-panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    margin: 0 0 10px;
    padding: 5px 8px;
    border: 12px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/banners/banner-plaque-gold.png") 28 36 32 fill / 12px 16px / 0 stretch;
    background: linear-gradient(180deg, rgba(37, 22, 9, 0.28), rgba(0, 0, 0, 0.28));
}

.black-market-panel-head h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff0b8;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
}

.black-market-panel-head h3::before {
    content: "";
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    background: var(--icon-coin-stack) center / contain no-repeat;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.58));
}

.black-market-panel-head .black-market-listing-count {
    min-width: 64px;
    padding: 5px 7px;
    border: 1px solid rgba(255, 224, 140, 0.34);
    border-radius: 6px;
    background: rgba(3, 7, 12, 0.72);
    color: #ffe8a6;
    text-align: center;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.black-market-refresh,
.black-market-listing-action {
    min-height: 32px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 8px / 0 stretch;
    background: linear-gradient(180deg, rgba(28, 31, 38, 0.84), rgba(7, 9, 13, 0.92));
    color: #f8edcb;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.black-market-refresh,
.black-market-refresh:disabled {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    border-image: none;
    background: var(--icon-action-refresh) center / 36px 36px no-repeat;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.72));
}

@media (max-width: 420px) {
    .black-market-panel-head {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .black-market-panel-head h3 {
        grid-column: 1 / 3;
        grid-row: 1;
        white-space: nowrap;
    }

    .black-market-panel-head .black-market-listing-count {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
    }

    .black-market-refresh {
        grid-column: 2 / 4;
        grid-row: 2;
        justify-self: end;
    }

    .black-market-close {
        grid-column: 3;
        grid-row: 1;
    }
}

.black-market-refresh:not(:disabled):is(:hover, :focus-visible),
.black-market-close:not(:disabled):is(:hover, :focus-visible),
.black-market-listing-action:not(:disabled):is(:hover, :focus-visible) {
    outline: 2px solid rgba(255, 225, 134, 0.92);
    outline-offset: 2px;
    filter: brightness(1.1) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.72));
}

.black-market-refresh:disabled,
.black-market-close:disabled,
.black-market-listing-action:disabled {
    opacity: 0.62;
    filter: grayscale(0.3);
}

.black-market-body {
    min-height: 64px;
    display: grid;
    gap: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.black-market-list {
    display: grid;
    gap: 8px;
}

.black-market-listing {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: 7px 8px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-blue-square.png") 24 fill / 10px / 0 stretch;
    background:
        radial-gradient(circle at 8% 20%, rgba(255, 224, 140, 0.1), transparent 32%),
        linear-gradient(180deg, rgba(7, 25, 38, 0.92), rgba(2, 9, 15, 0.98));
}

.black-market-listing.is-error {
    display: block;
    color: #ffaaa2;
    font-size: 12px;
    font-weight: 900;
}

.black-market-listing-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 7px solid transparent;
    border-radius: 6px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 7px / 0 stretch;
    background: rgba(2, 5, 9, 0.76);
}

.black-market-listing-icon-fallback {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 224, 140, 0.14);
    color: #ffe8a6;
    font-size: 16px;
    font-weight: 900;
}

.black-market-listing-body {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.black-market-listing-body strong,
.black-market-listing-body span,
.black-market-listing-body small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.black-market-listing-body strong {
    color: #fff0b8;
    font-size: 14px;
    font-weight: 900;
}

.black-market-listing-body span,
.black-market-listing-body small,
.black-market-empty {
    color: #b9d7ef;
    font-size: 12px;
    font-weight: 800;
}

.black-market-empty {
    margin: 0;
    padding: 18px 12px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-blue-square.png") 24 fill / 10px / 0 stretch;
    background: rgba(3, 14, 23, 0.74);
    text-align: center;
}

.black-market-empty.is-error {
    color: #ffaaa2;
}

.black-market-listing-action.is-buy {
    border-image-source: url("./assets/ui/buttons/button-blue-large.png");
}

.black-market-listing-trade {
    display: grid;
    justify-items: end;
    gap: 6px;
}

.black-market-listing-price {
    color: #ffe18a;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
    white-space: nowrap;
}

.black-market-listing-action {
    min-width: 68px;
}

.inventory-action-dialog {
    position: fixed;
    inset: auto;
    top: var(--inventory-action-viewport-top, 0px);
    left: var(--inventory-action-viewport-left, 0px);
    z-index: 10120;
    width: var(--inventory-action-viewport-width, 100vw);
    height: var(--inventory-action-viewport-height, 100dvh);
    box-sizing: border-box;
    display: grid;
    place-items: center;
    padding: 18px;
    overflow: hidden;
    overscroll-behavior: contain;
    background:
        radial-gradient(ellipse at 50% 18%, rgba(224, 171, 72, 0.18), transparent 42%),
        rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.inventory-action-dialog[hidden] {
    display: none;
}

.inventory-action-dialog-sheet {
    width: min(340px, calc(var(--inventory-action-viewport-width, 100vw) - 36px));
    max-height: calc(var(--inventory-action-viewport-height, 100dvh) - 36px);
    padding: 14px;
    overflow-y: auto;
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 12px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 224, 140, 0.12), transparent 58%),
        linear-gradient(180deg, rgba(5, 8, 12, 0.96), rgba(2, 3, 5, 0.98));
    color: #f4e4bd;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.48);
}

.inventory-action-dialog-sheet h3 {
    margin: 0 0 8px;
    color: #fff0b8;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
}

.inventory-action-dialog-message {
    margin: 0 0 10px;
    color: #d9cba8;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}

.inventory-action-dialog-field {
    display: grid;
    gap: 5px;
    margin: 0 0 8px;
    color: #ffe8a6;
    font-size: 12px;
    font-weight: 900;
}

.inventory-action-dialog-field[hidden] {
    display: none;
}

.inventory-action-dialog-input {
    min-height: 44px;
    padding: 6px 8px;
    border: 2px solid rgba(87, 53, 22, 0.48);
    border-radius: 6px;
    background: rgba(255, 245, 214, 0.88);
    color: #241205;
    font-size: 16px;
    font-weight: 900;
}

.inventory-action-dialog-error {
    min-height: 16px;
    margin: 0 0 8px;
    color: #ffaaa2;
    font-size: 12px;
    font-weight: 900;
}

.inventory-action-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.inventory-action-dialog-actions button {
    min-height: 44px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 8px / 0 stretch;
    background: linear-gradient(180deg, rgba(28, 31, 38, 0.84), rgba(7, 9, 13, 0.92));
    color: #f8edcb;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

.inventory-action-dialog-confirm {
    border-image-source: url("./assets/ui/buttons/button-blue-large.png");
}

@media (max-width: 420px) {
    #tabContentInventory .inventory-mobile-switch {
        margin-inline: 5px;
        gap: 3px;
        padding: 2px;
    }



    #tabContentInventory .avatar-card.inventory-section,
    #tabContentInventory .inventory-section.active[data-panel="items"],
    #tabContentInventory .inventory-section.active[data-panel="tarot"] {
        margin-inline: 5px;
        padding: 6px;
    }

    #tabContentInventory .inventory-section[data-panel="items"] .section-header h2,
    #tabContentInventory .inventory-section[data-panel="tarot"] .section-header h2,
    #tabContentInventory .tarot-loadout-header h3 {
        font-size: 15px;
    }

    #tabContentInventory #inventoryGrid[data-layout="equipment"] {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
    }

    #tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell {
        padding: 3px;
        border-width: 7px;
        border-image-width: 7px;
    }

    #tabContentInventory #inventoryGrid[data-layout="equipment"] .inventory-item-cell.is-equipment-card::before {
        inset: 5px 5px 25px;
    }

    #tabContentInventory #inventoryGrid[data-layout="tarot"] {
        grid-template-columns: repeat(5, minmax(48px, 1fr));
        justify-items: center;
        gap: 8px 4px;
    }

    #avatarStyleModal .avatar-style-controls {
        grid-template-columns: minmax(0, 1fr);
    }



    #tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] #equipmentGrid {
        grid-template-columns: minmax(0, 31%) minmax(0, 38%) minmax(0, 31%);
        grid-template-rows: repeat(2, minmax(0, 1fr));
        gap: 8% 0;
        min-height: 0;
        padding: 5.7% 3.5% 4.5%;
    }

    #tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .equip-slot {
        min-height: 0;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 17% 45% 23% 15%;
        gap: 0;
        padding: 3% 8% 4%;
    }

    #tabContentInventory .avatar-card.inventory-section::before {
        width: min(270px, 82%);
        min-height: 42px;
        padding: 3px 22px 7px;
        font-size: 16px;
    }

    #tabContentInventory .inventory-avatar-stage {
        top: 70px;
        bottom: 14px;
        width: 36%;
    }

    #tabContentInventory .inventory-avatar-stage .avatar-container {
        transform: scale(2.05);
    }

    #tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .equip-slot-label {
        font-size: 10px;
        line-height: 1;
    }

    #tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .equip-slot-name {
        margin-top: 0;
        padding: 1px 1px 0;
        color: #fff0bd;
        font-size: 10px;
        line-height: 1.16;
    }

    #tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .equip-slot-stats {
        display: flex;
        gap: 1px 4px;
        font-size: 9px;
        line-height: 1.1;
    }

    #tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .equip-slot-item-art {
        width: 48px;
        height: 48px;
    }

    #tabContentInventory .inventory-browse-tools {
        grid-template-columns: minmax(92px, 1fr) 88px auto;
        gap: 4px;
    }

    #tabContentInventory .inventory-search-input,
    #tabContentInventory .sort-select,
    #tabContentInventory .inventory-sell-control-btn {
        min-height: 38px;
    }

    #tabContentInventory .inventory-search-input {
        padding-inline: 9px 34px;
        font-size: 12px;
    }

    #tabContentInventory .inventory-search-clear {
        width: 34px;
        height: 34px;
    }

    #tabContentInventory .sort-select {
        padding-inline: 5px;
        font-size: 10px;
    }

    #tabContentInventory .inventory-sell-controls {
        gap: 3px;
    }

    #tabContentInventory .inventory-sell-control-btn.is-market,
    #tabContentInventory .inventory-sell-control-btn.is-select {
        width: 38px;
        min-width: 38px;
        padding: 0;
        overflow: hidden;
        color: transparent;
        font-size: 0;
    }

    #tabContentInventory .inventory-sell-control-btn.is-market::before,
    #tabContentInventory .inventory-sell-control-btn.is-select::before {
        content: "";
        width: 22px;
        height: 22px;
        display: block;
        margin: auto;
        background-position: center;
        background-repeat: no-repeat;
        background-size: contain;
    }

    #tabContentInventory .inventory-sell-control-btn.is-market::before {
        background-image: var(--icon-coin-stack);
    }

    #tabContentInventory .inventory-sell-control-btn.is-select::before {
        border: 2px solid #f4dfae;
        border-radius: 3px;
        box-shadow: inset 0 0 0 3px rgba(4, 8, 13, 0.86);
        background: linear-gradient(135deg, transparent 42%, #f4dfae 43% 55%, transparent 56%) center / 13px 13px no-repeat;
    }
}


#tabContentInventory[data-inventory-panel="items"][data-inventory-group="Equipment"] .armor-slot .equip-slot-icon {
    background-size: 74% 74%, 100% 100%, 100% 100%;
}





.ranking-row-top .ranking-rank-number {
    display: none;
}


#tabContentQr .qr-battle-card > h2::before,
#tabContentQr .equipment-gacha-card > h2::before,
#tabContentQr .guild-card > h2::before,
#tabContentQr .content-area > h2:first-child::before,
#tabContentBattle .content-area > h2:first-child::before,
#tabContentKing .content-area > h2:first-child::before {
    width: 48px;
    height: 48px;
    margin-right: 8px;
    background-image: var(--section-banner, var(--section-icon));
    background-size: contain;
}

@media (max-width: 420px) {
    .home-card-header,
    #tabContentInventory .inventory-section[data-panel="items"] > .section-header,
    #tabContentTroy .troy-entry-header,
    #tabContentTroy .troy-calendar-head,
    #tabContentCompanions .companion-list-head,
    #tabContentQr .guild-summary-header,
    .tarot-loadout-header {
        min-height: 40px;
        padding: 7px 10px;
    }

    #tabContentQr .qr-battle-card > h2,
    #tabContentQr .equipment-gacha-card > h2,
    #tabContentQr .guild-card > h2,
    #tabContentQr .content-area > h2:first-child,
    #tabContentBattle .content-area > h2:first-child,
    #tabContentKing .content-area > h2:first-child {
        width: 100%;
        min-height: 52px;
        font-size: clamp(25px, 8vw, 34px);
    }
}

/* --- Sheet2 action icons for richer command surfaces --- */

#tabContentTroy .troy-entry-btn,
#tabContentTroy .troy-reservation-actions button,
#tabContentCompanions .companion-create-btn,
#tabContentCompanions .btn-muted,
#tabContentCompanions .companion-action-btn,
#tabContentMap .map-action-button,
#tabContentMap .map-secondary-action-btn,
.battle-room-btn,
#tabContentKing .king-inline-actions button,
#tabContentKing .king-store-game-inline-save,
#tabContentKing .troy-admin-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

#tabContentTroy .troy-entry-btn::before,
#tabContentTroy .troy-reservation-actions button::before,
#tabContentCompanions .companion-create-btn::before,
#tabContentCompanions .btn-muted::before,
#tabContentCompanions .companion-action-btn::before,
#tabContentMap .map-action-button::before,
#tabContentMap .map-secondary-action-btn::before,
.battle-room-btn::before,
#tabContentKing .king-inline-actions button::before,
#tabContentKing .king-store-game-inline-save::before,
#tabContentKing .troy-admin-actions button::before {
    content: "";
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background: var(--command-icon, var(--icon-action-plus)) center / contain no-repeat;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.58));
}

#btnTroyJoin,
.companion-action-btn.is-join,
.companion-action-btn.is-approve,
#btnKingTroyOpen,
#btnKingSaveAnnouncement,
.king-store-game-inline-save,
#btnKingTroyCalendarSave {
    --command-icon: var(--icon-action-check);
}

#btnCreateReservation,
#createIslandButton,
#btnKingMenuAddCustom,
#btnKingMenuAddSpecial {
    --command-icon: var(--icon-action-plus);
}

#btnCancelTroyReservation,
.companion-action-btn.is-reject,
#btnKingTroyClose,
#btnKingTroyCalendarClear {
    --command-icon: var(--icon-action-close);
}

#btnKingReload,
#btnKingReload2 {
    --command-icon: var(--icon-action-refresh);
}

#shipSideCannonButton {
    --command-icon: var(--icon-action-cannon);
}

#shipNormalAttackButton {
    --command-icon: var(--icon-action-swords);
}

#shipActionButton,
#mapOwnedIslandsShortcut {
    --command-icon: var(--icon-action-ship);
}

#shipSkillToggleButton {
    --command-icon: var(--icon-action-card);
}

#btnKingWarDeploy {
    --command-icon: var(--icon-action-ship);
}

#btnKingWarStrike {
    --command-icon: var(--icon-action-swords);
}

/* --- Rich player profile panel --- */
#playerProfileModal {
    padding: 12px;
    align-items: center;
    background:
        radial-gradient(circle at 50% 88%, rgba(198, 141, 54, 0.18), transparent 34%),
        rgba(2, 6, 23, 0.78);
}

#playerProfileModal .player-profile-sheet {
    width: min(520px, calc(100vw - 18px));
    max-height: min(760px, calc(100dvh - 26px));
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 18px 18px calc(18px + var(--safe-bottom));
    overflow: auto;
    border: 16px solid transparent;
    border-radius: 10px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 16px / 0 stretch;
    text-align: left;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 220, 142, 0.16), transparent 52%),
        linear-gradient(180deg, rgba(8, 9, 11, 0.9), rgba(3, 5, 8, 0.98));
    box-shadow:
        0 22px 54px rgba(0, 0, 0, 0.56),
        inset 0 1px 0 rgba(255, 241, 190, 0.16);
}

#playerProfileModal .sheet-handle {
    width: min(210px, 54%);
    height: 18px;
    margin: -8px auto 10px;
    border-radius: 0;
    background: var(--panel-sheet-rule) center / contain no-repeat;
    opacity: 0.92;
}

#playerProfileModal .player-profile-head {
    position: relative;
    grid-template-columns: minmax(0, 1fr) 170px;
    grid-template-areas:
        "copy avatar"
        "copy ship";
    gap: 8px 10px;
    align-items: start;
    margin-bottom: 14px;
    padding: 10px;
    border: 12px solid transparent;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(12, 18, 28, 0.82), rgba(2, 5, 9, 0.92)),
        radial-gradient(ellipse at 28% 12%, rgba(248, 213, 129, 0.12), transparent 45%);
}

#playerProfileModal .player-profile-avatar-shell {
    position: relative;
    grid-area: avatar;
    justify-self: center;
    width: 164px;
    min-width: 164px;
    height: 174px;
    display: grid;
    place-items: center;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 10px / 0 stretch;
    background:
        radial-gradient(circle at 50% 16%, rgba(255, 239, 180, 0.42), transparent 43%),
        linear-gradient(180deg, rgba(58, 35, 19, 0.42), rgba(14, 10, 8, 0.48));
    box-shadow: inset 0 -10px 18px rgba(64, 32, 12, 0.16);
    overflow: visible;
}

#playerProfileModal #playerProfileAvatar.player-profile-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    transform: translateY(7px) scale(1.18);
    transform-origin: center center;
}

#playerProfileModal .player-profile-avatar-shell.has-pet-companion #playerProfileAvatar.player-profile-avatar {
    transform: translate(-8px, 7px) scale(1.18);
}

#playerProfileModal .player-profile-avatar-shell.has-pet-companion {
    margin-bottom: 54px;
}

#playerProfileModal .player-profile-pet-companion {
    --pixel-monster-context-scale: 1.18;
    z-index: 2;
    right: -4px;
    bottom: 29px;
    width: 84px;
    height: 104px;
    transform: translateY(29px);
}

#playerProfileModal .player-profile-pet-companion.is-renamable {
    pointer-events: auto;
    cursor: pointer;
}

#playerProfileModal .player-profile-pet-companion.is-renamable:focus-visible {
    outline: 2px solid #f6d56f;
    outline-offset: -6px;
    border-radius: 50%;
}

#playerProfileModal .player-profile-pet-name {
    position: absolute;
    z-index: 4;
    right: -4px;
    bottom: 4px;
    width: 116px;
    min-height: 24px;
    padding: 3px 6px;
    overflow: hidden;
    border: 1px solid rgba(238, 204, 117, 0.82);
    border-radius: 12px;
    color: #fff0ba;
    background: linear-gradient(180deg, rgba(35, 26, 17, 0.94), rgba(9, 9, 12, 0.96));
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.72), inset 0 1px rgba(255, 243, 197, 0.14);
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    transform: translateY(46px);
}

#playerProfileModal .player-profile-pet-name:not(:disabled) {
    cursor: pointer;
}

#playerProfileModal .player-profile-pet-name:not(:disabled)::after {
    content: " ✎";
    color: #f6d56f;
}

#playerProfileModal .player-profile-pet-name:disabled {
    opacity: 1;
}

#playerProfileModal .player-profile-pet-name[hidden],
#playerProfileModal .player-profile-pet-rename[hidden] {
    display: none !important;
}

#playerProfileModal .player-profile-pet-rename {
    position: absolute;
    z-index: 6;
    right: -4px;
    bottom: 3px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 3px;
    width: 150px;
    padding: 4px;
    border: 1px solid rgba(238, 204, 117, 0.9);
    border-radius: 7px;
    background: rgba(7, 9, 14, 0.97);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.78);
    transform: translateY(54px);
}

#playerProfileModal .player-profile-pet-rename input {
    min-width: 0;
    height: 26px;
    padding: 3px 5px;
    border: 1px solid rgba(125, 175, 207, 0.7);
    border-radius: 4px;
    color: #f7f2e5;
    background: #111a24;
    font-size: 11px;
}

#playerProfileModal .player-profile-pet-rename button {
    min-width: 34px;
    height: 26px;
    padding: 2px 5px;
    border: 1px solid rgba(238, 204, 117, 0.72);
    border-radius: 4px;
    color: #fff0ba;
    background: linear-gradient(180deg, #493719, #20160c);
    font-size: 10px;
}

#playerProfileModal .player-profile-ship {
    grid-area: ship;
    width: 164px;
    justify-self: center;
    min-height: 86px;
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 6px;
    justify-items: start;
    align-items: center;
    padding: 7px 8px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 10px / 0 stretch;
    background:
        radial-gradient(circle at 50% 20%, rgba(125, 211, 252, 0.24), transparent 46%),
        linear-gradient(180deg, rgba(6, 24, 38, 0.68), rgba(3, 8, 16, 0.88));
    overflow: hidden;
}

#playerProfileModal .player-profile-ship-name {
    min-width: 0;
    color: #ffe8a6;
    line-height: 1.12;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#playerProfileModal .player-profile-ship-icon {
    grid-row: 1 / 3;
    width: 64px;
    height: 64px;
    background-position: var(--player-ship-sprite-x, -64px) -64px;
    background-size: 2048px 1024px;
}

#playerProfileModal .player-profile-ship-meta {
    min-width: 0;
    color: #b9d7ef;
    font-weight: 800;
    line-height: 1.1;
}

#itemDetailModal {
    --item-tarot-edge: #edf3fb;
    --item-tarot-glow: rgba(218, 231, 246, 0.42);
    position: fixed;
    inset: auto;
    top: var(--item-detail-viewport-top, 0px);
    left: var(--item-detail-viewport-left, 0px);
    width: var(--item-detail-viewport-width, 100vw);
    height: var(--item-detail-viewport-height, 100dvh);
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
    overflow: hidden;
    overscroll-behavior: contain;
    background:
        radial-gradient(ellipse at 50% 18%, rgba(224, 171, 72, 0.22), transparent 42%),
        rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#itemDetailModal[data-tarot-suit="wand"] {
    --item-tarot-edge: #d34a40;
    --item-tarot-glow: rgba(211, 74, 64, 0.38);
}

#itemDetailModal[data-tarot-suit="cup"] {
    --item-tarot-edge: #3f89cf;
    --item-tarot-glow: rgba(63, 137, 207, 0.4);
}

#itemDetailModal[data-tarot-suit="sword"] {
    --item-tarot-edge: #9b72e6;
    --item-tarot-glow: rgba(155, 114, 230, 0.42);
}

#itemDetailModal[data-tarot-suit="pentacle"] {
    --item-tarot-edge: #3aa66d;
    --item-tarot-glow: rgba(58, 166, 109, 0.4);
}

#itemDetailModal .item-detail-sheet {
    position: relative;
    width: min(462px, calc(var(--item-detail-viewport-width, 100vw) - 16px));
    max-width: none;
    max-height: min(calc(var(--item-detail-viewport-height, 100dvh) - 20px), 720px);
    margin: 0;
    padding: 9px 12px 12px;
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 16px / 0 stretch;
    overflow: auto;
    touch-action: pan-y;
    color: #f4e4bd;
    text-align: left;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 224, 140, 0.12), transparent 58%),
        linear-gradient(180deg, rgba(5, 8, 12, 0.94), rgba(2, 3, 5, 0.98));
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.58);
}

#itemDetailModal .item-detail-corner-close {
    position: absolute;
    z-index: 4;
    top: 0;
    right: 0;
}

#itemDetailModal .item-detail-navigation {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 0 48px 8px;
}

#itemDetailModal .item-detail-navigation[hidden] {
    display: none;
}

#itemDetailModal .item-detail-navigation button {
    width: 48px;
    height: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 10px solid transparent;
    border-radius: 6px;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 10px / 0 stretch;
    color: #fff0b8;
    background: rgba(3, 6, 10, 0.92);
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 #000;
    box-shadow: none;
}

#itemDetailModal .item-detail-navigation svg {
    display: block;
    width: 20px;
    height: 20px;
}

#itemDetailModal .item-detail-navigation button:is(:hover, :focus-visible) {
    outline: 2px solid rgba(255, 225, 134, 0.92);
    outline-offset: 1px;
}

#itemDetailModal .sheet-handle {
    width: 62px;
    height: 7px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(255, 224, 142, 0.9), transparent);
}

#itemDetailModal .item-detail-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    margin: 0 0 10px;
}

#itemDetailModal .item-detail-icon-frame {
    width: 86px;
    min-height: 92px;
    display: grid;
    place-items: center;
    border: 13px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 13px / 0 stretch;
    background:
        radial-gradient(circle at 50% 28%, rgba(255, 224, 140, 0.14), transparent 52%),
        linear-gradient(180deg, rgba(7, 14, 22, 0.82), rgba(2, 4, 7, 0.94));
}

#itemDetailModal[data-detail-kind="tarot"] .item-detail-icon-frame {
    position: relative;
    width: 76px;
    min-height: 112px;
    padding: 0;
    overflow: visible;
    border: 0;
    border-image: none;
    background: none;
}

#itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up #itemDetailIcon {
    animation: itemDetailTarotLevelUpCard 720ms cubic-bezier(0.18, 0.82, 0.26, 1) both;
}

#itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up .item-detail-icon-frame::after {
    position: absolute;
    inset: 9px 11px;
    z-index: 1;
    border: 1px solid var(--item-tarot-edge);
    border-radius: 6px;
    box-shadow: 0 0 8px var(--item-tarot-glow), inset 0 0 7px var(--item-tarot-glow);
    content: "";
    pointer-events: none;
    animation: itemDetailTarotLevelUpRing 820ms ease-out both;
}

#itemDetailModal .item-detail-tarot-level-up-burst {
    position: absolute;
    z-index: 2;
    top: 68%;
    left: 50%;
    width: max-content;
    padding: 3px 6px;
    border: 1px solid color-mix(in srgb, var(--item-tarot-edge) 82%, #fff 18%);
    border-radius: 999px;
    background: rgba(3, 9, 16, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.72), 0 0 8px var(--item-tarot-glow);
    color: #fff6ce;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.1;
    pointer-events: none;
    text-shadow: 0 1px 0 #000;
    white-space: nowrap;
    animation: itemDetailTarotLevelUpLabel 1080ms cubic-bezier(0.16, 0.8, 0.24, 1) both;
}

@keyframes itemDetailTarotLevelUpCard {
    0% { transform: scale(1); }
    36% { transform: scale(1.1); }
    68% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

@keyframes itemDetailTarotLevelUpRing {
    0% { opacity: 0.88; transform: scale(0.58); }
    100% { opacity: 0; transform: scale(1.3); }
}

@keyframes itemDetailTarotLevelUpLabel {
    0% { opacity: 0; transform: translate(-50%, 6px) scale(0.82); }
    20%, 56% { opacity: 1; transform: translate(-50%, -5px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -18px) scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
    #itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up #itemDetailIcon,
    #itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up .item-detail-icon-frame::after,
    #itemDetailModal .item-detail-tarot-level-up-burst {
        animation: none;
    }

    #itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up .item-detail-icon-frame::after {
        opacity: 0.78;
        transform: scale(1);
    }

    #itemDetailModal .item-detail-tarot-level-up-burst {
        opacity: 1;
        transform: translate(-50%, -5px);
    }
}

#itemDetailModal #itemDetailIcon {
    margin: auto !important;
    image-rendering: pixelated;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.52));
}

#itemDetailModal[data-detail-kind="tarot"] #itemDetailIcon {
    width: 48px;
    height: 80px;
    box-sizing: border-box;
    border: 1px solid var(--item-tarot-edge);
    border-radius: 3px;
    background-color: #120f0c;
    box-shadow:
        inset 0 0 0 1px rgba(255, 248, 219, 0.12),
        0 5px 8px rgba(0, 0, 0, 0.72),
        0 0 5px var(--item-tarot-glow);
}

#itemDetailModal #itemDetailIcon.is-image-icon {
    width: 62px;
    height: 66px;
    display: grid;
    place-items: center;
    background: none !important;
    image-rendering: auto;
}

#itemDetailModal #itemDetailIcon.is-image-icon img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#itemDetailModal .item-detail-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 13px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/banners/banner-plaque-gold.png") 28 36 32 fill / 13px 17px / 0 stretch;
    background: linear-gradient(180deg, rgba(37, 22, 9, 0.3), rgba(0, 0, 0, 0.24));
}

#itemDetailModal[data-detail-kind="tarot"] .item-detail-copy {
    align-items: center;
    padding: 10px 8px;
    border: 1px solid color-mix(in srgb, var(--item-tarot-edge) 52%, transparent);
    border-image: none;
    border-radius: 6px;
    background:
        radial-gradient(ellipse at 50% 0%, var(--item-tarot-glow), transparent 58%),
        rgba(5, 8, 13, 0.82);
    text-align: center;
}

#itemDetailModal #itemDetailName {
    margin: 0;
    color: #fff0b8;
    font-size: 20px;
    font-weight: 900;
    line-height: 1.22;
    letter-spacing: 0;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
    overflow-wrap: anywhere;
}

#itemDetailModal #itemDetailCategory {
    margin: 0;
    color: #d6bd81;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 1px 0 #000;
}

#itemDetailModal .item-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

#itemDetailModal .item-detail-meta-chip {
    min-height: 24px;
    padding: 3px 8px;
    display: inline-flex;
    align-items: center;
    border: 8px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 8px / 0 stretch;
    color: #f0d6a0;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

#itemDetailModal .item-detail-meta-chip.is-equipment,
#itemDetailModal .item-detail-meta-chip.is-equipped,
#itemDetailModal .item-detail-meta-chip.is-enhanced {
    border-image-source: url("./assets/ui/panels/panel-gold-square.png");
    color: #fff4c9;
}

#itemDetailModal .item-detail-meta-chip.is-tarot {
    border-image-source: url("./assets/ui/panels/panel-blue-square.png");
    color: #e4f4ff;
}

#itemDetailModal .item-detail-meta-chip.is-muted {
    color: #af9a72;
}

#itemDetailModal #itemDetailDescription {
    margin: 0 0 10px;
    padding: 14px 16px;
    border: 1px solid rgba(92, 55, 21, 0.5);
    border-radius: 8px;
    border-image: none;
    background:
        linear-gradient(180deg, rgba(255, 244, 206, 0.18), rgba(180, 118, 48, 0.08)),
        url("./assets/ui/panels/panel-parchment-wide.png") center / 100% 100% no-repeat,
        #d8b878;
    color: #2b1908;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.55;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 0 rgba(255, 243, 203, 0.45);
}

#itemDetailModal[data-detail-kind="tarot"] #itemDetailDescription,
#itemDetailModal[data-detail-kind="tarot"] #itemDetailStats {
    display: none;
}

#itemDetailModal #itemDetailStats {
    display: grid;
    gap: 8px;
    margin: 0 0 10px;
    font-weight: 800;
    line-height: 1.3;
}

#itemDetailModal .item-detail-tarot-combat {
    display: grid;
    gap: 4px;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--item-tarot-edge) 52%, transparent);
    border-radius: 6px;
    border-image: none;
    background: radial-gradient(ellipse at 50% 0%, var(--item-tarot-glow), transparent 58%),
        rgba(4, 9, 15, 0.82);
}

#itemDetailModal .item-detail-tarot-combat-title {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

#itemDetailModal .item-detail-tarot-combat-title strong {
    color: #fff0b8;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 1px 0 #000;
}

#itemDetailModal .item-detail-tarot-combat-title span {
    color: var(--item-tarot-edge);
    font-size: 11px;
    font-weight: 900;
}

#itemDetailModal .item-detail-tarot-rows {
    display: grid;
    gap: 0;
}

#itemDetailModal .item-detail-tarot-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: stretch;
    gap: 12px;
    padding: 8px 0;
    border-radius: 0;
    background: none;
    text-align: left;
    align-items: baseline;
}

#itemDetailModal .item-detail-tarot-row-label {
    color: var(--item-tarot-edge);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.25;
}

#itemDetailModal .item-detail-tarot-row-value {
    min-width: 0;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.35;
    text-align: right;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 0 #000;
}

#itemDetailModal .item-detail-tarot-row.is-master .item-detail-tarot-row-value {
    color: #ead7ff;
    text-shadow: 0 0 6px rgba(182, 137, 255, 0.52), 0 1px 0 #000;
}

#itemDetailModal .item-detail-abp-gauge {
    width: 100%;
    height: 8px;
    border: 1px solid rgba(244, 220, 151, 0.48);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.72);
    overflow: hidden;
    margin: 0 0 6px;
}

#itemDetailModal .item-detail-abp-gauge > span {
    display: block;
    width: var(--abp-progress, 0%);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #98661d, #f5d36c 72%, #fff1ac);
    box-shadow: 0 0 5px rgba(255, 219, 110, 0.52);
}

#itemDetailModal .item-detail-abp-gauge.is-master > span {
    background: linear-gradient(90deg, #8f6adb, #d9c0ff 70%, #fff1ac);
}

#itemDetailModal .item-detail-stat-row,
#itemDetailModal .item-detail-empty {
    min-height: 38px;
    display: grid;
    grid-template-columns: minmax(86px, 0.36fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(255, 224, 142, 0.08), transparent 50%),
        rgba(2, 4, 7, 0.74);
}

#itemDetailModal .item-detail-empty {
    grid-template-columns: minmax(0, 1fr);
    color: #cbb185;
}

#itemDetailModal .item-detail-stat-label {
    color: #bda174;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.1;
}

#itemDetailModal .item-detail-stat-value {
    min-width: 0;
    color: #fff1bf;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.25;
    text-align: right;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 0 #000;
}

#itemDetailModal .item-detail-stat-row.is-option .item-detail-stat-value {
    color: #86efac;
}

#itemDetailModal .item-detail-stat-row.is-power .item-detail-stat-value,
#itemDetailModal .item-detail-stat-row.is-level .item-detail-stat-value,
#itemDetailModal .item-detail-stat-row.is-enhancement .item-detail-stat-value {
    color: #ffe18a;
}

#itemDetailModal .item-detail-stat-row.is-defense .item-detail-stat-value,
#itemDetailModal .item-detail-stat-row.is-heal .item-detail-stat-value {
    color: #d7f0ff;
}

#itemDetailModal .item-detail-stat-row.is-magic .item-detail-stat-value,
#itemDetailModal .item-detail-stat-row.is-tarot .item-detail-stat-value {
    color: #e8d7ff;
}

#itemDetailModal #itemDetailButtons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    margin: 0 0 10px;
}

#itemDetailModal[data-detail-kind="tarot"] #itemDetailButtons .item-detail-action.is-equip,
#itemDetailModal[data-detail-kind="tarot"] #itemDetailButtons .item-detail-action.is-remove,
#itemDetailModal[data-detail-kind="tarot"] #itemDetailButtons .item-detail-action.is-levelup,
#itemDetailModal[data-detail-kind="tarot"] #itemDetailButtons .item-detail-action.is-disabled:not(.is-move) {
    grid-column: 1 / -1;
}

#itemDetailModal .item-detail-management {
    grid-column: 1 / -1;
    border: 1px solid rgba(188, 166, 122, 0.2);
    border-radius: 7px;
    background: rgba(2, 5, 9, 0.48);
    overflow: hidden;
}

#itemDetailModal .item-detail-management summary {
    min-height: 40px;
    display: grid;
    place-items: center;
    padding: 7px 34px;
    color: #bba983;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    list-style-position: inside;
}

#itemDetailModal .item-detail-management[open] summary {
    border-bottom: 1px solid rgba(188, 166, 122, 0.16);
    color: #ead7b0;
}

#itemDetailModal .item-detail-management-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
}

#itemDetailModal .item-detail-management-actions .item-detail-action-note {
    grid-column: 1 / -1;
}

#itemDetailModal #itemDetailButtons .item-detail-action-note {
    grid-column: 1 / -1;
    width: auto;
    margin: 0;
    padding: 8px 10px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-blue-square.png") 24 fill / 10px / 0 stretch;
    color: #dff3ff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
    background: rgba(3, 22, 34, 0.68);
}

#itemDetailModal .item-detail-action,
#itemDetailModal .item-detail-close {
    min-height: 44px;
    width: 100%;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 240, 184, 0.28), rgba(111, 60, 13, 0.18)),
        linear-gradient(180deg, #e6b44b, #9a591d);
    color: #241205;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.15;
    text-shadow: 0 1px 0 rgba(255, 236, 177, 0.48);
    box-shadow: none;
}

#itemDetailModal .item-detail-action.is-remove,
#itemDetailModal .item-detail-action.is-sell,
#itemDetailModal .item-detail-action.is-move,
#itemDetailModal .item-detail-close {
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    background: linear-gradient(180deg, rgba(32, 35, 41, 0.9), rgba(7, 8, 10, 0.98));
    color: #ead7b0;
    text-shadow: 0 1px 0 #000;
}

#itemDetailModal[data-detail-kind="tarot"] > .item-detail-sheet > .item-detail-close {
    display: none;
}

#itemDetailModal .item-detail-action.is-use,
#itemDetailModal .item-detail-action.is-levelup,
#itemDetailModal .item-detail-action.is-market {
    border-image-source: url("./assets/ui/buttons/button-blue-large.png");
    background:
        linear-gradient(180deg, rgba(70, 181, 238, 0.18), rgba(3, 28, 45, 0.24)),
        linear-gradient(180deg, #104c70, #071b29);
    color: #eff8ff;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#itemDetailModal .item-detail-action.is-enhance {
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
    background: linear-gradient(180deg, #f1c15b, #a66220);
    color: #241205;
}

#itemDetailModal .item-detail-action:disabled,
#itemDetailModal .item-detail-action.is-disabled {
    opacity: 0.62;
    filter: grayscale(0.35);
}

#itemDetailModal .item-detail-close {
    grid-column: 1 / -1;
}

.equipment-enhancement-modal {
    position: fixed;
    inset: auto;
    top: var(--equipment-enhancement-viewport-top, 0px);
    left: var(--equipment-enhancement-viewport-left, 0px);
    z-index: 10100;
    width: var(--equipment-enhancement-viewport-width, 100vw);
    height: var(--equipment-enhancement-viewport-height, 100dvh);
    box-sizing: border-box;
    display: grid;
    place-items: center;
    padding: max(12px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: hidden;
    overscroll-behavior: contain;
    background: rgba(0, 0, 0, 0.84);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.equipment-enhancement-modal[hidden] {
    display: none;
}

.equipment-enhancement-sheet {
    width: min(540px, calc(var(--equipment-enhancement-viewport-width, 100vw) - 16px));
    max-height: min(calc(var(--equipment-enhancement-viewport-height, 100dvh) - 24px), 720px);
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
    gap: 9px;
    padding: 9px 12px 12px;
    overflow: hidden;
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 16px / 0 stretch;
    background: linear-gradient(180deg, rgba(10, 12, 16, 0.98), rgba(2, 3, 5, 0.99));
    color: #f4e4bd;
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.64);
}

.equipment-enhancement-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 4px 8px;
    border: 12px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/banners/banner-plaque-gold.png") 28 36 32 fill / 12px 16px / 0 stretch;
    background: rgba(24, 15, 7, 0.42);
}

.equipment-enhancement-head h3,
.equipment-enhancement-materials h4 {
    margin: 0;
    color: #fff0b8;
    font-size: 19px;
    font-weight: 900;
    line-height: 1.1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
}

.equipment-enhancement-materials h4 {
    padding: 0 2px;
    font-size: 13px;
}

.equipment-enhancement-base,
.equipment-enhancement-result,
.equipment-enhancement-material {
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background: rgba(2, 4, 7, 0.76);
}

.equipment-enhancement-base {
    min-height: 68px;
    padding: 5px 8px;
}

.equipment-enhancement-base-name {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.equipment-enhancement-base-name > div:last-child,
.equipment-enhancement-material-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.equipment-enhancement-base-name strong,
.equipment-enhancement-material-copy strong {
    min-width: 0;
    color: #fff0b8;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.equipment-enhancement-base-name span,
.equipment-enhancement-material-copy span {
    color: #cbb185;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.equipment-enhancement-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 7px solid transparent;
    border-radius: 6px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 7px / 0 stretch;
    background: rgba(2, 5, 9, 0.76);
}

.equipment-enhancement-icon > div {
    image-rendering: pixelated;
}

.equipment-enhancement-result {
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    color: #d8c69d;
    font-size: 12px;
    font-weight: 900;
}

.equipment-enhancement-result strong {
    color: #ffe18a;
    font-size: 20px;
}

.equipment-enhancement-arrow {
    color: #8ea6b8;
    font-size: 16px;
}

.equipment-enhancement-gain {
    min-width: 72px;
    color: #cdeeff;
    text-align: right;
}

.equipment-enhancement-materials {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
    overflow: hidden;
}

.equipment-enhancement-material-list {
    min-height: 0;
    display: grid;
    gap: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.equipment-enhancement-material {
    min-height: 66px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 94px;
    align-items: center;
    gap: 8px;
    padding: 5px 7px;
}

.equipment-enhancement-stepper {
    width: 94px;
    display: grid;
    grid-template-columns: 30px 30px 30px;
    align-items: center;
    justify-content: end;
    gap: 2px;
}

.equipment-enhancement-stepper button,
.equipment-enhancement-stepper output {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(235, 213, 157, 0.34);
    border-radius: 4px;
    background: rgba(9, 11, 15, 0.94);
    color: #f8edcb;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
}

.equipment-enhancement-stepper output {
    color: #ffe18a;
    font-size: 12px;
}

.equipment-enhancement-stepper button:disabled,
.equipment-enhancement-apply:disabled {
    opacity: 0.48;
    filter: grayscale(0.4);
}

.equipment-enhancement-empty {
    margin: 0;
    padding: 14px 10px;
    color: #cbb185;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.equipment-enhancement-error {
    min-height: 18px;
    color: #ffaaa2;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.35;
}

.equipment-enhancement-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.equipment-enhancement-actions button {
    min-height: 42px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 10px / 0 stretch;
    background: linear-gradient(180deg, rgba(32, 35, 41, 0.9), rgba(7, 8, 10, 0.98));
    color: #ead7b0;
    font-size: 13px;
    font-weight: 900;
}

.equipment-enhancement-actions .equipment-enhancement-apply {
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
    background: linear-gradient(180deg, #e6b44b, #9a591d);
    color: #241205;
}

.equipment-enhancement-close:not(:disabled):is(:hover, :focus-visible),
.equipment-enhancement-stepper button:not(:disabled):is(:hover, :focus-visible),
.equipment-enhancement-actions button:not(:disabled):is(:hover, :focus-visible) {
    outline: 2px solid rgba(255, 225, 134, 0.92);
    outline-offset: 2px;
}

@media (max-width: 420px) {
    #itemDetailModal {
        padding-inline: 6px;
    }

    #itemDetailModal .item-detail-sheet {
        width: calc(var(--item-detail-viewport-width, 100vw) - 12px);
        max-height: calc(var(--item-detail-viewport-height, 100dvh) - 12px);
        padding: 8px 9px 10px;
    }

    #itemDetailModal .item-detail-head {
        grid-template-columns: 82px minmax(0, 1fr);
        gap: 8px;
    }

    #itemDetailModal[data-detail-kind="tarot"] .item-detail-head {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    #itemDetailModal .item-detail-icon-frame {
        width: 78px;
        min-height: 86px;
    }

    #itemDetailModal[data-detail-kind="tarot"] .item-detail-icon-frame {
        width: 76px;
        min-height: 112px;
    }

    #itemDetailModal #itemDetailName {
        font-size: 17px;
    }

    #itemDetailModal .item-detail-copy {
        padding: 8px 10px;
    }

    #itemDetailModal .item-detail-stat-row {
        grid-template-columns: minmax(76px, 0.34fr) minmax(0, 1fr);
        gap: 6px;
        padding-inline: 8px;
    }

    #itemDetailModal #itemDetailButtons:not(:has(.item-detail-action.is-move)) {
        grid-template-columns: minmax(0, 1fr);
    }

    .equipment-enhancement-modal {
        padding-inline: 6px;
    }

    .equipment-enhancement-sheet {
        width: calc(var(--equipment-enhancement-viewport-width, 100vw) - 12px);
        max-height: calc(var(--equipment-enhancement-viewport-height, 100dvh) - 12px);
        padding: 8px 9px 10px;
    }

    .equipment-enhancement-material {
        grid-template-columns: 44px minmax(0, 1fr) 88px;
        gap: 6px;
        padding-inline: 5px;
    }

    .equipment-enhancement-icon {
        width: 44px;
        height: 44px;
    }

    .equipment-enhancement-stepper {
        width: 88px;
        grid-template-columns: 28px 28px 28px;
    }

    .equipment-enhancement-stepper button,
    .equipment-enhancement-stepper output {
        width: 28px;
        height: 30px;
    }
}

#playerProfileModal .item-detail-copy {
    grid-area: copy;
    min-height: 242px;
    align-self: stretch;
    justify-content: center;
    padding: 9px 10px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(9, 22, 35, 0.58), rgba(0, 0, 0, 0.42)),
        radial-gradient(ellipse at 50% 0%, rgba(125, 211, 252, 0.08), transparent 60%);
}

#playerProfileModal #playerProfileName {
    color: #ffedb7;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.18;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.82);
}

#playerProfileModal #playerProfileNation {
    color: #d8ecff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.64);
}

#playerProfileModal #playerProfileNation,
#playerProfileModal #playerProfileMeta {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#playerProfileModal #playerProfileMeta {
    color: rgba(232, 241, 255, 0.78);
}

#playerProfileModal .player-profile-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    margin-top: 6px;
}

#playerProfileModal .player-profile-stat {
    min-width: 0;
    min-height: 32px;
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 3px 2px;
    border: 1px solid rgba(158, 197, 224, 0.22);
    border-radius: 7px;
    background:
        linear-gradient(180deg, rgba(8, 28, 43, 0.72), rgba(2, 6, 12, 0.82)),
        radial-gradient(ellipse at 50% 0%, rgba(125, 211, 252, 0.12), transparent 58%);
}

#playerProfileModal .player-profile-stat span {
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

#playerProfileModal .player-profile-stat strong {
    color: #fff2c6;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

#playerProfileModal .player-profile-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

#playerProfileModal .player-profile-action-btn[hidden] {
    display: none;
}

#playerProfileModal .player-profile-action-btn,
#playerProfileModal .player-profile-transfer-submit,
#playerProfileModal .item-detail-close {
    flex: 1 1 118px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 11px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.28), rgba(109, 58, 11, 0.2)),
        linear-gradient(180deg, #e7b64b, #9c5c1e);
    color: #241205;
    text-shadow: 0 1px 0 rgba(255, 236, 177, 0.48);
    box-shadow: none;
}

#playerProfileModal .player-profile-action-btn-icon {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    font-size: 18px;
    line-height: 1;
}

#playerProfileModal .player-profile-action-btn-heart {
    font-size: 23px;
    font-family: Georgia, "Times New Roman", serif;
}

#playerProfileModal .player-profile-action-btn-heart.is-active {
    color: #ffe4ec;
    text-shadow:
        0 2px 0 rgba(0, 0, 0, 0.72),
        0 0 12px rgba(255, 112, 156, 0.52);
}

#playerProfileModal #btnPlayerProfileCopyId {
    flex: 0 1 98px;
}

#playerProfileModal #btnPlayerProfileBeauty {
    flex: 1 1 132px;
}

#playerProfileModal .player-profile-action-btn.player-profile-action-btn-secondary,
#playerProfileModal .player-profile-transfer-cancel,
#playerProfileModal .player-profile-transfer-quick-btn,
#playerProfileModal .item-detail-close {
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 11px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(70, 181, 238, 0.18), rgba(3, 28, 45, 0.24)),
        linear-gradient(180deg, #104c70, #071b29);
    color: #eff8ff;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#playerProfileModal .player-profile-action-btn.is-active {
    filter: brightness(1.08) saturate(1.08);
    box-shadow: 0 0 0 1px rgba(255, 232, 166, 0.18);
}

#playerProfileModal .player-profile-transfer-panel,
#playerProfileModal .player-profile-equip-row,
#playerProfileModal .player-profile-empty {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 13px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 13px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(12, 15, 20, 0.74), rgba(3, 4, 6, 0.88)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
}

#playerProfileModal .player-profile-transfer-panel[hidden] {
    display: none;
}

#playerProfileModal .player-profile-stat-allocation {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 12px;
    padding: 11px 12px;
    border: 13px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 13px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(14, 22, 31, 0.8), rgba(3, 7, 12, 0.9)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
}

#playerProfileModal .player-profile-stat-allocation[hidden] {
    display: none;
}

#playerProfileModal .player-profile-destiny {
    width: 100%;
    min-width: 0;
    margin-bottom: 12px;
    padding: 12px 4px;
    border-top: 1px solid rgba(255, 226, 139, 0.38);
    border-bottom: 1px solid rgba(125, 211, 252, 0.24);
    background: linear-gradient(90deg, transparent, rgba(116, 65, 145, 0.16), transparent);
}

#playerProfileModal .player-profile-destiny[hidden] {
    display: none;
}

#playerProfileModal .player-profile-destiny > span {
    display: inline-block;
    margin-bottom: 3px;
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
}

#playerProfileModal .player-profile-personality-features {
    margin: 8px 0 10px;
    padding: 7px 0;
    border-top: 1px solid rgba(125, 211, 252, 0.18);
    border-bottom: 1px solid rgba(255, 226, 139, 0.2);
}

#playerProfileModal .player-profile-personality-features > span {
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
}

#playerProfileModal .player-profile-personality-features > p {
    margin: 5px 0 0;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

#playerProfileModal .player-profile-destiny-core {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 226, 139, 0.2);
}

#playerProfileModal .player-profile-destiny-animal {
    display: grid;
    grid-template-columns: 72px auto minmax(0, 1fr);
    gap: 3px 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 226, 139, 0.2);
}

#playerProfileModal .player-profile-destiny-animal > img {
    grid-row: 1 / span 2;
    width: 72px;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid rgba(255, 226, 139, 0.34);
    border-radius: 6px;
    background: #080d12;
}

#playerProfileModal .player-profile-destiny-animal > span,
#playerProfileModal .player-profile-destiny-core > span,
#playerProfileModal .player-profile-arcana-day > span,
#playerProfileModal .player-profile-compatibility-summary > span {
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
}

#playerProfileModal .player-profile-destiny-animal > strong {
    align-self: center;
    color: #ffe8a8;
    font-size: 15px;
}

#playerProfileModal .player-profile-destiny-core > p,
#playerProfileModal .player-profile-compatibility-summary > p {
    margin: 4px 0 0;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.65;
}

#playerProfileModal .player-profile-arcana-day {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 4px 10px;
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 226, 139, 0.24);
    border-radius: 6px;
    background: rgba(4, 10, 15, 0.54);
}

#playerProfileModal .player-profile-arcana-day > strong {
    color: #ffe8a8;
    font-size: 13px;
    text-align: right;
}

#playerProfileModal .player-profile-arcana-day > p {
    grid-column: 1 / -1;
    margin: 2px 0 0;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.65;
}

#playerProfileModal .player-profile-destiny-detail[hidden],
#playerProfileModal .player-profile-destiny-actions[hidden] {
    display: none;
}

#playerProfileModal .player-profile-destiny-detail {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(125, 211, 252, 0.22);
}

#playerProfileModal .player-profile-destiny-detail dl {
    margin: 0;
}

#playerProfileModal .player-profile-destiny-detail dl > div {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 226, 139, 0.14);
}

#playerProfileModal .player-profile-destiny-detail dt {
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
}

#playerProfileModal .player-profile-destiny-detail dd,
#playerProfileModal .player-profile-destiny-disclaimer {
    margin: 4px 0 0;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.65;
}

#playerProfileModal .player-profile-destiny-disclaimer {
    color: #91a4b2;
    font-size: 10px;
}

#playerProfileModal .player-profile-destiny-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

#playerProfileModal .player-profile-destiny-actions > button {
    min-height: 34px;
    padding: 7px 10px;
    color: #f5e8c0;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    border: 1px solid rgba(255, 226, 139, 0.35);
    border-radius: 6px;
    background: rgba(13, 31, 42, 0.8);
    cursor: pointer;
}

#playerProfileModal .player-profile-compatibility-summary {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(125, 211, 252, 0.22);
}

#playerProfileModal .player-profile-compatibility-summary[hidden] {
    display: none;
}

#playerProfileModal .player-profile-compatibility-summary > strong {
    display: block;
    margin-top: 2px;
    color: #ffe8a8;
    font-size: 19px;
}

#playerProfileModal .player-profile-compatibility-summary > button {
    margin-top: 8px;
    padding: 7px 10px;
    color: #f5e8c0;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    border: 1px solid rgba(255, 226, 139, 0.35);
    border-radius: 6px;
    background: rgba(13, 31, 42, 0.8);
    cursor: pointer;
}

#playerCompatibilityModal .player-compatibility-sheet {
    width: min(94vw, 620px);
    max-height: min(88vh, 760px);
    overflow-y: auto;
}

#playerCompatibilityModal .player-compatibility-sheet > h3 {
    margin: 4px 0 14px;
    color: #fff2c6;
    letter-spacing: 0;
}

#playerCompatibilityModal .player-compatibility-target {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
}

#playerCompatibilityModal .player-compatibility-target[hidden],
#playerCompatibilityModal #playerCompatibilityResult[hidden] {
    display: none;
}

#playerCompatibilityModal .player-compatibility-target > span,
#playerCompatibilityModal .player-compatibility-overall > span {
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
}

#playerCompatibilityModal .player-compatibility-target > select {
    width: 100%;
    min-height: 38px;
    color: #f5e8c0;
    border: 1px solid rgba(255, 226, 139, 0.3);
    border-radius: 6px;
    background: #101820;
}

#playerCompatibilityModal .player-compatibility-status {
    min-height: 22px;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.55;
}

#playerCompatibilityModal .player-compatibility-overall {
    padding: 14px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 226, 139, 0.26);
    border-bottom: 1px solid rgba(255, 226, 139, 0.26);
}

#playerCompatibilityModal .player-compatibility-overall > strong {
    display: block;
    margin-top: 2px;
    color: #ffe8a8;
    font-size: 36px;
}

#playerCompatibilityModal .player-compatibility-overall > p {
    margin: 4px auto 0;
    max-width: 480px;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.6;
}

#playerCompatibilityModal .player-compatibility-scores {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

#playerCompatibilityModal .player-compatibility-score {
    min-width: 0;
    padding: 9px 10px;
    border-bottom: 1px solid rgba(125, 211, 252, 0.22);
}

#playerCompatibilityModal .player-compatibility-score > span {
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
}

#playerCompatibilityModal .player-compatibility-score > strong {
    float: right;
    color: #ffe8a8;
    font-size: 15px;
}

#playerCompatibilityModal .player-compatibility-score > p {
    clear: both;
    margin: 5px 0 0;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.5;
}

#playerCompatibilityModal .player-compatibility-reading {
    margin: 14px 0 0;
}

#playerCompatibilityModal .player-compatibility-reading > div {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 226, 139, 0.18);
}

#playerCompatibilityModal .player-compatibility-reading dt {
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 900;
}

#playerCompatibilityModal .player-compatibility-reading dd {
    margin: 4px 0 0;
    color: #dbe9f3;
    font-size: 12px;
    line-height: 1.65;
}

#playerProfileModal .player-profile-stat-alloc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
    color: #fff2c6;
    font-size: 13px;
    font-weight: 900;
}

#playerProfileModal .player-profile-stat-alloc-head b {
    color: #ffe48c;
    font-size: 18px;
    line-height: 1;
}

#playerProfileModal .player-profile-stat-alloc-sub {
    margin-bottom: 9px;
    color: #a9d7f4;
    font-size: 10px;
    font-weight: 800;
}

#playerProfileModal .player-profile-stat-alloc-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
}

#playerProfileModal .player-profile-stat-alloc-row {
    min-width: 0;
    min-height: 38px;
    display: grid;
    grid-template-columns: 24px minmax(38px, 1fr) 36px 64px;
    align-items: center;
    gap: 4px;
    padding: 4px 5px;
    border: 1px solid rgba(158, 197, 224, 0.2);
    border-radius: 7px;
    background: rgba(2, 8, 14, 0.44);
}

#playerProfileModal .player-profile-stat-alloc-label {
    color: #a9d7f4;
    font-size: 11px;
    font-weight: 900;
}

#playerProfileModal .player-profile-stat-alloc-value {
    color: #fff2c6;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
}

#playerProfileModal .player-profile-stat-alloc-pending {
    min-width: 0;
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 900;
    text-align: right;
}

#playerProfileModal .player-profile-stat-alloc-controls {
    display: grid;
    grid-template-columns: repeat(2, 27px);
    gap: 4px;
}

#playerProfileModal .player-profile-stat-alloc-controls button {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    border-image: url("./assets/ui/buttons/button-blue-large.png") 24 fill / 9px / 0 stretch;
    background: linear-gradient(180deg, #104c70, #071b29);
    color: #eff8ff;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

#playerProfileModal .player-profile-stat-alloc-controls button:disabled {
    opacity: 0.45;
}

#playerProfileModal .player-profile-stat-alloc-save {
    width: 100%;
    min-height: 40px;
    margin-top: 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 11px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.28), rgba(109, 58, 11, 0.2)),
        linear-gradient(180deg, #e7b64b, #9c5c1e);
    color: #241205;
    font-size: 13px;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255, 236, 177, 0.48);
}

#playerProfileModal .player-profile-stat-alloc-save:disabled {
    opacity: 0.5;
}

#playerProfileModal .player-profile-transfer-quick-row,
#playerProfileModal .player-profile-transfer-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

#playerProfileModal .player-profile-transfer-quick-btn,
#playerProfileModal .player-profile-transfer-submit {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

#playerProfileModal .player-profile-transfer-title,
#playerProfileModal .player-profile-equip-row strong {
    color: #fff1c2;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
    overflow-wrap: anywhere;
}

#playerProfileModal .player-profile-transfer-input-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border: 11px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 11px / 0 stretch;
    background: rgba(5, 10, 16, 0.74);
}

#playerProfileModal .player-profile-transfer-input-row input {
    width: 100%;
    min-width: 0;
    color: #fff4cf;
}

#playerProfileModal .player-profile-transfer-input-row span,
#playerProfileModal .player-profile-equip-row span {
    color: #a9c7dc;
}

@media (max-width: 640px) {
    #playerProfileModal {
        padding: 8px;
        align-items: flex-end;
    }

    #playerProfileModal .player-profile-sheet {
        width: 100%;
        max-height: calc(100dvh - 14px);
        padding: 14px 14px calc(16px + var(--safe-bottom));
    }

    #playerProfileModal .player-profile-head {
        grid-template-columns: minmax(0, 1fr) 144px;
        grid-template-areas:
            "copy avatar"
            "copy ship";
        justify-items: stretch;
        text-align: left;
        gap: 8px;
        padding: 8px;
        border-width: 10px;
        border-image-width: 10px;
    }

    #playerProfileModal .player-profile-avatar-shell {
        width: 144px;
        min-width: 144px;
        max-width: 144px;
        height: 162px;
        border-width: 9px;
        border-image-width: 9px;
        align-self: stretch;
        justify-self: center;
    }

    #playerProfileModal #playerProfileAvatar.player-profile-avatar {
        transform: translateY(9px) scale(1.12);
    }

    #playerProfileModal .player-profile-avatar-shell.has-pet-companion #playerProfileAvatar.player-profile-avatar {
        transform: translate(-4px, 9px) scale(1.12);
    }

    #playerProfileModal .player-profile-pet-companion {
        --pixel-monster-context-scale: 1.12;
        right: -4px;
        bottom: 27px;
        width: 82px;
        height: 100px;
    }

    #playerProfileModal .player-profile-pet-name {
        right: -4px;
        bottom: 3px;
        width: 112px;
    }

    #playerProfileModal .player-profile-pet-rename {
        right: -4px;
        width: 140px;
    }

    #playerProfileModal .player-profile-ship {
        width: 144px;
        justify-self: center;
        min-height: 72px;
        grid-template-columns: 56px minmax(0, 1fr);
        column-gap: 4px;
        justify-items: start;
        align-items: center;
        text-align: left;
        padding: 6px 7px;
        border-width: 9px;
        border-image-width: 9px;
    }

    #playerProfileModal .player-profile-ship-icon {
        grid-row: 1 / 3;
        width: 56px;
        height: 56px;
        background-position: var(--player-ship-sprite-x, -56px) -56px;
        background-size: 1792px 896px;
    }

    #playerProfileModal .player-profile-ship-icon.is-boat { --player-ship-sprite-x: -56px; }
    #playerProfileModal .player-profile-ship-icon.is-explorer { --player-ship-sprite-x: -392px; }
    #playerProfileModal .player-profile-ship-icon.is-defender { --player-ship-sprite-x: -728px; }
    #playerProfileModal .player-profile-ship-icon.is-fighter { --player-ship-sprite-x: -1064px; }
    #playerProfileModal .player-profile-ship-icon.is-merchant { --player-ship-sprite-x: -1400px; }
    #playerProfileModal .player-profile-ship-icon.is-guild {
        --guild-hull-frame-x: -56px;
        --guild-sail-frame-x: -56px;
        --guild-top-y: -56px;
    }

    #playerProfileModal .player-profile-ship-icon.is-guild .home-guild-ship-layer {
        background-size: 1176px 672px;
    }

    #playerProfileModal .player-profile-ship-icon.is-guild .home-guild-ship-layer.is-sail-middle {
        background-position: var(--guild-sail-frame-x, -56px) calc(var(--guild-top-y, -56px) - 224px);
    }

    #playerProfileModal .player-profile-ship-icon.is-guild .home-guild-ship-layer.is-sail-bottom {
        background-position: var(--guild-sail-frame-x, -56px) calc(var(--guild-top-y, -56px) - 448px);
    }

    #playerProfileModal .item-detail-copy {
        width: 100%;
        min-height: 0;
        padding-inline: 9px;
        border-width: 9px;
        border-image-width: 9px;
    }

    #playerProfileModal #playerProfileName {
        font-size: 16px;
    }

    #playerProfileModal #playerProfileNation,
    #playerProfileModal #playerProfileMeta {
        font-size: 11px;
    }

    #playerProfileModal .player-profile-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 3px;
    }

    #playerProfileModal .player-profile-stat {
        min-height: 29px;
    }

    #playerProfileModal .player-profile-stat strong {
        font-size: 13px;
    }
}

.rpg-message-popup {
    position: fixed;
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    bottom: calc(var(--rpg-message-bottom, 78px) + env(safe-area-inset-bottom));
    z-index: 10020;
    width: min(460px, calc(100vw - 28px));
    margin-inline: auto;
    padding: 16px 20px;
    border: 14px solid transparent;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.45;
    letter-spacing: 0;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: min(260px, calc(100dvh - 118px));
    overflow-y: auto;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
    animation: rpgMessagePopupIn 140ms ease-out;
    pointer-events: none;
}

.rpg-message-popup.is-normal {
    border-image: url("./assets/ui/panels/speech-parchment.png") 28 fill / 14px / 0 stretch;
    color: #241207;
    text-shadow: 0 1px 0 rgba(255, 246, 210, 0.55);
}

.rpg-message-popup.is-error {
    border-image: url("./assets/ui/panels/speech-dark.png") 28 fill / 14px / 0 stretch;
    color: #fff;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65);
}

@keyframes rpgMessagePopupIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#btnViewGuildMembers {
    --command-icon: var(--icon-action-crew);
}

#btnViewGuildApplications {
    --command-icon: var(--icon-action-mail);
}

#tabContentCompanions .companion-card[data-companion-type="darts"] {
    --companion-card-icon: var(--icon-dart);
}

#tabContentCompanions .companion-card[data-companion-type="karaoke"] {
    --companion-card-icon: var(--icon-microphone);
}

#tabContentCompanions .companion-card[data-companion-type="billiards"] {
    --companion-card-icon: var(--icon-companion-eightball);
}

#tabContentCompanions .companion-card[data-companion-type="poker"] {
    --companion-card-icon: var(--icon-companion-dice);
}

#tabContentCompanions [data-crew-icon="billiards"] {
    --crew-role-icon-image: var(--icon-companion-eightball);
}

#tabContentCompanions [data-crew-icon="darts"] {
    --crew-role-icon-image: var(--icon-dart);
}

#tabContentCompanions [data-crew-icon="drink"] {
    --crew-role-icon-image: var(--icon-companion-drink);
}

#tabContentCompanions [data-crew-icon="fish"] {
    --crew-role-icon-image: var(--icon-companion-fish);
}

#tabContentCompanions [data-crew-icon="game"] {
    --crew-role-icon-image: var(--icon-companion-game);
}

#tabContentCompanions [data-crew-icon="karaoke"] {
    --crew-role-icon-image: var(--icon-microphone);
}

#tabContentCompanions [data-crew-icon="poker"] {
    --crew-role-icon-image: var(--icon-companion-poker-chip);
}

#tabContentCompanions .crew-role-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
    gap: 8px;
    margin: 10px 0 12px;
}

#tabContentCompanions .crew-role-card {
    --crew-rank-accent: #a7b0bd;
    --crew-rank-glow: rgba(167, 176, 189, 0.18);
    position: relative;
    min-height: 62px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border: 1px solid rgba(220, 169, 82, 0.24);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(13, 19, 27, 0.86), rgba(5, 7, 10, 0.94));
    color: #f7e8c1;
    text-align: left;
    box-shadow: inset 0 0 0 1px var(--crew-rank-glow);
}

#tabContentCompanions .crew-role-card.is-selected {
    border-color: var(--crew-rank-accent);
    box-shadow:
        inset 0 0 0 1px rgba(255, 239, 192, 0.12),
        0 0 0 2px var(--crew-rank-glow);
}

#tabContentCompanions .crew-role-card.is-disabled {
    opacity: 0.48;
}

#tabContentCompanions .crew-role-card::after,
#tabContentCompanions .crew-member-card::after {
    content: "";
    position: absolute;
    top: 7px;
    bottom: 7px;
    right: 7px;
    width: 3px;
    border-radius: 999px;
    background: var(--crew-rank-accent, rgba(220, 169, 82, 0.4));
    opacity: 0.72;
}

#tabContentCompanions .crew-role-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}

#tabContentCompanions .crew-role-copy strong,
#tabContentCompanions .crew-role-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tabContentCompanions .crew-role-copy strong {
    color: #ffe2a0;
    font-size: 13px;
    line-height: 1.15;
}

#tabContentCompanions .crew-role-copy span {
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.05;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

#tabContentCompanions .crew-role-icon {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 229, 149, 0.38);
    background:
        radial-gradient(circle at 50% 36%, rgba(255, 238, 182, 0.18), rgba(0, 0, 0, 0.2) 64%),
        var(--crew-role-icon-image, var(--icon-action-crew)) center / 72% 72% no-repeat;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.36),
        0 0 12px var(--crew-rank-glow, rgba(220, 169, 82, 0.12));
}

#tabContentCompanions [data-crew-icon="fish"] .crew-role-icon {
    background:
        radial-gradient(circle at 50% 36%, rgba(255, 238, 182, 0.18), rgba(0, 0, 0, 0.2) 64%),
        var(--icon-companion-fish) center / 76% 76% no-repeat,
        linear-gradient(180deg, rgba(11, 17, 25, 0.88), rgba(3, 5, 8, 0.96));
}

#tabContentCompanions [data-crew-icon="fish"] .crew-role-icon::before,
#tabContentCompanions [data-crew-icon="fish"] .crew-role-icon::after {
    content: none;
}

#tabContentCompanions .crew-member-card {
    --crew-rank-accent: #a7b0bd;
    --crew-rank-glow: rgba(167, 176, 189, 0.18);
    position: relative;
    box-shadow:
        inset 0 0 0 1px var(--crew-rank-glow),
        0 6px 18px rgba(0, 0, 0, 0.16);
}

#tabContentCompanions .crew-member-card .companion-card-head {
    align-items: center;
}

#tabContentCompanions .crew-rank-1 {
    --crew-rank-accent: #9ca3af;
    --crew-rank-glow: rgba(156, 163, 175, 0.18);
}

#tabContentCompanions .crew-rank-2 {
    --crew-rank-accent: #7dd3fc;
    --crew-rank-glow: rgba(125, 211, 252, 0.22);
}

#tabContentCompanions .crew-rank-3 {
    --crew-rank-accent: #f2d394;
    --crew-rank-glow: rgba(242, 211, 148, 0.24);
}

#tabContentCompanions .crew-rank-4 {
    --crew-rank-accent: #fb923c;
    --crew-rank-glow: rgba(251, 146, 60, 0.28);
}

#tabContentCompanions .crew-rank-5 {
    --crew-rank-accent: #d8b4fe;
    --crew-rank-glow: rgba(216, 180, 254, 0.34);
}

#tabContentCompanions .crew-invite-panel,
#tabContentCompanions .crew-join-panel,
#tabContentCompanions .crew-application-role-row,
#tabContentCompanions .guild-companion-redirect {
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 12px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%),
        linear-gradient(180deg, rgba(8, 12, 18, 0.88), rgba(2, 5, 9, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.08);
}

#tabContentCompanions [hidden],
#tabContentQr [hidden] {
    display: none !important;
}

#tabContentCompanions .crew-invite-title {
    min-height: 36px;
    margin: -2px 0 10px;
    padding: 8px 12px;
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/banners/banner-plaque-blue.png") 28 36 32 fill / 10px 14px / 0 stretch;
    color: #fff1c2;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72);
}

#tabContentCompanions .crew-invite-value,
#tabContentCompanions .crew-invite-panel select,
#tabContentCompanions .crew-warehouse-actions input,
#tabContentCompanions .crew-warehouse-actions select,
#tabContentCompanions .crew-recruitment-role-select,
#tabContentCompanions .crew-application-role-row select {
    border: 10px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(21, 27, 37, 0.82), rgba(4, 7, 11, 0.94)),
        radial-gradient(ellipse at 50% 0%, rgba(125, 211, 252, 0.08), transparent 60%);
    color: #f7e8c1;
    box-shadow: inset 0 1px 0 rgba(255, 239, 192, 0.06);
}

#tabContentCompanions .crew-invite-value {
    min-height: 42px;
    display: grid;
    place-items: center;
    font-weight: 800;
}

#tabContentCompanions .crew-invite-panel label {
    color: #f2d394;
    text-shadow: 0 1px 0 #000;
}

#tabContentCompanions .crew-recruitment-role-select {
    min-width: 0;
}

#tabContentCompanions .crew-application-role-row {
    padding: 10px;
}

#tabContentCompanions .crew-application-role-row label {
    color: #f2d394;
    text-shadow: 0 1px 0 #000;
}

#tabContentCompanions .companion-card-actions .crew-recruitment-role-select {
    flex: 1 1 100%;
}

#tabContentCompanions #crewRecruitmentManagePanel textarea {
    min-height: 84px;
}

#tabContentCompanions .crew-quick-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin: 12px 0;
    padding: 12px;
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-wide.png") 26 fill / 12px / 0 stretch;
    background: linear-gradient(180deg, rgba(12, 18, 27, 0.92), rgba(5, 8, 13, 0.98));
}

#tabContentCompanions .crew-quick-title {
    color: #fff1c2;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.25;
}

#tabContentCompanions .crew-quick-meta {
    margin-top: 3px;
    color: #d0b98c;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
}

#tabContentCompanions .crew-quick-actions,
#tabContentCompanions .crew-section-tabs,
#tabContentCompanions .crew-board-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#tabContentCompanions .crew-quick-action,
#tabContentCompanions .crew-section-tab,
#tabContentCompanions .crew-board-filter,
#tabContentCompanions .crew-slot-invite {
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid rgba(220, 169, 82, 0.32);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(29, 38, 52, 0.92), rgba(7, 11, 18, 0.96));
    color: #f7e8c1;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

#tabContentCompanions .crew-quick-action.is-primary,
#tabContentCompanions .crew-section-tab.is-active,
#tabContentCompanions .crew-board-filter.is-active,
#tabContentCompanions .crew-slot-invite {
    border-color: rgba(242, 211, 148, 0.75);
    color: #fff1c2;
    box-shadow: 0 0 0 2px rgba(242, 211, 148, 0.12);
}

#tabContentCompanions .crew-section-tabs {
    margin: 12px 0;
}

#tabContentCompanions .crew-section-tab {
    position: relative;
    flex: 1 1 120px;
}

#tabContentCompanions .crew-tab-badge {
    position: absolute;
    top: -7px;
    right: 8px;
    min-width: 19px;
    height: 19px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #b91c1c;
    color: #fff7ed;
    font-size: 10px;
    line-height: 1;
}

#tabContentCompanions [data-companion-section].is-section-hidden {
    display: none !important;
}

#tabContentCompanions .crew-role-slot-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

#tabContentCompanions .crew-role-slot {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 68px;
    padding: 9px;
    border: 1px solid rgba(220, 169, 82, 0.22);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(13, 19, 27, 0.86), rgba(5, 7, 10, 0.94));
}

#tabContentCompanions .crew-role-slot.is-filled {
    border-color: rgba(125, 211, 252, 0.36);
}

#tabContentCompanions .crew-role-slot.is-open {
    border-color: rgba(74, 222, 128, 0.42);
}

#tabContentCompanions .crew-role-slot-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

#tabContentCompanions .crew-role-slot-copy strong {
    color: #ffe2a0;
    font-size: 13px;
}

#tabContentCompanions .crew-role-slot-copy span,
#tabContentCompanions .crew-role-slot-copy em {
    color: #cbd5e1;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    line-height: 1.25;
}

#tabContentCompanions .crew-member-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: end;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(220, 169, 82, 0.18);
}

#tabContentCompanions .crew-member-tools label {
    color: #f2d394;
    font-size: 12px;
    font-weight: 900;
}

#tabContentCompanions .crew-member-tools select {
    width: 100%;
    margin-top: 4px;
}

#tabContentCompanions .crew-history-panel {
    margin-top: 12px;
}

#tabContentCompanions .crew-history-list {
    display: grid;
    gap: 7px;
}

#tabContentCompanions .crew-history-entry {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(220, 169, 82, 0.18);
    border-radius: 8px;
    background: rgba(4, 7, 11, 0.64);
    color: #f7e8c1;
    font-size: 12px;
    font-weight: 800;
}

#tabContentCompanions .crew-history-entry time {
    flex: 0 0 auto;
    color: #d0b98c;
}

@media (max-width: 640px) {
    #tabContentCompanions .crew-quick-panel,
    #tabContentCompanions .crew-member-tools {
        grid-template-columns: 1fr;
    }

    #tabContentCompanions .crew-quick-actions {
        width: 100%;
    }

    #tabContentCompanions .crew-quick-action {
        flex: 1 1 120px;
    }

    #tabContentCompanions .crew-history-entry {
        display: grid;
    }
}

#tabContentQr .guild-companion-redirect {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(13, 19, 27, 0.84), rgba(5, 7, 10, 0.94));
}

#tabContentQr .guild-companion-redirect p {
    margin: 0;
    color: #d0b98c;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.55;
}

#btnOpenCompanionsFromQr {
    --button-icon: var(--icon-nav-companions);
    width: 100%;
}

/* --- Inventory tarot deck: fixed 5-card equal-scale loadout --- */
#tabContentInventory .inventory-section[hidden] {
    display: none !important;
}

#tabContentInventory .tarot-deck-panel {
    display: grid;
    gap: 6px;
    border: 8px solid transparent;
    border-radius: 8px;
    border-image: url("./assets/ui/panels/panel-sheet-frame.png") 28 34 fill / 8px / 0 stretch;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%),
        linear-gradient(180deg, rgba(6, 10, 15, 0.82), rgba(2, 3, 5, 0.94));
}


#tabContentInventory[data-inventory-panel="tarot"] .inventory-section.active[data-panel="tarot"] > .section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    margin-bottom: 5px;
    padding: 2px 4px;
    border-width: 6px;
    border-image-width: 6px 12px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-inventory-heading {
    min-width: 0;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-toolbar-button,
#tabContentInventory[data-inventory-panel="tarot"] .tarot-loadout-catalog-button {
    min-width: 72px;
    min-height: 34px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-inventory-heading p {
    margin: 4px 0 0;
    color: #cfbc94;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 66px;
    align-items: start;
    gap: 6px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 6px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-presets[hidden],
#tabContentInventory .tarot-loadout-effect-list[hidden] {
    display: none;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset {
    min-width: 0;
    min-height: 86px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 3px;
    padding: 7px 6px;
    border: 1px solid rgba(218, 191, 126, 0.28);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(17, 20, 24, 0.88), rgba(3, 5, 8, 0.9));
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset.is-empty {
    border-style: dashed;
    opacity: 0.82;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset.is-current {
    border-color: rgba(255, 226, 151, 0.7);
    background: linear-gradient(180deg, rgba(92, 63, 16, 0.78), rgba(15, 12, 8, 0.9));
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset-label {
    min-width: 0;
    color: #ffe4a3;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset-summary {
    min-width: 0;
    align-self: center;
    color: #d6c69f;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.25;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset.is-current .tarot-deck-preset-summary {
    color: #fff1bc;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset-action {
    min-width: 0;
    min-height: 29px;
    padding: 3px 4px;
    border: 1px solid rgba(222, 195, 137, 0.32);
    border-radius: 4px;
    color: #f6e6bd;
    background: rgba(3, 6, 10, 0.82);
    font: inherit;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.86);
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset-action.is-apply {
    border-color: rgba(106, 177, 219, 0.66);
    color: #d8f0ff;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset-action.is-save {
    border-color: rgba(227, 192, 111, 0.58);
    color: #ffe9ae;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-preset-action:disabled {
    opacity: 0.52;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-presets.is-busy {
    pointer-events: none;
    opacity: 0.78;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-panel {
    border-width: 8px;
    border-image-width: 8px;
    min-width: 0;
    gap: 4px;
    padding: 4px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-deck-panel.is-details-expanded {
    grid-column: 1 / -1;
}

#tabContentInventory[data-inventory-panel="tarot"] #guardianArcanaPanel {
    position: relative;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-loadout-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 0;
    margin: 0 0 4px;
    padding: 0 1px 4px;
    border: 0;
    border-bottom: 1px solid rgba(224, 192, 119, 0.2);
    border-image: none;
    border-radius: 0;
    background: none;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-loadout-header h3 {
    margin: 0;
    font-size: 13px;
    line-height: 1.1;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-loadout-header p {
    margin: 3px 0 0;
    color: #b9a77e;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.3;
}

#tabContentInventory[data-inventory-panel="tarot"] #guardianArcanaPanel:not(.is-details-expanded) .tarot-loadout-header {
    position: static;
    min-height: 26px;
    padding: 0;
}

#tabContentInventory[data-inventory-panel="tarot"] #guardianArcanaPanel:not(.is-details-expanded) .tarot-loadout-header h3 {
    display: none;
}

#tabContentInventory[data-inventory-panel="tarot"] #guardianArcanaPanel:not(.is-details-expanded) .tarot-panel-disclosure {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 6;
    min-width: 30px;
    min-height: 24px;
    padding: 2px 3px;
    font-size: 8px;
}

#tabContentInventory[data-inventory-panel="tarot"] .tarot-loadout-role {
    display: none;
}

#tabContentInventory .tarot-loadout-suit,
#tabContentInventory .tarot-loadout-number,
#tabContentInventory .tarot-loadout-title,
#tabContentInventory .tarot-loadout-detail {
    display: none !important;
}

#tabContentInventory .tarot-loadout-role {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 8px 10px;
    overflow: hidden;
}

#tabContentInventory .tarot-loadout-role-label,
#tabContentInventory .tarot-loadout-role-main,
#tabContentInventory .tarot-loadout-role-bonus {
    min-width: 0;
    margin: 0;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.82);
}

#tabContentInventory .tarot-loadout-role-main {
    flex: 0 1 auto;
    font-size: 13px;
}

#tabContentInventory .tarot-loadout-role-bonus {
    flex: 1 1 auto;
    font-size: 10px;
}

#tabContentInventory .tarot-loadout-role-hint {
    display: none !important;
}

#tabContentInventory .tarot-loadout-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, 48px);
    grid-auto-rows: 80px;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 100%;
    overflow: visible;
}

#tabContentInventory .tarot-loadout-grid.is-guardian {
    grid-template-columns: 48px;
}

#tabContentInventory .tarot-loadout-effect-list {
    display: grid;
    margin-top: 7px;
}

#tabContentInventory .tarot-panel-disclosure {
    min-width: 34px;
    min-height: 28px;
    padding: 3px 5px;
    border: 1px solid rgba(222, 195, 137, 0.34);
    border-radius: 4px;
    color: #f4dfae;
    background: rgba(4, 8, 13, 0.78);
    font-size: 10px;
    font-weight: 900;
}

#tabContentInventory .tarot-panel-disclosure[aria-expanded="true"] {
    border-color: rgba(255, 226, 151, 0.72);
    color: #fff2c5;
    background: rgba(106, 72, 20, 0.72);
}

#tabContentInventory .tarot-loadout-effect-empty {
    margin: 0;
    padding: 10px 11px;
    border: 1px dashed rgba(213, 187, 126, 0.26);
    border-radius: 6px;
    color: #aa9874;
    background: rgba(2, 5, 9, 0.42);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
}

#tabContentInventory .tarot-loadout-effect-row {
    --tarot-effect-accent: #d7c38f;
    --tarot-effect-glow: rgba(215, 195, 143, 0.34);
    position: relative;
    width: 100%;
    min-height: 106px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 9px 30px 8px;
    border: 1px solid rgba(221, 198, 142, 0.2);
    border-radius: 6px;
    color: #f8edcf;
    background:
        radial-gradient(ellipse at 12% 50%, var(--tarot-effect-glow), transparent 34%),
        linear-gradient(90deg, rgba(23, 21, 20, 0.84), rgba(5, 8, 12, 0.8));
    text-align: center;
}

#tabContentInventory .tarot-loadout-effect-collapse {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(222, 195, 137, 0.34);
    border-radius: 50%;
    color: transparent;
    background: rgba(1, 3, 6, 0.86);
}

#tabContentInventory .tarot-loadout-effect-collapse::before,
#tabContentInventory .tarot-loadout-effect-collapse::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 5px;
    width: 12px;
    height: 2px;
    border-radius: 1px;
    background: #f4dfae;
    transform: rotate(45deg);
}

#tabContentInventory .tarot-loadout-effect-collapse::after {
    transform: rotate(-45deg);
}

#tabContentInventory .tarot-loadout-effect-row[data-suit="cup"] {
    --tarot-effect-accent: #3f89cf;
    --tarot-effect-glow: rgba(63, 137, 207, 0.28);
}

#tabContentInventory .tarot-loadout-effect-row[data-suit="wand"] {
    --tarot-effect-accent: #d34a40;
    --tarot-effect-glow: rgba(211, 74, 64, 0.26);
}

#tabContentInventory .tarot-loadout-effect-row[data-suit="sword"] {
    --tarot-effect-accent: #9b72e6;
    --tarot-effect-glow: rgba(155, 114, 230, 0.28);
}

#tabContentInventory .tarot-loadout-effect-row[data-suit="pentacle"] {
    --tarot-effect-accent: #3aa66d;
    --tarot-effect-glow: rgba(58, 166, 109, 0.26);
}

#tabContentInventory .tarot-loadout-effect-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    align-self: stretch;
    padding-block: 1px;
}

#tabContentInventory .tarot-loadout-effect-kicker {
    color: var(--tarot-effect-accent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

#tabContentInventory .tarot-loadout-effect-name {
    min-width: 0;
    color: #ffe8aa;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tabContentInventory .tarot-loadout-effect-meta {
    color: #baa878;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.1;
}

#tabContentInventory .tarot-loadout-effect-text {
    max-width: 100%;
    color: #ddd3bd;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

#tabContentInventory .tarot-loadout-effect-r {
    max-width: 100%;
    color: #a99c83;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

#tabContentInventory .tarot-loadout-effect-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

#tabContentInventory .tarot-loadout-effect-action {
    min-height: 44px;
    padding: 5px 7px;
    border: 1px solid rgba(213, 190, 137, 0.28);
    border-radius: 6px;
    color: #eee0bd;
    background: rgba(4, 8, 13, 0.76);
    font-size: 12px;
    font-weight: 900;
    text-shadow: 0 1px 0 #000;
}

#tabContentInventory .tarot-loadout-effect-action.is-detail {
    border-color: color-mix(in srgb, var(--tarot-effect-accent) 72%, transparent);
    color: #fff3cf;
    background: color-mix(in srgb, var(--tarot-effect-accent) 20%, rgba(4, 8, 13, 0.88));
}

#tabContentInventory .tarot-loadout-effect-action.is-remove {
    color: #c8b99a;
}

#tabContentInventory .tarot-loadout-effect-action:disabled {
    opacity: 0.34;
}

#tabContentInventory .tarot-loadout-effect-action:not(:disabled):is(:active, :focus-visible) {
    outline: 2px solid color-mix(in srgb, var(--tarot-effect-accent) 72%, white);
    outline-offset: 1px;
}

#tabContentInventory .tarot-guardian-loadout {
    display: grid;
    grid-template-columns: 48px;
    align-items: center;
    gap: 10px;
}

#tabContentInventory #guardianArcanaPanel.is-details-expanded .tarot-guardian-loadout {
    grid-template-columns: 48px minmax(0, 1fr);
}

#tabContentInventory .tarot-loadout-effect-list.is-guardian {
    min-width: 0;
    margin: 0;
}

#tabContentInventory .tarot-inherited-ability {
    display: grid;
    gap: 6px;
    margin-top: 9px;
    padding: 9px;
    border: 1px solid rgba(188, 158, 230, 0.38);
    border-radius: 6px;
    color: #f4ecff;
    background: linear-gradient(135deg, rgba(58, 37, 78, 0.78), rgba(8, 10, 18, 0.88));
}

#tabContentInventory .tarot-inherited-ability-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

#tabContentInventory .tarot-inherited-ability-heading strong {
    color: #e2c9ff;
    font-size: 12px;
    letter-spacing: 0.05em;
}

#tabContentInventory .tarot-inherited-ability-heading small {
    color: #cfc3dc;
    font-size: 9px;
}

#tabContentInventory .tarot-inherited-ability select {
    box-sizing: border-box;
    width: 100%;
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid rgba(226, 201, 255, 0.5);
    border-radius: 5px;
    color: #fff;
    background: #171020;
    font: inherit;
}

#tabContentInventory .tarot-inherited-ability p {
    margin: 0;
    color: #cfc3dc;
    font-size: 10px;
    line-height: 1.45;
}

#tabContentInventory .tarot-guardian-effect-summary {
    --guardian-accent: #e7e4db;
    --guardian-glow: rgba(231, 228, 219, 0.24);
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border: 1px solid rgba(230, 225, 211, 0.3);
    border-radius: 6px;
    color: #f5eee0;
    background:
        radial-gradient(ellipse at 12% 50%, var(--guardian-glow), transparent 34%),
        linear-gradient(90deg, rgba(33, 31, 37, 0.84), rgba(5, 8, 13, 0.78));
    text-align: center;
}

#tabContentInventory .tarot-guardian-effect-summary[data-attribute="light"] {
    --guardian-accent: #fff0aa;
    --guardian-glow: rgba(255, 240, 170, 0.24);
}

#tabContentInventory .tarot-guardian-effect-summary[data-attribute="dark"] {
    --guardian-accent: #a88ddd;
    --guardian-glow: rgba(168, 141, 221, 0.26);
}

#tabContentInventory .tarot-guardian-effect-summary .tarot-loadout-effect-card {
    --tarot-effect-accent: var(--guardian-accent);
    --tarot-effect-glow: var(--guardian-glow);
    position: relative;
    width: 48px;
    height: 80px;
    display: block;
    box-sizing: border-box;
    border: 1px solid var(--tarot-effect-accent);
    border-radius: 3px;
    background: #120f0c;
    box-shadow:
        inset 0 0 0 1px rgba(255, 248, 219, 0.12),
        0 3px 5px rgba(0, 0, 0, 0.78),
        0 0 4px var(--tarot-effect-glow);
    overflow: hidden;
}

#tabContentInventory .tarot-guardian-effect-summary .tarot-loadout-effect-card .tarot-number-badge {
    right: 0;
    top: 0;
    min-width: 18px;
    height: 18px;
    padding-inline: 3px;
    font-size: 11px;
}

#tabContentInventory .tarot-guardian-effect-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding-block: 2px;
}

#tabContentInventory .tarot-guardian-effect-kicker {
    color: var(--guardian-accent);
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
}

#tabContentInventory .tarot-guardian-effect-name {
    color: #fff0ba;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tabContentInventory .tarot-guardian-effect-meta {
    color: var(--guardian-accent);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

#tabContentInventory .tarot-guardian-effect-line {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
    gap: 5px;
    width: 100%;
    color: #ddd4c5;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
}

#tabContentInventory .tarot-guardian-effect-line b {
    padding: 2px 3px;
    border-radius: 3px;
    color: #191207;
    background: var(--guardian-accent);
    font-size: 9px;
    line-height: 1;
    text-align: center;
}

#tabContentInventory .tarot-guardian-effect-summary .tarot-loadout-effect-chevron {
    width: 48px;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--guardian-accent);
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
}

#tabContentInventory .tarot-loadout-grid::before {
    content: attr(data-deck-count) "/5";
    position: absolute;
    right: 0;
    top: -30px;
    min-width: 42px;
    min-height: 22px;
    padding: 3px 8px;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 226, 151, 0.34);
    border-radius: 999px;
    background: rgba(5, 7, 10, 0.82);
    color: #f4dfae;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.86);
}

#tabContentInventory .tarot-loadout-grid.is-guardian::before {
    content: attr(data-deck-count) "/1";
}

#tabContentInventory #guardianArcanaPanel.is-details-expanded .tarot-loadout-grid.is-guardian::before {
    right: 42px;
}

#tabContentInventory .tarot-loadout-grid[data-deck-complete="true"]::before {
    color: #fff7d1;
    background: rgba(92, 63, 16, 0.9);
    border-color: rgba(255, 226, 151, 0.58);
}

#tabContentInventory .tarot-loadout-card {
    position: relative;
    width: 48px;
    height: 80px;
    min-width: 48px;
    min-height: 80px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    display: grid;
    place-items: center;
    overflow: visible;
    appearance: none;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    transition: translate 150ms ease, filter 150ms ease, opacity 150ms ease;
    --tarot-suit-glow: rgba(218, 231, 246, 0.42);
    --tarot-suit-line: #edf3fb;
}

#tabContentInventory .tarot-loadout-card.is-selected {
    z-index: 3;
    translate: 0 -4px;
    filter: brightness(1.12);
}

#tabContentInventory .tarot-loadout-card.is-selected::after {
    content: "";
    position: absolute;
    right: 6px;
    bottom: -7px;
    left: 6px;
    height: 3px;
    border-radius: 999px;
    background: var(--tarot-suit-line);
    box-shadow: 0 0 7px var(--tarot-suit-glow);
}

#tabContentInventory .tarot-loadout-grid.is-replacement-target-picker .tarot-loadout-card.is-replacement-target {
    z-index: 2;
    box-shadow: 0 0 0 1px rgba(255, 235, 166, 0.76), 0 0 8px var(--tarot-suit-glow);
    filter: brightness(1.12);
}

#tabContentInventory .tarot-loadout-grid.is-replacement-target-picker .tarot-loadout-card.is-replacement-target:hover,
#tabContentInventory .tarot-loadout-grid.is-replacement-target-picker .tarot-loadout-card.is-replacement-target:focus-visible {
    translate: 0 -4px;
    filter: brightness(1.22);
}

#tabContentInventory .tarot-loadout-grid.is-busy {
    pointer-events: none;
    opacity: 0.78;
}

#tabContentInventory .tarot-loadout-slot-badge {
    position: absolute;
    z-index: 5;
    right: -3px;
    bottom: -4px;
    min-width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    padding: 0 3px;
    border: 1px solid var(--tarot-suit-line);
    border-radius: 999px;
    color: #fff7df;
    background: rgba(2, 5, 9, 0.94);
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 0 #000;
}

#tabContentInventory .tarot-loadout-card[data-suit="wand"] {
    --tarot-suit-glow: rgba(211, 74, 64, 0.38);
    --tarot-suit-line: #d34a40;
}

#tabContentInventory .tarot-loadout-card[data-suit="pentacle"] {
    --tarot-suit-glow: rgba(58, 166, 109, 0.4);
    --tarot-suit-line: #3aa66d;
}

#tabContentInventory .tarot-loadout-card[data-suit="sword"] {
    --tarot-suit-glow: rgba(155, 114, 230, 0.42);
    --tarot-suit-line: #9b72e6;
}

#tabContentInventory .tarot-loadout-card[data-suit="cup"] {
    --tarot-suit-glow: rgba(63, 137, 207, 0.4);
    --tarot-suit-line: #3f89cf;
}

#tabContentInventory .tarot-loadout-card[data-suit="all"] {
    --tarot-suit-glow: rgba(228, 216, 168, 0.34);
    --tarot-suit-line: rgba(245, 226, 160, 0.66);
}

#tabContentInventory .tarot-loadout-card.is-empty {
    cursor: pointer;
}

#tabContentInventory button.tarot-loadout-card:focus-visible {
    outline: 2px solid rgba(255, 225, 134, 0.92);
    outline-offset: 3px;
}

#tabContentInventory .tarot-loadout-visual {
    position: static;
    width: 48px;
    height: 80px;
    box-sizing: border-box;
    border: 1px solid var(--tarot-suit-line);
    border-radius: 3px;
    background:
        linear-gradient(180deg, rgba(255, 244, 208, 0.08), rgba(0, 0, 0, 0.12)),
        rgba(3, 5, 8, 0.78);
    box-shadow:
        inset 0 0 0 1px rgba(255, 248, 219, 0.12),
        0 5px 10px rgba(0, 0, 0, 0.48),
        0 0 4px var(--tarot-suit-glow);
    overflow: hidden;
}

#tabContentInventory .tarot-loadout-art {
    margin: 0 !important;
}

#tabContentInventory .tarot-loadout-visual .tarot-number-badge {
    left: auto;
    right: 0;
    top: 0;
    bottom: auto;
    min-width: 18px;
    height: 18px;
    padding-inline: 3px;
    font-size: 11px;
}

#tabContentInventory .tarot-loadout-cell-empty {
    width: 48px;
    height: 80px;
    min-height: 0;
    border: 1px dashed rgba(255, 228, 160, 0.26);
    border-radius: 3px;
    background:
        var(--icon-action-plus) center / 18px 18px no-repeat,
        linear-gradient(180deg, rgba(18, 20, 24, 0.42), rgba(3, 4, 6, 0.72)),
        repeating-linear-gradient(135deg, rgba(255, 228, 160, 0.05) 0 6px, transparent 6px 12px);
    opacity: 0.86;
}

#tabContentInventory .tarot-loadout-card.is-empty:is(:hover, :focus-visible) .tarot-loadout-cell-empty {
    border-color: rgba(255, 225, 134, 0.68);
    background-color: rgba(255, 225, 134, 0.08);
    opacity: 1;
}

@media (max-width: 360px) {
    #tabContentInventory .tarot-loadout-grid {
        gap: 4px;
    }
}

/* --- Final sliced panel enforcement --- */

#globalPlayerInfoTop,
.currency-display,
.global-rank-badge,
.equipment-slot-card,
.inventory-item-card,
.item-card,
#tabContentInventory .inventory-mobile-switch,
#tabContentInventory .sort-select,
#tabContentTroy .troy-state-badge,
#tabContentCompanions .companion-host-note,
#tabContentCompanions .companion-status,
#tabContentKing .king-troy-status,
#tabContentTroy .troy-entry-section,
#tabContentTroy .troy-calendar-section,
#tabContentTroy .troy-menu-board-section,
#tabContentCompanions .companion-list-panel,
#tabContentCompanions .companion-create-panel,
#tabContentKing .king-card,
#tabContentKing .king-editor-card,
#tabContentKing .troy-admin-card,
#tabContentKing .troy-admin-details,
#tabContentQr .qr-battle-card,
#tabContentQr .equipment-gacha-card,
#tabContentQr .guild-card,
#tabContentBattle .content-area,
#tabContentTarot .tarot-poker-root,
#tabContentTarot .tarot-kingdom-root,
#tabContentCompanions input,
#tabContentCompanions select,
#tabContentCompanions textarea,
#tabContentTroy input,
#tabContentTroy select,
#tabContentTroy textarea,
#tabContentKing input,
#tabContentKing select,
#tabContentKing textarea {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark.png") 30 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(13, 18, 24, 0.94), rgba(4, 5, 7, 0.98)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
}

.home-hero-card .home-player-ship-frame,
.home-hero-card .home-player-ship-frame.is-exploring {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(13, 18, 24, 0.42), rgba(4, 5, 7, 0.72)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.08), transparent 58%);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.content-area:not(.home-hero-card),
#tabContentTroy .content-area,
#tabContentCompanions .content-area,
#tabContentQr .content-area,
#tabContentBattle .content-area,
#tabContentTarot .content-area,
#tabContentKing .content-area {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 14px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(11, 8, 6, 0.3), rgba(4, 4, 5, 0.62)),
        repeating-linear-gradient(90deg, rgba(101, 58, 25, 0.12) 0 28px, rgba(16, 10, 6, 0.12) 28px 56px);
}

.home-ps-card,
#tabContentCompanions .companion-create-panel,
#tabContentTroy .troy-reservation-panel,
#tabContentKing .king-editor-card {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-parchment.png") 34 fill / 14px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 238, 190, 0.36), rgba(111, 64, 27, 0.12)),
        repeating-linear-gradient(0deg, rgba(88, 47, 20, 0.06) 0 1px, transparent 1px 10px);
}

.home-exp-rank,
#inventoryMobileSwitch,
#inventoryPrimaryTabs,
#tabContentInventory #inventoryTabs,
#rankingToggleButtons,
#tabContentTroy .troy-calendar-item,
#tabContentTroy .troy-menu-board-item,
#tabContentTroy .troy-entry-item,
#tabContentCompanions .companion-card,
#tabContentCompanions .crew-role-card,
#tabContentKing .king-announcement-current,
#tabContentKing .king-menu-specials-list,
#tabContentKing .king-menu-disable-list,
#tabContentTarot .tarot-poker-column,
#tabContentTarot .tarot-kingdom-panel,
#tabContentTarot .tarot-log,
#tabContentQr .guild-entry-grid > *,
#tabContentQr .battle-entry-card,
#tabContentQr .equipment-gacha-entry,
#chatMessages {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-navy-wide.png") 34 fill / 12px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(8, 20, 32, 0.9), rgba(2, 5, 10, 0.96)),
        radial-gradient(ellipse at 50% 0%, rgba(66, 149, 196, 0.1), transparent 58%);
}


#tabContentKing .king-chip-return-panel {
    min-height: 40px;
    padding: 5px 8px;
}

#tabContentKing .king-chip-return-input-row {
    width: 104px;
    min-height: 30px;
    margin: 0;
    padding: 5px 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-image: none;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.82);
}

#tabContentKing .king-chip-return-input-row input {
    min-height: 18px;
    padding: 0 !important;
    border: 0 !important;
    border-image: none !important;
    background: transparent !important;
    font-size: 14px;
    font-weight: 900;
}

#tabContentKing .king-chip-return-input-row span {
    font-size: 11px;
}

#tabContentKing .king-chip-return-btn {
    min-height: 32px;
    padding: 5px 9px;
}

.inventory-mobile-switch-btn:not(.active),
.inventory-primary-tab-btn:not(.active),
#tabContentInventory .inventory-tab-btn:not(.active),
.ranking-toggle-btn:not(.active),
.ranking-refresh-btn,
#tabContentInventory .inventory-primary-tab-btn:not(.active),
#tabContentTroy .troy-entry-btn.alt,
#tabContentCompanions .companion-action-btn:not(.is-join):not(.is-approve),
#tabContentKing .troy-admin-actions .btn-muted,
#tabContentTarot button.btn-muted {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-wood.png") 34 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(49, 27, 13, 0.44), rgba(7, 6, 5, 0.42)),
        repeating-linear-gradient(0deg, rgba(119, 68, 30, 0.14) 0 1px, transparent 1px 12px);
}

#tabContentKing .king-inline-actions .btn-open,
#tabContentKing .troy-admin-actions .btn-open {
    border: 1px solid transparent;
    border-image: url("./assets/ui/buttons/button-gold-large.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(255, 239, 176, 0.42), rgba(109, 58, 11, 0.28)),
        linear-gradient(180deg, #f2c45f, #a86420);
    color: #1d0e04;
    text-shadow:
        0 1px 0 rgba(255, 247, 205, 0.72),
        0 0 2px rgba(255, 247, 205, 0.48);
}

#tabContentKing .king-inline-actions .btn-open:disabled,
#tabContentKing .troy-admin-actions .btn-open:disabled {
    opacity: 1;
    color: #2a1305;
    filter: saturate(0.88) brightness(0.96);
}


.nav-button:not(.active),
.map-chat-tab {
    border: 1px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-square.png") 24 fill / 10px / 0 stretch;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.22), rgba(2, 6, 23, 0.42)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 225, 136, 0.06), transparent 58%);
}
.boot-shop-link {
    position: absolute;
    z-index: 2;
    right: 50%;
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px));
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 9px 14px;
    border: 1px solid rgba(255, 215, 132, 0.62);
    border-radius: 999px;
    color: #fff3ce;
    background: rgba(5, 8, 12, 0.76);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-decoration: none;
    transform: translateX(50%);
    backdrop-filter: blur(8px);
}

.boot-shop-link:hover,
.boot-shop-link:focus-visible {
    border-color: #ffd784;
    color: #ffd784;
}

/* Tarot Kingdom monster battle stage */
#tarotKingdomRoot #tarotKingdomBattleStage[hidden] {
    display: none !important;
}

#tarotKingdomRoot #tarotKingdomBattleStage:not([hidden]) {
    display: block;
}

#tarotKingdomRoot #tarotKingdomBattleStage {
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    width: 100%;
    margin: 8px 0;
    padding: 12px;
    overflow: hidden;
    border: 1px solid rgba(235, 198, 103, 0.52);
    border-radius: 16px;
    color: #f8fafc;
    background:
        radial-gradient(circle at 20% 58%, rgba(202, 67, 51, 0.16), transparent 34%),
        radial-gradient(circle at 82% 40%, rgba(58, 129, 171, 0.16), transparent 38%),
        linear-gradient(180deg, rgba(15, 24, 36, 0.97), rgba(3, 7, 13, 0.98));
    box-shadow:
        inset 0 0 0 2px rgba(255, 239, 180, 0.04),
        inset 0 -28px 52px rgba(0, 0, 0, 0.28),
        0 10px 24px rgba(0, 0, 0, 0.28);
}

#tarotKingdomRoot #tarotKingdomBattleStage::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    opacity: 0.24;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent 49.7%, rgba(255, 255, 255, 0.045) 50%, transparent 50.3%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 7px);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
    display: grid;
    grid-template-columns: minmax(164px, 1fr) minmax(112px, 0.72fr) minmax(190px, 1.05fr);
    gap: 14px;
    align-items: stretch;
    min-height: 268px;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    position: relative;
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.7), rgba(2, 6, 23, 0.42));
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    display: grid;
    grid-template-rows: auto auto minmax(116px, 1fr);
    border-color: rgba(248, 113, 113, 0.25);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    display: flex;
    flex-direction: column;
    border-color: rgba(125, 211, 252, 0.23);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    min-width: 0;
    gap: 8px;
    margin-bottom: 6px;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
    min-width: 0;
    overflow: hidden;
    color: #fff7db;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-overflow: ellipsis;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-eyebrow {
    flex: 0 0 auto;
    color: #fca5a5;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.15em;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-party-side .tarot-kingdom-battle-eyebrow {
    color: #7dd3fc;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-hp {
    min-width: 0;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-hp-label {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
    color: #fecaca;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-hp-track,
#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
    position: relative;
    height: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.78);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-hp-fill,
#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-fill {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #dc2626, #fb7185 68%, #fecdd3);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.48);
    transition: width 360ms cubic-bezier(0.22, 0.8, 0.25, 1), background-color 240ms ease;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-fill {
    background: linear-gradient(90deg, #15803d, #4ade80 68%, #bbf7d0);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.36);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
    position: relative;
    display: grid;
    place-items: end center;
    min-height: 116px;
    overflow: visible;
}

#tarotKingdomRoot #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
    --tarot-kingdom-enemy-scale: 2;
    position: relative;
    z-index: 1;
    width: 81px;
    height: 84px;
    background-repeat: no-repeat;
    background-position: 0 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transform: scale(var(--tarot-kingdom-enemy-scale));
    transform-origin: 50% 100%;
    filter: drop-shadow(0 5px 2px rgba(0, 0, 0, 0.58));
    will-change: transform, filter, opacity;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 10px;
    text-align: center;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-turn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 8px;
    border: 1px solid rgba(250, 204, 21, 0.32);
    border-radius: 999px;
    color: #fde68a;
    background: rgba(63, 44, 6, 0.48);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-feed {
    display: grid;
    align-content: center;
    min-height: 62px;
    max-height: 108px;
    overflow: hidden;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event {
    padding: 7px 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 9px;
    color: #cbd5e1;
    background: rgba(2, 6, 23, 0.68);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
    animation: tarotKingdomBattleEventIn 260ms ease-out both;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event.is-attack {
    border-color: rgba(125, 211, 252, 0.38);
    color: #bae6fd;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event.is-skill {
    border-color: rgba(250, 204, 21, 0.54);
    color: #fef08a;
    background: rgba(113, 63, 18, 0.48);
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.12);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event.is-enemy,
#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event.is-danger,
#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event.is-defeat {
    border-color: rgba(248, 113, 113, 0.42);
    color: #fecaca;
    background: rgba(69, 10, 10, 0.52);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event.is-victory {
    border-color: rgba(74, 222, 128, 0.48);
    color: #bbf7d0;
    background: rgba(20, 83, 45, 0.48);
}

#tarotKingdomRoot #tarotKingdomBattleParty.tarot-kingdom-battle-party {
    display: grid;
    flex: 1 1 auto;
    align-content: center;
    min-height: 0;
    gap: 7px;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    position: relative;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-areas: "avatar info";
    align-items: center;
    min-width: 0;
    min-height: 68px;
    gap: 4px 7px;
    padding: 5px 7px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    border-radius: 10px;
    background: rgba(8, 22, 36, 0.68);
    transition: border-color 180ms ease, background-color 180ms ease, filter 180ms ease, opacity 180ms ease;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
    grid-area: avatar;
    display: grid;
    place-items: center;
    width: 56px;
    height: 60px;
    overflow: visible;
    --avatar-combat-scale: 0.78;
    --avatar-attack-x: -22px;
    --avatar-attack-recoil-x: -14px;
    --avatar-slash-left: -16px;
    --avatar-slash-top: 12px;
    --avatar-foot-shadow-width: 42px;
    --avatar-foot-shadow-height: 8px;
    image-rendering: pixelated;
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.54));
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    grid-area: info;
    display: grid;
    min-width: 0;
    gap: 3px;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-jobs {
    min-width: 0;
    overflow: hidden;
    color: #e9d5ff;
    font-size: 7px;
    font-weight: 850;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 1px 1px 0 #000;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    min-width: 0;
    gap: 5px;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
    min-width: 0;
    overflow: hidden;
    color: #e0f2fe;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.1;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank {
    flex: 0 1 auto;
    overflow: hidden;
    color: #bae6fd;
    font-size: 8px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats {
    overflow: hidden;
    color: #fde68a;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-status {
    color: #94a3b8;
    font-size: 8px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-width: 0;
    gap: 5px;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
    color: #bbf7d0;
    font-size: 8px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn {
    border-color: rgba(250, 204, 21, 0.74);
    background: linear-gradient(90deg, rgba(113, 63, 18, 0.58), rgba(8, 22, 36, 0.72));
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.2), inset 3px 0 0 #facc15;
    animation: tarotKingdomBattleTurnPulse 1.35s ease-in-out infinite;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-status {
    color: #fde68a;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-hit {
    animation: tarotKingdomBattlePlayerHit 360ms ease-out both;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-ko {
    border-color: rgba(148, 163, 184, 0.13);
    opacity: 0.48;
    filter: grayscale(1);
    background: rgba(15, 23, 42, 0.64);
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-ko::after {
    content: "KO";
    position: absolute;
    right: 8px;
    bottom: 5px;
    color: #fecaca;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-shadow: 0 1px 4px #000;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-hurt .tarot-kingdom-battle-enemy-sprite,
#tarotKingdomRoot #tarotKingdomEnemySprite.is-hurt {
    animation: tarotKingdomBattleEnemyHurt 360ms ease-out both;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-time-stopped .tarot-kingdom-battle-enemy-sprite,
#tarotKingdomRoot #tarotKingdomEnemySprite.is-time-stopped {
    animation: none !important;
}

#tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-defeated .tarot-kingdom-battle-enemy-sprite,
#tarotKingdomRoot #tarotKingdomEnemySprite.is-defeated {
    opacity: 0.32;
    filter: grayscale(1) brightness(0.62) drop-shadow(0 5px 2px rgba(0, 0, 0, 0.58));
    transform: translateY(11px) rotate(-7deg) scale(var(--tarot-kingdom-enemy-scale));
    transition: opacity 480ms ease, filter 480ms ease, transform 480ms ease;
}

#tarotKingdomRoot #tarotKingdomBattleStage.is-victory {
    border-color: rgba(74, 222, 128, 0.62);
    box-shadow: inset 0 0 42px rgba(34, 197, 94, 0.12), 0 0 24px rgba(34, 197, 94, 0.14);
}

#tarotKingdomRoot #tarotKingdomBattleStage.is-defeat {
    border-color: rgba(248, 113, 113, 0.56);
    box-shadow: inset 0 0 48px rgba(127, 29, 29, 0.2), 0 0 24px rgba(127, 29, 29, 0.16);
}

#tarotKingdomRoot #tarotKingdomBattleStage.is-defeat .tarot-kingdom-battle-party {
    filter: grayscale(0.85) brightness(0.68);
}

#tarotKingdomRoot #tarotKingdomBattleStage.is-retreat .tarot-kingdom-battle-player.is-retreating {
    z-index: 12;
    opacity: 1;
    filter: none;
}

#tarotKingdomRoot #tarotKingdomBattleStage.is-retreat .tarot-kingdom-battle-player.is-retreating .tarot-kingdom-battle-player-avatar {
    animation: tarotKingdomPlayerRetreat 1600ms linear both;
}

#tarotKingdomRoot #tarotKingdomBattleStage.is-retreat .tarot-kingdom-battle-player.is-retreating .tarot-kingdom-battle-player-info {
    animation: tarotKingdomRetreatInfoFade 520ms ease-out both;
}

@keyframes tarotKingdomPlayerRetreat {
    0% {
        opacity: 1;
        transform: translateX(0) scaleX(-1);
    }
    14% {
        opacity: 1;
        transform: translateX(0) scaleX(-1);
    }
    82% {
        opacity: 1;
        transform: translateX(108px) scaleX(-1);
    }
    100% {
        opacity: 0;
        transform: translateX(148px) scaleX(-1);
    }
}

@keyframes tarotKingdomRetreatInfoFade {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes tarotKingdomBattleEventIn {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tarotKingdomBattleTurnPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(250, 204, 21, 0.13), inset 3px 0 0 #facc15; }
    50% { box-shadow: 0 0 20px rgba(250, 204, 21, 0.3), inset 3px 0 0 #fde047; }
}

@keyframes tarotKingdomBattleEnemyHurt {
    0%, 100% { transform: translateX(0) scale(var(--tarot-kingdom-enemy-scale)); filter: drop-shadow(0 5px 2px rgba(0, 0, 0, 0.58)); }
    22% { transform: translateX(-10px) scale(var(--tarot-kingdom-enemy-scale)); filter: brightness(2.4) sepia(1) saturate(4) hue-rotate(315deg); }
    48% { transform: translateX(7px) scale(var(--tarot-kingdom-enemy-scale)); }
    70% { transform: translateX(-4px) scale(var(--tarot-kingdom-enemy-scale)); }
}

@media (prefers-reduced-motion: reduce) {
    #tarotKingdomRoot #tarotKingdomBattleStage.is-retreat .tarot-kingdom-battle-player.is-retreating .tarot-kingdom-battle-player-avatar {
        animation: tarotKingdomPlayerRetreatReduced 1600ms ease-out both;
    }
}

@keyframes tarotKingdomPlayerRetreatReduced {
    0%, 70% {
        opacity: 1;
        transform: scaleX(-1);
    }
    100% {
        opacity: 0;
        transform: scaleX(-1);
    }
}

@keyframes tarotKingdomBattlePlayerHit {
    0%, 100% { transform: translateX(0); filter: none; }
    24% { transform: translateX(9px); filter: brightness(1.8) sepia(0.8) saturate(2.5); }
    48% { transform: translateX(-6px); }
    70% { transform: translateX(3px); }
}

@media (max-width: 720px) {
    #tarotKingdomRoot #tarotKingdomBattleStage,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage {
        margin: 5px 0;
        padding: 8px;
        border-radius: 12px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        grid-template-columns: minmax(100px, 0.85fr) minmax(72px, 0.62fr) minmax(126px, 1.12fr);
        min-height: 208px;
        gap: 6px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-party-side,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
        padding: 6px;
        border-radius: 9px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading {
        display: block;
        margin-bottom: 4px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
        display: block;
        font-size: 10px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-eyebrow,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-eyebrow {
        display: block;
        margin-bottom: 2px;
        font-size: 7px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-hp-label,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-hp-label {
        font-size: 8px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
        min-height: 92px;
    }

    #tarotKingdomRoot #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
        --tarot-kingdom-enemy-scale: 1.42;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-center,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-center {
        gap: 5px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-turn,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-turn {
        display: grid;
        gap: 1px;
        padding: 4px 3px;
        font-size: 8px;
        line-height: 1.15;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-feed,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-feed {
        min-height: 48px;
        max-height: 82px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-event {
        padding: 5px 3px;
        border-radius: 7px;
        font-size: 8px;
        line-height: 1.25;
    }

    #tarotKingdomRoot #tarotKingdomBattleParty.tarot-kingdom-battle-party,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleParty.tarot-kingdom-battle-party {
        gap: 4px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: 34px minmax(0, 1fr);
        grid-template-areas: "avatar info";
        min-height: 46px;
        gap: 2px 4px;
        padding: 3px 4px;
        border-radius: 7px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        width: 32px;
        height: 38px;
        --avatar-combat-scale: 0.54;
        --avatar-attack-x: -14px;
        --avatar-attack-recoil-x: -9px;
        --avatar-foot-shadow-width: 30px;
        --avatar-foot-shadow-height: 6px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-name,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
        font-size: 9px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats {
        font-size: 8px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats {
        overflow: visible;
        line-height: 1.15;
        text-overflow: clip;
        white-space: normal;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-status,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-status {
        display: none;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp {
        gap: 3px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
        height: 5px;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
        font-size: 8px;
    }
}

@media (max-width: 430px) {
    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        grid-template-columns: minmax(84px, 0.8fr) minmax(58px, 0.54fr) minmax(108px, 1.18fr);
        min-height: 190px;
        gap: 4px;
    }

    #tarotKingdomRoot #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
        --tarot-kingdom-enemy-scale: 1.18;
    }

    #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text,
    #tabContentTarot #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
        display: inline;
        font-size: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #tarotKingdomRoot #tarotKingdomBattleStage *,
    #tarotKingdomRoot #tarotKingdomBattleStage *::before,
    #tarotKingdomRoot #tarotKingdomBattleStage *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}

/* Keep the JRPG composition authoritative inside the production Tarot tab. */
#tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg {
    box-sizing: border-box;
    width: 100%;
    max-width: 1120px;
    margin-inline: auto;
    padding: 10px 10px calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 102px);
    overflow-x: hidden;
    overflow-y: visible;
    color: #f8fbff;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(180deg, rgba(7, 20, 65, 0.98), rgba(1, 4, 20, 0.99));
    background-size: 4px 4px, 4px 4px, auto;
    border: 2px solid #c7d5ff;
    border-radius: 4px;
    box-shadow:
        inset 0 0 0 2px #263d91,
        inset 0 0 36px rgba(1, 4, 20, 0.72),
        0 10px 30px rgba(0, 0, 0, 0.48);
}

#tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-layout {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    gap: 7px;
    overflow: visible;
}

#tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel {
    padding: 7px;
    overflow: visible;
    border: 2px solid var(--tk-window-line);
    border-radius: 3px;
    background-color: var(--tk-window-blue);
    background-image:
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 32%),
        linear-gradient(180deg, var(--tk-window-mid), var(--tk-window-deep));
    box-shadow:
        inset 0 0 0 2px var(--tk-window-inner),
        inset 0 0 0 4px #020827,
        3px 4px 0 rgba(0, 0, 0, 0.46);
}

@media (max-width: 720px) {
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg {
        height: auto;
        min-height: 0;
        max-height: none;
        overflow-x: hidden;
        overflow-y: visible;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage {
        margin: 3px 0 5px;
        padding: 5px;
        border-radius: 3px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
        grid-template-areas:
            "enemy party"
            "center center";
        min-height: 244px;
        gap: 4px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
        grid-area: enemy;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
        grid-area: party;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-center {
        grid-area: center;
        grid-template-columns: 76px minmax(0, 1fr);
        gap: 0;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
        padding: 4px;
        border-radius: 2px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading {
        display: flex;
        margin-bottom: 3px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
        display: block;
        font-size: 10px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-eyebrow {
        display: none;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
        --tarot-kingdom-enemy-scale: 1.38;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: 35px minmax(0, 1fr);
        min-height: 49px;
        gap: 2px 3px;
        padding: 2px 3px 2px 2px;
        border-radius: 1px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        width: 34px;
        height: 42px;
        --avatar-combat-scale: 0.55;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
        font-size: 11px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
        display: inline;
        overflow: hidden;
        font-size: 10px;
        line-height: 1.05;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomBattleStage .tarot-kingdom-battle-player-status {
        display: none;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg #tarotKingdomHand.tarot-kingdom-hand {
        justify-content: center;
        gap: 0;
        padding-top: 18px;
        padding-bottom: 2px;
        overflow-x: hidden;
        overflow-y: visible;
        flex-wrap: nowrap;
    }
}

@media (max-width: 430px) {
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg {
        width: 100%;
        margin: 0;
        padding: 6px 6px calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 94px);
        border-width: 0;
        border-radius: 0;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel--hand {
        padding-right: 1px;
        padding-left: 1px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel--hand .tarot-kingdom-panel-title,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-jrpg .tarot-kingdom-panel--hand .tarot-kingdom-selected-effect {
        margin-right: 4px;
        margin-left: 4px;
    }
}

/* Tarot Kingdom — moonlit reference battle layout */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui {
    --tk-ref-gold: #e8bd52;
    --tk-ref-gold-bright: #ffe99a;
    --tk-ref-ink: #080713;
    --tk-ref-panel: rgba(12, 9, 20, 0.94);
    max-width: 980px;
    padding: 7px 7px calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 94px);
    overflow-x: hidden;
    color: #f8f4e8;
    border: 1px solid rgba(232, 189, 82, 0.48);
    border-radius: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(180deg, #080713, #020208);
    background-size: 5px 5px, 5px 5px, auto;
    box-shadow: inset 0 0 42px #000, 0 12px 30px rgba(0, 0, 0, 0.58);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-header {
    min-height: 27px;
    margin: 0;
    padding: 1px 5px;
    border: 0;
    background: linear-gradient(90deg, rgba(4, 18, 20, 0.94), rgba(4, 18, 20, 0.52) 52%, transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-title-wrap {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-header-meta {
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active #tarotKingdomRound.tarot-kingdom-chip {
    min-height: 24px;
    padding: 0 10px;
    border: 0;
    border-bottom: 1px solid rgba(232, 189, 82, 0.46);
    border-radius: 0;
    color: #fff0a5;
    background: transparent;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 13px;
    font-style: italic;
    letter-spacing: 0.04em;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active #tarotKingdomStateText.tarot-state-text {
    min-height: 27px;
    max-height: 34px;
    margin: 0 0 3px;
    padding: 4px 10px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid rgba(232, 189, 82, 0.35);
    border-radius: 0;
    color: #fff;
    background-color: rgba(3, 17, 21, 0.9);
    background-image: linear-gradient(90deg, rgba(4, 29, 31, 0.96), rgba(4, 29, 31, 0.34) 72%, transparent);
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage {
    position: relative;
    width: 100%;
    margin: 0 0 6px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #6f603d;
    border-radius: 0;
    color: #fff;
    background-color: #050512;
    background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.2));
    box-shadow:
        inset 0 0 0 1px rgba(255, 233, 154, 0.16),
        inset 0 -42px 54px rgba(0, 0, 0, 0.34),
        0 5px 14px rgba(0, 0, 0, 0.6);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage::before {
    content: "";
    position: absolute;
    z-index: 3;
    inset: 0;
    opacity: 1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 22%),
        linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent 22%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
    position: relative;
    display: block;
    width: 100%;
    min-height: 450px;
    overflow: hidden;
    isolation: isolate;
    background-color: #080717;
    background-image:
        linear-gradient(180deg, rgba(2, 3, 12, 0.02) 38%, rgba(1, 2, 8, 0.26) 72%, rgba(0, 0, 0, 0.6)),
        url("./assets/tarot-kingdom/moonlit-ruins-v1.webp");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    image-rendering: pixelated;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    position: absolute;
    z-index: 5;
    top: 0;
    bottom: 55px;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    left: 0;
    width: 50%;
    padding: 13px 10px 5px;
    background-color: transparent;
    background-image: linear-gradient(110deg, rgba(2, 8, 18, 0.8), rgba(2, 8, 18, 0.12) 62%, transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    right: 0;
    width: 48%;
    padding: 58px 7px 8px;
    background-color: transparent;
    background-image: linear-gradient(250deg, rgba(2, 8, 18, 0.48), rgba(2, 8, 18, 0.04) 65%, transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 7px;
    margin: 0 0 5px;
    padding: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading::before {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-eyebrow {
    display: inline;
    color: #ff4a40;
    font-size: 0;
    font-style: italic;
    text-shadow: 1px 1px 0 #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy .tarot-kingdom-battle-eyebrow::after {
    content: none;
    font-size: inherit;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    text-shadow: 1px 1px 2px #000, 0 0 8px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side > .tarot-kingdom-battle-side-heading {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-hp-label {
    margin-bottom: 3px;
    color: #fff4e5;
    font-size: 10px;
    text-shadow: 1px 1px 2px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-hp-track {
    height: 11px;
    border: 2px solid #d8c99e;
    border-radius: 3px;
    background: #0a0710;
    box-shadow: inset 0 0 0 1px #000, 0 1px 3px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-hp-fill {
    border-radius: 0;
    background: linear-gradient(90deg, #f11914, #ff5a18 70%, #ffad35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 0 8px rgba(255, 58, 20, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
    position: absolute;
    right: 1%;
    bottom: 10px;
    left: 0;
    min-height: 250px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
    --tarot-kingdom-enemy-scale: 3.4;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82)) drop-shadow(0 0 7px rgba(149, 73, 222, 0.48));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty.tarot-kingdom-battle-party {
    display: grid;
    align-content: center;
    height: 100%;
    gap: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    grid-template-columns: 46px minmax(0, 1fr);
    min-height: 58px;
    gap: 2px 5px;
    padding: 3px 5px 3px 2px;
    overflow: visible;
    border: 1px solid rgba(205, 216, 244, 0.2);
    border-radius: 2px;
    background-color: rgba(4, 8, 21, 0.26);
    background-image: linear-gradient(90deg, rgba(8, 19, 46, 0.2), rgba(3, 5, 15, 0.44));
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(1px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn {
    border-color: #f5ca54;
    background-image: linear-gradient(90deg, rgba(89, 65, 10, 0.72), rgba(5, 9, 23, 0.72));
    box-shadow: inset 3px 0 0 #ffe36a, 0 0 10px rgba(255, 215, 72, 0.34);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
    width: 44px;
    height: 50px;
    --avatar-combat-scale: 0.8;
    image-rendering: pixelated;
    filter: drop-shadow(0 3px 2px #000);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    gap: 2px;
    text-shadow: 1px 1px 1px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
    color: #fff;
    font-size: 11px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
    display: inline;
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats {
    color: #ffe978;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
    height: 6px;
    border: 1px solid #d9e6dc;
    border-radius: 1px;
    background: #03050d;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    position: absolute;
    z-index: 8;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    min-height: 55px;
    border: 0;
    border-top: 1px solid rgba(232, 189, 82, 0.62);
    border-radius: 0;
    background-color: rgba(5, 4, 11, 0.9);
    background-image: linear-gradient(90deg, rgba(25, 18, 8, 0.95), rgba(6, 5, 13, 0.88));
    box-shadow: inset 0 1px 0 rgba(255, 238, 172, 0.16);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-turn {
    min-width: 0;
    padding: 7px 8px;
    border: 0;
    border-right: 1px solid rgba(232, 189, 82, 0.38);
    color: #f5d371;
    background: transparent;
    font-size: 9px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-feed {
    min-height: 52px;
    max-height: 54px;
    padding: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-event {
    min-height: 28px;
    padding: 6px 8px;
    border: 1px solid rgba(232, 189, 82, 0.42);
    border-radius: 1px;
    color: #fff4d0;
    background-color: #110e12;
    background-image: linear-gradient(90deg, rgba(31, 23, 14, 0.96), rgba(9, 8, 14, 0.92));
    font-size: 10px;
    text-shadow: 1px 1px 1px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-battle-menu {
    position: absolute;
    z-index: 20;
    top: 9px;
    right: 9px;
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 3px solid #f8df88;
    border-radius: 50%;
    color: #fff0a4;
    background: radial-gradient(circle at 35% 30%, #2aa67b, #08604f 62%, #04362f);
    font-size: 27px;
    line-height: 1;
    text-shadow: 1px 2px 0 #04362f;
    box-shadow: inset 0 0 0 2px #0a382d, 0 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.6);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-battle-menu-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-layout {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-panel--hand {
    order: 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-panel--trick {
    order: 2;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active:not(.has-settlement-action) .tarot-kingdom-panel--players,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active #tarotKingdomLog {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--hand {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 6px;
    overflow: visible;
    border: 1px solid rgba(232, 189, 82, 0.55);
    border-radius: 0;
    background-color: rgba(5, 4, 10, 0.97);
    background-image:
        linear-gradient(180deg, rgba(27, 20, 12, 0.62), rgba(4, 4, 9, 0.96)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 5px);
    box-shadow: inset 0 0 0 1px rgba(255, 231, 148, 0.12), 0 4px 12px rgba(0, 0, 0, 0.62);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--hand .tarot-kingdom-panel-heading {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #d9caa1;
    font-size: 9px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--hand .tarot-kingdom-panel-eyebrow {
    color: #e9bd55;
    font-size: 8px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-hand-count {
    position: static;
    min-width: 18px;
    height: 18px;
    margin-left: 2px;
    border: 1px solid #f8df88;
    border-radius: 2px;
    color: #0d0904;
    background: #f0c95c;
    font-size: 9px;
    box-shadow: 1px 1px 0 #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards.tarot-kingdom-selected-cards {
    --selected-card-w: clamp(72px, 11.5vw, 108px);
    order: 1;
    display: grid;
    grid-template-columns: repeat(5, var(--selected-card-w));
    align-items: end;
    justify-content: center;
    width: 100%;
    min-height: calc(var(--selected-card-w) * 1.58 + 6px);
    gap: clamp(4px, 1vw, 9px);
    padding: 4px 2px 2px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-selected-slot {
    box-sizing: border-box;
    width: var(--selected-card-w);
    min-width: var(--selected-card-w);
    height: calc(var(--selected-card-w) * 1.58);
    margin: 0;
    border-radius: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards.is-empty {
    min-height: 0;
    padding-block: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards.is-empty .tarot-kingdom-selected-slot {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards > .tarot-card {
    flex: none;
    border: 2px solid #e9cf84;
    transform: none;
    box-shadow: 0 0 0 1px #503510, 0 5px 9px rgba(0, 0, 0, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-selected-slot {
    display: block;
    border: 1px solid rgba(232, 189, 82, 0.24);
    background:
        linear-gradient(135deg, transparent 47%, rgba(232, 189, 82, 0.11) 48% 52%, transparent 53%),
        rgba(10, 8, 14, 0.5);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.68);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.82);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedEffect.tarot-kingdom-selected-effect {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: min(100%, 660px);
    min-height: 42px;
    margin: 5px auto 2px;
    padding: 7px 26px;
    overflow: hidden;
    border: 2px solid #e6ba4c;
    border-radius: 3px;
    color: #ead89d;
    background-color: #0c0904;
    background-image:
        linear-gradient(90deg, rgba(69, 45, 7, 0.12), rgba(38, 25, 5, 0.58), rgba(69, 45, 7, 0.12));
    font-family: Georgia, "Yu Mincho", serif;
    font-size: clamp(12px, 2vw, 16px);
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 1px 1px 0 #000;
    box-shadow: inset 0 0 0 1px #4b3109, 0 3px 5px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedEffect.has-selection {
    color: #fff0ad;
    box-shadow: inset 0 0 0 1px #6b4812, 0 0 10px rgba(236, 186, 63, 0.2);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand.tarot-kingdom-hand {
    order: 4;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    align-items: end;
    justify-content: center;
    box-sizing: border-box;
    width: min(100%, 640px);
    min-height: 68px;
    margin: 0 auto;
    gap: 4px;
    padding: 13px 1px 2px;
    overflow-x: hidden;
    overflow-y: visible;
    flex-wrap: nowrap;
    perspective: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card + .tarot-card {
    box-sizing: border-box;
    flex: none;
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 0.62;
    margin: 0;
    border: 1px solid #d7bd79;
    border-radius: 3px;
    transform-origin: center bottom;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.62), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.48);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card.is-selected {
    z-index: 10;
    border-color: #fff2a8;
    transform: translateY(-12px);
    box-shadow: 0 0 0 2px #e6b934, 0 0 12px rgba(255, 211, 79, 0.65), 0 4px 5px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card.is-selected::after {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    position: fixed;
    z-index: 4100;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 5px);
    box-sizing: border-box;
    width: min(760px, calc(100vw - 10px));
    max-width: calc(100vw - 10px);
    padding: 20px 6px 6px;
    border: 1px solid #6e5926;
    border-radius: 0;
    background-color: rgba(5, 4, 9, 0.98);
    background-image: linear-gradient(180deg, rgba(36, 27, 11, 0.96), rgba(5, 4, 9, 0.98));
    backdrop-filter: none;
    box-shadow: inset 0 1px 0 rgba(255, 235, 168, 0.18), 0 -3px 12px rgba(0, 0, 0, 0.72);
    transform: translateX(-50%);
}

#tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    bottom: calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 5px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup::before {
    content: "COMMAND";
    top: 4px;
    left: 10px;
    color: #ead073;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 9px;
    letter-spacing: 0.16em;
    transform: none;
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    margin: 0;
    padding: 5px 3px;
    overflow: hidden;
    border: 2px solid #e8c55e;
    border-radius: 4px;
    color: #f8e8ae;
    background-color: #5a3c08;
    background-image: linear-gradient(180deg, #a87514, #5d3908 54%, #352005);
    font-family: Georgia, "Yu Mincho", serif;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 1px 1px 0 #231400;
    box-shadow: inset 0 0 0 1px #3b2406, inset 0 1px 0 #ffe8a1, 0 2px 0 #090600;
    writing-mode: horizontal-tb;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup #tarotKingdomClearButton,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button:last-of-type {
    border-color: #e8cf75;
    background-image: linear-gradient(180deg, #188160, #075241 56%, #04372e);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button:not(:disabled)::before {
    content: "";
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button:disabled {
    opacity: 0.68;
    filter: saturate(0.55) brightness(0.84);
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui {
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        margin: 0;
        padding: 4px 4px calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 88px);
        overflow-x: hidden;
        overflow-y: visible;
        border-width: 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        min-height: clamp(360px, 48svh, 410px);
        background-position: 43% center;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
        width: 46%;
        padding: 11px 6px 4px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
        width: 54%;
        padding: 55px 4px 6px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-side-heading strong {
        font-size: 11px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-hp-label {
        font-size: 9px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-hp-track {
        height: 9px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
        bottom: 6px;
        min-height: 204px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomEnemySprite.tarot-kingdom-battle-enemy-sprite {
        --tarot-kingdom-enemy-scale: 2.4;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty.tarot-kingdom-battle-party {
        gap: 4px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: 38px minmax(0, 1fr);
        min-height: 52px;
        gap: 2px 3px;
        padding: 2px 3px 2px 1px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        width: 37px;
        height: 44px;
        --avatar-combat-scale: 0.68;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
        font-size: 10px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
        font-size: 10px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-battle-menu {
        top: 7px;
        right: 7px;
        width: 44px;
        height: 44px;
        font-size: 23px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--hand {
        padding: 4px 3px 5px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards.tarot-kingdom-selected-cards {
        --selected-card-w: clamp(54px, 15vw, 59px);
        min-height: calc(var(--selected-card-w) * 1.58 + 4px);
        gap: 4px;
        padding-top: 2px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards.tarot-kingdom-selected-cards.is-empty {
        min-height: 0;
        padding-block: 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedCards .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.68);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedEffect.tarot-kingdom-selected-effect {
        min-height: 38px;
        margin-top: 3px;
        padding: 6px 15px;
        font-size: 12px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand.tarot-kingdom-hand {
        width: 100%;
        min-height: 58px;
        gap: 2px;
        padding: 12px 0 1px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.34);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
        width: calc(100vw - 6px);
        max-width: calc(100vw - 6px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 3px);
        padding: 18px 3px 4px;
    }

    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
        bottom: calc(var(--nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 3px);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions {
        gap: 3px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button {
        height: 48px;
        min-height: 48px;
        padding-inline: 2px;
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui *,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui *::before,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui *::after {
        scroll-behavior: auto !important;
    }
}

/* Tarot Kingdom — final shared-reference composition override */
body.tarot-kingdom-preview-body {
    margin: 0;
    padding: 0;
    background: #03030a;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0 2px calc(env(safe-area-inset-bottom, 0px) + 2px);
    overflow-x: hidden;
    overflow-y: visible;
    border: 0;
    border-image: none;
    border-radius: 0;
    background: #03030a;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-header {
    position: absolute;
    z-index: 70;
    top: 7px;
    left: 7px;
    display: block;
    box-sizing: border-box;
    width: min(55%, 470px);
    min-height: 48px;
    margin: 0;
    padding: 1px 9px 2px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid rgba(199, 164, 67, 0.62);
    background: linear-gradient(90deg, rgba(1, 17, 24, 0.94), rgba(1, 17, 24, 0.42) 74%, transparent);
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-title-wrap,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-title-copy {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-header-meta {
    display: block;
    width: 100%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active #tarotKingdomRound.tarot-kingdom-chip {
    display: block;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    color: #f1e49d;
    background: none;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(12px, 3.2vw, 18px);
    font-style: italic;
    font-weight: 800;
    line-height: 1.22;
    letter-spacing: 0.05em;
    white-space: pre-line;
    text-shadow: 1px 2px 0 #000;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active #tarotKingdomStateText.tarot-state-text {
    position: absolute;
    z-index: 71;
    top: 55px;
    left: 7px;
    box-sizing: border-box;
    width: min(55%, 470px);
    min-height: 22px;
    max-height: 25px;
    margin: 0;
    padding: 3px 9px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid rgba(199, 164, 67, 0.3);
    border-radius: 0;
    color: #fff;
    background: linear-gradient(90deg, rgba(1, 22, 28, 0.9), rgba(1, 22, 28, 0.24) 76%, transparent);
    font-size: 10px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage {
    width: 100%;
    margin: 0 0 4px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid #635329;
    border-radius: 0;
    box-shadow: inset 0 -28px 38px rgba(0, 0, 0, 0.2);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
    min-height: clamp(470px, 54svh, 570px);
    background-position: 45% center;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    top: 0;
    bottom: 28px;
    overflow: visible;
    border: 0;
    background-color: transparent;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    width: 53%;
    padding: 84px 7px 3px;
    background-image: linear-gradient(105deg, rgba(1, 8, 18, 0.64), rgba(1, 8, 18, 0.06) 70%, transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    width: 47%;
    padding: 0;
    background-image: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
    right: -3%;
    bottom: 15px;
    left: 1%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty.tarot-kingdom-battle-party {
    position: absolute;
    inset: 96px 3px 10px 0;
    display: block;
    height: auto;
    min-height: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    position: absolute;
    right: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px;
    grid-template-areas: "info avatar";
    align-items: end;
    box-sizing: border-box;
    width: 100%;
    min-height: 68px;
    gap: 2px;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(1) { top: 0; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(2) { top: 25%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(3) { top: 50%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(4) { top: 75%; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
    grid-area: avatar;
    align-self: end;
    justify-self: end;
    width: 54px;
    height: 66px;
    --avatar-combat-scale: 0.84;
    filter: drop-shadow(0 4px 2px #000) drop-shadow(0 0 3px rgba(170, 208, 255, 0.22));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar[data-facing="left"] {
    --avatar-facing-scale-x: -1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    grid-area: info;
    align-self: center;
    display: grid;
    min-width: 0;
    gap: 1px;
    padding: 3px 3px 3px 5px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid rgba(229, 213, 157, 0.4);
    border-radius: 0;
    background: linear-gradient(90deg, transparent, rgba(3, 7, 17, 0.24) 12%, rgba(3, 7, 17, 0.58));
    opacity: 0.9;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn {
    border: 0;
    background: none;
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-info {
    border-bottom-color: #f5ca54;
    background: linear-gradient(90deg, transparent, rgba(53, 37, 5, 0.15) 12%, rgba(60, 43, 6, 0.55));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-avatar {
    filter: drop-shadow(0 4px 2px #000) drop-shadow(0 0 7px rgba(255, 219, 89, 0.8));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-name {
    font-size: 9px;
    line-height: 1.05;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-stats,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-text {
    display: block;
    min-width: 0;
    overflow: visible;
    font-size: 8px;
    line-height: 1.05;
    text-overflow: clip;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-status {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
    height: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    min-height: 28px;
    grid-template-columns: minmax(0, 1fr);
    border-top-color: rgba(232, 189, 82, 0.34);
    background: linear-gradient(90deg, rgba(5, 4, 11, 0.74), rgba(5, 4, 11, 0.46));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-turn {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-feed {
    min-height: 26px;
    max-height: 27px;
    padding: 2px 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-event {
    min-height: 0;
    padding: 3px 7px;
    overflow: hidden;
    border: 0;
    color: rgba(255, 244, 208, 0.86);
    background: rgba(7, 5, 10, 0.52);
    font-size: 9px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-layout {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-panel--trick { order: 1; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.is-battle-active .tarot-kingdom-panel--hand { order: 2; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick {
    --kingdom-display-card-w: clamp(54px, 16vw, 146px);
    position: relative;
    box-sizing: border-box;
    min-height: calc(var(--kingdom-display-card-w) * 2.05 + 27px);
    padding: 25px 2px 4px;
    overflow: hidden;
    border: 1px solid rgba(126, 103, 52, 0.56);
    border-image: none;
    border-radius: 0;
    background: linear-gradient(180deg, #09080c, #030309);
    box-shadow: inset 0 0 0 1px rgba(255, 233, 154, 0.06);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-trick-title {
    position: absolute;
    z-index: 5;
    top: 3px;
    right: 3px;
    left: 3px;
    display: flex;
    min-height: 18px;
    margin: 0;
    padding: 0 4px;
    overflow: hidden;
    border: 0;
    background: linear-gradient(90deg, rgba(7, 8, 12, 0.9), rgba(7, 8, 12, 0.3), transparent);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-panel-heading {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-trick-status {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: 3px;
    overflow: hidden;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-chip {
    min-height: 16px;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 8px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomTrick.tarot-kingdom-trick,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards {
    display: grid;
    grid-template-columns: repeat(5, var(--kingdom-display-card-w));
    align-items: end;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-height: calc(var(--kingdom-display-card-w) * 2.05);
    gap: clamp(3px, 1vw, 8px);
    margin: 0;
    padding: 2px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards {
    position: absolute;
    z-index: 4;
    right: 0;
    bottom: 4px;
    left: 0;
    background: linear-gradient(180deg, rgba(9, 8, 12, 0.98), rgba(3, 3, 9, 0.99));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards.is-empty:not(.is-placeholder) {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards.is-placeholder {
    display: grid;
    min-height: calc(var(--kingdom-display-card-w) * 2.05);
    padding: 2px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards.is-placeholder .tarot-kingdom-selected-slot {
    display: block;
    border: 2px solid #806b3d;
    background:
        radial-gradient(circle at 50% 42%, rgba(207, 167, 65, 0.18), transparent 28%),
        linear-gradient(135deg, transparent 45%, rgba(207, 167, 65, 0.18) 46% 49%, transparent 50%),
        linear-gradient(45deg, transparent 45%, rgba(207, 167, 65, 0.1) 46% 49%, transparent 50%),
        #121019;
    box-shadow: inset 0 0 0 2px #261b0b, 0 4px 7px rgba(0, 0, 0, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick .tarot-kingdom-selected-slot {
    box-sizing: border-box;
    width: var(--kingdom-display-card-w) !important;
    min-width: var(--kingdom-display-card-w) !important;
    height: calc(var(--kingdom-display-card-w) * 2.05) !important;
    margin: 0;
    border-radius: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick > #tarotKingdomSelectedCards > .tarot-card {
    border: 2px solid #d4bb78;
    transform: none;
    box-shadow: 0 0 0 1px #3f2a0c, 0 5px 8px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--hand {
    display: flex;
    flex-direction: column;
    padding: 3px 3px 0;
    overflow: visible;
    border: 1px solid rgba(126, 103, 52, 0.56);
    border-image: none;
    border-radius: 0;
    background: linear-gradient(180deg, #09080c, #030309);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomSelectedEffect.tarot-kingdom-selected-effect {
    order: 1;
    width: min(100%, 760px);
    min-height: 44px;
    margin: 1px auto 3px;
    padding: 7px 20px;
    border: 2px solid #dcb647;
    font-size: clamp(12px, 3.4vw, 17px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand.tarot-kingdom-hand {
    order: 3;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    box-sizing: border-box;
    width: min(100%, 760px);
    min-height: 110px;
    margin: 0 auto;
    gap: 3px;
    padding: 12px 0 3px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand > .tarot-card + .tarot-card {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 0.48;
    margin: 0;
    border: 1px solid #d7bd79;
    border-radius: 3px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand .tarot-card-art {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.58);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup,
#tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    position: relative;
    z-index: 4100;
    order: 4;
    right: auto;
    bottom: auto;
    left: auto;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 5px 0 0;
    padding: 17px 4px 5px;
    border: 1px solid #82672c;
    background: linear-gradient(180deg, rgba(34, 25, 9, 0.99), rgba(4, 4, 8, 0.99));
    transform: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions {
    gap: 5px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup .tarot-betting-actions > button {
    height: 52px;
    min-height: 52px;
    font-size: clamp(9px, 2.8vw, 14px);
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        min-height: clamp(440px, 55svh, 540px);
        background-position: 45% center;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
        width: 52%;
        padding: 82px 6px 3px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
        width: 48%;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleParty.tarot-kingdom-battle-party {
        inset: 98px 2px 9px 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: minmax(0, 1fr) 50px;
        min-height: 64px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        width: 49px;
        height: 62px;
        --avatar-combat-scale: 0.78;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui .tarot-kingdom-panel--trick {
        --kingdom-display-card-w: clamp(52px, 17vw, 68px);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomHand.tarot-kingdom-hand {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        min-height: 106px;
        gap: 3px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui #tarotKingdomActionPopup.tarot-kingdom-action-popup {
        position: relative;
        width: 100%;
        max-width: none;
        bottom: auto;
        margin-top: 5px;
        padding: 17px 3px 4px;
        transform: none;
    }
}

/* Keep the rebuilt v2 composition authoritative over legacy Tarot cascades. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 {
    width: min(100%, 640px);
    max-width: 640px;
    margin-right: auto;
    margin-left: auto;
    padding: 0;
    overflow-x: clip;
    background: #050409;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2.is-battle-active #tarotKingdomStateText {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedEffect.tarot-kingdom-selected-effect.is-error {
    border-color: #ef755f;
    background: linear-gradient(180deg, rgba(66, 14, 12, 0.96), rgba(24, 5, 7, 0.98));
    color: #ffe6d5;
    box-shadow: inset 0 0 0 1px rgba(255, 205, 139, 0.2), 0 0 12px rgba(239, 70, 45, 0.34);
    text-shadow: 0 1px 1px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage {
    width: 100%;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-bottom: 2px solid #51411b;
    border-radius: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
    width: 100%;
    height: clamp(390px, 49svh, 510px);
    min-height: 0;
    background-image:
        var(--tarot-kingdom-battlefield-atmosphere, linear-gradient(180deg, rgba(3, 4, 12, 0.03) 46%, rgba(3, 3, 9, 0.08) 72%, rgba(1, 1, 5, 0.5) 100%)),
        var(--tarot-kingdom-battlefield-image, url("./assets/tarot-kingdom/moonlit-terrace-vertical-v3.png"));
    background-position: center center, var(--tarot-kingdom-battlefield-position, center center);
    background-size: cover, var(--tarot-kingdom-battlefield-size, 100% 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    display: block;
    top: 0;
    bottom: 0;
    left: 0;
    width: 55%;
    padding: 0;
    background: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    top: 0;
    right: 0;
    bottom: 0;
    width: 48%;
    padding: 0;
    background: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty.tarot-kingdom-battle-party {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    right: 2px;
    grid-template-columns: minmax(0, 1fr) clamp(62px, 17vw, 84px);
    width: min(calc(100% - 26px), 180px);
    min-height: clamp(64px, 16vw, 84px);
}

/* Lower battlefield lanes render closer to the camera. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(1) {
    top: 28%;
    z-index: 10;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(2) {
    top: 46%;
    z-index: 20;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(3) {
    top: 64%;
    z-index: 30;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty > .tarot-kingdom-battle-player:nth-child(4) {
    top: 82%;
    z-index: 40;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
    position: relative;
    z-index: 2;
    justify-self: end;
    width: 70px;
    height: clamp(72px, 18vw, 84px);
    --avatar-combat-scale: 1.02;
    --avatar-facing-scale-x: 1;
    /* Avatar layers occupy the leading 64px frame, not the full battle slot. */
    --avatar-foot-shadow-width: 46px;
    --avatar-foot-shadow-height: 11px;
    --avatar-foot-shadow-left: 32px;
    --avatar-foot-shadow-bottom: 17px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-front-row .tarot-kingdom-battle-player-avatar {
    right: 12px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    padding: 0 2px 2px 0;
    border: 0;
    background: none;
    text-align: right;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-header {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 3px;
    align-items: center;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-name,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-rank {
    grid-column: 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-formation {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
    min-width: 16px;
    padding: 1px 3px;
    border: 1px solid rgba(231, 209, 139, 0.72);
    border-radius: 3px;
    color: #fff4c5;
    background: rgba(8, 9, 15, 0.84);
    font: 800 8px/1.2 system-ui, sans-serif;
    text-align: center;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-back-row .tarot-kingdom-battle-player-formation {
    border-color: rgba(125, 201, 255, 0.78);
    color: #c9edff;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp {
    width: min(88px, calc(100% - 14px));
    max-width: 100%;
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-hp-track {
    width: 100%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-center {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-panel--trick {
    min-height: 0;
    padding: 22px 5px 5px;
    border: 0;
    border-bottom: 1px solid #443514;
    background: linear-gradient(180deg, #121019, #050409);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-card-stage {
    position: relative;
    width: min(100%, 610px);
    margin: 0 auto;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    min-height: 0;
    gap: clamp(3px, 1vw, 8px);
    margin: 0;
    padding: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards {
    position: absolute;
    z-index: 8;
    inset: 0;
    background: #050409;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards.is-empty {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: 0.61;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art {
    transform: translate(-50%, -50%) scale(1.75);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-panel--hand {
    padding: 0 5px 4px;
    border: 0;
    background: linear-gradient(180deg, #0c0b11, #050409);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedEffect {
    flex-direction: row;
    width: min(calc(100% - 24px), 540px);
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    margin: 3px auto;
    padding: 5px 14px;
    border: 2px solid #d9b54d;
    font-size: clamp(13px, 3.5vw, 18px);
    white-space: normal;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedEffect.is-compact {
    padding: 5px 10px;
    overflow-wrap: anywhere;
    font-size: clamp(10px, 2.8vw, 14px);
    line-height: 1.15;
    white-space: normal;
    text-overflow: clip;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedEffect.is-tight {
    padding-inline: 7px;
    font-size: clamp(9px, 2.45vw, 12px);
    letter-spacing: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-arcana-nav {
    order: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: min(calc(100% - 42px), 500px);
    height: 22px;
    min-height: 22px;
    max-height: 22px;
    margin: 3px auto 0;
    padding: 2px 9px;
    overflow: hidden;
    border: 1px solid rgba(188, 211, 240, 0.58);
    border-radius: 8px 8px 2px 2px;
    background: linear-gradient(90deg, rgba(14, 17, 26, 0.94), rgba(39, 49, 68, 0.96), rgba(14, 17, 26, 0.94));
    box-shadow: inset 0 0 8px rgba(158, 195, 238, 0.12), 0 1px 3px rgba(0, 0, 0, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-arcana-nav[hidden] {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-guardian-passive {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    gap: 4px;
    color: #dce9ff;
    font-family: "Yu Gothic", sans-serif;
    font-size: clamp(8px, 2vw, 10px);
    font-weight: 700;
    line-height: 1.15;
    text-shadow: 0 1px 2px #000;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-guardian-passive[hidden] {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-guardian-passive-label {
    flex: 0 0 auto;
    padding: 0 4px;
    border: 1px solid rgba(222, 235, 255, 0.72);
    border-radius: 7px;
    color: #f4f8ff;
    background: rgba(44, 57, 78, 0.78);
    font-size: 8px;
    letter-spacing: 0.06em;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-guardian-passive[data-attribute="light"] {
    color: #fff5c7;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-guardian-passive[data-attribute="dark"] {
    color: #e2d5ff;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-guardian-passive strong {
    flex: 0 0 auto;
    color: inherit;
    font-size: inherit;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-guardian-passive > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-effect-text {
    display: -webkit-box;
    width: 100%;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    text-align: center;
    text-overflow: clip;
    white-space: normal;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: min(100%, 610px);
    min-height: 0;
    gap: clamp(3px, 0.8vw, 6px);
    padding: 2px 0 3px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 0.61;
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
    transform: translate(-50%, -50%) scale(1.5);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup.tarot-kingdom-action-popup,
#tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup.tarot-kingdom-action-popup {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: none;
    margin: 3px 0 0;
    padding: 5px 3px;
    border: 0;
    border-top: 1px solid #443514;
    background: linear-gradient(180deg, #15100a, #050408);
    transform: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(5px, 1.5vw, 10px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions > button {
    height: 52px;
    min-height: 52px;
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-arena {
        height: clamp(380px, 49svh, 420px);
        min-height: 0;
        background-position: center center, var(--tarot-kingdom-battlefield-position, center center);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty.tarot-kingdom-battle-party {
        inset: 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: minmax(0, 1fr) 62px;
        min-height: 62px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar {
        height: 72px;
        --avatar-combat-scale: 0.96;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art {
        transform: translate(-50%, -50%) scale(1.05);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
        min-height: 0;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.92);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup.tarot-kingdom-action-popup,
    #tabContentTarot #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup.tarot-kingdom-action-popup {
        margin-top: 3px;
        padding: 5px 3px;
    }
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-panel--players {
    display: block;
    order: 3;
    min-height: 0;
    padding: 0;
    border: 0;
    background: #050409;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-panel--players > .tarot-kingdom-panel-title {
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2.is-battle-active .tarot-kingdom-panel--players .tarot-kingdom-panel-heading,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2.is-battle-active #tarotKingdomPlayers {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSettlementConfirmButton:not([hidden]) {
    display: block;
    box-sizing: border-box;
    width: min(100%, 360px);
    max-width: min(calc(100vw - 24px), 520px);
    min-height: 48px;
    margin: 6px auto 0;
    padding-inline: clamp(16px, 5vw, 28px);
    border: 2px solid #d9b54d;
    color: #f4e2aa;
    background: linear-gradient(180deg, #7e5710, #382405);
    font-weight: 800;
}

/* The quieter second choice next to "play again". */
#tarotKingdomSettlementMenuButton {
    flex: 0 0 auto;
    min-height: 48px;
    margin-top: 6px;
    padding: 8px 14px;
    border: 1px solid rgba(217, 181, 77, 0.55);
    border-radius: 10px;
    color: #e8dcb8;
    background: rgba(20, 14, 6, 0.92);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

#tarotKingdomSettlementMenuButton[hidden] {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena[data-battlefield-id="coral-island"] {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(40, 6, 60, 0.02) 38%, rgba(93, 20, 58, 0.08) 70%, rgba(19, 4, 24, 0.34) 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena[data-battlefield-id="haunted-marsh"] {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(0, 28, 35, 0.04) 38%, rgba(0, 58, 60, 0.12) 68%, rgba(0, 11, 17, 0.58) 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena[data-battlefield-id="blue-grotto"] {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(0, 21, 65, 0.03) 36%, rgba(0, 38, 94, 0.1) 70%, rgba(0, 7, 25, 0.62) 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena[data-battlefield-id="sea-fortress"] {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(2, 10, 28, 0.04) 40%, rgba(53, 31, 8, 0.07) 72%, rgba(2, 4, 12, 0.6) 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-arena[data-battlefield-id="ship-side"] {
    --tarot-kingdom-battlefield-atmosphere: linear-gradient(180deg, rgba(17, 3, 47, 0.03) 34%, rgba(20, 7, 48, 0.1) 68%, rgba(3, 2, 15, 0.54) 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite[data-facing="left"] {
    position: absolute;
    right: auto;
    bottom: calc(var(--tarot-kingdom-enemy-anchor-y) - var(--tarot-kingdom-enemy-frame-height) + var(--tarot-kingdom-enemy-offset-y, 0px) + var(--tarot-kingdom-enemy-clip-lift, 0px));
    left: 50%;
    margin-left: calc(-1 * var(--tarot-kingdom-enemy-anchor-x));
    transform: scaleX(var(--tarot-kingdom-enemy-confusion-facing-scale-x, var(--tarot-kingdom-enemy-facing-scale-x, -1))) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    transform-origin: var(--tarot-kingdom-enemy-anchor-x) var(--tarot-kingdom-enemy-origin-y, var(--tarot-kingdom-enemy-anchor-y));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite[data-facing="left"].is-defeated,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-defeated #tarotKingdomEnemySprite[data-facing="left"] {
    transform: translateY(11px) rotate(7deg) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
}

@keyframes tarotKingdomBattleEnemyHurt {
    0%, 100% { transform: scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale)); filter: drop-shadow(0 5px 2px rgba(0, 0, 0, 0.58)); }
    22% { transform: translateX(-10px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale)); filter: brightness(2.4) sepia(1) saturate(4) hue-rotate(315deg); }
    48% { transform: translateX(7px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale)); }
    70% { transform: translateX(-4px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale)); }
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    right: 0;
    width: min(calc(100% - 4px), 158px);
    grid-template-columns: 70px minmax(0, 1fr);
    grid-template-areas: "avatar info";
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-info {
    padding: 0 0 2px 3px;
    text-align: left;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card {
    border: 10px solid transparent !important;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 10px / 0 stretch !important;
    border-radius: 0;
    background-color: #0a090d;
    box-shadow: 0 4px 7px rgba(0, 0, 0, 0.76);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-playable:not(.is-selected) {
    opacity: 1;
    filter: brightness(1.08) saturate(1.08) drop-shadow(0 0 4px rgba(255, 218, 100, 0.76));
    animation: tarotKingdomPlayableCardGlow 1.25s ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-unplayable:not(.is-selected) {
    opacity: 0.72;
    filter: grayscale(0.12) brightness(0.86) saturate(0.86);
}

@keyframes tarotKingdomPlayableCardGlow {
    0%, 100% { filter: brightness(1.04) saturate(1.04) drop-shadow(0 0 2px rgba(255, 218, 100, 0.56)); }
    50% { filter: brightness(1.14) saturate(1.12) drop-shadow(0 0 6px rgba(255, 226, 125, 0.92)); }
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
    left: 50%;
    top: 50%;
    transform-origin: 50% 50%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-betting-actions > button {
    border: 10px solid transparent;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 10px / 0 stretch;
    border-radius: 0;
    background: transparent;
    box-shadow: 0 3px 4px rgba(0, 0, 0, 0.72);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomPlayButton {
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
    background: transparent;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomFoldButton {
    display: grid;
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: center;
    font-size: min(12px, 2.8vw);
    line-height: 1.05;
    padding-block: 4px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomFoldButton::after {
    content: "自動パス";
    position: static;
    inset: auto;
    z-index: auto;
    display: block;
    width: auto;
    margin-top: 2px;
    border: 0;
    border-radius: 0;
    color: rgba(230, 240, 238, 0.72);
    background: none;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.05em;
}

/* Tarot Kingdom command row v9: grave / sort / fold / context action */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-kingdom-command-grave {
    position: static;
    inset: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    border-radius: 0;
    color: #bde7dd;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-kingdom-command-grave > [aria-hidden="true"] {
    margin-right: 4px;
    font-size: 0.9em;
    line-height: 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomActionPopup .tarot-kingdom-command-grave .tarot-kingdom-battle-menu-label {
    position: static;
    display: inline;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: nowrap;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomPlayButton.is-defense {
    border-image-source: url("./assets/ui/buttons/button-dark-large.png");
    color: #bde7dd;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomPlayButton.is-attack,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomPlayButton.is-minor-draw {
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
    color: #fff0ad;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomPlayButton.is-confirm-ready {
    color: #fffbd4;
    filter:
        brightness(1.28)
        saturate(1.22)
        drop-shadow(0 0 3px rgba(255, 229, 128, 0.9))
        drop-shadow(0 0 7px rgba(255, 170, 24, 0.72));
    text-shadow:
        0 1px 1px #4b2500,
        0 0 5px rgba(255, 248, 190, 0.95),
        0 0 10px rgba(255, 190, 45, 0.9);
    box-shadow:
        0 3px 4px rgba(0, 0, 0, 0.72),
        0 0 0 2px rgba(255, 232, 139, 0.86),
        0 0 14px rgba(255, 199, 54, 0.82),
        0 0 24px rgba(255, 139, 20, 0.48);
    animation: tarotKingdomConfirmButtonGlow 0.82s ease-in-out infinite;
}

@keyframes tarotKingdomConfirmButtonGlow {
    0%, 100% {
        filter:
            brightness(1.2)
            saturate(1.16)
            drop-shadow(0 0 2px rgba(255, 229, 128, 0.82))
            drop-shadow(0 0 5px rgba(255, 170, 24, 0.62));
        box-shadow:
            0 3px 4px rgba(0, 0, 0, 0.72),
            0 0 0 1px rgba(255, 232, 139, 0.76),
            0 0 10px rgba(255, 199, 54, 0.7),
            0 0 18px rgba(255, 139, 20, 0.36);
    }

    50% {
        filter:
            brightness(1.42)
            saturate(1.3)
            drop-shadow(0 0 5px rgba(255, 244, 181, 1))
            drop-shadow(0 0 11px rgba(255, 167, 18, 0.9));
        box-shadow:
            0 3px 4px rgba(0, 0, 0, 0.72),
            0 0 0 2px rgba(255, 242, 175, 0.98),
            0 0 18px rgba(255, 213, 80, 0.96),
            0 0 30px rgba(255, 137, 18, 0.62);
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-playable,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomPlayButton.is-confirm-ready {
        animation: none;
    }
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player {
        grid-template-columns: 70px minmax(0, 1fr);
    }
}

/* Tarot Kingdom v4 final cascade overrides. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy-visual {
    bottom: 27.5%;
    place-items: end end;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-info {
    border: 0;
    border-bottom-color: transparent;
    background: none;
    box-shadow: none;
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn::after {
    content: none;
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-avatar:not(.is-avatar-attacking) {
    filter: drop-shadow(0 4px 2px #000) drop-shadow(0 0 5px #fff0a8) drop-shadow(0 0 11px rgba(255, 210, 64, 0.92));
    animation: tarotKingdomAvatarTurnGlow 1.25s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-turn .tarot-kingdom-battle-player-avatar:not(.is-avatar-attacking) {
        animation: none;
    }
}

/* Tarot Kingdom Rush Time and monster finisher. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-rush-time .tarot-kingdom-battle-eyebrow::after {
    content: "RUSH TIME";
    color: #ffcf5a;
    letter-spacing: 0.05em;
    text-shadow: 1px 1px 0 #000, 0 0 7px rgba(255, 76, 54, 0.9);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite[data-facing="left"].is-rush-time,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-rush-time #tarotKingdomEnemySprite[data-facing="left"] {
    opacity: 0.82;
    filter: grayscale(0.52) saturate(0.7) brightness(0.78) drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82)) drop-shadow(0 0 9px rgba(255, 70, 55, 0.5));
    transform: scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    transition: opacity 420ms ease, filter 420ms ease;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite[data-facing="left"].is-finisher-defeat,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-finisher-defeat #tarotKingdomEnemySprite[data-facing="left"] {
    opacity: 1 !important;
    clip-path: inset(0 0 0 0);
    filter: drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82)) drop-shadow(0 0 9px rgba(177, 119, 255, 0.58)) !important;
    transform: scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale)) !important;
    transition: none !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite[data-facing="left"].is-finisher-defeat.is-dusting,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-dusting #tarotKingdomEnemySprite[data-facing="left"] {
    animation: tarotKingdomEnemyDustLeft 330ms steps(6, end) forwards !important;
}

@keyframes tarotKingdomEnemyDustLeft {
    0% {
        opacity: 1;
        clip-path: inset(0 0 0 0);
        filter: saturate(0.8) brightness(1.05) drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
        transform: scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
    45% {
        opacity: 0.72;
        clip-path: inset(0 0 38% 0);
        filter: grayscale(0.7) sepia(0.25) blur(0.4px) brightness(1.2);
        transform: translateY(-3px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
    100% {
        opacity: 0;
        clip-path: inset(0 0 100% 0);
        filter: grayscale(1) sepia(0.35) blur(2px) brightness(1.45);
        transform: translateY(-13px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
}

/* A surviving monster turns away from the party and leaves the cleared field. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite[data-facing="left"].is-escaping,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-escaping #tarotKingdomEnemySprite[data-facing="left"] {
    opacity: 1;
    filter: drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
    animation: tarotKingdomEnemyEscapeLeft 1080ms linear forwards !important;
    transition: none !important;
}

@keyframes tarotKingdomEnemyEscapeLeft {
    0% {
        opacity: 1;
        transform: translateX(0) scaleX(var(--tarot-kingdom-enemy-escape-facing-scale-x, 1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
    12% {
        opacity: 1;
        transform: translateX(-5px) scaleX(var(--tarot-kingdom-enemy-escape-facing-scale-x, 1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
    82% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(clamp(-340px, -42vw, -150px)) scaleX(var(--tarot-kingdom-enemy-escape-facing-scale-x, 1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite.is-rush-time {
        transition: none !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite.is-dusting {
        opacity: 0 !important;
        animation: none !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite.is-escaping {
        opacity: 0 !important;
        animation: none !important;
    }

}

/* Tarot Kingdom v11 final card cascade. Keep this after all legacy kingdom themes. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card,
.tarot-kingdom-card-deal-ghost.tarot-card {
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #c9a85c !important;
    border-image: none !important;
    border-radius: 3px !important;
    background: var(--tk-card-face, #120f0c) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 239, 184, 0.18), 0 3px 5px rgba(0, 0, 0, 0.76), 0 0 0 1px rgba(36, 22, 8, 0.78) !important;
    animation: none;
}

/* XVI-XIX visibly carry both their Major Arcana and assigned suit identities. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.arcana-suit-hybrid,
.tarot-kingdom-card-deal-ghost.tarot-card.arcana-suit-hybrid {
    --tk-card-major-color: #edf3fb;
    --tk-card-face: linear-gradient(
        135deg,
        var(--tk-card-major-color) 0 49.2%,
        #fff7d4 49.2% 50.8%,
        var(--tk-card-suit-edge) 50.8% 100%
    );
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.arcana-suit-hybrid::before,
.tarot-kingdom-card-deal-ghost.tarot-card.arcana-suit-hybrid::before {
    position: absolute;
    z-index: 1;
    inset: 1px;
    display: block;
    border-radius: 1px;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--tk-card-major-color) 48%, transparent) 0 49.2%,
        rgba(255, 247, 212, 0.74) 49.2% 50.8%,
        color-mix(in srgb, var(--tk-card-suit-edge) 54%, transparent) 50.8% 100%
    );
    content: "";
    pointer-events: none;
}

/* v12: identify suits by the card edge only; no extra crest or frame. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card:is(.wand, .cup, .sword, .pentacle, .arcana-suit-wand, .arcana-suit-cup, .arcana-suit-sword, .arcana-suit-pentacle),
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card:is(.wand, .cup, .sword, .pentacle, .arcana-suit-wand, .arcana-suit-cup, .arcana-suit-sword, .arcana-suit-pentacle),
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card:is(.wand, .cup, .sword, .pentacle, .arcana-suit-wand, .arcana-suit-cup, .arcana-suit-sword, .arcana-suit-pentacle),
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomJudgmentOptions > .tarot-card:is(.wand, .cup, .sword, .pentacle, .arcana-suit-wand, .arcana-suit-cup, .arcana-suit-sword, .arcana-suit-pentacle),
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-grave-slot > .tarot-card:is(.wand, .cup, .sword, .pentacle, .arcana-suit-wand, .arcana-suit-cup, .arcana-suit-sword, .arcana-suit-pentacle) {
    border: 1px solid var(--tk-card-suit-edge) !important;
    border-image: none !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 248, 219, 0.12),
        0 3px 5px rgba(0, 0, 0, 0.78),
        0 0 4px var(--tk-card-suit-glow) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card:is(.wand, .arcana-suit-wand) {
    --tk-card-suit-edge: #d34a40;
    --tk-card-suit-glow: rgba(211, 74, 64, 0.38);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card:is(.cup, .arcana-suit-cup) {
    --tk-card-suit-edge: #3f89cf;
    --tk-card-suit-glow: rgba(63, 137, 207, 0.4);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card:is(.sword, .arcana-suit-sword) {
    --tk-card-suit-edge: #9b72e6;
    --tk-card-suit-glow: rgba(155, 114, 230, 0.42);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card:is(.pentacle, .arcana-suit-pentacle) {
    --tk-card-suit-edge: #3aa66d;
    --tk-card-suit-glow: rgba(58, 166, 109, 0.4);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card-number {
    border-width: 2px !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card:is(
    .wand,
    .cup,
    .sword,
    .pentacle,
    .arcana-suit-wand,
    .arcana-suit-cup,
    .arcana-suit-sword,
    .arcana-suit-pentacle
) .tarot-card-number {
    border-color: var(--tk-card-suit-edge) !important;
    border-image: none !important;
    box-shadow: 0 0 3px var(--tk-card-suit-glow);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card:is(.sword, .arcana-suit-sword) .tarot-card-number {
    color: #e9ddff;
}

/*
 * Suitless major arcana must use the same physical-card edge as the hand.
 * This selector intentionally includes #tarotKingdomHand so it outranks the
 * legacy panel-dark-gold hand rule without changing cards on other screens.
 */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-arcana {
    border: 1px solid var(--tk-card-suit-edge, #e1c77b) !important;
    border-image: none !important;
    border-radius: 3px !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 239, 184, 0.18),
        0 3px 5px rgba(0, 0, 0, 0.76),
        0 0 3px var(--tk-card-suit-glow, rgba(225, 199, 123, 0.28)) !important;
}

/*
 * Suitless major arcana use a white-silver identity. Major I and XVI-XIX keep
 * their existing multicolor/suit edges so their card-rule cues stay visible.
 */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.is-arcana:not(.arcana-all-corners):not(.arcana-suit-hybrid) {
    --tk-card-suit-edge: #edf3fb;
    --tk-card-suit-glow: rgba(218, 231, 246, 0.42);
    border: 1px solid var(--tk-card-suit-edge) !important;
    border-image: none !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.2),
        0 3px 5px rgba(0, 0, 0, 0.76),
        0 0 4px var(--tk-card-suit-glow) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.is-arcana:not(.arcana-all-corners):not(.arcana-suit-hybrid) .tarot-card-number {
    border-color: #edf3fb !important;
    border-image: none !important;
    color: #f8fbff;
    box-shadow: 0 0 3px rgba(218, 231, 246, 0.42);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.is-arcana:not(.arcana-all-corners):not(.arcana-suit-hybrid) .tarot-card-title {
    color: #f3f7fc;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card.arcana-all-corners,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card.arcana-all-corners,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.arcana-all-corners,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomJudgmentOptions > .tarot-card.arcana-all-corners,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-grave-slot > .tarot-card.arcana-all-corners {
    border: 1px solid transparent !important;
    border-color: transparent !important;
    border-image: conic-gradient(#d34a40 0 25%, #3f89cf 0 50%, #9b72e6 0 75%, #3aa66d 0) 1 !important;
    box-shadow: inset 0 0 0 1px rgba(255, 248, 219, 0.12), 0 3px 5px rgba(0, 0, 0, 0.78) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-card.arcana-all-corners .tarot-card-number {
    border: 2px solid transparent !important;
    border-image: conic-gradient(#d34a40 0 25%, #3f89cf 0 50%, #9b72e6 0 75%, #3aa66d 0) 1 !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-selected-slot {
    width: 50px !important;
    height: 82px !important;
    border: 1px solid rgba(202, 169, 91, 0.45) !important;
    border-image: none !important;
    border-radius: 3px;
    background: rgba(14, 11, 11, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 231, 165, 0.06);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick > .tarot-kingdom-field-slot,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards > .tarot-kingdom-selected-slot {
    width: 50px !important;
    height: 82px !important;
    border: 1px solid rgba(202, 169, 91, 0.55) !important;
    border-image: none !important;
    border-radius: 3px !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomTrick .tarot-card-art,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomSelectedCards .tarot-card-art {
    left: 50%;
    top: 50%;
    width: 48px;
    height: 80px;
    transform: translate(-50%, -50%) scale(1);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
    --tk-hand-card-width: 50px;
    grid-template-columns: repeat(8, var(--tk-hand-card-width));
    justify-content: center;
    width: 100%;
    max-width: 435px;
    gap: 5px;
    overflow-x: clip;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
    width: var(--tk-hand-card-width);
    height: 82px;
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
    left: 50%;
    top: 50%;
    width: 48px;
    height: 80px;
    transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 640px) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand.tarot-kingdom-hand {
        --tk-hand-card-width: clamp(35px, calc((100vw - 26px) / 8), 45px);
        max-width: none;
        gap: 2px;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card + .tarot-card {
        height: calc(var(--tk-hand-card-width) / 0.6);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand .tarot-card-art {
        transform: translate(-50%, -50%) scale(0.84);
    }
}

/* Dedicated raid arena atmosphere. The image stays fixed while the boss form
   adds a lightweight color layer, avoiding a second large texture upload. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-battle .tarot-kingdom-battle-arena::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-battle .tarot-kingdom-battle-arena::after {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-battle .tarot-kingdom-battle-arena::before {
    background:
        linear-gradient(180deg, rgba(6, 13, 34, 0.08) 28%, rgba(7, 10, 24, 0.22) 70%, rgba(2, 3, 10, 0.34)),
        radial-gradient(ellipse at 52% 32%, rgba(116, 91, 174, 0.16), transparent 48%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-battle .tarot-kingdom-battle-arena::after {
    background:
        radial-gradient(ellipse at 48% 28%, rgba(180, 31, 72, 0.3), transparent 42%),
        linear-gradient(180deg, rgba(46, 4, 32, 0.2), rgba(18, 2, 20, 0.28) 52%, rgba(3, 1, 9, 0.18));
    opacity: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-battle.is-raid-boss-phase .tarot-kingdom-battle-arena::after {
    opacity: 0.72;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-battle.is-raid-boss-phase.is-raid-transforming .tarot-kingdom-battle-arena::after {
    animation: tarotKingdomRaidAtmosphereReveal 1500ms ease-out both;
}

@keyframes tarotKingdomRaidAtmosphereReveal {
    0% { opacity: 0; }
    34% { opacity: 0.18; }
    58% { opacity: 0.88; }
    100% { opacity: 0.72; }
}

/* Raid boss reveal: a short synchronized phase, kept light enough for mobile GPUs. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming {
    animation: tarotKingdomRaidStagePulse 1500ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming .tarot-kingdom-battle-enemy-visual::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 50%;
    bottom: -12px;
    width: min(180px, 44vw);
    aspect-ratio: 1;
    border: 2px solid rgba(255, 104, 90, 0.88);
    border-radius: 50%;
    pointer-events: none;
    background:
        radial-gradient(circle, transparent 0 39%, rgba(255, 190, 104, 0.22) 40% 42%, transparent 43%),
        conic-gradient(from 45deg, rgba(255, 72, 91, 0) 0 10%, rgba(255, 210, 132, 0.8) 11% 13%, rgba(255, 72, 91, 0) 14% 24%);
    opacity: 0;
    transform: translate(-50%, 16%) rotate(-16deg) scale(0.28);
    animation: tarotKingdomRaidSealReveal 1500ms cubic-bezier(0.2, 0.72, 0.18, 1) both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming #tarotKingdomEnemySprite[data-facing="left"] {
    animation: tarotKingdomRaidBossReveal 1500ms cubic-bezier(0.2, 0.75, 0.16, 1) both !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming .tarot-kingdom-battle-enemy .tarot-kingdom-battle-side-heading,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming .tarot-kingdom-battle-enemy .tarot-kingdom-battle-hp {
    animation: tarotKingdomRaidBossHudReveal 1500ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage > #tarotKingdomCutin.tarot-cutin.is-kingdom-raid-transform {
    --tk-action-accent: #ff665e;
    --tk-action-surface: rgba(60, 4, 18, 0.96);
    top: 34%;
    right: auto;
    left: 6px;
    width: min(78%, 360px);
    min-height: 46px;
    padding-left: 15px;
    border-left-width: 5px;
    transform-origin: 0 50%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage > #tarotKingdomCutin.tarot-cutin.is-kingdom-raid-transform.show {
    animation: tarotKingdomRaidTransformCutin 1500ms cubic-bezier(0.2, 0.78, 0.18, 1) both !important;
}

@keyframes tarotKingdomRaidStagePulse {
    0%, 100% { box-shadow: none; }
    28% { box-shadow: inset 0 0 0 999px rgba(18, 3, 18, 0.12); }
    52% { box-shadow: inset 0 0 42px rgba(255, 68, 80, 0.2); }
}

@keyframes tarotKingdomRaidSealReveal {
    0% { opacity: 0; transform: translate(-50%, 16%) rotate(-16deg) scale(0.28); }
    22% { opacity: 0.9; }
    56% { opacity: 0.78; transform: translate(-50%, 16%) rotate(12deg) scale(1); }
    100% { opacity: 0; transform: translate(-50%, 16%) rotate(32deg) scale(1.14); }
}

@keyframes tarotKingdomRaidBossReveal {
    0% {
        opacity: 0;
        filter: brightness(0) saturate(0.35) drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
        transform: translateY(12px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(calc(var(--tarot-kingdom-enemy-scale) * 0.72));
    }
    25% {
        opacity: 0.52;
        filter: brightness(0) saturate(0.4) drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
    }
    48% {
        opacity: 1;
        filter: brightness(2.25) saturate(0.55) drop-shadow(0 0 14px rgba(255, 113, 90, 0.92));
        transform: translateY(-2px) scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(calc(var(--tarot-kingdom-enemy-scale) * 1.06));
    }
    66% {
        filter: brightness(1.25) saturate(1.18) drop-shadow(0 0 9px rgba(255, 98, 82, 0.66));
    }
    100% {
        opacity: 1;
        filter: drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
        transform: scaleX(var(--tarot-kingdom-enemy-facing-scale-x, -1)) scaleY(var(--tarot-kingdom-enemy-scale-y, 1)) scale(var(--tarot-kingdom-enemy-scale));
    }
}

@keyframes tarotKingdomRaidBossHudReveal {
    0%, 34% { opacity: 0; transform: translateY(-4px); }
    52%, 100% { opacity: 1; transform: translateY(0); }
}

@keyframes tarotKingdomRaidTransformCutin {
    0% { opacity: 0; clip-path: inset(0 86% 0 0); transform: translate(-8%, -50%) scaleX(0.22); }
    14% { opacity: 1; clip-path: inset(0); transform: translate(0, -50%) scaleX(1); }
    22%, 72% { opacity: 1; clip-path: inset(0); transform: translate(0, -50%) scaleX(1); }
    100% { opacity: 0; clip-path: inset(0 0 0 18%); transform: translate(7%, -50%) scaleX(0.92); }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming #tarotKingdomEnemySprite[data-facing="left"],
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming .tarot-kingdom-battle-enemy .tarot-kingdom-battle-side-heading,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming .tarot-kingdom-battle-enemy .tarot-kingdom-battle-hp {
        animation: none !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-battle.is-raid-boss-phase.is-raid-transforming .tarot-kingdom-battle-arena::after {
        opacity: 0.72;
        animation: none;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage.is-raid-transforming .tarot-kingdom-battle-enemy-visual::before {
        opacity: 0.55;
        transform: translate(-50%, 16%) scale(1);
        animation: none;
    }
}

/* Actor silhouettes already provide the battle shadow; suppress the legacy oval. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar::before {
    content: none;
}

/* Exploration mercenary parties can contain three seats, or four with a pet. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty[data-player-count="3"] > .tarot-kingdom-battle-player:nth-child(1) {
    top: 38%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty[data-player-count="3"] > .tarot-kingdom-battle-player:nth-child(2) {
    top: 60%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleParty[data-player-count="3"] > .tarot-kingdom-battle-player:nth-child(3) {
    top: 82%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-pet {
    position: relative;
    overflow: visible;
    isolation: isolate;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-pet-sprite {
    position: absolute;
    z-index: 1;
    bottom: 8px;
    left: calc(50% - 4px);
    pointer-events: none;
    transform: translateX(calc(-1 * var(--tarot-kingdom-pet-anchor-x, 24px))) translateY(var(--tarot-kingdom-pet-offset-y, 0px))
        scaleX(var(--tarot-kingdom-pet-scale-x, 1))
        scaleY(var(--tarot-kingdom-pet-scale-y, 1))
        scale(var(--tarot-kingdom-pet-scale, 1));
    transform-origin: var(--tarot-kingdom-pet-anchor-x, 50%) var(--tarot-kingdom-pet-origin-y, 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-pet[data-monster-anchor="ground"] .tarot-kingdom-battle-pet-sprite {
    bottom: calc(
        8px
        + var(--tarot-kingdom-pet-anchor-y, var(--tarot-kingdom-pet-frame-height, 48px))
        - var(--tarot-kingdom-pet-frame-height, 48px)
    );
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-ko .tarot-kingdom-battle-pet-sprite {
    filter: grayscale(0.65) brightness(0.7);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-rebirth-active .tarot-kingdom-battle-enemy-visual,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-pet.is-rebirth-active {
    animation: tarotKingdomRebirthActorReveal 1400ms ease-out both;
}

@keyframes tarotKingdomRebirthActorReveal {
    0%, 34% {
        opacity: 0;
        filter: brightness(0) saturate(0.45);
    }

    48% {
        opacity: 0.28;
        filter: brightness(2.4) saturate(0.7) drop-shadow(0 0 13px rgba(255, 248, 207, 0.94));
    }

    68%, 100% {
        opacity: 1;
        filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy.is-rebirth-active .tarot-kingdom-battle-enemy-visual,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-pet.is-rebirth-active {
        animation: none;
    }
}

/* Monster recruitment appears before the exploration reward reveal. */
.tarot-pet-offer-overlay {
    position: fixed;
    z-index: 2147483001;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    background:
        radial-gradient(circle at 50% 36%, rgba(84, 73, 132, 0.28), transparent 42%),
        rgba(3, 5, 12, 0.88);
}

.tarot-pet-offer-dialog {
    width: min(100%, 430px);
    padding: 16px 16px 14px;
    border: 10px solid transparent;
    border-image: url("./assets/ui/panels/panel-dark-gold.png") 32 fill / 10px / 0 stretch;
    color: #fff5cf;
    background: #080911;
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.85);
    text-align: center;
}

.tarot-pet-offer-stage {
    display: grid;
    place-items: end center;
    min-height: 132px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 92%, rgba(0, 0, 0, 0.82) 0 18%, transparent 52%),
        linear-gradient(180deg, rgba(42, 37, 79, 0.58), rgba(10, 10, 18, 0.15));
}

.tarot-pet-offer-stage .exploration-pixel-monster {
    transform-origin: 50% 100%;
}

.tarot-pet-offer-message {
    margin: 12px 0 10px;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-weight: 700;
    line-height: 1.72;
    letter-spacing: 0.025em;
    text-shadow: 1px 2px 0 #000;
}

.tarot-pet-offer-message p {
    margin: 0 0 9px;
}

.tarot-pet-offer-replace {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 54px;
    margin: 4px 0 10px;
    color: #dccb9a;
    font-size: 12px;
}

.tarot-pet-offer-current {
    position: relative;
    display: grid;
    place-items: center;
    width: 58px;
    height: 50px;
    overflow: visible;
}

.tarot-pet-offer-current .exploration-pixel-monster {
    position: absolute;
    left: 50%;
    bottom: var(--exploration-monster-result-bottom, 4px);
    transform-origin: 50% 100%;
}

.tarot-pet-offer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.tarot-pet-offer-actions button {
    min-height: 45px;
    border: 9px solid transparent;
    border-image: url("./assets/ui/buttons/button-dark-large.png") 24 fill / 9px / 0 stretch;
    color: #f7e6aa;
    background: transparent;
    font: inherit;
    font-weight: 800;
}

.tarot-pet-offer-actions button:focus-visible,
.tarot-pet-offer-actions button:first-child {
    border-image-source: url("./assets/ui/buttons/button-gold-large.png");
}

.tarot-pet-offer-actions button:disabled {
    opacity: 0.58;
}

.tarot-pet-offer-status {
    min-height: 1.4em;
    margin-top: 9px;
    color: #d8e9df;
    font-size: 12px;
}

@media (max-width: 420px) {
    .tarot-pet-offer-overlay {
        padding: 8px;
    }

    .tarot-pet-offer-dialog {
        padding-inline: 10px;
    }

    .tarot-pet-offer-message {
        font-size: 13px;
    }
}

/* Tarot Kingdom owns the viewport while a match screen is open. */
body.tarot-kingdom-fullscreen {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0 !important;
    overflow: hidden !important;
    background: #020207;
}

body.tarot-kingdom-fullscreen #globalStatusBar,
body.tarot-kingdom-fullscreen #bottomNav {
    display: none !important;
}

body.tarot-kingdom-fullscreen #appWrapper {
    position: fixed !important;
    inset: 0;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    background: #020207;
}

body.tarot-kingdom-fullscreen #tabContainer,
body.tarot-kingdom-fullscreen #tabContentTarot {
    position: absolute !important;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.tarot-kingdom-fullscreen #tarotGameSelectRoot,
body.tarot-kingdom-fullscreen #tarotPokerRoot,
body.tarot-kingdom-fullscreen #tarotSpinRoot {
    display: none !important;
}

body.tarot-kingdom-preview-body.tarot-kingdom-fullscreen #tarotKingdomRoot.tarot-kingdom-root,
body.tarot-kingdom-fullscreen #tabContentTarot #tarotKingdomRoot.tarot-kingdom-root {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    width: min(100%, 640px) !important;
    max-width: 640px !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    margin: 0 auto !important;
    border: 0 !important;
    border-image: none !important;
    border-radius: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

body.tarot-kingdom-fullscreen #tabContentTarot .tarot-kingdom-header {
    padding-top: max(0px, env(safe-area-inset-top));
    padding-right: max(6px, env(safe-area-inset-right));
    padding-left: max(6px, env(safe-area-inset-left));
}

#tabContentTarot .tarot-kingdom-header-meta {
    align-items: center;
}

#tabContentTarot .tarot-kingdom-exit-button {
    margin: -11px -8px -11px 0;
}

body.tarot-kingdom-fullscreen #tabContentTarot .tarot-kingdom-exit-button {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right), calc((100vw - 640px) / 2 + 8px));
    z-index: 1200;
    pointer-events: auto;
}

/* Major Arcana secondary skills: readable impact without covering the battle. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner.is-major {
    z-index: 49;
    bottom: 24%;
    min-width: min(68%, 250px);
    padding: 6px 18px 7px;
    border-width: 1px;
    border-color: rgba(var(--tk-major-rgb, 205, 158, 255), 0.82);
    color: #fff8df;
    background:
        linear-gradient(90deg, transparent, rgba(8, 6, 17, 0.9) 16%, rgba(20, 12, 32, 0.96) 50%, rgba(8, 6, 17, 0.9) 84%, transparent);
    box-shadow:
        0 0 14px rgba(var(--tk-major-rgb, 205, 158, 255), 0.34),
        inset 0 1px rgba(255, 247, 211, 0.14);
    font-family: Georgia, "Yu Mincho", serif;
    font-size: clamp(12px, 3.4vw, 15px);
    letter-spacing: 0.08em;
    text-align: center;
    text-shadow: 0 1px 2px #000, 0 0 8px rgba(var(--tk-major-rgb, 205, 158, 255), 0.48);
    animation: tarotKingdomMajorTitle 440ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner.is-major::before,
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner.is-major::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--tk-major-rgb, 205, 158, 255), 0.9));
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner.is-major::before {
    left: 3px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner.is-major::after {
    right: 3px;
    transform: scaleX(-1);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="elemental"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="charge"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="justice"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="death"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="tower"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="sun"] {
    --tk-major-rgb: 255, 124, 70;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="holy"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="barrier"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="star"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="judgment"] {
    --tk-major-rgb: 255, 220, 122;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="nature"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="link"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="temperance"] {
    --tk-major-rgb: 89, 225, 172;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="authority"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="will"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="fortune"] {
    --tk-major-rgb: 255, 182, 70;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="silence"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="moon"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="world"] {
    --tk-major-rgb: 103, 181, 255;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="chaos"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="penance"],
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage :is(
    .tarot-kingdom-effect-banner,
    .tarot-kingdom-major-visual
)[data-major-tone="devil"] {
    --tk-major-rgb: 192, 104, 255;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-visual {
    --tk-major-rgb: 205, 158, 255;
    --tk-major-focus-x: 29%;
    position: absolute;
    z-index: 45;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(circle at var(--tk-major-focus-x) 62%, rgba(var(--tk-major-rgb), 0.25), transparent 22%),
        linear-gradient(90deg, transparent 12%, rgba(var(--tk-major-rgb), 0.06) 50%, transparent 88%);
    mix-blend-mode: screen;
    animation: tarotKingdomMajorVeil 480ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-visual[data-major-scope="party"] {
    --tk-major-focus-x: 75%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-visual[data-major-scope="both"] {
    --tk-major-focus-x: 50%;
    background:
        radial-gradient(ellipse at center 64%, rgba(var(--tk-major-rgb), 0.21), transparent 38%),
        linear-gradient(90deg, transparent 4%, rgba(var(--tk-major-rgb), 0.08) 50%, transparent 96%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-sigil {
    position: absolute;
    left: var(--tk-major-focus-x);
    top: 60%;
    width: clamp(56px, 18vw, 82px);
    aspect-ratio: 1;
    border: 1px solid rgba(var(--tk-major-rgb), 0.92);
    border-radius: 50%;
    box-shadow:
        0 0 11px rgba(var(--tk-major-rgb), 0.52),
        inset 0 0 12px rgba(var(--tk-major-rgb), 0.2);
    transform: translate(-50%, -50%) rotate(18deg);
    animation: tarotKingdomMajorSigil 480ms cubic-bezier(0.16, 0.75, 0.25, 1) both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-sigil::before,
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-sigil::after {
    content: "";
    position: absolute;
    inset: 13%;
    border: 1px solid rgba(var(--tk-major-rgb), 0.64);
    transform: rotate(45deg);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-sigil::after {
    inset: 28%;
    border-radius: 50%;
    transform: none;
    background: rgba(var(--tk-major-rgb), 0.14);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-wave {
    position: absolute;
    left: var(--tk-major-focus-x);
    top: 68%;
    width: clamp(74px, 24vw, 118px);
    height: clamp(15px, 5vw, 24px);
    border: 1px solid rgba(var(--tk-major-rgb), 0.8);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(var(--tk-major-rgb), 0.42);
    transform: translate(-50%, -50%);
    animation: tarotKingdomMajorWave 460ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-spark {
    position: absolute;
    left: var(--tk-major-focus-x);
    top: 62%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #fff9df;
    box-shadow: 0 0 7px 2px rgba(var(--tk-major-rgb), 0.82);
    animation: tarotKingdomMajorSpark 440ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-spark.is-one {
    --tk-major-spark-x: -32px;
    --tk-major-spark-y: -38px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-spark.is-two {
    --tk-major-spark-x: 28px;
    --tk-major-spark-y: -29px;
    animation-delay: 35ms;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-spark.is-three {
    --tk-major-spark-x: 8px;
    --tk-major-spark-y: -50px;
    animation-delay: 70ms;
}

@keyframes tarotKingdomMajorTitle {
    0% { opacity: 0; transform: translate(-50%, 5px) scaleX(0.86); }
    46% { opacity: 1; transform: translate(-50%, 0) scaleX(1.025); }
    100% { opacity: 0.96; transform: translate(-50%, 0) scaleX(1); }
}

@keyframes tarotKingdomMajorVeil {
    0% { opacity: 0; }
    38% { opacity: 1; }
    100% { opacity: 0.68; }
}

@keyframes tarotKingdomMajorSigil {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(-18deg) scale(0.58); }
    52% { opacity: 0.94; transform: translate(-50%, -50%) rotate(7deg) scale(1.04); }
    100% { opacity: 0.54; transform: translate(-50%, -50%) rotate(18deg) scale(1); }
}

@keyframes tarotKingdomMajorWave {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35); }
    44% { opacity: 0.88; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.46); }
}

@keyframes tarotKingdomMajorSpark {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
    34% { opacity: 1; }
    100% {
        opacity: 0;
        transform: translate(
            calc(-50% + var(--tk-major-spark-x, 0px)),
            calc(-50% + var(--tk-major-spark-y, -36px))
        ) scale(0.8);
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-effect-banner.is-major,
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-visual,
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-sigil,
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-wave,
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-spark {
        animation: none !important;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-visual {
        opacity: 0.5;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-major-spark {
        display: none;
    }
}

/* 5 skip: keep only the wet film and dripping water left after the wave. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomEnemySprite.is-area-sealed {
    box-shadow: none;
    border-radius: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-enemy-skip-soak {
    position: absolute;
    z-index: 2;
    bottom: -1%;
    left: 50%;
    width: clamp(108px, 31vw, 188px);
    height: clamp(84px, 24vw, 142px);
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transform: translateX(-50%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-enemy-skip-soak::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-enemy-skip-soak::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-enemy-skip-soak::before {
    inset: 3% 7% 8%;
    opacity: 0.76;
    background:
        radial-gradient(ellipse, rgba(240, 249, 255, 0.76) 0 5%, rgba(125, 211, 252, 0.28) 11%, transparent 34%) 24% 18% / 28% 34% no-repeat,
        radial-gradient(ellipse, rgba(224, 242, 254, 0.62) 0 4%, rgba(56, 189, 248, 0.22) 10%, transparent 32%) 72% 28% / 25% 31% no-repeat,
        radial-gradient(ellipse, rgba(186, 230, 253, 0.52) 0 4%, rgba(14, 165, 233, 0.2) 10%, transparent 34%) 38% 76% / 22% 32% no-repeat,
        linear-gradient(106deg, transparent 36%, rgba(224, 242, 254, 0.5) 47%, rgba(125, 211, 252, 0.12) 53%, transparent 64%) 52% 46% / 34% 58% no-repeat;
    filter:
        drop-shadow(0 1px 1px rgba(125, 211, 252, 0.5))
        drop-shadow(0 3px 2px rgba(14, 116, 144, 0.22));
    mask-image: radial-gradient(ellipse at 50% 54%, #000 0 48%, rgba(0, 0, 0, 0.76) 65%, transparent 84%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-enemy-skip-soak::after {
    inset: 3% 11% 0;
    opacity: 0;
    background:
        radial-gradient(circle at 13% 13%, rgba(220, 248, 255, 0.96) 0 2px, transparent 3px),
        radial-gradient(circle at 32% 4%, rgba(122, 218, 255, 0.88) 0 3px, transparent 4px),
        radial-gradient(circle at 52% 19%, rgba(224, 250, 255, 0.94) 0 2px, transparent 3px),
        radial-gradient(circle at 72% 7%, rgba(106, 207, 250, 0.9) 0 3px, transparent 4px),
        radial-gradient(circle at 90% 22%, rgba(220, 248, 255, 0.88) 0 2px, transparent 3px);
    filter: drop-shadow(0 2px 1px rgba(19, 112, 154, 0.72));
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-battle-enemy.is-area-sealed .tarot-kingdom-enemy-skip-soak {
    visibility: visible;
    opacity: 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-battle-enemy.is-area-sealed .tarot-kingdom-enemy-skip-soak::after {
    animation: tarotKingdomEnemySkipWaterDrops 1650ms ease-out infinite;
}

@keyframes tarotKingdomEnemySkipWaterDrops {
    0% { opacity: 0; transform: translateY(-10%) scale(0.92); }
    18% { opacity: 0.92; }
    74% { opacity: 0.58; }
    100% { opacity: 0; transform: translateY(18%) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-battle-enemy.is-area-sealed .tarot-kingdom-enemy-skip-soak,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-battle-enemy.is-area-sealed .tarot-kingdom-enemy-skip-soak::before,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-battle-enemy.is-area-sealed .tarot-kingdom-enemy-skip-soak::after {
        animation: none;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 .tarot-kingdom-battle-enemy.is-area-sealed .tarot-kingdom-enemy-skip-soak {
        opacity: 0.48;
    }
}

/* Keep the judgment decline action readable on the dark graveyard panel. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomJudgmentSkipButton {
    color: #f8fafc;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomJudgmentSkipButton:disabled {
    color: rgba(248, 250, 252, 0.62);
}

/* Local turn cue: a restrained, persistent edge light marks available input. */
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert {
    position: fixed;
    z-index: 3650;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    border: 2px solid rgba(250, 219, 120, 0);
    box-shadow: none;
    transition: opacity 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert::before,
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert::after {
    content: "";
    position: absolute;
    right: 12%;
    left: 12%;
    height: 2px;
    opacity: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 237, 172, 0.92), transparent);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.7);
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert::before {
    top: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert::after {
    bottom: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert.is-active {
    visibility: visible;
    opacity: 1;
    border-color: rgba(250, 219, 120, 0.78);
    box-shadow:
        inset 0 0 18px -12px rgba(250, 204, 21, 0.72),
        inset 0 0 40px -28px rgba(255, 239, 177, 0.88);
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert.is-active::before,
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert.is-active::after {
    opacity: 0.9;
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert.is-active {
        opacity: 1;
        border-color: rgba(250, 219, 120, 0.78);
        box-shadow:
            inset 0 0 18px -12px rgba(250, 204, 21, 0.72),
            inset 0 0 40px -28px rgba(255, 239, 177, 0.88);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert.is-active::before,
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-turn-alert.is-active::after {
        opacity: 0.9;
    }
}

/* A skipped local player gets two brief light pulses without reusing the turn shutters. */
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-skip-flash {
    position: fixed;
    z-index: 3651;
    inset: 0;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    background:
        radial-gradient(ellipse at 50% 48%, rgba(255, 255, 255, 0.3), rgba(125, 211, 252, 0.12) 36%, transparent 68%);
    border: 2px solid rgba(224, 242, 254, 0);
    box-shadow: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-skip-flash.is-show {
    visibility: visible;
    animation: tarotKingdomLocalSkipDoubleFlash 760ms linear both;
}

@keyframes tarotKingdomLocalSkipDoubleFlash {
    0%, 24%, 48%, 72%, 100% {
        opacity: 0;
        border-color: rgba(224, 242, 254, 0);
        box-shadow: none;
    }
    10%, 58% {
        opacity: 0.88;
        border-color: rgba(240, 249, 255, 0.92);
        box-shadow:
            inset 0 0 34px rgba(125, 211, 252, 0.82),
            inset 0 0 72px rgba(255, 255, 255, 0.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-local-skip-flash.is-show {
        opacity: 0.58;
        border-color: rgba(224, 242, 254, 0.84);
        box-shadow: inset 0 0 32px rgba(125, 211, 252, 0.58);
        animation: none !important;
    }
}

/* Judgment recovery: local grave close control and shared card-to-avatar motion. */
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-judgment {
    position: relative;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-judgment-close {
    position: absolute;
    z-index: 3;
    top: 0;
    right: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-judgment-close[hidden] {
    display: none !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-judgment-title {
    padding-right: 58px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-battle-player {
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-judgment-reclaim-card {
    --tarot-card-w: 50px;
    --tarot-card-h: 82px;
    position: absolute;
    z-index: 24;
    top: 50%;
    left: 35px;
    width: 50px !important;
    min-width: 50px !important;
    height: 82px !important;
    min-height: 82px !important;
    margin: 0;
    pointer-events: none;
    opacity: 0;
    transform-origin: 50% 50%;
    animation: tarotKingdomJudgmentReclaim 1100ms cubic-bezier(0.22, 0.72, 0.2, 1) both;
    animation-delay: var(--tk-judgment-reclaim-delay, 0ms);
    filter: none;
    image-rendering: pixelated;
    box-shadow: 0 0 0 1px rgba(255, 223, 132, 0.72), 0 0 7px rgba(255, 223, 132, 0.76);
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-judgment-reclaim-card .tarot-card-art {
    left: 50%;
    top: 50%;
    width: 48px;
    height: 80px;
    transform: translate(-50%, -50%);
    transform-origin: 50% 50%;
    image-rendering: pixelated;
}

/* The enemy occupies the plane between party seats 2 and 3. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-party-side {
    z-index: auto;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomBattleStage .tarot-kingdom-battle-enemy {
    z-index: 25;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomBattleParty > .tarot-kingdom-battle-player.is-covering-ally {
    z-index: 70;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomBattleStage .tarot-kingdom-battle-player-avatar.is-cover-interposing {
    z-index: 72;
    will-change: translate;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomBattleStage .tarot-kingdom-battle-player.is-covering-ally
    > .tarot-kingdom-player-damage-number {
    translate: var(--tk-cover-offset-x, 0) var(--tk-cover-offset-y, 0);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomBattleStage .tarot-kingdom-cover-callout {
    position: absolute;
    z-index: 74;
    top: 6px;
    left: 14px;
    padding: 2px 8px 3px;
    border: 1px solid rgba(255, 231, 154, 0.82);
    border-radius: 3px;
    color: #fff6cf;
    background: linear-gradient(180deg, rgba(66, 91, 123, 0.94), rgba(15, 27, 47, 0.94));
    box-shadow: 0 0 0 1px rgba(8, 13, 24, 0.82), 0 2px 8px rgba(0, 0, 0, 0.6);
    font: 800 11px/1.1 Georgia, "Times New Roman", serif;
    letter-spacing: 0.12em;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
    opacity: 0;
    animation: tarotKingdomCoverCallout var(--tk-cover-duration, 900ms) ease-out both;
    animation-delay: var(--tk-cover-delay, 0ms);
}

@keyframes tarotKingdomCoverCallout {
    0%, 6% {
        opacity: 0;
        transform: translateY(5px) scale(0.94);
    }
    14%, 62% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    78%, 100% {
        opacity: 0;
        transform: translateY(-3px) scale(1);
    }
}

@keyframes tarotKingdomJudgmentReclaim {
    0% {
        opacity: 0;
        transform: translate(-72px, -50%) scale(0.75);
    }
    14% {
        opacity: 1;
        transform: translate(-62px, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-62px, -50%) scale(1);
    }
    78% {
        opacity: 1;
        box-shadow: 0 0 0 1px rgba(255, 236, 173, 0.92), 0 0 12px rgba(255, 230, 148, 0.96);
    }
    92% {
        opacity: 0.72;
        transform: translate(0, -50%) scale(0.16);
    }
    100% {
        opacity: 0;
        transform: translate(0, -50%) scale(0);
        box-shadow: 0 0 0 1px rgba(255, 239, 181, 0.52), 0 0 3px rgba(255, 239, 181, 0.62);
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage .tarot-kingdom-judgment-reclaim-card {
        animation-name: tarotKingdomJudgmentReclaimReduced;
    }
}

@keyframes tarotKingdomJudgmentReclaimReduced {
    0%, 72% {
        opacity: 1;
        transform: translate(-62px, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-62px, -50%) scale(1);
    }
}

/* Keep selected hand cards on whole-pixel axes so the sprite sheet stays sharp. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-selected {
    transform: translateY(-9px) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2 #tarotKingdomHand > .tarot-card.is-selected .tarot-card-art {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Direct hand reordering: tap selects, a short pointer drag moves the card. */
:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-clickable {
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand.is-reordering > .tarot-card {
    transition: box-shadow 90ms ease, filter 90ms ease;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-kingdom-hand-drop-gap {
    box-sizing: border-box;
    width: var(--tk-hand-gap-width, var(--tk-hand-card-width, 45px));
    height: var(--tk-hand-gap-height, calc(var(--tk-hand-card-width, 45px) / 0.6));
    min-width: 0;
    margin: 0;
    pointer-events: none;
    border: 1px dashed rgba(255, 226, 151, 0.86);
    border-radius: 3px;
    background:
        linear-gradient(180deg, rgba(255, 236, 174, 0.08), rgba(255, 216, 112, 0.025));
    box-shadow:
        inset 0 0 0 1px rgba(63, 43, 13, 0.72),
        0 0 8px rgba(255, 198, 72, 0.24);
    animation: tarotKingdomHandDropGapAppear 120ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-dragging {
    position: fixed !important;
    z-index: 30;
    left: var(--tk-hand-drag-left, 0);
    top: var(--tk-hand-drag-top, 0);
    width: var(--tk-hand-drag-width, var(--tk-hand-card-width, 45px)) !important;
    height: var(--tk-hand-drag-height, auto) !important;
    margin: 0 !important;
    cursor: grabbing;
    opacity: 0.96;
    transform: none !important;
    translate: var(--tk-hand-drag-x, 0) var(--tk-hand-drag-y, 0);
    scale: 1.06;
    box-shadow:
        0 13px 14px rgba(0, 0, 0, 0.72),
        0 0 0 2px rgba(255, 230, 153, 0.94) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-drop-before {
    box-shadow:
        -4px 0 0 #ffe7a1,
        -7px 0 8px rgba(255, 198, 72, 0.72),
        0 4px 6px rgba(0, 0, 0, 0.56) !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-card.is-drop-after {
    box-shadow:
        4px 0 0 #ffe7a1,
        7px 0 8px rgba(255, 198, 72, 0.72),
        0 4px 6px rgba(0, 0, 0, 0.56) !important;
}

@keyframes tarotKingdomHandDropGapAppear {
    from {
        opacity: 0;
        border-color: rgba(255, 226, 151, 0.28);
    }
    to {
        opacity: 1;
        border-color: rgba(255, 226, 151, 0.86);
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomHand > .tarot-kingdom-hand-drop-gap {
        animation: none !important;
    }
}

/* Judgment cannot reclaim a card discarded by the chooser. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomJudgmentOptions .tarot-card.is-judgment-ineligible {
    cursor: not-allowed;
    opacity: 0.38;
    filter: grayscale(1) saturate(0) brightness(0.58) !important;
    box-shadow:
        inset 0 0 0 1px rgba(148, 163, 184, 0.16),
        0 2px 3px rgba(0, 0, 0, 0.52) !important;
}

/* Call: show that the existing field card becomes the first card of the five-card role. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-call-source {
    overflow: visible !important;
    outline: 2px solid rgba(250, 204, 21, 0.9);
    outline-offset: 1px;
    animation-name: tarotKingdomCallSourceLift !important;
    animation-duration: 190ms !important;
    animation-timing-function: cubic-bezier(0.2, 0.82, 0.24, 1) !important;
    animation-fill-mode: both !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-call-reused {
    overflow: visible !important;
    outline: 2px solid rgba(250, 204, 21, 0.72);
    outline-offset: 1px;
    animation-name: tarotKingdomCallReuseSettle !important;
    animation-duration: 460ms !important;
    animation-timing-function: cubic-bezier(0.2, 0.82, 0.24, 1) !important;
    animation-fill-mode: both !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-call-arriving {
    animation-name: tarotKingdomCallCardFromRight !important;
    animation-timing-function: cubic-bezier(0.2, 0.82, 0.24, 1) !important;
    animation-fill-mode: forwards !important;
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
        #tarotKingdomTrick > .tarot-card:is(.is-call-source, .is-call-reused, .is-call-arriving) {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Final cascade override: a call retains its first card but follows the completed role choreography. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-from-right {
    animation-name: tarotKingdomRoleCardFromRight !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-from-top {
    animation-name: tarotKingdomRoleCardFromTop !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-fade {
    animation-name: tarotKingdomRoleCardFade !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-slam {
    animation-name: tarotKingdomRoleCardSlam !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-orbit {
    animation-name: tarotKingdomRoleCardOrbit !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-fan-left {
    animation-name: tarotKingdomRoleCardFanLeft !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-fan-right {
    animation-name: tarotKingdomRoleCardFanRight !important;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
    #tarotKingdomTrick > .tarot-card.is-role-arriving.is-role-entry-converge {
    animation-name: tarotKingdomRoleCardConverge !important;
}

/* Regeneration remains readable without covering the avatar or its equipment. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-regen-aura {
    grid-area: avatar;
    align-self: end;
    justify-self: end;
    z-index: 1;
    width: 54px;
    height: 66px;
    border-radius: 44% 44% 38% 38%;
    opacity: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 52% 52%,
            rgba(197, 255, 205, 0.38) 0 24%,
            rgba(100, 255, 139, 0.3) 42%,
            rgba(55, 218, 105, 0.12) 62%,
            transparent 78%);
    filter: blur(4px);
    transform: scale(0.84);
    transform-origin: 50% 72%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-player.has-regen:not(.is-ko)
    > .tarot-kingdom-regen-aura {
    animation: tarotKingdomRegenAura 1500ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage
    .tarot-kingdom-heal-number {
    opacity: 0;
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage
    .tarot-kingdom-heal-number.is-show {
    animation: tarotKingdomHealNumber 680ms ease-out both;
}

:is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage
    .tarot-kingdom-heal-number.is-regen {
    color: #b8ffc7;
    font-size: clamp(12px, 3.4vw, 17px);
    text-shadow:
        0 1px #052a12,
        0 0 6px rgba(116, 255, 151, 0.88),
        0 0 13px rgba(63, 227, 111, 0.62);
}

@keyframes tarotKingdomRegenAura {
    0%, 100% { opacity: 0.38; transform: scale(0.84); }
    50% { opacity: 0.68; transform: scale(1.02); }
}

@keyframes tarotKingdomHealNumber {
    0% { opacity: 0; transform: translateY(8px) scale(0.86); }
    24% { opacity: 1; transform: translateY(-2px) scale(1.12); }
    72% { opacity: 1; transform: translateY(-9px) scale(1); }
    100% { opacity: 0; transform: translateY(-18px) scale(0.94); }
}

/* AP and compact player ailments share the row below the hand count without shifting party rows. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-tray {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    min-height: 16px;
    max-height: 34px;
    gap: 2px;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-player-info
    > .tarot-kingdom-battle-status-tray {
    width: 100%;
    min-height: 12px;
    max-height: 25px;
    gap: 1px;
    justify-content: flex-start;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-player-info
    > .tarot-kingdom-battle-status-tray
    > .tarot-kingdom-battle-ap {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 27px;
    height: 12px;
    padding: 0 3px;
    border: 1px solid rgba(125, 211, 252, 0.78);
    border-radius: 3px;
    background: rgba(8, 47, 73, 0.88);
    color: #e0f2fe;
    font-size: 8px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 0 4px rgba(56, 189, 248, 0.24);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-player-info
    > .tarot-kingdom-battle-status-tray
    > .tarot-kingdom-battle-ap[hidden] {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-player-info
    > .tarot-kingdom-battle-status-tray
    > .tarot-kingdom-battle-status-icon {
    flex-basis: 12px;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon,
:is(body, #tabContentTarot) #tarotKingdomRoot
    .tarot-kingdom-status-detail-row > .tarot-kingdom-battle-status-icon {
    box-sizing: border-box;
    flex: 0 0 15px;
    width: 15px;
    min-width: 0;
    height: 15px;
    min-height: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(240, 226, 182, 0.82);
    border-radius: 4px;
    background-color: rgba(3, 7, 15, 0.9);
    background-image: url("./Sprites/items/icons.png");
    background-repeat: no-repeat;
    background-size: 1600% 6400%;
    image-rendering: pixelated;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.82);
    cursor: pointer;
    appearance: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon.is-status-sprite,
:is(body, #tabContentTarot) #tarotKingdomRoot
    .tarot-kingdom-status-detail-row > .tarot-kingdom-battle-status-icon.is-status-sprite {
    background-color: rgba(3, 7, 15, 0.82);
    background-repeat: no-repeat;
    image-rendering: pixelated;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon.is-modifier,
:is(body, #tabContentTarot) #tarotKingdomRoot
    .tarot-kingdom-status-detail-row > .tarot-kingdom-battle-status-icon.is-modifier {
    --tk-modifier-frame: #78e7f5;
    --tk-modifier-marker: #baf8ff;
    border-color: var(--tk-modifier-frame);
    background-color: #061b25;
    box-shadow:
        inset 0 0 0 1px rgba(136, 234, 255, 0.16),
        0 1px 2px rgba(0, 0, 0, 0.82),
        0 0 4px rgba(72, 218, 240, 0.38);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon.is-debuff,
:is(body, #tabContentTarot) #tarotKingdomRoot
    .tarot-kingdom-status-detail-row > .tarot-kingdom-battle-status-icon.is-debuff {
    --tk-modifier-frame: #ff858e;
    --tk-modifier-marker: #ffb0b5;
    background-color: #2a080f;
    box-shadow:
        inset 0 0 0 1px rgba(255, 130, 139, 0.14),
        0 1px 2px rgba(0, 0, 0, 0.82),
        0 0 4px rgba(255, 92, 106, 0.38);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon.is-special,
:is(body, #tabContentTarot) #tarotKingdomRoot
    .tarot-kingdom-status-detail-row > .tarot-kingdom-battle-status-icon.is-special {
    --tk-modifier-frame: #f2cf72;
    --tk-modifier-marker: #fff0ae;
    background-color: #211907;
    box-shadow:
        inset 0 0 0 1px rgba(255, 225, 139, 0.14),
        0 1px 2px rgba(0, 0, 0, 0.82),
        0 0 4px rgba(237, 196, 89, 0.34);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon.is-modifier[data-direction]::after,
:is(body, #tabContentTarot) #tarotKingdomRoot
    .tarot-kingdom-status-detail-row > .tarot-kingdom-battle-status-icon.is-modifier[data-direction]::after {
    content: "";
    position: absolute;
    z-index: 1;
    top: 1px;
    right: 1px;
    width: 4px;
    height: 4px;
    pointer-events: none;
    background: var(--tk-modifier-marker);
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.8));
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon.is-modifier[data-direction="-1"]::after,
:is(body, #tabContentTarot) #tarotKingdomRoot
    .tarot-kingdom-status-detail-row > .tarot-kingdom-battle-status-icon.is-modifier[data-direction="-1"]::after {
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-tray.is-enemy {
    position: absolute;
    z-index: 36;
    top: 126px;
    left: 10px;
    width: min(156px, calc(100% - 12px));
    min-height: 17px;
    max-height: 36px;
    align-content: flex-start;
    justify-content: flex-start;
    margin: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="poison"] { border-color: #7de85c; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="burn"] { border-color: #ff7944; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="paralysis"] { border-color: #ffe85c; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="sleep"] { border-color: #bca5ff; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="freeze"] { border-color: #b9f2ff; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="blind"] { border-color: #70558f; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="fear"] { border-color: #b46be0; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="confusion"] { border-color: #ed89ff; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="wet"] { border-color: #67d5ff; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="petrify"] { border-color: #c8d0cc; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="seal"] { border-color: #f3d9ff; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="curse"] { border-color: #a865d1; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="vulnerable"] { border-color: #ff6661; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="slow"] { border-color: #a4e4ff; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-battle-status-icon[data-status="silence"] { border-color: #8aadd0; }

/* Status color and motion remain primary; compact accents stay close to the actor for quick recognition. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-status-accent, .tarot-kingdom-shield-ring) {
    position: absolute;
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent {
    z-index: 6;
    inset: 10% 20% 8% 14%;
    overflow: visible;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent.is-enemy {
    inset: 8% 15% 7%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[hidden],
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-shield-ring[hidden] {
    display: none;
}

/* The pixelfx status loop replaces the accent while it runs; reduced motion has no loop and keeps it. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage [data-pixel-status] > .tarot-kingdom-status-accent {
    visibility: hidden;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent::after {
    position: absolute;
    content: "";
    opacity: 0.84;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="paralysis"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="paralysis"]::after {
    top: 28%;
    width: 5px;
    height: 14px;
    background: #fff36b;
    clip-path: polygon(52% 0, 100% 0, 67% 38%, 100% 38%, 23% 100%, 43% 54%, 8% 54%);
    filter: drop-shadow(0 0 2px rgba(255, 238, 62, 0.9));
    animation: tarotKingdomStatusSpark 760ms steps(2, end) infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="paralysis"]::before { left: 5%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="paralysis"]::after { right: 3%; transform: scaleX(-1); animation-delay: -320ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="sleep"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="sleep"]::after {
    border: 1px solid rgba(211, 196, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(158, 128, 255, 0.62);
    animation: tarotKingdomStatusFloat 2100ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="sleep"]::before { top: 5%; right: 4%; width: 5px; height: 5px; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="sleep"]::after { top: 19%; right: 16%; width: 3px; height: 3px; animation-delay: -800ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="freeze"]::before {
    right: 4%;
    bottom: 2%;
    left: 4%;
    height: 6px;
    border-bottom: 2px solid rgba(201, 249, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(101, 215, 255, 0.45);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="freeze"]::after {
    right: 12%;
    bottom: 4%;
    width: 5px;
    height: 5px;
    border: 1px solid rgba(225, 253, 255, 0.9);
    transform: rotate(45deg);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="burn"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="burn"]::after {
    bottom: 3%;
    width: 6px;
    height: 10px;
    border-radius: 70% 30% 60% 40%;
    background: rgba(255, 144, 33, 0.88);
    box-shadow: 0 0 4px rgba(255, 75, 22, 0.7);
    transform: rotate(18deg);
    animation: tarotKingdomStatusFlame 740ms ease-in-out infinite alternate;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="burn"]::before { left: 17%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="burn"]::after { right: 13%; height: 7px; animation-delay: -370ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="poison"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="poison"]::after {
    bottom: 8%;
    width: 5px;
    height: 5px;
    border: 1px solid rgba(164, 255, 97, 0.88);
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(86, 216, 54, 0.62);
    animation: tarotKingdomStatusFloat 1700ms ease-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="poison"]::before { left: 8%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="poison"]::after { right: 5%; width: 3px; height: 3px; animation-delay: -650ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="blind"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="blind"]::after {
    inset: -4% -8% -2%;
    border-radius: 44% 52% 46% 55%;
    background:
        radial-gradient(ellipse at 48% 23%, rgba(5, 2, 10, 0.44) 0 25%, transparent 66%),
        radial-gradient(ellipse at 40% 56%, rgba(10, 4, 17, 0.38) 0 34%, transparent 74%),
        radial-gradient(ellipse at 58% 82%, rgba(1, 1, 5, 0.42) 0 27%, transparent 70%);
    filter: blur(2px);
    animation: tarotKingdomStatusMist 1900ms ease-in-out infinite alternate;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="blind"]::after {
    inset: 6% -2% -5% 4%;
    opacity: 0.48;
    animation-delay: -950ms;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="fear"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="fear"]::after {
    top: 20%;
    width: 3px;
    height: 9px;
    border-radius: 50%;
    background: rgba(187, 103, 228, 0.74);
    box-shadow: 0 0 4px rgba(102, 34, 153, 0.7);
    animation: tarotKingdomStatusTremor 520ms steps(2, end) infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="fear"]::before { left: 4%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="fear"]::after { right: 4%; animation-delay: -260ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="confusion"]::before {
    top: 4%;
    left: 35%;
    width: 30%;
    height: 9px;
    border-top: 2px solid rgba(255, 135, 239, 0.86);
    border-right: 1px solid rgba(121, 202, 255, 0.82);
    border-radius: 50%;
    animation: tarotKingdomStatusConfusionSway 1200ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="wet"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="wet"]::after {
    top: 19%;
    width: 4px;
    height: 7px;
    border-radius: 70% 30% 65% 35%;
    background: rgba(145, 226, 255, 0.72);
    transform: rotate(35deg);
    animation: tarotKingdomStatusDrop 1450ms ease-in infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="wet"]::before { left: 7%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="wet"]::after { right: 6%; animation-delay: -720ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="petrify"]::before {
    bottom: 5%;
    left: 34%;
    width: 32%;
    height: 15px;
    background: rgba(225, 232, 228, 0.7);
    clip-path: polygon(45% 0, 64% 0, 54% 37%, 78% 46%, 42% 100%, 49% 60%, 25% 49%);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="seal"]::before {
    top: 35%;
    left: 38%;
    width: 24%;
    aspect-ratio: 1;
    border: 1px solid rgba(233, 199, 255, 0.86);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(191, 111, 247, 0.58);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="curse"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="curse"]::after {
    bottom: 10%;
    width: 5px;
    height: 5px;
    background: rgba(175, 76, 220, 0.78);
    box-shadow: 0 0 4px rgba(88, 23, 128, 0.78);
    transform: rotate(45deg);
    animation: tarotKingdomStatusPulse 1300ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="curse"]::before { left: 12%; }
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="curse"]::after { right: 10%; animation-delay: -650ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="vulnerable"]::before {
    top: 40%;
    left: 42%;
    width: 9px;
    height: 9px;
    border-right: 2px solid rgba(255, 110, 92, 0.88);
    border-bottom: 2px solid rgba(255, 110, 92, 0.88);
    transform: rotate(45deg);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="slow"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="slow"]::after {
    top: 48%;
    right: 4%;
    width: 9px;
    height: 1px;
    background: rgba(177, 231, 255, 0.8);
    box-shadow: 0 5px rgba(177, 231, 255, 0.54);
    animation: tarotKingdomStatusTrail 1600ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="slow"]::after { top: 64%; right: 13%; width: 6px; animation-delay: -800ms; }

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="silence"]::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="silence"]::after {
    top: 50%;
    left: 50%;
    width: 58%;
    height: 2px;
    border-radius: 2px;
    background: rgba(218, 238, 252, 0.94);
    box-shadow: 0 0 1px rgba(13, 31, 48, 0.95), 0 0 4px rgba(87, 143, 186, 0.84);
    transform: translate(-50%, -50%) rotate(45deg);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="silence"]::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-status-accent[data-status="weaken"]::before {
    top: 45%;
    left: 45%;
    width: 7px;
    height: 7px;
    border-right: 2px solid rgba(255, 164, 101, 0.78);
    border-bottom: 2px solid rgba(255, 164, 101, 0.78);
    transform: rotate(45deg);
    animation: tarotKingdomStatusDrop 1600ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-shield-ring {
    --tk-shield-gold: rgba(255, 224, 151, 0.94);
    --tk-shield-lead: rgba(238, 211, 151, 0.58);
    z-index: 8;
    left: 50%;
    bottom: 3%;
    width: 74%;
    height: 86%;
    overflow: hidden;
    border: 2px solid var(--tk-shield-gold);
    border-radius: 50% 50% 28% 28% / 38% 38% 62% 62%;
    background:
        linear-gradient(62deg, transparent 0 47%, var(--tk-shield-lead) 48% 50%, transparent 51%),
        linear-gradient(-62deg, transparent 0 47%, var(--tk-shield-lead) 48% 50%, transparent 51%),
        linear-gradient(90deg, transparent 0 49%, rgba(255, 235, 184, 0.52) 50%, transparent 51%),
        radial-gradient(circle at 28% 28%, rgba(123, 230, 255, 0.38), transparent 34%),
        radial-gradient(circle at 72% 44%, rgba(143, 111, 230, 0.34), transparent 38%),
        linear-gradient(145deg, rgba(95, 216, 255, 0.24), rgba(97, 75, 190, 0.22) 56%, rgba(255, 203, 105, 0.12));
    box-shadow:
        inset 0 0 8px rgba(204, 246, 255, 0.44),
        inset 0 -7px 10px rgba(64, 40, 137, 0.22),
        0 0 5px rgba(255, 220, 142, 0.7),
        0 0 12px rgba(80, 196, 255, 0.38);
    clip-path: polygon(50% 0, 82% 10%, 100% 36%, 92% 76%, 50% 100%, 8% 76%, 0 36%, 18% 10%);
    transform: translateX(-50%);
    opacity: 0.4;
    animation: tarotKingdomShieldGlass 3200ms ease-in-out infinite;
    transition: opacity 240ms ease-out;
}

/* While a heal or buff effect plays on the actor, the lasting shield steps back so the effect reads. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage [data-pixel-fx-active] > .tarot-kingdom-shield-ring {
    opacity: 0.1;
    animation: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-shield-ring::before,
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-shield-ring::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-shield-ring::before {
    inset: 7%;
    border: 1px solid rgba(255, 235, 181, 0.58);
    border-radius: inherit;
    background:
        linear-gradient(31deg, transparent 0 48%, rgba(241, 216, 159, 0.4) 49% 51%, transparent 52%),
        linear-gradient(-31deg, transparent 0 48%, rgba(241, 216, 159, 0.4) 49% 51%, transparent 52%);
    clip-path: inherit;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-shield-ring::after {
    top: 43%;
    left: 50%;
    width: 16%;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 239, 192, 0.88);
    background: linear-gradient(135deg, rgba(232, 250, 255, 0.86), rgba(119, 196, 255, 0.5) 48%, rgba(150, 107, 224, 0.62));
    box-shadow:
        0 0 4px rgba(235, 250, 255, 0.92),
        0 0 8px rgba(117, 199, 255, 0.68);
    transform: translate(-50%, -50%) rotate(45deg);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, .tarot-kingdom-battle-enemy-sprite).is-avatar-damaged
    > .tarot-kingdom-shield-ring:not([hidden]) {
    animation: tarotKingdomShieldGlassImpact 300ms ease-out 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, .tarot-kingdom-battle-enemy-sprite).is-avatar-damaged
    > .tarot-kingdom-shield-ring:not([hidden])::before {
    background:
        linear-gradient(72deg, transparent 0 56%, rgba(239, 249, 255, 0.92) 57% 58%, transparent 59%),
        linear-gradient(18deg, transparent 0 60%, rgba(239, 249, 255, 0.82) 61% 62%, transparent 63%),
        linear-gradient(31deg, transparent 0 48%, rgba(241, 216, 159, 0.48) 49% 51%, transparent 52%),
        linear-gradient(-31deg, transparent 0 48%, rgba(241, 216, 159, 0.48) 49% 51%, transparent 52%);
    animation: tarotKingdomShieldGlassCrack 300ms ease-out 1;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage .tarot-kingdom-shield-ring.is-enemy {
    bottom: 5%;
    width: 80%;
    height: 82%;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status] {
    --tk-status-outline: rgba(202, 219, 233, 0.58);
    --tk-status-color-adjust: saturate(0.9);
    --tk-status-ground-shadow: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.76));
    filter:
        var(--tk-status-ground-shadow)
        var(--tk-status-color-adjust)
        drop-shadow(0 0 1px var(--tk-status-outline));
    will-change: filter, translate;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage #tarotKingdomEnemySprite[data-combat-status] {
    --tk-status-ground-shadow: drop-shadow(0 7px 4px rgba(0, 0, 0, 0.82));
}

/* A pixelfx status loop draws the status on the sprite itself, so the CSS tint and outline stand down. */
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status][data-pixel-status] {
    filter: var(--tk-status-ground-shadow);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="poison"] {
    --tk-status-outline: rgba(137, 241, 75, 0.62);
    --tk-status-color-adjust: sepia(0.22) hue-rotate(48deg) saturate(1.45) brightness(0.88);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="burn"] {
    --tk-status-outline: rgba(255, 181, 57, 0.68);
    --tk-status-color-adjust: sepia(0.3) saturate(1.55) contrast(1.08) brightness(1.06);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="blind"] {
    --tk-status-outline: rgba(93, 66, 143, 0.62);
    --tk-status-color-adjust: saturate(0.58) brightness(0.72) contrast(1.14);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="paralysis"] {
    --tk-status-outline: rgba(255, 246, 107, 0.72);
    --tk-status-color-adjust: saturate(0.82) contrast(1.18) brightness(1.1);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="sleep"] {
    --tk-status-outline: rgba(188, 169, 255, 0.58);
    --tk-status-color-adjust: saturate(0.56) hue-rotate(12deg) brightness(0.76);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="freeze"] {
    --tk-status-outline: rgba(213, 251, 255, 0.72);
    --tk-status-color-adjust: grayscale(0.3) sepia(0.12) hue-rotate(145deg) saturate(1.5) brightness(1.08) contrast(1.12);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="fear"] {
    --tk-status-outline: rgba(175, 92, 224, 0.62);
    --tk-status-color-adjust: saturate(0.56) hue-rotate(12deg) brightness(0.68) contrast(1.12);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="confusion"] {
    --tk-status-outline: rgba(255, 128, 239, 0.64);
    --tk-status-color-adjust: saturate(1.6) hue-rotate(18deg) contrast(1.08);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="wet"] {
    --tk-status-outline: rgba(190, 242, 255, 0.66);
    --tk-status-color-adjust: sepia(0.1) hue-rotate(150deg) saturate(1.25) brightness(0.92);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="petrify"] {
    --tk-status-outline: rgba(216, 226, 222, 0.64);
    --tk-status-color-adjust: grayscale(1) sepia(0.12) contrast(1.28) brightness(0.7);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="seal"] {
    --tk-status-outline: rgba(228, 190, 255, 0.62);
    --tk-status-color-adjust: saturate(0.72) hue-rotate(15deg) contrast(1.08);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="curse"] {
    --tk-status-outline: rgba(160, 74, 209, 0.64);
    --tk-status-color-adjust: saturate(0.72) hue-rotate(18deg) brightness(0.58) contrast(1.25);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="vulnerable"] {
    --tk-status-outline: rgba(255, 105, 86, 0.68);
    --tk-status-color-adjust: sepia(0.18) saturate(1.38) contrast(1.14);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="slow"] {
    --tk-status-outline: rgba(181, 234, 255, 0.6);
    --tk-status-color-adjust: saturate(0.62) hue-rotate(145deg) brightness(0.86);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="silence"] {
    --tk-status-outline: rgba(150, 201, 240, 0.6);
    --tk-status-color-adjust: saturate(0.44) hue-rotate(154deg) brightness(0.74);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-combat-status="weaken"] {
    --tk-status-outline: rgba(255, 164, 101, 0.6);
    --tk-status-color-adjust: saturate(0.58) brightness(0.7) contrast(1.04);
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-status-motion="interrupt"]:not(.is-avatar-attacking):not(.is-attacking):not(.is-hurt):not(.is-avatar-damaged):not(.is-cover-interposing) {
    animation: tarotKingdomActorParalysis 1600ms steps(1, end) infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-status-motion="drowsy"]:not(.is-avatar-attacking):not(.is-attacking):not(.is-cover-interposing) {
    animation: tarotKingdomActorDrowsy 2400ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-status-motion="tremble"]:not(.is-avatar-attacking):not(.is-attacking):not(.is-hurt):not(.is-cover-interposing) {
    animation: tarotKingdomActorTremble 440ms steps(2, end) infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    .tarot-kingdom-battle-player-avatar[data-status-motion="unstable"]:not(.is-avatar-attacking):not(.is-attacking):not(.is-hurt):not(.is-cover-interposing) {
    animation: tarotKingdomActorConfusion 1800ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-status-motion="agitated"]:not(.is-avatar-attacking):not(.is-attacking):not(.is-hurt):not(.is-cover-interposing) {
    animation: tarotKingdomActorBurn 760ms steps(2, end) infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-status-motion="burdened"]:not(.is-avatar-attacking):not(.is-attacking):not(.is-cover-interposing),
:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage
    :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-status-motion="weakened"]:not(.is-avatar-attacking):not(.is-attacking):not(.is-cover-interposing) {
    animation: tarotKingdomActorBurdened 2100ms ease-in-out infinite;
}

:is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
    #tarotKingdomBattleStage [data-status-motion="stopped"] .avatar-layer {
    animation-play-state: paused;
}

@keyframes tarotKingdomActorParalysis {
    0%, 43%, 67%, 100% { translate: 0 0; }
    46%, 55% { translate: -1px 0; }
    49%, 61% { translate: 1px -1px; }
    52%, 64% { translate: -1px 1px; }
}

@keyframes tarotKingdomActorDrowsy {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 2px; }
}

@keyframes tarotKingdomActorTremble {
    0%, 100% { translate: -1px 0; }
    50% { translate: 1px 0; }
}

@keyframes tarotKingdomActorConfusion {
    0%, 100% { translate: 0 0; }
    22% { translate: -2px 0; }
    48% { translate: 2px 0; }
    72% { translate: -1px 0; }
    88% { translate: 2px 0; }
}

@keyframes tarotKingdomActorBurn {
    0%, 100% { translate: 0 0; }
    45% { translate: 0 -1px; }
    55% { translate: 1px 0; }
}

@keyframes tarotKingdomActorBurdened {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 1px; }
}

@keyframes tarotKingdomStatusSpark {
    0%, 34%, 67%, 100% { opacity: 0.18; scale: 0.82; }
    38%, 55%, 72%, 88% { opacity: 0.92; scale: 1; }
}

@keyframes tarotKingdomStatusFloat {
    0% { opacity: 0; translate: 0 4px; }
    35%, 70% { opacity: 0.78; }
    100% { opacity: 0; translate: 0 -7px; }
}

@keyframes tarotKingdomStatusFlame {
    from { opacity: 0.48; scale: 0.84 0.9; translate: 0 1px; }
    to { opacity: 0.9; scale: 1 1.08; translate: 0 -1px; }
}

@keyframes tarotKingdomStatusTremor {
    0%, 100% { translate: -1px 0; }
    50% { translate: 1px 1px; }
}

@keyframes tarotKingdomStatusConfusionSway {
    0%, 100% { translate: -3px 0; }
    50% { translate: 3px 0; }
}

@keyframes tarotKingdomStatusMist {
    0% { opacity: 0.3; scale: 0.96 1; translate: -1px 0; }
    55% { opacity: 0.48; scale: 1.03 0.98; translate: 1px -1px; }
    100% { opacity: 0.36; scale: 1 1.03; translate: 0 1px; }
}

@keyframes tarotKingdomStatusDrop {
    0% { opacity: 0; translate: 0 -4px; }
    35%, 75% { opacity: 0.78; }
    100% { opacity: 0; translate: 0 5px; }
}

@keyframes tarotKingdomStatusPulse {
    0%, 100% { opacity: 0.34; scale: 0.8; }
    50% { opacity: 0.82; scale: 1; }
}

@keyframes tarotKingdomStatusTrail {
    0%, 100% { opacity: 0.22; translate: 2px 0; }
    50% { opacity: 0.78; translate: -2px 0; }
}

@keyframes tarotKingdomShieldGlass {
    0%, 100% { opacity: 0.34; filter: brightness(0.94) saturate(0.9); }
    50% { opacity: 0.46; filter: brightness(1.04) saturate(0.96); }
}

@keyframes tarotKingdomShieldGlassImpact {
    0% { opacity: 0.8; filter: brightness(1) saturate(1); }
    32% { opacity: 1; filter: brightness(1.65) saturate(0.78); }
    100% { opacity: 0.82; filter: brightness(1.04) saturate(1); }
}

@keyframes tarotKingdomShieldGlassCrack {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0.48; }
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 12050;
    display: grid;
    place-items: end center;
    padding: 16px;
    background: rgba(1, 4, 11, 0.68);
    backdrop-filter: blur(2px);
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-backdrop[hidden] {
    display: none;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail {
    width: min(420px, 100%);
    max-height: min(62vh, 440px);
    overflow: hidden auto;
    color: #f8f2e4;
    border: 1px solid rgba(214, 179, 92, 0.82);
    border-radius: 14px 14px 8px 8px;
    background: linear-gradient(180deg, rgba(24, 29, 43, 0.98), rgba(5, 9, 18, 0.99));
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.58), inset 0 1px rgba(255, 245, 211, 0.14);
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail > header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 7px 10px 7px 14px;
    background: rgba(8, 12, 22, 0.96);
    border-bottom: 1px solid rgba(214, 179, 92, 0.36);
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail h3 {
    margin: 0;
    font-size: 15px;
    letter-spacing: 0.04em;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail header button {
    width: 32px;
    height: 32px;
    padding: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-list {
    display: grid;
    gap: 1px;
    padding: 6px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 56px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row
    > .tarot-kingdom-battle-status-icon {
    width: 24px;
    height: 24px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row
    > .tarot-kingdom-battle-status-icon.is-modifier[data-direction]::after {
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row strong {
    color: #fff7dd;
    font-size: 13px;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row span,
:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row small {
    font-size: 11px;
    line-height: 1.35;
}

:is(body, #tabContentTarot) #tarotKingdomRoot .tarot-kingdom-status-detail-row small {
    color: #d9bd72;
}

@media (prefers-reduced-motion: reduce) {
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
        #tarotKingdomBattleStage .tarot-kingdom-battle-player.has-regen:not(.is-ko)
        > .tarot-kingdom-regen-aura {
        opacity: 0.52;
        animation: none;
        transform: scale(0.94);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot #tarotKingdomBattleStage
        .tarot-kingdom-heal-number.is-show {
        opacity: 1;
        animation: none;
        transform: translateY(-8px);
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
        #tarotKingdomBattleStage
        :is(.tarot-kingdom-battle-player-avatar, #tarotKingdomEnemySprite)[data-status-motion] {
        animation: none;
        translate: 0 0;
        rotate: 0deg;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
        #tarotKingdomBattleStage .tarot-kingdom-status-accent::before,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
        #tarotKingdomBattleStage .tarot-kingdom-status-accent::after,
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
        #tarotKingdomBattleStage .tarot-kingdom-shield-ring {
        animation: none;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
        #tarotKingdomBattleStage
        :is(.tarot-kingdom-battle-player-avatar, .tarot-kingdom-battle-enemy-sprite).is-avatar-damaged
        > .tarot-kingdom-shield-ring:not([hidden]),
    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui
        #tarotKingdomBattleStage
        :is(.tarot-kingdom-battle-player-avatar, .tarot-kingdom-battle-enemy-sprite).is-avatar-damaged
        > .tarot-kingdom-shield-ring:not([hidden])::before {
        animation: none;
    }

    :is(body, #tabContentTarot) #tarotKingdomRoot.tarot-kingdom-reference-ui.tarot-kingdom-reference-v2
        #tarotKingdomBattleStage .tarot-kingdom-cover-callout {
        opacity: 1;
        animation: none;
        transform: none;
    }
}

.home-points-status {
    margin-left: 6px;
    font-size: 10px;
    color: #e5d4a4;
}

.companion-page.is-status-unavailable > :not(.companion-page-header):not(#companionPageMessage) {
    display: none;
}

/* Full-screen tarot card viewer (daily fortune result and inventory detail). */
.is-card-zoomable,
.tarot-fortune-card-shell.is-card-zoomable {
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}

.pirate-tarot-inventory-art.is-card-zoomable {
    position: relative;
    border-radius: 8px;
    transition: transform 160ms ease;
}

.pirate-tarot-inventory-art.is-card-zoomable:active {
    transform: scale(0.98);
}

.pirate-tarot-inventory-art.is-card-zoomable:focus-visible,
.tarot-fortune-card-shell.is-card-zoomable:focus-visible {
    outline: 2px solid rgba(255, 226, 150, 0.9);
    outline-offset: 3px;
}

.tarot-card-viewer {
    position: fixed;
    inset: 0;
    z-index: 2147483100;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center;
    align-items: center;
    gap: 12px;
    padding:
        max(56px, calc(env(safe-area-inset-top) + 48px))
        16px
        max(24px, calc(env(safe-area-inset-bottom) + 16px));
    background: radial-gradient(ellipse at 50% 42%, rgba(38, 30, 68, 0.94), rgba(6, 5, 14, 0.97) 70%);
    opacity: 0;
    transition: opacity 220ms ease;
    cursor: zoom-out;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: contain;
    touch-action: none;
}

.tarot-card-viewer.is-open {
    opacity: 1;
}

.tarot-card-viewer.is-closing {
    opacity: 0;
    transition-duration: 200ms;
}

.tarot-card-viewer-stage {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.tarot-card-viewer-frame {
    /* The card keeps 2:3 and fills whichever side runs out first. */
    width: min(100%, 480px, calc((100dvh - 180px) * 2 / 3));
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(255, 233, 180, 0.28),
        0 18px 48px rgba(0, 0, 0, 0.6),
        0 0 72px rgba(170, 140, 255, 0.22);
    transform-origin: center;
    will-change: transform;
}

.tarot-card-viewer-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
    user-select: none;
    -webkit-user-drag: none;
}

.tarot-card-viewer-image.is-reversed {
    transform: rotate(180deg);
}

.tarot-card-viewer-caption {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    max-width: 100%;
    color: #fff4d6;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 240ms ease 120ms, transform 240ms ease 120ms;
}

.tarot-card-viewer.is-open .tarot-card-viewer-caption {
    opacity: 1;
    transform: none;
}

.tarot-card-viewer-caption:empty {
    display: none;
}

.tarot-card-viewer-orientation {
    padding: 2px 8px;
    border: 1px solid rgba(255, 196, 170, 0.6);
    border-radius: 999px;
    color: #ffd2c0;
    font-size: 12px;
    font-weight: 600;
}

.tarot-card-viewer-close {
    position: absolute;
    top: max(10px, calc(env(safe-area-inset-top) + 6px));
    right: max(10px, calc(env(safe-area-inset-right) + 6px));
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: rgba(20, 16, 36, 0.6);
    cursor: pointer;
}

.tarot-card-viewer-close::before,
.tarot-card-viewer-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: #fff;
    transform: translate(-50%, -50%) rotate(45deg);
}

.tarot-card-viewer-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.tarot-card-viewer-close:focus-visible {
    outline: 2px solid rgba(255, 226, 150, 0.9);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .tarot-card-viewer,
    .tarot-card-viewer-caption {
        transition: none;
    }
}

/* Inventory detail sheet: one place per fact, numbers at a glance, actions within reach. */
#itemDetailModal > .item-detail-sheet > .item-detail-close {
    display: none;
}

#itemDetailModal .item-detail-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

#itemDetailModal .item-detail-stat-grid > .is-tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

#itemDetailModal .item-detail-stat-row.is-tile {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 3px;
    padding: 8px 11px 9px;
    border: 1px solid rgba(214, 180, 110, 0.24);
    border-image: none;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 224, 142, 0.07), transparent 70%),
        rgba(2, 4, 7, 0.72);
}

#itemDetailModal .item-detail-stat-row.is-tile .item-detail-stat-value {
    font-size: 20px;
    line-height: 1.1;
    text-align: left;
}

#itemDetailModal .item-detail-stat-note {
    color: #bda174;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

#itemDetailModal .item-detail-stat-list {
    display: grid;
    border: 1px solid rgba(214, 180, 110, 0.24);
    border-radius: 8px;
    background: rgba(2, 4, 7, 0.66);
    overflow: hidden;
}

#itemDetailModal .item-detail-stat-list > .item-detail-stat-row {
    min-height: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 9px 12px;
    border: 0;
    border-image: none;
    border-radius: 0;
    background: none;
}

#itemDetailModal .item-detail-stat-list > .item-detail-stat-row + .item-detail-stat-row {
    border-top: 1px solid rgba(214, 180, 110, 0.14);
}

#itemDetailModal #itemDetailButtons,
#itemDetailModal #itemDetailButtons:not(:has(.item-detail-action.is-move)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0;
}

#itemDetailModal #itemDetailButtons > .item-detail-action:last-of-type:nth-of-type(odd) {
    grid-column: 1 / -1;
}

/* Tarot: the adopted card is the header; the small sprite is only a fallback. */
#itemDetailModal .pirate-tarot-inventory-art {
    position: relative;
    width: min(56%, 216px);
    margin: 0 auto 12px;
}

#itemDetailModal .pirate-tarot-inventory-art > img {
    border-radius: 8px;
    box-shadow:
        0 10px 26px rgba(0, 0, 0, 0.62),
        0 0 18px var(--item-tarot-glow);
}

#itemDetailModal[data-detail-kind="tarot"]:has(.pirate-tarot-inventory-art > img:not([hidden])) .item-detail-head {
    grid-template-columns: minmax(0, 1fr);
}

#itemDetailModal[data-detail-kind="tarot"]:has(.pirate-tarot-inventory-art > img:not([hidden])) .item-detail-icon-frame {
    display: none;
}

#itemDetailModal[data-detail-kind="tarot"]:has(.pirate-tarot-inventory-art > img:not([hidden])) .item-detail-copy {
    gap: 5px;
    padding: 0 4px;
    border: 0;
    background: none;
}

#itemDetailModal[data-detail-kind="tarot"] .item-detail-meta {
    justify-content: center;
}

#itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up .pirate-tarot-inventory-art {
    animation: itemDetailTarotLevelUpCard 720ms cubic-bezier(0.18, 0.82, 0.26, 1) both;
}

#itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up .pirate-tarot-inventory-art::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    border: 1px solid var(--item-tarot-edge);
    border-radius: 8px;
    box-shadow: 0 0 10px var(--item-tarot-glow), inset 0 0 9px var(--item-tarot-glow);
    content: "";
    pointer-events: none;
    animation: itemDetailTarotLevelUpRing 820ms ease-out both;
}





#itemDetailModal .item-detail-tarot-row + .item-detail-tarot-row {
    border-top: 1px solid color-mix(in srgb, var(--item-tarot-edge) 18%, transparent);
}


#itemDetailModal .item-detail-tarot-row.is-skill {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
}

#itemDetailModal .item-detail-tarot-row.is-skill .item-detail-tarot-row-value {
    font-weight: 800;
    line-height: 1.55;
    text-align: left;
}


@media (prefers-reduced-motion: reduce) {
    #itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up .pirate-tarot-inventory-art,
    #itemDetailModal[data-detail-kind="tarot"].is-tarot-level-up .pirate-tarot-inventory-art::after {
        animation: none;
    }
}

/* Daily fortune reveal extras: wind compass, reversed turn and major arcana signatures. */
.tarot-fortune-compass {
    --compass-turn: -90deg;
    --compass-lit: 100;
    --compass-duration: 600ms;
    position: absolute;
    top: -24px;
    left: 50%;
    z-index: 4;
    width: 96px;
    margin-left: -48px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 260ms ease-out, transform 260ms ease-out;
}

.tarot-fortune-compass > svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.tarot-fortune-fx.is-charging .tarot-fortune-compass,
.tarot-fortune-fx.is-imploding .tarot-fortune-compass {
    opacity: 1;
    transform: none;
}

.tarot-fortune-fx.is-revealed .tarot-fortune-compass {
    opacity: 0;
    transition-delay: 380ms;
    transition-duration: 420ms;
}

.tarot-fortune-compass-track,
.tarot-fortune-compass-lit {
    fill: none;
    stroke-linecap: round;
    stroke-width: 6;
}

.tarot-fortune-compass-track {
    stroke: rgba(255, 255, 255, 0.14);
}

.tarot-fortune-compass-lit {
    stroke: url("#tarotFortuneCompassGlow");
    stroke-dasharray: 100;
    stroke-dashoffset: var(--compass-lit);
    filter: drop-shadow(0 0 3px rgba(var(--fx-glow), 0.8));
    transition: stroke-dashoffset var(--compass-duration) cubic-bezier(0.2, 0.8, 0.3, 1);
}

.tarot-fortune-compass-ticks line {
    stroke: rgba(255, 244, 214, 0.55);
    stroke-width: 1.4;
    stroke-linecap: round;
}

.tarot-fortune-compass-caption {
    fill: rgba(255, 244, 214, 0.6);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-anchor: middle;
}

.tarot-fortune-compass-needle,
.tarot-fortune-compass-needle-body {
    transform-box: view-box;
    transform-origin: 60px 58px;
}

.tarot-fortune-compass-needle {
    transform: rotate(var(--compass-turn));
    transition: transform var(--compass-duration) cubic-bezier(0.25, 1.35, 0.4, 1);
}

.tarot-fortune-compass-needle path {
    fill: #fff4c2;
    filter: drop-shadow(0 0 3px rgba(var(--fx-glow), 0.9));
}

.tarot-fortune-compass.is-searching .tarot-fortune-compass-needle-body {
    animation: tarotFortuneCompassSearch 520ms ease-in-out infinite alternate;
}

.tarot-fortune-compass-cap {
    fill: #142538;
    stroke: rgba(var(--fx-glow), 0.9);
    stroke-width: 1.6;
}

.tarot-fortune-compass-value {
    fill: #fff4c2;
    font-size: 12px;
    font-weight: 900;
    text-anchor: middle;
    font-variant-numeric: tabular-nums;
}

.tarot-fortune-compass.is-settled .tarot-fortune-compass-cap {
    animation: tarotFortuneCompassSettle 420ms ease-out;
}

.tarot-fortune-fx.is-omen .tarot-fortune-compass-cap {
    fill: #3a2a06;
    stroke: #ffe27a;
}

@keyframes tarotFortuneCompassSearch {
    from { transform: rotate(-5deg); }
    to { transform: rotate(4deg); }
}

@keyframes tarotFortuneCompassSettle {
    0% { stroke-width: 1.6; }
    40% { stroke-width: 4; }
    100% { stroke-width: 1.6; }
}

/* Reversed: the card lands upright, then turns over while the light cools. */
.tarot-fortune-card-shell.is-reversed-turn {
    animation:
        tarotFortuneFlipIn 340ms cubic-bezier(0.15, 0.9, 0.3, 1.25) both,
        tarotFortuneReversedTurn 520ms cubic-bezier(0.55, 0, 0.25, 1) 300ms both;
}

@keyframes tarotFortuneReversedTurn {
    0% { rotate: 180deg; scale: 1; filter: none; }
    50% { scale: 0.93; filter: brightness(0.8) saturate(0.8); }
    100% { rotate: 0deg; scale: 1; filter: none; }
}

.tarot-fortune-fx.is-reversed.is-revealed {
    --fx-glow: 129, 140, 248;
    --fx-core: 199, 210, 254;
}

.tarot-fortune-fx-reversed {
    position: absolute;
    top: calc(40px + (100% - 56px) / 2);
    left: 50%;
    z-index: 4;
    color: #dfe3ff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.32em;
    white-space: nowrap;
    padding: 4px 8px 4px 14px;
    border: 1px solid rgba(165, 180, 252, 0.6);
    border-radius: 6px;
    background: rgba(24, 22, 64, 0.78);
    text-shadow: 0 0 10px rgba(129, 140, 248, 0.95), 0 1px 2px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transform: translate(-50%, -50%);
    animation: tarotFortuneReversedLabel 620ms ease-out 260ms both;
}

@keyframes tarotFortuneReversedLabel {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
    30%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* Major arcana signatures: one short, soft motif per card, centered on the card. */
.tarot-fortune-sign {
    --sign-h: 148px;
    --sign-w: 98px;
    position: absolute;
    inset: 40px 56px 16px;
    z-index: 2;
    pointer-events: none;
}

.tarot-fortune-sign > * {
    position: absolute;
    top: 50%;
    left: 50%;
}

.tarot-fortune-sign-rays,
.tarot-fortune-sign-disk {
    width: calc(var(--sign-h) * 1.9);
    height: calc(var(--sign-h) * 1.9);
    margin: calc(var(--sign-h) * -0.95) 0 0 calc(var(--sign-h) * -0.95);
    border-radius: 50%;
}

.tarot-fortune-sign-rays {
    background: repeating-conic-gradient(rgba(255, 214, 102, 0.42) 0deg 4deg, transparent 4deg 20deg);
    mask: radial-gradient(circle closest-side, transparent 0 26%, #000 42%, transparent 100%);
    animation: tarotFortuneSignSunRays 1.8s ease-out both;
}

.tarot-fortune-sign-disk {
    background: radial-gradient(circle closest-side, rgba(255, 236, 170, 0.5) 0 30%, rgba(255, 190, 80, 0.2) 55%, transparent 100%);
    animation: tarotFortuneSignFade 1.8s ease-out both;
}

.tarot-fortune-sign-crescent {
    width: calc(var(--sign-h) * 0.34);
    height: calc(var(--sign-h) * 0.34);
    margin: calc(var(--sign-h) * -0.68) 0 0 calc(var(--sign-w) * -0.95);
    border-radius: 50%;
    box-shadow: inset calc(var(--sign-h) * -0.07) calc(var(--sign-h) * 0.03) 0 0 #e8ecff;
    filter: drop-shadow(0 0 8px rgba(199, 210, 254, 0.9));
    animation: tarotFortuneSignRise 1.8s ease-out both;
}

.tarot-fortune-sign-mist {
    width: calc(var(--sign-w) * 2.6);
    height: calc(var(--sign-h) * 0.22);
    margin: calc(var(--sign-h) * 0.16) 0 0 calc(var(--sign-w) * -1.3);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(199, 210, 254, 0.32), transparent 70%);
    filter: blur(4px);
    animation: tarotFortuneSignMist 1.8s ease-out both;
}

.tarot-fortune-sign-mist:last-child {
    margin-top: calc(var(--sign-h) * 0.34);
    animation-direction: reverse;
}

.tarot-fortune-sign-streak {
    width: calc(var(--sign-w) * 0.9);
    height: 2px;
    margin: calc(var(--sign-h) * -0.6) 0 0 calc(var(--sign-w) * -0.2);
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(224, 242, 255, 0.95));
    opacity: 0;
    transform: rotate(152deg) translateX(0);
    animation: tarotFortuneSignStreak 900ms ease-in both;
}

.tarot-fortune-sign-streak:nth-child(2) {
    margin-top: calc(var(--sign-h) * -0.35);
    margin-left: calc(var(--sign-w) * 0.35);
    animation-delay: 260ms;
}

.tarot-fortune-sign-streak:nth-child(3) {
    margin-top: calc(var(--sign-h) * -0.75);
    margin-left: calc(var(--sign-w) * -0.7);
    animation-delay: 520ms;
}

.tarot-fortune-sign-sparkle {
    width: calc(var(--sign-w) * 0.42);
    height: calc(var(--sign-w) * 0.42);
    margin: calc(var(--sign-h) * -0.62) 0 0 calc(var(--sign-w) * 0.38);
    background: radial-gradient(circle closest-side, #fff 0 18%, rgba(186, 230, 253, 0.85) 40%, transparent 100%);
    clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
    animation: tarotFortuneSignSparkle 1.8s ease-out both;
}

.tarot-fortune-sign-wreath {
    width: calc(var(--sign-w) * 1.9);
    height: calc(var(--sign-h) * 1.32);
    margin: calc(var(--sign-h) * -0.66) 0 0 calc(var(--sign-w) * -0.95);
    border: 3px solid rgba(167, 243, 208, 0.75);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(167, 243, 208, 0.55), inset 0 0 12px rgba(255, 214, 102, 0.35);
    animation: tarotFortuneSignWreath 1.8s ease-out both;
}

.tarot-fortune-sign-wreath:last-child {
    border-color: rgba(255, 214, 102, 0.6);
    border-style: dashed;
    animation-delay: 160ms;
}

.tarot-fortune-sign-wheel {
    width: calc(var(--sign-h) * 1.5);
    height: calc(var(--sign-h) * 1.5);
    margin: calc(var(--sign-h) * -0.75) 0 0 calc(var(--sign-h) * -0.75);
    overflow: visible;
    animation: tarotFortuneSignWheel 1.9s cubic-bezier(0.1, 0.7, 0.3, 1) both;
}

.tarot-fortune-sign-wheel circle,
.tarot-fortune-sign-wheel path {
    fill: none;
    stroke: rgba(255, 214, 102, 0.7);
    stroke-width: 2;
}

.tarot-fortune-sign-bolt {
    width: calc(var(--sign-w) * 0.7);
    height: calc(var(--sign-h) * 1.1);
    margin: calc(var(--sign-h) * -0.95) 0 0 calc(var(--sign-w) * 0.15);
    overflow: visible;
}

.tarot-fortune-sign-bolt path {
    fill: none;
    stroke: #e0e7ff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    filter: drop-shadow(0 0 4px rgba(165, 180, 252, 0.9));
    animation: tarotFortuneSignBolt 1.5s ease-out both;
}

@keyframes tarotFortuneSignFade {
    0% { opacity: 0; transform: scale(0.6); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: scale(1.1); }
}

@keyframes tarotFortuneSignSunRays {
    0% { opacity: 0; transform: scale(0.5) rotate(0); }
    30% { opacity: 1; }
    100% { opacity: 0; transform: scale(1.15) rotate(40deg); }
}

@keyframes tarotFortuneSignRise {
    0% { opacity: 0; transform: translateY(10px); }
    30%, 70% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-4px); }
}

@keyframes tarotFortuneSignMist {
    0% { opacity: 0; transform: translateX(-14px); }
    40% { opacity: 1; }
    100% { opacity: 0; transform: translateX(14px); }
}

@keyframes tarotFortuneSignStreak {
    0% { opacity: 0; transform: rotate(152deg) translateX(0); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: rotate(152deg) translateX(calc(var(--sign-w) * -1.4)); }
}

@keyframes tarotFortuneSignSparkle {
    0% { opacity: 0; transform: scale(0.3) rotate(0); }
    35% { opacity: 1; transform: scale(1) rotate(20deg); }
    100% { opacity: 0; transform: scale(0.8) rotate(45deg); }
}

@keyframes tarotFortuneSignWreath {
    0% { opacity: 0; transform: scale(0.8) rotate(-8deg); }
    35% { opacity: 1; }
    100% { opacity: 0; transform: scale(1.06) rotate(4deg); }
}

@keyframes tarotFortuneSignWheel {
    0% { opacity: 0; transform: scale(0.85) rotate(0); }
    25% { opacity: 1; }
    75% { opacity: 0.9; }
    100% { opacity: 0; transform: scale(1) rotate(300deg); }
}

@keyframes tarotFortuneSignBolt {
    0% { opacity: 0; stroke-dashoffset: 100; }
    15% { opacity: 0.9; }
    45% { stroke-dashoffset: 0; }
    100% { opacity: 0; stroke-dashoffset: 0; }
}

/* Signatures drawn as strokes: infinity, crown, keys, scales and the flowing water. */
.tarot-fortune-sign-figure {
    overflow: visible;
    animation: tarotFortuneSignFigure 1.9s ease-out both;
}

.tarot-fortune-sign-figure path,
.tarot-fortune-sign-figure circle {
    fill: none;
    stroke: rgba(255, 224, 140, 0.85);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    filter: drop-shadow(0 0 4px rgba(255, 200, 90, 0.7));
    animation: tarotFortuneSignDraw 900ms ease-out both;
}

.tarot-fortune-sign-figure.is-infinity {
    width: calc(var(--sign-w) * 1.1);
    height: calc(var(--sign-w) * 0.55);
    margin: calc(var(--sign-h) * -0.3 - var(--sign-w) * 0.275) 0 0 calc(var(--sign-w) * -0.55);
}

.tarot-fortune-sign-figure.is-infinity path {
    stroke: rgba(253, 224, 255, 0.9);
    filter: drop-shadow(0 0 5px rgba(232, 121, 249, 0.8));
}

.tarot-fortune-sign-figure.is-crown {
    width: calc(var(--sign-w) * 0.72);
    height: calc(var(--sign-w) * 0.43);
    margin: calc(var(--sign-h) * -0.32 - var(--sign-w) * 0.43) 0 0 calc(var(--sign-w) * -0.36);
}

.tarot-fortune-sign-figure.is-crown path {
    fill: rgba(255, 200, 90, 0.16);
}

.tarot-fortune-sign-figure.is-keys {
    width: calc(var(--sign-w) * 1.5);
    height: calc(var(--sign-w) * 1.5);
    margin: calc(var(--sign-w) * -0.75) 0 0 calc(var(--sign-w) * -0.75);
}

.tarot-fortune-sign-figure.is-keys g:last-child path,
.tarot-fortune-sign-figure.is-keys g:last-child circle {
    stroke: rgba(226, 232, 240, 0.85);
    filter: drop-shadow(0 0 4px rgba(203, 213, 225, 0.7));
    animation-delay: 220ms;
}

.tarot-fortune-sign-figure.is-scales {
    width: calc(var(--sign-w) * 1.2);
    height: calc(var(--sign-w) * 0.9);
    margin: calc(var(--sign-w) * -0.45) 0 0 calc(var(--sign-w) * -0.6);
}

.tarot-fortune-sign-scale-arm {
    transform-box: view-box;
    transform-origin: 60px 22px;
    animation: tarotFortuneSignBalance 1.4s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

.tarot-fortune-sign-figure.is-flow {
    width: calc(var(--sign-w) * 1.5);
    height: calc(var(--sign-w) * 0.75);
    margin: calc(var(--sign-h) * -0.1 - var(--sign-w) * 0.375) 0 0 calc(var(--sign-w) * -0.75);
}

.tarot-fortune-sign-figure.is-flow path {
    stroke: rgba(186, 230, 253, 0.55);
    filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.7));
}

.tarot-fortune-sign-figure.is-flow .tarot-fortune-sign-flow-drops {
    stroke: #f0f9ff;
    stroke-width: 3.4;
    stroke-dasharray: 1 7;
    animation: tarotFortuneSignFlow 1.6s linear 200ms both;
}

/* The Fool: soft bubbles drifting up on the wind. */
.tarot-fortune-sign-bubble {
    width: calc(var(--sign-w) * 0.26);
    height: calc(var(--sign-w) * 0.26);
    margin: calc(var(--sign-h) * var(--y)) 0 0 calc(var(--sign-w) * var(--x));
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(186, 230, 253, 0.6);
    background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.8) 0 12%, rgba(186, 230, 253, 0.18) 40%, transparent 72%);
    opacity: 0;
    animation: tarotFortuneSignBubble 1.7s ease-out var(--delay) both;
}

/* The High Priestess: a dark and a light pillar either side of the card. */
.tarot-fortune-sign-pillar {
    width: calc(var(--sign-w) * 0.14);
    height: calc(var(--sign-h) * 1.08);
    margin: calc(var(--sign-h) * -0.54) 0 0 calc(var(--sign-w) * -0.82);
    border-radius: 3px;
    background: linear-gradient(180deg, transparent, rgba(49, 46, 129, 0.85) 18%, rgba(30, 27, 75, 0.9) 82%, transparent);
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.55);
    transform-origin: 50% 100%;
    animation: tarotFortuneSignPillar 1.9s ease-out both;
}

.tarot-fortune-sign-pillar.is-light {
    margin-left: calc(var(--sign-w) * 0.68);
    background: linear-gradient(180deg, transparent, rgba(241, 245, 249, 0.75) 18%, rgba(226, 232, 240, 0.8) 82%, transparent);
    box-shadow: 0 0 10px rgba(226, 232, 240, 0.6);
    animation-delay: 120ms;
}

/* The Empress and the Devil: petals falling, embers rising. */
.tarot-fortune-sign-petal {
    width: calc(var(--sign-w) * 0.13);
    height: calc(var(--sign-w) * 0.09);
    margin: calc(var(--sign-h) * -0.62) 0 0 calc(var(--sign-w) * var(--x));
    border-radius: 80% 0;
    background: linear-gradient(135deg, #fbcfe8, #f9a8d4 60%, #fde68a);
    opacity: 0;
    animation: tarotFortuneSignPetal 1.8s ease-in var(--delay) both;
}

.tarot-fortune-sign-ember {
    width: 5px;
    height: 5px;
    margin: calc(var(--sign-h) * 0.5) 0 0 calc(var(--sign-w) * var(--x));
    border-radius: 50%;
    background: #fca5a5;
    box-shadow: 0 0 6px 2px rgba(220, 38, 38, 0.6);
    opacity: 0;
    animation: tarotFortuneSignEmber 1.6s ease-out var(--delay) both;
}

.tarot-fortune-sign-smoke {
    width: calc(var(--sign-w) * 2.2);
    height: calc(var(--sign-h) * 0.5);
    margin: calc(var(--sign-h) * 0.22) 0 0 calc(var(--sign-w) * -1.1);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(127, 29, 29, 0.5), rgba(59, 7, 100, 0.3) 45%, transparent 72%);
    filter: blur(6px);
    animation: tarotFortuneSignRise 1.9s ease-out both;
}

/* The Lovers: two hearts drifting together above the card. */
.tarot-fortune-sign-heart {
    --heart-from: calc(var(--sign-w) * -0.5);
    --heart-to: calc(var(--sign-w) * -0.1);
    width: calc(var(--sign-w) * 0.24);
    height: calc(var(--sign-w) * 0.22);
    margin: calc(var(--sign-h) * -0.3) 0 0 calc(var(--sign-w) * -0.12);
    overflow: visible;
    animation: tarotFortuneSignHeart 1.8s ease-out both;
}

.tarot-fortune-sign-heart:last-child {
    --heart-from: calc(var(--sign-w) * 0.5);
    --heart-to: calc(var(--sign-w) * 0.1);
}

.tarot-fortune-sign-heart path {
    fill: rgba(251, 113, 133, 0.85);
    filter: drop-shadow(0 0 5px rgba(251, 113, 133, 0.8));
}

/* The Chariot: speed lines rushing past. */
.tarot-fortune-sign-speed {
    width: calc(var(--sign-w) * 0.8);
    height: 3px;
    margin: calc(var(--sign-h) * var(--y)) 0 0 calc(var(--sign-w) * -1.2);
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #fef9c3);
    box-shadow: 0 0 6px rgba(253, 224, 71, 0.7);
    opacity: 0;
    animation: tarotFortuneSignSpeed 700ms ease-in var(--delay) 2 both;
}

/* Strength: a warm aura breathing out twice. */
.tarot-fortune-sign-aura {
    width: calc(var(--sign-w) * 1.4);
    height: calc(var(--sign-h) * 1.2);
    margin: calc(var(--sign-h) * -0.6) 0 0 calc(var(--sign-w) * -0.7);
    border: 2px solid rgba(251, 146, 60, 0.7);
    border-radius: 18px;
    box-shadow: 0 0 16px rgba(251, 146, 60, 0.5), inset 0 0 14px rgba(251, 191, 36, 0.35);
    opacity: 0;
    animation: tarotFortuneSignAura 1.1s ease-out both;
}

.tarot-fortune-sign-aura:last-child {
    animation-delay: 650ms;
}

/* The Hermit: a lantern swaying at the top corner, casting a faint cone. */
.tarot-fortune-sign-lantern {
    width: calc(var(--sign-w) * 0.32);
    height: calc(var(--sign-w) * 0.32);
    margin: calc(var(--sign-h) * -0.62) 0 0 calc(var(--sign-w) * 0.3);
    border-radius: 50%;
    background: radial-gradient(circle closest-side, #fffbeb 0 22%, rgba(253, 224, 71, 0.7) 50%, transparent 100%);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    transform-origin: 50% -60%;
    animation: tarotFortuneSignLantern 1.9s ease-in-out both;
}

.tarot-fortune-sign-lantern-beam {
    width: calc(var(--sign-w) * 1.2);
    height: calc(var(--sign-h) * 1.1);
    margin: calc(var(--sign-h) * -0.55) 0 0 calc(var(--sign-w) * -0.62);
    background: radial-gradient(ellipse at 80% 6%, rgba(253, 230, 138, 0.5), transparent 62%);
    animation: tarotFortuneSignFade 1.9s ease-out both;
}

/* The Hanged Man: a thread from above and a halo near the lowered head. */
.tarot-fortune-sign-thread {
    width: 2px;
    height: calc(var(--sign-h) * 0.45);
    margin: calc(var(--sign-h) * -0.5) 0 0 -1px;
    background: linear-gradient(180deg, transparent, rgba(254, 243, 199, 0.85));
    transform-origin: 50% 0;
    animation: tarotFortuneSignThread 1.8s ease-out both;
}

.tarot-fortune-sign-halo {
    width: calc(var(--sign-w) * 0.6);
    height: calc(var(--sign-w) * 0.6);
    margin: calc(var(--sign-h) * 0.18) 0 0 calc(var(--sign-w) * -0.3);
    border: 3px solid rgba(254, 240, 138, 0.95);
    border-radius: 50%;
    box-shadow: 0 0 16px rgba(253, 224, 71, 0.8), inset 0 0 12px rgba(253, 224, 71, 0.55);
    animation: tarotFortuneSignFade 1.9s ease-out 300ms both;
}

/* Death: a dawn rising along the lower edge. */
.tarot-fortune-sign-dawn {
    width: calc(var(--sign-w) * 2.4);
    height: calc(var(--sign-h) * 0.7);
    margin: calc(var(--sign-h) * -0.1) 0 0 calc(var(--sign-w) * -1.2);
    background: radial-gradient(ellipse at 50% 100%, rgba(255, 237, 213, 0.8), rgba(251, 146, 60, 0.35) 40%, transparent 70%);
    animation: tarotFortuneSignRise 1.9s ease-out both;
}

.tarot-fortune-sign-dawn-line {
    width: calc(var(--sign-w) * 2);
    height: 3px;
    margin: calc(var(--sign-h) * 0.5) 0 0 calc(var(--sign-w) * -1);
    background: linear-gradient(90deg, transparent, #fff7ed, transparent);
    box-shadow: 0 0 10px rgba(253, 186, 116, 0.9);
    animation: tarotFortuneSignDawnLine 1.9s ease-out both;
}

/* Judgement: three soft beams falling from above. */
.tarot-fortune-sign-ray {
    width: calc(var(--sign-w) * 0.3);
    height: calc(var(--sign-h) * 1.1);
    margin: calc(var(--sign-h) * -0.5) 0 0 calc(var(--sign-w) * -0.15);
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.9), rgba(253, 230, 138, 0.4) 55%, transparent);
    filter: blur(1.5px);
    transform: rotate(calc(var(--x) * 1deg));
    transform-origin: 50% 0;
    opacity: 0;
    animation: tarotFortuneSignRay 1.8s ease-out var(--delay) both;
}

@keyframes tarotFortuneSignFigure {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes tarotFortuneSignDraw {
    0% { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 0; }
}

@keyframes tarotFortuneSignBalance {
    0% { transform: rotate(-9deg); }
    100% { transform: rotate(0); }
}

@keyframes tarotFortuneSignFlow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -40; }
}

@keyframes tarotFortuneSignBubble {
    0% { opacity: 0; transform: translate(0, 10px) scale(0.6); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translate(14px, -40px) scale(1); }
}

@keyframes tarotFortuneSignPillar {
    0% { opacity: 0; transform: scaleY(0.4); }
    30%, 70% { opacity: 1; transform: scaleY(1); }
    100% { opacity: 0; transform: scaleY(1); }
}

@keyframes tarotFortuneSignPetal {
    0% { opacity: 0; transform: translate(0, 0) rotate(0); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(12px, calc(var(--sign-h) * 1.1)) rotate(220deg); }
}

@keyframes tarotFortuneSignEmber {
    0% { opacity: 0; transform: translate(0, 0); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translate(-6px, calc(var(--sign-h) * -0.9)); }
}

@keyframes tarotFortuneSignHeart {
    0% { opacity: 0; transform: translate(var(--heart-from), 12px) scale(0.6); }
    35% { opacity: 1; }
    70% { opacity: 1; transform: translate(var(--heart-to), 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--heart-to), -6px) scale(1); }
}

@keyframes tarotFortuneSignSpeed {
    0% { opacity: 0; transform: translateX(0); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translateX(calc(var(--sign-w) * 1.8)); }
}

@keyframes tarotFortuneSignAura {
    0% { opacity: 0; transform: scale(0.94); }
    35% { opacity: 1; }
    100% { opacity: 0; transform: scale(1.1); }
}

@keyframes tarotFortuneSignLantern {
    0% { opacity: 0; transform: rotate(-10deg); }
    25% { opacity: 1; }
    50% { transform: rotate(8deg); }
    75% { opacity: 1; transform: rotate(-4deg); }
    100% { opacity: 0; transform: rotate(0); }
}

@keyframes tarotFortuneSignThread {
    0% { opacity: 0; transform: scaleY(0); }
    30%, 75% { opacity: 1; transform: scaleY(1); }
    100% { opacity: 0; transform: scaleY(1); }
}

@keyframes tarotFortuneSignDawnLine {
    0% { opacity: 0; transform: scaleX(0.2); }
    35%, 70% { opacity: 1; transform: scaleX(1); }
    100% { opacity: 0; transform: scaleX(1); }
}

@keyframes tarotFortuneSignRay {
    0% { opacity: 0; transform: rotate(calc(var(--x) * 1deg)) scaleY(0.3); }
    30%, 65% { opacity: 1; transform: rotate(calc(var(--x) * 1deg)) scaleY(1); }
    100% { opacity: 0; transform: rotate(calc(var(--x) * 1deg)) scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-fortune-compass,
    .tarot-fortune-sign,
    .tarot-fortune-fx-reversed {
        display: none;
    }

    .tarot-fortune-card-shell.is-reversed-turn {
        animation: none;
    }
}

/* Daily fortune → inventory: jump button, fragment progress, and the arrival highlight. */
.tarot-fortune-reward .tarot-fortune-view-inventory {
    grid-column: 1 / -1;
    justify-self: start;
    min-height: 32px;
    padding: 4px 12px;
    border: 1px solid rgba(248, 226, 168, 0.42);
    border-radius: 8px;
    background: rgba(30, 58, 95, 0.72);
    color: #ffe8a3;
    font-size: 12px;
    font-weight: 900;
}

#tabContentInventory .inventory-fortune-fragments {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(248, 226, 168, 0.28);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    color: #f8e7c0;
}

#tabContentInventory .inventory-fortune-fragments[hidden] {
    display: none;
}

#tabContentInventory .inventory-fortune-fragments-title {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 900;
}

#tabContentInventory .inventory-fortune-fragments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#tabContentInventory .inventory-fortune-fragment {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(143, 95, 32, 0.45);
    font-size: 12px;
}

#tabContentInventory .inventory-fortune-fragment strong {
    color: #ffe8a3;
}

#tabContentInventory .is-spotlight {
    outline: 2px solid #ffe8a3;
    outline-offset: 2px;
    transition: outline-color 0.6s ease;
}
