/* =========================================================
   Pixel SMP — Minecraft UI components
   Hjerter, XP-bar, hotbar, item-slots, fakler, blokke
   ========================================================= */

/* ---------- Item slot (Minecraft inventory style) ---------- */
.mc-slot {
    background: #8b8b8b;
    border-top:    3px solid #fefefe;
    border-left:   3px solid #fefefe;
    border-right:  3px solid #373737;
    border-bottom: 3px solid #373737;
    box-shadow: inset 0 0 0 3px #5b5b5b;
    image-rendering: pixelated;
    position: relative;
    padding: .8rem;
}
.mc-slot.is-dark {
    background: #1f1f2e;
    border-top-color:    #4b4b66;
    border-left-color:   #4b4b66;
    border-right-color:  #0a0a14;
    border-bottom-color: #0a0a14;
    box-shadow: inset 0 0 0 3px #14141f;
}

/* ---------- Minecraft button bevel (override of .btn) ---------- */
.mc-btn {
    position: relative;
    border: none !important;
    box-shadow:
        inset  3px  3px 0 0 rgba(255,255,255,.45),
        inset -3px -3px 0 0 rgba(0,0,0,.55),
        4px 4px 0 0 rgba(0,0,0,.6) !important;
    transition: transform .08s ease, box-shadow .08s ease;
}
.mc-btn:active {
    transform: translate(2px, 2px);
    box-shadow:
        inset  3px  3px 0 0 rgba(255,255,255,.25),
        inset -3px -3px 0 0 rgba(0,0,0,.65),
        2px 2px 0 0 rgba(0,0,0,.6) !important;
}

/* ---------- Hearts (server health) ---------- */
.hearts {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}
.heart {
    width: 18px; height: 16px;
    background:
        radial-gradient(circle at 30% 35%, #ff4d4d 4px, transparent 5px),
        radial-gradient(circle at 70% 35%, #ff4d4d 4px, transparent 5px),
        linear-gradient(180deg, transparent 50%, #ff4d4d 50% 75%, transparent 76%);
    -webkit-mask:
        conic-gradient(from 45deg at 50% 60%, #000 0 25%, transparent 0 75%, #000 0),
        radial-gradient(circle at 30% 40%, #000 6px, transparent 6.5px),
        radial-gradient(circle at 70% 40%, #000 6px, transparent 6.5px);
    -webkit-mask-composite: source-over;
    /* Simpler: use SVG-like CSS heart */
    background: #ff2d2d;
    clip-path: polygon(
        50% 100%, 0% 50%, 0% 25%, 25% 0%, 50% 25%,
        75% 0%, 100% 25%, 100% 50%
    );
    filter: drop-shadow(2px 2px 0 #000);
    image-rendering: pixelated;
}
.heart.is-empty { background: #4a1c1c; }
.heart.is-half {
    background: linear-gradient(90deg, #ff2d2d 50%, #4a1c1c 50%);
}

/* ---------- XP bar ---------- */
.xp-bar {
    position: relative;
    height: 14px;
    background: #1f1f2e;
    border: 2px solid #000;
    box-shadow: inset 0 0 0 1px #4b4b66;
    overflow: hidden;
    image-rendering: pixelated;
}
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(180deg, #b6ffae 0%, #4ad13d 50%, #2a8c20 100%);
    width: 0%;
    transition: width .4s ease;
    box-shadow: 0 0 8px rgba(109,255,92,.5);
}
.xp-bar-label {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--f-display);
    font-size: .55rem;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    letter-spacing: 1px;
}

/* ---------- TPS pixel bar ---------- */
.tps-bar {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}
.tps-bar .tick {
    width: 6px; height: 14px;
    background: #2a8c20;
    box-shadow: inset 0 0 0 1px #1a5614;
}
.tps-bar .tick.is-mid  { background: #d6b53a; box-shadow: inset 0 0 0 1px #7a6420; }
.tps-bar .tick.is-low  { background: #d63a3a; box-shadow: inset 0 0 0 1px #7a2020; }
.tps-bar .tick.is-off  { background: #2a2a3a; box-shadow: inset 0 0 0 1px #14141f; }

/* ---------- Player head ---------- */
.head {
    width: 32px; height: 32px;
    image-rendering: pixelated;
    border: 2px solid #000;
    box-shadow: 2px 2px 0 #000;
    background: #4b3a2a;
    flex-shrink: 0;
}
.head.head-lg { width: 48px; height: 48px; }
.head.head-sm { width: 24px; height: 24px; box-shadow: 1px 1px 0 #000; }

/* ---------- Torch in hero corners ---------- */
.torch {
    position: absolute;
    width: 16px; height: 56px;
    z-index: 6;
    pointer-events: none;
}
.torch-stick {
    position: absolute;
    bottom: 0; left: 6px;
    width: 4px; height: 36px;
    background: #6b3a18;
    box-shadow:
        0 4px 0 #4a2810,
        2px 0 0 #4a2810;
    image-rendering: pixelated;
}
.torch-flame {
    position: absolute;
    bottom: 30px; left: 4px;
    width: 8px; height: 12px;
    background: #ffce42;
    box-shadow:
        0 -4px 0 #ff8a1f,
        2px -2px 0 #ff8a1f,
       -2px -2px 0 #ff8a1f,
        0 -8px 0 #ff5b1f,
        4px 4px 12px rgba(255,180,40,.8);
    image-rendering: pixelated;
    animation: flicker 0.18s steps(2) infinite;
}
.torch-glow {
    position: absolute;
    bottom: 18px; left: -20px;
    width: 56px; height: 56px;
    background: radial-gradient(circle, rgba(255,200,80,.45) 0%, transparent 70%);
    animation: flickerGlow 0.4s ease-in-out infinite alternate;
    pointer-events: none;
}
.torch-tl { top: 12px;    left: 16px; }
.torch-tr { top: 12px;    right: 16px; }

/* ---------- Dirt block (used as divider) ---------- */
.dirt-divider {
    height: 32px;
    background-image:
        repeating-linear-gradient(90deg,
            #6b3a18 0 32px,
            #5a2f12 32px 64px);
    border-top: 4px solid #4a2810;
    border-bottom: 4px solid #2a1608;
    image-rendering: pixelated;
    position: relative;
    box-shadow: 0 4px 0 #2a1608;
}
.dirt-divider::before {
    /* grass top */
    content: "";
    position: absolute;
    top: -10px; left: 0; right: 0;
    height: 10px;
    background:
        repeating-linear-gradient(90deg,
            #4ad13d 0 8px,
            #3fb031 8px 16px);
    border-top: 3px solid #1a5614;
}
.dirt-divider::after {
    /* speckles */
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, #4a2810 1px, transparent 2px),
        radial-gradient(circle, #2a1608 1px, transparent 2px);
    background-position: 8px 12px, 22px 22px;
    background-size: 32px 32px, 32px 32px;
    opacity: .6;
}

/* ---------- Crack overlay (4 stages) ---------- */
.crack {
    position: absolute; inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(45deg, transparent 40%, rgba(0,0,0,.4) 40% 42%, transparent 42%),
        linear-gradient(-45deg, transparent 60%, rgba(0,0,0,.3) 60% 62%, transparent 62%);
    opacity: 0;
    transition: opacity .15s steps(4);
}
.crack-host:hover .crack { opacity: .9; }

/* ---------- Tooltip ---------- */
.tip { position: relative; }
.tip[data-tip]:hover::after,
.tip[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f1f2e;
    color: #fff;
    border: 2px solid #000;
    box-shadow: 3px 3px 0 #000;
    padding: .4rem .6rem;
    font-family: var(--f-display);
    font-size: .55rem;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
}

/* ---------- Achievement toast (Minecraft-style) ---------- */
.achievement {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: min(340px, 92vw);
    background: #1f1f2e;
    border: 3px solid #000;
    box-shadow:
        inset  2px  2px 0 0 rgba(255,255,255,.15),
        inset -2px -2px 0 0 rgba(0,0,0,.6),
        5px 5px 0 #000;
    padding: .8rem .9rem;
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: .8rem;
    align-items: center;
    z-index: 950;
    transform: translateX(120%);
    transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.achievement.is-visible { transform: translateX(0); }
.achievement-icon {
    width: 40px; height: 40px;
    background: #6b3a18;
    border: 2px solid #000;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    box-shadow: inset 2px 2px 0 rgba(255,255,255,.2);
}
.achievement-text {
    display: flex; flex-direction: column;
    line-height: 1.2;
}
.achievement-title {
    font-family: var(--f-display);
    font-size: .55rem;
    color: var(--c-cyan);
    margin-bottom: 2px;
}
.achievement-msg {
    font-family: var(--f-body);
    font-size: 1rem;
    color: #fff;
}

/* ---------- Health bar widget ---------- */
.health-widget {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: #1f1f2e;
    border: 2px solid #000;
    padding: .35rem .6rem;
    box-shadow: 2px 2px 0 #000;
    font-family: var(--f-display);
    font-size: .55rem;
    color: var(--c-text);
}
.health-widget .heart {
    width: 12px; height: 11px;
    filter: drop-shadow(1px 1px 0 #000);
}

/* ---------- Scroll XP bar (top of viewport) ---------- */
.scroll-xp {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: rgba(0,0,0,.4);
    z-index: 9999;
    pointer-events: none;
}
.scroll-xp-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--c-green) 0%, var(--c-cyan) 100%);
    box-shadow: 0 0 6px var(--c-green);
    transition: width .1s linear;
}

/* ---------- Hotbar layout ---------- */
.hotbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
    background: #1f1f2e;
    border: 3px solid #000;
    box-shadow: 4px 4px 0 #000;
}
@media (min-width: 720px) {
    .hotbar { grid-template-columns: repeat(3, 1fr); }
}
.hotbar-slot {
    width: 100%;
    min-width: 0;
    background: #5b5b5b;
    border-top:    3px solid #fefefe;
    border-left:   3px solid #fefefe;
    border-right:  3px solid #373737;
    border-bottom: 3px solid #373737;
    padding: 1.1rem 1rem;
    text-align: left;
    color: #fff;
    position: relative;
}
.hotbar-slot.is-selected {
    outline: 3px solid #fff;
    outline-offset: 0;
    box-shadow: 0 0 0 5px #000;
}
.hotbar-slot .slot-title {
    font-family: var(--f-display);
    font-size: .65rem;
    color: #ffd84a;
    text-shadow: 1px 1px 0 #000;
    margin-bottom: .8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.hotbar-slot ol {
    list-style: none;
    padding: 0; margin: 0;
    display: grid;
    gap: 6px;
}
.hotbar-slot li {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--f-body);
    font-size: 1.1rem;
    background: rgba(0,0,0,.35);
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,.08);
    min-width: 0;
}
.hotbar-slot li > span:not(.rank):not(.val) {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hotbar-slot li .rank {
    font-family: var(--f-display);
    font-size: .6rem;
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    color: #ffd84a;
}
.hotbar-slot li .val {
    margin-left: auto;
    flex-shrink: 0;
    font-family: var(--f-display);
    font-size: .6rem;
    color: var(--c-green);
}
.hotbar-slot li.r1 .rank { color: #ffd84a; text-shadow: 0 0 6px #ffd84a; }
.hotbar-slot li.r2 .rank { color: #d8d8d8; }
.hotbar-slot li.r3 .rank { color: #cd7f32; }

/* ---------- Plot mosaic ---------- */
.plot-mosaic {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    aspect-ratio: 1 / 1;
    width: min(360px, 100%);
    background: #0a0420;
    padding: 6px;
    border: 3px solid #000;
    box-shadow: inset 0 0 0 2px #4b4b66, 4px 4px 0 #000;
}
.plot-cell {
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,.18), inset -1px -1px 0 rgba(0,0,0,.5);
    transition: transform .15s ease, filter .15s ease;
}
.plot-cell.s { background: #b53d3d; } /* sold */
.plot-cell.r { background: #d6b53a; } /* reserved */
.plot-cell.a { background: #4ad13d; } /* available */
.plot-cell:hover { transform: scale(1.15); filter: brightness(1.3); z-index: 2; }

.plot-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-family: var(--f-display);
    font-size: .6rem;
    color: var(--c-text);
}
.plot-legend .swatch {
    display: inline-block;
    width: 14px; height: 14px;
    margin-right: .35rem;
    border: 2px solid #000;
    vertical-align: middle;
}

/* ---------- Live status big number ---------- */
.live-card {
    background: var(--c-panel);
    border: 4px solid var(--c-green);
    box-shadow: 6px 6px 0 #000, 0 0 20px rgba(109,255,92,.25);
    padding: 1.6rem;
    text-align: center;
}
.live-dot {
    display: inline-block;
    width: 12px; height: 12px;
    background: var(--c-green);
    box-shadow: 0 0 8px var(--c-green), inset 0 0 0 2px #000;
    margin-right: .5rem;
    vertical-align: middle;
    animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
    0%,100% { box-shadow: 0 0 8px var(--c-green), inset 0 0 0 2px #000; }
    50%     { box-shadow: 0 0 18px var(--c-green), inset 0 0 0 2px #000; }
}
.live-big {
    font-family: var(--f-display);
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: var(--c-green);
    text-shadow: 4px 4px 0 #000, 0 0 20px rgba(109,255,92,.5);
    margin: .5rem 0;
    line-height: 1;
}
.live-big .slash { color: var(--c-text-dim); font-size: .6em; }
.live-label {
    font-family: var(--f-display);
    font-size: .65rem;
    color: var(--c-text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.live-meta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .6rem;
    margin-top: 1.2rem;
}
.live-meta-row .meta {
    background: var(--c-bg-3);
    border: 2px solid var(--c-cyan);
    padding: .6rem .8rem;
    font-family: var(--f-display);
    font-size: .55rem;
    color: var(--c-text);
    text-align: left;
}
.live-meta-row .meta .v { display: block; color: var(--c-cyan); font-size: .8rem; margin-top: .2rem; }

/* ---------- Online players strip ---------- */
.players-strip {
    overflow: hidden;
    position: relative;
    margin-top: 1rem;
    padding: .8rem;
    background: var(--c-bg-3);
    border: 3px solid #000;
    box-shadow: inset 0 0 0 2px #4b4b66;
    -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
            mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.players-track {
    display: flex;
    gap: 28px;
    width: max-content;
    animation: marquee 50s linear infinite;
}
.players-track .head {
    flex-shrink: 0;
}
.players-track figure {
    margin: 0;
    text-align: center;
    font-family: var(--f-body);
    font-size: .9rem;
    color: var(--c-text-dim);
    width: 80px;
    word-break: break-word;
    line-height: 1.15;
}
.players-track figcaption {
    margin-top: 4px;
}
@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ---------- Nav clock + weather + sound ---------- */
.nav-extras {
    display: flex; align-items: center; gap: .5rem;
    margin-left: auto;
}
.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--c-bg-2);
    border: 2px solid var(--c-cyan);
    padding: .35rem .55rem;
    font-family: var(--f-display);
    font-size: .55rem;
    color: var(--c-text);
    box-shadow: 2px 2px 0 #000;
}
.nav-pill .v { color: var(--c-cyan); }
.sound-toggle {
    background: var(--c-bg-2);
    border: 2px solid var(--c-purple);
    padding: .35rem .5rem;
    font-family: var(--f-display);
    font-size: .55rem;
    color: var(--c-text);
    box-shadow: 2px 2px 0 #000;
    cursor: pointer;
}
.sound-toggle:hover { color: var(--c-green); }
@media (max-width: 960px) {
    .nav-extras { margin-left: 0; }
}

/* ---------- Hero widgets (clock + weather) ---------- */
.hero-widgets {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    justify-content: center;
    margin-top: 1rem;
}
.hero-widget {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: rgba(255,255,255,.85);
    color: #1b0a3a;
    border: 3px solid #1b0a3a;
    box-shadow: var(--shadow-pixel);
    padding: .55rem .85rem;
    font-family: var(--f-display);
    font-size: .6rem;
    image-rendering: pixelated;
    text-shadow: none;
}
.hero-widget .hw-icon {
    font-size: 1.3rem;
    line-height: 1;
    filter: drop-shadow(2px 2px 0 rgba(0,0,0,.3));
}
.hero-widget .hw-label {
    color: #5a3a8c;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: .5rem;
}
.hero-widget .hw-value {
    color: var(--c-purple);
    font-size: .75rem;
    border-left: 2px solid rgba(27,10,58,.3);
    padding-left: .6rem;
    margin-left: .1rem;
}

/* ---------- DK badge ---------- */
.dk-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #fff;
    color: #c8102e;
    border: 3px solid #000;
    padding: .4rem .65rem;
    font-family: var(--f-display);
    font-size: .55rem;
    box-shadow: 3px 3px 0 #000;
    letter-spacing: 1px;
}
.dk-badge::before {
    content: "";
    display: inline-block;
    width: 14px; height: 10px;
    background:
        linear-gradient(0deg, #c8102e 50%, transparent 50%),
        linear-gradient(90deg, transparent 36%, #fff 36% 50%, transparent 50%),
        linear-gradient(0deg, transparent 36%, #fff 36% 64%, transparent 64%),
        #c8102e;
    border: 1px solid #000;
}

/* ---------- Highlight card ---------- */
.highlight-card {
    background: var(--c-panel);
    border: 4px solid var(--c-purple);
    box-shadow: 6px 6px 0 #000;
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: 80px 1fr;
    align-items: center;
}
.highlight-card .h-icon {
    width: 80px; height: 80px;
    background: var(--c-bg-3);
    border: 3px solid var(--c-cyan);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.6rem;
    box-shadow: 4px 4px 0 #000;
}
.highlight-card h3 { color: var(--c-cyan); margin-bottom: .3rem; }
.highlight-card p  { margin: 0; color: var(--c-text-dim); }

/* ---------- Plot stats grid ---------- */
.plot-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
    align-items: center;
}
@media (min-width: 760px) {
    .plot-stats { grid-template-columns: auto 1fr; }
}
.plot-numbers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
}
.plot-number {
    background: var(--c-panel);
    border: 3px solid #000;
    box-shadow: 4px 4px 0 #000;
    padding: 1rem .8rem;
    text-align: center;
}
.plot-number.is-sold     { border-color: #b53d3d; }
.plot-number.is-reserved { border-color: #d6b53a; }
.plot-number.is-available{ border-color: #4ad13d; }
.plot-number .n {
    font-family: var(--f-display);
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--c-text);
    text-shadow: 3px 3px 0 #000;
    display: block;
    line-height: 1.2;
}
.plot-number .l {
    font-family: var(--f-display);
    font-size: .55rem;
    color: var(--c-text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ---------- Events feed (recent activity) ---------- */
.events-list {
    list-style: none;
    margin: 0; padding: 0;
    display: grid;
    gap: .5rem;
}
.events-list li {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    background: var(--c-bg-3);
    border-left: 4px solid var(--c-cyan);
    font-family: var(--f-body);
    font-size: 1.05rem;
    color: var(--c-text);
}
.events-list li.t-join        { border-left-color: var(--c-green); }
.events-list li.t-death       { border-left-color: #b53d3d; }
.events-list li.t-achievement { border-left-color: #ffd84a; }
.events-list li.t-plot        { border-left-color: var(--c-purple); }
.events-list li.t-build       { border-left-color: var(--c-cyan); }
.events-list li .ev-icon {
    width: 28px; height: 28px;
    background: var(--c-bg-2);
    border: 2px solid #000;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}
.events-list li .ev-name { color: var(--c-cyan); font-weight: bold; }

/* ---------- 8-bit Minecraft icons ---------- */
.mc-icon {
    display: inline-block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    vertical-align: -0.18em;
    width: 1.2em;
    height: 1.2em;
    flex-shrink: 0;
    user-select: none;
}
.mc-icon-sm { width: 1em;    height: 1em;    vertical-align: -0.15em; }
.mc-icon-md { width: 1.2em;  height: 1.2em;  vertical-align: -0.18em; }
.mc-icon-lg { width: 1.8em;  height: 1.8em;  vertical-align: -0.35em; }
.mc-icon-xl { width: 56px;   height: 56px;   vertical-align: middle;  }

/* Inline icons inside flex rows: keep them from collapsing */
.hw-icon .mc-icon,
.copy-icon .mc-icon,
.ev-icon .mc-icon,
.q-icon .mc-icon,
.h-icon .mc-icon,
.id-card .icon .mc-icon,
.voice-icon .mc-icon { display: block; margin: 0 auto; }

/* ---------- Pixel cursor ---------- */
.cursor-pixel, .cursor-pixel * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><rect x='2' y='2' width='3' height='3' fill='black'/><rect x='5' y='2' width='3' height='3' fill='white'/><rect x='2' y='5' width='3' height='3' fill='white'/><rect x='5' y='5' width='3' height='3' fill='black'/></svg>") 2 2, auto;
}

/* ---------- Floating sound toggle (bottom-right) ---------- */
.sound-toggle {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    appearance: none;
    background: #5b5b5b;
    color: #fff;
    border-top:    3px solid #fefefe;
    border-left:   3px solid #fefefe;
    border-right:  3px solid #373737;
    border-bottom: 3px solid #373737;
    box-shadow: 4px 4px 0 #000;
    padding: .65rem .9rem .65rem .75rem;
    font-family: var(--f-display);
    font-size: .6rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: inherit;
    transition: transform .1s ease, box-shadow .1s ease, background .15s ease;
}
.sound-toggle:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 #000;
    background: #6a6a6a;
}
.sound-toggle:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
}
.sound-toggle.is-on  { background: #2f7d3a; }
.sound-toggle.is-on:hover  { background: #389645; }
.sound-toggle.is-off { background: #8a2a2a; }
.sound-toggle.is-off:hover { background: #a73232; }

.sound-toggle .sound-label {
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

/* Pixel-art speaker icon built with box-shadow chunks */
.sound-toggle .sound-icon {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    image-rendering: pixelated;
}
.sound-toggle .speaker {
    position: absolute;
    left: 2px; top: 7px;
    width: 4px; height: 8px;
    background: #fff;
    box-shadow:
        4px -3px 0 #fff,  4px  3px 0 #fff,
        8px -5px 0 #fff,  8px  5px 0 #fff,
        4px -2px 0 #fff,  4px  2px 0 #fff,
        4px -1px 0 #fff,  4px  1px 0 #fff,
        4px  0    0 #fff;
}
.sound-toggle .wave {
    position: absolute;
    background: #fff;
    transition: opacity .15s ease;
}
.sound-toggle .wave.w1 {
    left: 14px; top: 9px;
    width: 2px; height: 4px;
    box-shadow: 2px -1px 0 #fff, 2px 4px 0 #fff;
}
.sound-toggle .wave.w2 {
    left: 18px; top: 7px;
    width: 2px; height: 8px;
    box-shadow: 2px -2px 0 #fff, 2px 8px 0 #fff;
}
.sound-toggle .mute-x {
    position: absolute;
    left: 12px; top: 8px;
    width: 10px; height: 2px;
    background: transparent;
    box-shadow:
        0 0 0 #ff5555,
        0 2px 0 #ff5555,
        2px 4px 0 #ff5555,
        4px 6px 0 #ff5555,
        6px 8px 0 #ff5555,
        8px 10px 0 #ff5555,
        8px -2px 0 #ff5555,
        6px 0 0 #ff5555,
        4px 2px 0 #ff5555,
        2px 4px 0 #ff5555,
        0 6px 0 #ff5555;
    opacity: 0;
    transition: opacity .15s ease;
}
.sound-toggle.is-off .wave { opacity: 0; }
.sound-toggle.is-off .mute-x { opacity: 1; }

@media (max-width: 540px) {
    .sound-toggle { padding: .55rem .65rem; }
    .sound-toggle .sound-label { display: none; }
}
