@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Fraunces:ital,wght@0,300;0,500;1,300&display=swap');

/* ACHIEVEMENTS MODAL STYLES */
.ach-overlay, .switch-set-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    backdrop-filter: blur(8px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s
}
.switch-set-overlay.visible {
    opacity: 1;
    pointer-events: all
}
.ach-overlay.visible {
    opacity: 1;
    pointer-events: all
}
.ach-modal, .switch-set-modal {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 18px;
    padding: 1.5rem;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0,0,0,.7);
    display: flex;
    flex-direction: column;
    overflow: hidden
}
.ach-modal-header, .switch-set-modal-header {
    text-align: center;
    margin-bottom: 1.5rem
}
.ach-modal-title, .switch-set-modal-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: 1.4rem;
    letter-spacing: -.01em
}
.ach-modal-subtitle {
    font-size: 11px;
    color: var(--muted)
}
.ach-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    padding-right: 8px
}
.ach-modal-footer, .switch-set-modal-footer {
    margin-top: 1.5rem;
    text-align: center
}
.ach-close-btn, .switch-set-close-btn {
    font-family: var(--font-body);
    font-size: 11px;
    padding: 8px 24px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background .2s, color .2s
}
.ach-close-btn:hover, .switch-set-close-btn:hover {
    background: rgba(255,255,255,.08);
    color: var(--amber)
}
.switch-set-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    overflow: hidden
}
.set-address-input {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px
}
.set-iframe {
    flex: 1;
    border: none;
    border-radius: 8px;
    background: rgba(0,0,0,.1)
}
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.header-title {
    margin: 0;
}
.sound-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    filter: grayscale(1)
}

#ach-metric:hover .lbl::after {
    content: ' ...';
    color: var(--amber);
    margin-right: 5px;
}
#ach-metric:hover .lbl {
    color: var(--amber);
}
#ach-metric:hover {
    cursor: pointer;
    border-color: rgba(232, 166, 48, .5)
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

:root {
    --bg: #0e0e10;
    --surface: #17171a;
    --surface2: #1f1f24;
    --border: rgba(255, 255, 255, 0.07);
    --text: #e8e6e1;
    --muted: #666;
    --green: #3ddc97;
    --amber: #e8a630;
    --red: #e85454;
    --blue: #5b9cf6;
    --pink: #e87dbd;
    --sync-glow: rgba(61, 220, 151, 0.35);
    --font-body: 'DM Mono', monospace;
    --font-display: 'Fraunces', serif;
}

body {
    font-family: var(--font-body);
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
    padding: 1.5rem min(1rem, 3vw) 4rem;
    max-width: 740px;
    margin: 0 auto;
    min-height: 100vh;
    overflow-x: hidden
}

html {
    overflow-x: hidden;
    width: 100%
}

h1 {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: 1.6rem;
    letter-spacing: -0.02em;
    margin-bottom: .25rem
}

.subtitle {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 1.5rem
}

.top-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    justify-content: center
}

.metric {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: min(.7rem, 2vw) min(.8rem, 3vw);
    text-align: left;
    position: relative
}

.metric .val {
    font-size: 20px;
    font-weight: 500;
    font-variant-numeric: tabular-nums
}

.metric .lbl {
    font-size: 10px;
    color: var(--muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ach-fraction {
    font-size: 10px;
}
.info-symbol {
    font-size: 15px !important;
    color: var(--muted);
    vertical-align: middle;
    display: inline-block;
}

#ach-metric .info-symbol {
    position: absolute;
    top: 1px;
    right: 3px;
    display: inline-block;
}
#ach-metric:hover .info-symbol {
    color: var(--amber);
}

.section-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: .6rem
}

/* PAIR CARDS */
.pairs-section {
    margin-bottom: 1rem
}

.pair-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .3s, box-shadow .3s
}

.pair-card-content {
    padding: min(.8rem, 2vw) min(1rem, 3vw);
    display: flex;
    flex-direction: column;
    gap: .6rem;
    position: relative;
}

.pair-header {
    width: 100%;
    margin-bottom: .4rem;
}

.pair-header .pair-names {
    font-weight: 500;
    font-size: 12px;
    white-space: normal;
    word-break: break-word;
    margin-bottom: 0;
}



/* Responsive 9-zone grid layout for pair cards */
.pair-card-content {
    display: grid;
    grid-template-columns: 6rem 1fr 6rem;
    grid-template-rows: auto 1fr auto;
    gap: .5rem;
}

@media (min-width: 600px) {
    .pair-card-content {
        grid-template-areas:
            "left header right"
            "left main right"
            "left footer right";
    }
}

@media (max-width: 599px) {
    .pair-card-content {
        grid-template-areas:
            "header header header"
            "left main right"
            "footer footer footer";
    }
}

.pair-header { grid-area: header; }
.pair-left { grid-area: left; }
.pair-main { grid-area: main; }
.pair-right { grid-area: right; }
.pair-footer { grid-area: footer; }
.pair-footer {
    width: 100%;
    margin-top: .4rem;
}

/* Holy Grail to Sandwich responsive layout for pair cards */


.pair-card:hover {
    border-color: rgba(255, 255, 255, .14)
}

.pair-card.selected-pair {
    border-color: rgba(91, 156, 246, .6);
    box-shadow: 0 0 0 1px rgba(91, 156, 246, .2)
}

.pair-card.syncing {
    border-color: rgba(61, 220, 151, .4);
    box-shadow: 0 0 16px var(--sync-glow)
}

.pair-card.syncing::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(61, 220, 151, .04), transparent);
    animation: sweep 1.2s ease-in-out
}

@keyframes sweep {
    0% {
    transform: translateX(-100%)
    }

    100% {
    transform: translateX(100%)
    }
}

.pair-main {
    display: flex;
    /* align-items: center; */
    gap: 10px
}

.pair-phase-bars {
    display: flex;
    gap: 2px;
    margin-top: 4px;
    height: 4px;
}

.pair-phase-bar {
    flex: 1;
    height: 100%;
    border-radius: 2px;
    background: var(--surface2);
    overflow: hidden;
}

.pair-phase-bar:last-child {
    direction: rtl; /* Inverse la direction pour le deuxième bar */
}

.pair-phase-fill {
    height: 100%;
    border-radius: 2px;
}

.pair-animals {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px
}

@media (min-width: 600px) {
    .pair-animals {
        gap: 9px
    }
}

.animal-face {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    position: relative;
    flex-shrink: 0
}

.animal-face.pulse-sync {
    animation: fps .5s ease-out
}

.animal-face.pulse-desync {
    animation: fpd .4s ease-out
}

@keyframes fps {
    0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--sync-glow)
    }

    30% {
    transform: scale(1.22);
    box-shadow: 0 0 0 8px var(--sync-glow)
    }

    100% {
    transform: scale(1);
    box-shadow: 0 0 0 14px transparent
    }
}

@keyframes fpd {
    0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(232, 166, 48, .4)
    }

    25% {
    transform: scale(.88);
    box-shadow: 0 0 0 6px rgba(232, 166, 48, .3)
    }

    100% {
    transform: scale(1);
    box-shadow: 0 0 0 12px transparent
    }
}

.animal-face .phase-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    transition: border-color .08s, box-shadow .08s;
    pointer-events: none
}

.animal-face.in-window .phase-ring {
    border-color: var(--green);
    box-shadow: 0 0 6px var(--sync-glow)
}

.link-symbol {
    font-size: 12px;
    color: var(--muted);
    transition: color .3s
}

.syncing .link-symbol {
    color: var(--green)
}

.pair-info {
    flex: 1;
    align-self: center;
}

.pair-names {
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 4px;
    white-space: normal;
    word-break: break-word
}

.pair-sub {
    font-size: 10px;
    color: var(--muted);
    display: flex;
    gap: 8px;
    white-space: normal;
    flex-wrap: wrap
}

.heart-pop {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(0px);
    font-size: 16px;
    pointer-events: none;
    animation: heart-rise 1s ease-out forwards;
    z-index: 10;
}

@keyframes heart-rise {
    0%   { opacity: 1;   transform: translateX(-50%) translateY(0px);   }
    100% { opacity: 0;   transform: translateX(-50%) translateY(-32px);  }
}

.pair-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px
}

/* EMBEDDED VISUALIZER IN PAIR CARD */
.pair-viz-container {
    border-top: 1px solid var(--border);
    background: var(--surface2);
    /* border-radius: 0 0 12px 12px; */
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease
}

.pair-card.selected-pair .pair-viz-container {
    max-height: 500px;
}

.pair-viz-content {
    padding: 0 1px 12px; /* Match horizontal padding, add bottom padding only */
}

.pair-viz-scores {
    display: flex;
    margin: 6px 0
}

.pair-viz-canvas-wrap {
    padding: 6px 0;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
}

.pair-viz-canvas-wrap canvas {
    border-radius: 6px;
    display: block
}

.pts-label {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    margin-top: auto;
    align-self: flex-end
}

.pts-label span {
    color: var(--text);
    font-weight: 500
}

.bar-wrap {
    width: 72px;
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden
}

/* NO CSS transition on bar-fill — phase oscillates at 60fps, transition would smooth it to 50% */
.bar-fill {
    height: 100%;
    border-radius: 2px
}

.break-btn {
    font-family: var(--font-body);
    font-size: 10px;
    padding: 3px 8px;
    border: 1px solid rgba(232, 84, 84, .4);
    border-radius: 6px;
    background: rgba(232, 84, 84, .1);
    color: var(--red);
    cursor: pointer;
    transition: background .2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.break-btn:hover {
    background: rgba(232, 84, 84, .2)
}

.empty {
    font-size: 12px;
    color: var(--muted);
    padding: .6rem 0
}

/* VISUALISEUR */
.viz-section {
    margin-bottom: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden
}

.viz-header {
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center
}

.viz-header .lbl {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em
}

.viz-header .pname {
    font-size: 11px;
    color: var(--text);
    font-weight: 500
}

.viz-scores {
    display: flex;
    border-bottom: 1px solid var(--border)
}

.viz-metric {
    flex: 1;
    padding: .5rem .75rem;
    text-align: center;
    border-right: 1px solid var(--border)
}

.viz-metric:last-child {
    border-right: none
}

.viz-metric .vval {
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums
}

.viz-metric .vlbl {
    font-size: 9px;
    color: var(--muted);
    margin-top: 2px
}

.viz-canvas-wrap {
    padding: .75rem
}

#viz-canvas {
    width: 100%;
    display: block;
    border-radius: 6px
}

.viz-empty {
    padding: 1.25rem 1rem;
    font-size: 11px;
    color: var(--muted);
    text-align: center
}

/* ANIMAL CARDS */
.animals-section {
    margin-bottom: 1.5rem
}

.animals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px
}

@media(max-width:500px) {
    .animals-grid {
    grid-template-columns: repeat(2, 1fr)
    }
}

.animal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: min(.75rem, 2vw) min(.8rem, 3vw);
    cursor: pointer;
    user-select: none;
    transition: border-color .2s, box-shadow .2s;
    position: relative
}

.animal-card:hover {
    border-color: rgba(255, 255, 255, .18)
}

.animal-card.selected {
    border-color: var(--blue);
    box-shadow: 0 0 10px rgba(91, 156, 246, .2)
}

.animal-card.paired {
    display: none
}

.card-face {
    font-size: 26px;
    margin-bottom: 6px;
    line-height: 1
}

.card-name {
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 5px
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 6px
}

.shop-card-tags {
    margin-top: 2px;
    justify-content: flex-end
}

.tag {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px
}

.tag-m {
    background: rgba(91, 156, 246, .15);
    color: #8bb5f8
}

.tag-f {
    background: rgba(232, 125, 189, .15);
    color: var(--pink)
}

.tag-carn {
    background: rgba(232, 84, 84, .12);
    color: #f08080
}

.tag-herb {
    background: rgba(61, 220, 151, .12);
    color: #6edaaa
}

.tag-r {
    background: var(--surface2);
    color: var(--muted)
}

/* NO CSS transition — updated at 60fps */
.card-phase {
    height: 3px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden
}

.card-phase-fill {
    height: 100%;
    border-radius: 2px
}

.dob-row {
    display: flex;
    gap: 3px;
    margin: 0.8rem 0;
    justify-content: center;
    flex-wrap: wrap
}

.dob-sym {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    position: relative;
    border-radius: 20px
}

.dob-sym .pol {
    width: 14px;
    height: 2px;
    border-radius: 1px
}

.dob-sym .pol.up {
    background: var(--green);
    margin-bottom: 1px
}

.dob-sym .pol.down {
    background: var(--red);
    margin-top: 1px;
    order: 1
}

.dob-sym .pol.spacer {
    background: transparent
}

.dob-sym .ball {
    font-size: 11px;
    line-height: 1
}

.dob-sym.shared .ball {
    font-size: 15px
}

.dob-sym.shared {
    background: rgba(255, 255, 255, .06);
    padding: 2px 4px
}

.dob-sym.bonus {
    background: rgba(61, 220, 151, .12);
    padding: 2px 4px
}

.dob-sym.malus {
    background: rgba(232, 84, 84, .1);
    padding: 2px 4px
}

.pair-dob {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 36px;
    margin-top: 4px;
    justify-content: center
}

/* SHOP */
.shop-section {
    margin-bottom: 1.5rem
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px
}

@media(max-width:500px) {
    .shop-grid {
    grid-template-columns: repeat(2, 1fr)
    }
}

.shop-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: min(.75rem, 2vw) min(.8rem, 3vw);
    opacity: .7;
    transition: opacity .2s, border-color .2s
}

.shop-card.affordable {
    opacity: 1;
    border-color: rgba(255, 255, 255, .1)
}

.shop-card.affordable:hover {
    border-color: rgba(255, 255, 255, .25);
    cursor: pointer
}

.shop-card .card-face {
    font-size: 22px
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.card-topleft {
    text-align: center;
    padding-right: .8rem;
}

.shop-price {
    font-size: 10px;
    font-weight: 500;
    margin-top: 6px;
    display: flex;
    justify-content: center;
    gap: 4px
}

.shop-buy-btn {
    font-family: var(--font-body);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(61, 220, 151, .4);
    background: rgba(61, 220, 151, .1);
    color: var(--green);
    cursor: pointer;
    transition: background .2s;
    margin-top: 5px;
    width: 100%;
    max-width: 6rem;
}

.obj-shop-card .shop-buy-btn {
    float: right;
}

.coin {
    color: var(--amber)
}

.amount {
    color: var(--text)
}

.shop-price .locked {
    color: var(--muted)
}

.shop-buy-btn {
    font-family: var(--font-body);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(61, 220, 151, .4);
    background: rgba(61, 220, 151, .1);
    color: var(--green);
    cursor: pointer;
    transition: background .2s;
    margin-top: 5px;
    width: 100%
}

.shop-buy-btn:hover {
    background: rgba(61, 220, 151, .2)
}

.view-tcg-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    filter: grayscale(1)
}

.view-tcg-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.shop-buy-btn:disabled {
    opacity: .3;
    cursor: not-allowed
}

.hint {
    font-size: 11px;
    color: var(--muted);
    min-height: 18px;
    margin-top: .5rem
}

/* ── TCG CARD MODAL ── */
#tcg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s
}
#tcg-overlay.visible {
    opacity: 1;
    pointer-events: all
}

.tcg-card {
    width: 280px;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 60px rgba(0,0,0,.8), 0 0 120px rgba(0,0,0,.4);
    transform: scale(.7) rotateY(20deg) rotateX(15deg);
    cursor: default;
    user-select: none;
    transform-style: preserve-3d;
}

.tcg-card {
    animation: disappear 0.4s cubic-bezier(.22,1,.36,1) forwards;
}

#tcg-overlay.visible .tcg-card {
    animation: appear 0.6s cubic-bezier(.22,1,.36,1) forwards, float 4s ease-in-out .7s infinite;
}

@keyframes appear {
    0% { 
    transform: scale(.7) rotateY(40deg) rotateX(-15deg);
    }
    100% {
    transform: scale(1) rotateY(0deg) rotateX(0deg);
    }
}

@keyframes disappear {
    0% { 
    transform: scale(1) rotateY(0deg) rotateX(0deg);
    }
    100% {
    transform: scale(.7) rotateY(35deg) rotateX(-10deg);
    }
}

@keyframes float {
    0%, 100% {
    transform: scale(1) rotateY(0deg) rotateX(0deg) translateY(0);
    }
    50% {
    transform: scale(1) rotateY(0deg) rotateX(0deg) translateY(-8px);
    }
}

/* color themes by sp */
.tcg-card.herb {
    --tcg-top: #1a3020;
    --tcg-accent: #3ddc97;
    --tcg-glow: rgba(61,220,151,.5);
    --tcg-badge: rgba(61,220,151,.18)
}
.tcg-card.carn {
    --tcg-top: #2a1a1a;
    --tcg-accent: #e85454;
    --tcg-glow: rgba(232,84,84,.5);
    --tcg-badge: rgba(232,84,84,.18)
}

.tcg-header {
    background: var(--tcg-top);
    padding: 14px 16px 10px;
    border-bottom: 2px solid var(--tcg-accent);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative
}
.tcg-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.04) 0%, transparent 60%);
    pointer-events: none
}
.tcg-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    color: #fff;
    line-height: 1.1
}
.tcg-subtitle {
    font-size: 9px;
    color: var(--tcg-accent);
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-top: 3px
}
.tcg-rythme-badge {
    font-size: 11px;
    font-weight: 500;
    background: var(--tcg-badge);
    border: 1px solid var(--tcg-accent);
    color: var(--tcg-accent);
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap
}
.tcg-rhythm-badge .badge-label {
    font-size: 8px;
    color: var(--tcg-accent);
    opacity: .7;
    text-transform: uppercase;
    letter-spacing: .1em
}


.tcg-image-zone {
    background: #0c0c0e;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden
}
.tcg-image-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 110%, var(--tcg-glow), transparent 65%);
    pointer-events: none
}
.tcg-animal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 24px var(--tcg-glow))
}
.tcg-animal-emoji-fallback {
    font-size: 100px;
    line-height: 1;
    filter: drop-shadow(0 4px 24px var(--tcg-glow));
    position: relative;
    z-index: 1
}

.tcg-body {
    background: #13131a;
    padding: 12px 14px
}
.tcg-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap
}
.tcg-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px
}
.tcg-tag {
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid transparent
}
.tcg-tag.sex-m { background: rgba(91,156,246,.15); border-color: rgba(91,156,246,.3); color: #8bb5f8 }
.tcg-tag.sex-f { background: rgba(232,125,189,.15); border-color: rgba(232,125,189,.3); color: var(--pink) }
.tcg-tag.sp-herb { background: rgba(61,220,151,.12); border-color: rgba(61,220,151,.3); color: #6edaaa }
.tcg-tag.sp-carn { background: rgba(232,84,84,.12); border-color: rgba(232,84,84,.3); color: #f08080 }

.tcg-dob {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 4px
}
.tcg-dob .dob-sym {
    justify-content: center;
    align-items: center;
    display: flex;
    flex-direction: column;
    padding: 4px 2px
}
.tcg-dob .dob-sym .ball {
    font-size: 26px;
    line-height: 1.1
}
.tcg-dob .dob-sym .pol {
    width: 20px;
    height: 3px;
    border-radius: 2px
}

.tcg-footer {
    display: flex;
    gap: 8px;
    padding: 10px 14px 12px;
    background: #0e0e10;
    border-top: 1px solid var(--border)
}
.tcg-close-btn {
    flex: 1;
    font-family: var(--font-body);
    font-size: 11px;
    padding: 7px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: border-color .2s, color .2s
}
.tcg-close-btn:hover { border-color: rgba(255,255,255,.2); color: var(--text) }
.tcg-confirm-btn {
    flex: 2;
    font-family: var(--font-body);
    font-size: 11px;
    padding: 7px;
    border-radius: 8px;
    border: 1px solid var(--tcg-accent);
    background: var(--tcg-badge);
    color: var(--tcg-accent);
    cursor: pointer;
    font-weight: 500;
    transition: background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px
}
.tcg-confirm-btn:hover { background: rgba(255,255,255,.08) }

/* shimmer animation on card appear */
.tcg-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.07) 50%, transparent 65%);
    animation: tcg-shine 1.8s ease .3s both;
    pointer-events: none;
    z-index: 10
}
@keyframes tcg-shine {
    0%   { transform: translateX(-100%) }
    100% { transform: translateX(200%) }
}

/* OBJECT CARDS */
.shop-section-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin: 1rem 0 .6rem
}

.obj-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .75rem .8rem;
    transition: border-color .2s, box-shadow .2s, opacity .2s;
    position: relative
}

.obj-card.available {
    opacity: 1;
    border-color: rgba(255, 255, 255, .1);
    cursor: pointer
}

.obj-card.available:hover {
    border-color: rgba(255, 255, 255, .25)
}

.obj-card.available.selecting {
    border-color: var(--amber);
    box-shadow: 0 0 10px rgba(232, 166, 48, .25)
}

.obj-card.attached {
    opacity: .45;
    cursor: default
}

.obj-card .card-face {
    font-size: 22px;
    margin-bottom: 6px;
    line-height: 1
}

.obj-card-name {
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 4px
}

.obj-card-desc {
    font-size: 10px;
    color: var(--muted);
    line-height: 1.4;
    margin-bottom: 6px
}

.obj-attach-info {
    font-size: 10px;
    color: var(--amber);
    margin-top: 4px
}

.obj-attach-info.done {
    color: var(--muted)
}

.attach-hint {
    font-size: 11px;
    color: var(--amber);
    min-height: 18px;
    margin-top: .5rem
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem 1rem;
    font-size: 12px;
    color: var(--text);
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    white-space: nowrap
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0)
}

/* ACHIEVEMENTS */
.ach-section {
    margin-bottom: 1.5rem
}

.ach-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    margin-bottom: .6rem
}

.ach-header:hover .section-label {
    color: var(--text)
}

.ach-toggle {
    font-size: 10px;
    color: var(--muted)
}

.ach-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px
}

@media(max-width:500px) {
    .ach-grid { grid-template-columns: repeat(2, 1fr) }
}

.ach-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .65rem .8rem;
    transition: border-color .3s, opacity .3s
}

.ach-card.locked {
    opacity: .38;
    filter: grayscale(1)
}

.ach-card.unlocked {
    border-color: rgba(232, 166, 48, .4);
    box-shadow: 0 0 10px rgba(232, 166, 48, .1)
}

.ach-card .card-topleft {
    width: 32px;
    flex-shrink: 0
}

.ach-card .ach-emoji {
    font-size: 22px;
    line-height: 1
}

.ach-card .ach-name {
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 3px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px
}

.ach-card .ach-desc {
    font-size: 9px;
    color: var(--muted);
    line-height: 1.4;
    text-align: right
}

.ach-card .ach-prog {
    margin-top: 5px;
    height: 2px;
    background: var(--surface2);
    border-radius: 1px;
    overflow: hidden
}

.ach-card .ach-prog-fill {
    height: 100%;
    background: var(--amber);
    border-radius: 1px;
    transition: width .4s
}

/* Achievement view button */
.ach-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(0, 98, 122, 0.3);
    border: none;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    margin-left: 4px;
    padding: 0;
    vertical-align: middle
}

.ach-view-btn:hover {
    background: rgba(0, 0, 0, 0.5)
}

.ach-card .ach-name {
    display: flex;
    align-items: center;
    justify-content: space-between
}

/* Achievement image modal */
.ach-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s
}

.ach-image-overlay.visible {
    opacity: 1;
    pointer-events: all
}

.ach-image-modal {
    background: var(--surface);
    border-radius: 12px;
    padding: 0;
    max-width: 80%;
    max-height: 80%;
    position: relative;
    overflow: hidden
}

.ach-image-content {
    display: flex;
    flex-direction: column;
    align-items: center
}

.ach-image-modal img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    background: var(--surface2)
}

.ach-image-info {
    padding: 1rem;
    text-align: center;
    width: 100%
}

.ach-image-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text)
}

.ach-image-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4
}

.ach-image-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center
}

.ach-image-close:hover {
    background: rgba(0, 0, 0, 0.7)
}

/* Achievement unlock toast — distinct from regular toast */
.ach-toast {
    position: fixed;
    bottom: 4.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--surface2);
    border: 1px solid rgba(232, 166, 48, .5);
    border-radius: 12px;
    padding: 1rem;
    font-size: 14px;
    color: var(--text);
    opacity: 0;
    transition: opacity .3s, transform .3s;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(232, 166, 48, .2);
    max-width: calc(100vw - 2rem);
    overflow: hidden
}

.ach-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0)
}

.ach-toast .ach-toast-label {
    font-size: 11px;
    color: var(--amber);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 4px
}
.ach-toast-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-top: 8px
}

#ach-toast-image-container {
    flex-shrink: 0
}

.ach-toast-text {
    flex: 1;
    min-width: 0;
    width: 100%
}

#ach-toast-body {
    font-size: min(16px, 4vw);
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    word-break: break-word
}

#ach-toast-desc {
    font-size: min(14px, 3.5vw);
    color: var(--text-secondary);
    margin-top: min(12px, 3vw);
    opacity: 0.9;
    overflow: hidden;
    word-break: break-word;
    text-align: center;
    padding: 0 min(10px, 2.5vw)
}

.ach-toast-image {
    width: 140px;
    height: 140px;
    border-radius: 10px;
    object-fit: cover;
    display: block
}

.ach-toast.has-image {
    width: auto;
    max-width: 350px;
    padding: 1rem
}

.ach-toast.has-image .ach-toast-content {
    flex-direction: column;
    align-items: center;
    gap: 12px
}

.ach-toast.has-image .ach-toast-text {
    text-align: center;
    width: 100%
}

.ach-toast:not(.has-image) #ach-toast-image-container {
    display: none
}

/* ── DOBBLE MODAL ── */
.dobble-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s
}
.dobble-overlay.visible {
    opacity: 1;
    pointer-events: all
}
.dobble-modal {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    padding: 1.5rem 1.25rem 1.25rem;
    max-width: 420px;
    width: calc(100vw - 2rem);
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    transform: translateY(10px);
    transition: transform .22s
}
.dobble-overlay.visible .dobble-modal {
    transform: translateY(0)
}
.dobble-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: .3rem;
    letter-spacing: -.01em
}
.dobble-subtitle {
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 1.2rem
}
.dobble-animals-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.2rem
}
.dobble-animal-col {
    flex: 1;
    max-width: 180px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .75rem;
    text-align: center
}
.dobble-animal-emoji {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: .4rem
}
.dobble-animal-name {
    font-size: 11px;
    font-weight: 500;
    margin-bottom: .65rem;
    color: var(--text)
}
.dobble-symbols {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center
}
.dobble-sym-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, background .15s, transform .1s;
    position: relative;
    padding: 0;
    overflow: hidden
}
.dobble-sym-btn .dob-sym {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    position: relative
}
.dobble-sym-btn .dob-sym .ball {
    font-size: 18px;
    line-height: 1
}
.dobble-sym-btn .dob-sym .pol {
    width: 14px;
    height: 2px;
    border-radius: 1px
}
.dobble-sym-btn:hover {
    border-color: rgba(255,255,255,.3);
    background: var(--surface2);
    transform: scale(1.12)
}
.dobble-sym-btn.wrong {
    animation: dob-shake .35s ease;
    border-color: var(--red);
    background: rgba(232,84,84,.12)
}
.dobble-sym-btn.correct {
    border-color: var(--green);
    background: rgba(61,220,151,.18);
    transform: scale(1.2)
}
@keyframes dob-shake {
    0%,100%{transform:translateX(0)}
    20%{transform:translateX(-5px)}
    40%{transform:translateX(5px)}
    60%{transform:translateX(-4px)}
    80%{transform:translateX(3px)}
}
.dobble-hint-row {
    text-align: center;
    font-size: 10px;
    color: var(--muted);
    min-height: 16px;
    margin-top: .5rem
}
.dobble-cancel-btn {
    display: block;
    margin: .9rem auto 0;
    font-family: var(--font-body);
    font-size: 10px;
    padding: 4px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color .2s, border-color .2s
}
.dobble-cancel-btn:hover {
    color: var(--red);
    border-color: var(--red)
}

/* RESET BUTTON */
.reset-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border)
}
.reset-btn {
    background: var(--surface);
    border: 2px solid var(--red);
    border-radius: 8px;
    padding: .75rem 1rem;
    font-size: 12px;
    color: var(--red);
    cursor: pointer;
    text-align: center;
    font-weight: 500
}
.reset-confirm-container {
    margin-top: .5rem;
    display: none
}
.reset-cancel-btn {
    background: var(--surface);
    border: 2px solid var(--green);
    border-radius: 8px;
    padding: .75rem 1rem;
    font-size: 12px;
    color: var(--green);
    cursor: pointer;
    text-align: center;
    margin-bottom: .3rem
}
.reset-confirm-btn {
    background: var(--red);
    border: 2px solid var(--red);
    border-radius: 8px;
    padding: .75rem 1rem;
    font-size: 12px;
    color: white;
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    margin-bottom: .3rem
}
.switch-set-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: .75rem 1rem;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    margin-bottom: .3rem
}
