/* =========================================================================
   gameManager/MTG/dice.css — DICE + LIFE batch (2026-08-26)

   Everything for the counter dice that sit on battlefield / command-zone
   cards, the 3D dice-pair affordance that appears over a hovered card, the
   Add Dice / Edit Dice / Edit Life popup, and the two life-total dice at
   the top and bottom of the screen.

   HOW A DIE IS DRAWN (mechanics/diceKit.js builds the markup):
     <div class="die die-c-<color> die-t-<texture>" style="font-size:<px>">
       <svg class="die-face" viewBox="0 0 100 100"> ...number(s)... </svg>
     </div>
   The die is sized ENTIRELY in em (font-size = the die's pixel size), so
   one rule set draws a 20px die on a card, a 56px life die and the 120px
   preview in the popup identically — and because a card's dice live
   INSIDE the card element, they scale with the card's hover pop for free.
   Color = five CSS variables per .die-c-* class; texture = the ::before
   overlay + a filter per .die-t-* class. Adding a color or a texture is
   one rule block here + one entry in the whitelists (diceKit.js, index.js,
   saveDiceStyle.php).

   Scoping: every selector starts with .die, .dice-, #dice or #lifeDie —
   nothing existing is restyled.
   ========================================================================= */

/* ---------- Palette (one block per color) ----------
   --die-base  the body color        --die-hi  the specular highlight
   --die-lo    the shadow side       --die-ink the numeral color
   --die-ink-shadow  a soft outline behind the numeral for legibility     */
.die-c-crimson  { --die-base:#b6212f; --die-hi:#ff7a7a; --die-lo:#4e0910; --die-ink:#fff3ef; --die-ink-shadow:rgba(60,0,0,.85); }
.die-c-ember    { --die-base:#d8611b; --die-hi:#ffbe7a; --die-lo:#5e2405; --die-ink:#fff7ee; --die-ink-shadow:rgba(70,20,0,.85); }
.die-c-gold     { --die-base:#d3a21c; --die-hi:#ffef9a; --die-lo:#6b4a04; --die-ink:#2a1d05; --die-ink-shadow:rgba(255,245,200,.7); }
.die-c-emerald  { --die-base:#1f8a4b; --die-hi:#7fe9a7; --die-lo:#07361c; --die-ink:#f0fff5; --die-ink-shadow:rgba(0,40,15,.85); }
.die-c-teal     { --die-base:#17898f; --die-hi:#7fe6ea; --die-lo:#053638; --die-ink:#eefeff; --die-ink-shadow:rgba(0,40,45,.85); }
.die-c-sapphire { --die-base:#2050b8; --die-hi:#82a9ff; --die-lo:#081c52; --die-ink:#eef3ff; --die-ink-shadow:rgba(0,15,60,.85); }
.die-c-violet   { --die-base:#6a35b8; --die-hi:#c39bff; --die-lo:#280d55; --die-ink:#f6eeff; --die-ink-shadow:rgba(30,0,60,.85); }
.die-c-rose     { --die-base:#d43a7b; --die-hi:#ffa8cf; --die-lo:#5e1034; --die-ink:#fff0f7; --die-ink-shadow:rgba(70,0,35,.85); }
.die-c-ivory    { --die-base:#efe5cc; --die-hi:#fffdf3; --die-lo:#b3a37e; --die-ink:#2b2416; --die-ink-shadow:rgba(255,250,235,.8); }
.die-c-onyx     { --die-base:#25252d; --die-hi:#7c7c8c; --die-lo:#040406; --die-ink:#f4f4f7; --die-ink-shadow:rgba(0,0,0,.9); }

/* ---------- The die body ---------- */
.die {
    position: relative;
    display: inline-block;
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    border-radius: 22%;
    color: var(--die-ink);
    background:
        radial-gradient(circle at 30% 24%, var(--die-hi) 0%, rgba(255,255,255,0) 52%),
        linear-gradient(160deg, var(--die-base) 0%, var(--die-base) 50%, var(--die-lo) 100%);
    box-shadow:
        inset 0 -0.14em 0.18em rgba(0, 0, 0, 0.38),      /* the shaded lower edge  */
        inset 0 0.10em 0.16em rgba(255, 255, 255, 0.35), /* the lit upper edge     */
        inset 0 0 0 0.035em rgba(0, 0, 0, 0.28),         /* a crisp rim            */
        0 0.10em 0.20em rgba(0, 0, 0, 0.45);             /* it sits ON the surface */
    -webkit-user-select: none;
    user-select: none;
    line-height: 1;
}

/* Texture overlay — each .die-t-* class fills in the background of this
   pseudo-element (and, where it fits the material, tweaks the body below) */
.die::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
}

/* The numeral(s) — an SVG so they stay razor sharp at every card scale */
.die-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.die-face text {
    fill: currentColor;
    font-family: Georgia, "Times New Roman", "Palatino Linotype", serif;
    font-weight: 700;
    paint-order: stroke fill;
    stroke: var(--die-ink-shadow);
    stroke-width: 2.6px;
    stroke-linejoin: round;
}

.die-face .die-slash {
    stroke: currentColor;
    stroke-width: 4.5;
    stroke-linecap: round;
    opacity: 0.82;
}

/* ---------- Textures ---------- */

/* GLASS — translucent, a bright specular streak, a faint refracted glow
   at the bottom. The card art shows softly through the body. */
.die-t-glass {
    background:
        radial-gradient(circle at 30% 22%, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.18) 26%, rgba(255,255,255,0) 50%),
        radial-gradient(circle at 70% 88%, var(--die-hi) 0%, rgba(255,255,255,0) 40%),
        linear-gradient(160deg, var(--die-base) 0%, var(--die-base) 45%, var(--die-lo) 100%);
    opacity: 0.93;
    box-shadow:
        inset 0 -0.12em 0.20em rgba(0, 0, 0, 0.30),
        inset 0 0.06em 0.10em rgba(255, 255, 255, 0.55),
        inset 0 0 0 0.05em rgba(255, 255, 255, 0.28),
        0 0.10em 0.22em rgba(0, 0, 0, 0.45);
}
.die-t-glass::before {
    background:
        linear-gradient(118deg, rgba(255,255,255,0) 34%, rgba(255,255,255,0.32) 42%, rgba(255,255,255,0.55) 47%, rgba(255,255,255,0.10) 54%, rgba(255,255,255,0) 60%),
        linear-gradient(180deg, rgba(255,255,255,0) 70%, rgba(255,255,255,0.18) 100%);
}

/* STONE — matte, speckled, slightly desaturated; no specular at all */
.die-t-stone {
    background:
        radial-gradient(circle at 28% 20%, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 45%),
        linear-gradient(160deg, var(--die-base) 0%, var(--die-base) 40%, var(--die-lo) 100%);
    filter: saturate(0.78) contrast(0.98);
    box-shadow:
        inset 0 -0.12em 0.14em rgba(0, 0, 0, 0.42),
        inset 0 0.06em 0.10em rgba(255, 255, 255, 0.18),
        inset 0 0 0 0.035em rgba(0, 0, 0, 0.35),
        0 0.10em 0.18em rgba(0, 0, 0, 0.45);
}
.die-t-stone::before {
    background-image:
        radial-gradient(circle at 78% 30%, rgba(0,0,0,0.25) 0 6%, rgba(0,0,0,0) 8%),
        radial-gradient(circle at 22% 72%, rgba(255,255,255,0.16) 0 5%, rgba(255,255,255,0) 8%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.9 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
    background-size: 100% 100%, 100% 100%, 0.55em 0.55em;
    opacity: 0.55;
    mix-blend-mode: multiply;
}

/* STEEL — brushed metal: fine directional lines + a hard anisotropic
   highlight band, crisper corners, cooler saturation */
.die-t-steel {
    border-radius: 17%;
    background:
        linear-gradient(150deg, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.10) 30%, rgba(0,0,0,0.05) 45%, rgba(0,0,0,0.32) 62%, rgba(255,255,255,0.28) 100%),
        linear-gradient(160deg, var(--die-hi) 0%, var(--die-base) 35%, var(--die-base) 60%, var(--die-lo) 100%);
    filter: saturate(0.72) contrast(1.10);
    box-shadow:
        inset 0 -0.10em 0.12em rgba(0, 0, 0, 0.45),
        inset 0 0.06em 0.08em rgba(255, 255, 255, 0.55),
        inset 0 0 0 0.04em rgba(0, 0, 0, 0.40),
        0 0.10em 0.18em rgba(0, 0, 0, 0.50);
}
.die-t-steel::before {
    background:
        repeating-linear-gradient(104deg, rgba(255,255,255,0.14) 0 0.02em, rgba(0,0,0,0.10) 0.02em 0.04em, rgba(255,255,255,0) 0.04em 0.075em);
    opacity: 0.9;
}

/* WOOD — grain lines + a stretched turbulence, a warm sepia cast */
.die-t-wood {
    border-radius: 20%;
    background:
        radial-gradient(circle at 30% 24%, rgba(255,240,200,0.45) 0%, rgba(255,255,255,0) 50%),
        linear-gradient(160deg, var(--die-base) 0%, var(--die-base) 50%, var(--die-lo) 100%);
    filter: sepia(0.28) saturate(0.95);
    box-shadow:
        inset 0 -0.13em 0.16em rgba(0, 0, 0, 0.40),
        inset 0 0.08em 0.12em rgba(255, 240, 200, 0.28),
        inset 0 0 0 0.035em rgba(40, 20, 0, 0.35),
        0 0.10em 0.18em rgba(0, 0, 0, 0.45);
}
.die-t-wood::before {
    background-image:
        repeating-linear-gradient(4deg, rgba(60,30,5,0.16) 0 0.025em, rgba(60,30,5,0) 0.025em 0.12em, rgba(60,30,5,0.08) 0.12em 0.15em, rgba(60,30,5,0) 0.15em 0.27em),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='w'><feTurbulence type='fractalNoise' baseFrequency='0.015 0.32' numOctaves='3' seed='7' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.12  0 0 0 0 0  0 0 0 0.75 0'/></filter><rect width='160' height='160' filter='url(%23w)'/></svg>");
    background-size: 100% 100%, 1.6em 1.6em;
    opacity: 0.58;
    mix-blend-mode: multiply;
}

/* RUGGED — weathered and scuffed: two scratch directions, heavy grit, a
   dark vignette, a dented corner, and a slightly irregular silhouette */
.die-t-rugged {
    border-radius: 24% 19% 23% 18%;
    background:
        radial-gradient(circle at 30% 24%, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0) 45%),
        radial-gradient(circle at 82% 78%, rgba(0,0,0,0.35) 0 9%, rgba(0,0,0,0) 20%),
        linear-gradient(160deg, var(--die-base) 0%, var(--die-base) 42%, var(--die-lo) 100%);
    filter: contrast(1.08) saturate(0.85);
    box-shadow:
        inset 0 -0.14em 0.16em rgba(0, 0, 0, 0.50),
        inset 0 0.06em 0.10em rgba(255, 255, 255, 0.22),
        inset 0 0 0.30em rgba(0, 0, 0, 0.38),
        inset 0 0 0 0.04em rgba(0, 0, 0, 0.45),
        0 0.10em 0.18em rgba(0, 0, 0, 0.50);
}
.die-t-rugged::before {
    background-image:
        repeating-linear-gradient(38deg, rgba(255,255,255,0.20) 0 0.02em, rgba(255,255,255,0) 0.02em 0.17em),
        repeating-linear-gradient(-54deg, rgba(0,0,0,0.30) 0 0.015em, rgba(0,0,0,0) 0.015em 0.23em),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='r'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' seed='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='120' height='120' filter='url(%23r)'/></svg>");
    background-size: 100% 100%, 100% 100%, 0.7em 0.7em;
    opacity: 0.62;
    mix-blend-mode: multiply;
}

/* =========================================================================
   DICE ON A CARD — the tray sits at the very top of the card, inside it,
   so it scales/rotates/travels with the card. cardDice.js builds it.
   ========================================================================= */
.dice-tray {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
    padding: 2px 3px 0;
    z-index: 15;
    pointer-events: none;
}

.dice-tray .die {
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.dice-tray .die:hover {
    transform: translateY(-4%) scale(1.06);
}

/* The opponent's dice are read-only on my screen */
.dice-tray.dice-tray-ro .die {
    pointer-events: none;
    cursor: default;
}

/* =========================================================================
   THE AFFORDANCE — a pair of 3D dice that fades in above a hovered card
   (player side only) once the hover pop has finished growing. Sized in the
   card's own (unscaled) space: at the 2× hover scale the icon paints ~52px
   tall, straddling the card's top edge — half over the card, half above.
   ========================================================================= */
.dice-btn {
    position: absolute;
    top: -13px;
    left: 50%;
    width: 44px;
    height: 26px;
    margin-left: -22px;
    z-index: 20;
    cursor: pointer;
    opacity: 0;
    transform: translateY(3px) scale(0.92);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 4px rgba(255, 235, 170, 0.35));
}

.dice-btn.dice-btn-raised {
    /* the card already carries dice at its top edge — sit fully above them */
    top: -30px;
}

.dice-btn.dice-btn-show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dice-btn:hover {
    transform: translateY(-1px) scale(1.12);
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 7px rgba(255, 220, 130, 0.75));
}

.dice-btn svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* =========================================================================
   THE POPUP — Add Dice / Edit Dice / Edit Life.
   Dark, warm-accented (the in-game trays' language) so the textured dice
   read true; the buttons keep the site's rounded shapes. Change the four
   variables below to re-theme it.
   ========================================================================= */
#diceOverlay {
    --dice-panel: #1d1d23;
    --dice-panel-2: #26262e;
    --dice-accent: #ffd27a;
    --dice-text: #f1ece0;
    position: fixed;
    inset: 0;
    z-index: 9700;   /* above the presentation (9600) and chat (9500), below the account dialogs (9999) */
    display: flex;
    align-items: center;
    justify-content: center;
    /* the SAME backdrop the card presentation uses (cardPresent.js
       ensureOverlay) — the dice popup should feel like the show did */
    background: radial-gradient(ellipse at center, rgba(8, 10, 18, 0.55) 0%, rgba(4, 5, 10, 0.82) 100%);
    opacity: 0;
    transition: opacity 0.22s ease;
}

#diceOverlay.dice-overlay-in {
    opacity: 1;
}

#diceOverlay.hidden {
    display: none;
}

.dice-dialog {
    width: 430px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 20px 24px 22px;
    border-radius: 16px;
    color: var(--dice-text);
    background: linear-gradient(180deg, var(--dice-panel-2) 0%, var(--dice-panel) 100%);
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    font-family: Helvetica, Arial, sans-serif;   /* the site's body font (core/base.css) */
    font-size: 14px;
    transform: translateY(10px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#diceOverlay.dice-overlay-in .dice-dialog {
    transform: translateY(0) scale(1);
}

.dice-dialog * {
    box-sizing: border-box;
}

.dice-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.dice-title {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--dice-text);
}

.dice-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(241, 236, 224, 0.7);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dice-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Edit-only row: "Same as Last" (text, 75%) + "Delete Dice" (button, 25%) */
.dice-edit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 0 6px;
    min-height: 34px;
}

.dice-edit-row.hidden {
    display: none;
}

.dice-same-last {
    flex: 3 1 0;
    text-align: left;
    padding: 6px 4px;
    border: none;
    background: transparent;
    color: var(--dice-accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.dice-same-last:hover {
    background: rgba(255, 210, 122, 0.10);
}

.dice-same-last.hidden {
    visibility: hidden;
    pointer-events: none;
}

.dice-delete {
    flex: 1 1 0;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 110, 110, 0.45);
    background: rgba(220, 38, 38, 0.10);
    color: #ff9c9c;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dice-delete:hover {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(255, 110, 110, 0.9);
}

/* The big die + arrows */
.dice-preview-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 10px 0 4px;
}

.dice-arrow {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    color: var(--dice-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.dice-arrow svg {
    width: 20px;
    height: 20px;
    display: block;
}

.dice-arrow:hover {
    background: rgba(255, 210, 122, 0.16);
    border-color: rgba(255, 210, 122, 0.6);
    color: var(--dice-accent);
}

.dice-arrow:active {
    transform: scale(0.92);
}

.dice-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 132px;
    height: 132px;
}

/* The die IS the editor: the numerals are real inputs laid over the face,
   drawn in the same serif + ink so they look like part of the die until
   hovered/focused. Selectors carry #diceOverlay + the element so they beat
   base.css's global input[type="text"] rules (width/padding/border/16px). */
.dice-preview .die {
    font-size: 118px;
}

#diceOverlay input.dice-num {
    position: absolute;
    width: 1.15em;
    height: 1em;
    margin: 0;
    padding: 0 0 0.04em;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--die-ink);
    font-family: Georgia, "Times New Roman", "Palatino Linotype", serif;
    font-weight: 700;
    text-align: center;
    line-height: 1;
    outline: none;
    text-shadow: 0 0 2px var(--die-ink-shadow), 0 0 2px var(--die-ink-shadow), 0 0 2px var(--die-ink-shadow);
    transition: background-color 0.15s ease, border-color 0.15s ease;
    -moz-appearance: textfield;
    appearance: textfield;
    cursor: text;
}

#diceOverlay input.dice-num::-webkit-outer-spin-button,
#diceOverlay input.dice-num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#diceOverlay input.dice-num:hover {
    background: rgba(255, 255, 255, 0.10);
    border-bottom-color: rgba(255, 255, 255, 0.35);
}

#diceOverlay input.dice-num:focus {
    background: rgba(255, 255, 255, 0.14);
    border-bottom-color: var(--dice-accent);
}

/* Standard counter: one big numeral dead center */
#diceOverlay input.dice-num-center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.52em;
}

#diceOverlay input.dice-num-center.dice-num-long {
    font-size: 0.40em;
    width: 1.6em;
}

/* Power / toughness: top-left and bottom-right of the slash */
#diceOverlay input.dice-num-tl {
    left: 7%;
    top: 12%;
    font-size: 0.30em;
    width: 1.5em;
}

#diceOverlay input.dice-num-br {
    right: 7%;
    bottom: 12%;
    font-size: 0.30em;
    width: 1.5em;
}

.dice-mode-label {
    text-align: center;
    margin: 6px 0 12px;
    font-size: 13px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(241, 236, 224, 0.62);
    font-weight: 600;
}

.dice-hint {
    text-align: center;
    margin: -8px 0 10px;
    font-size: 11.5px;
    color: rgba(241, 236, 224, 0.42);
}

/* The four P/T modifier buttons */
.dice-pt-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.dice-pt-row.hidden {
    display: none;
}

.dice-pt-btn {
    padding: 9px 0;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    color: var(--dice-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.dice-pt-btn:hover {
    background: rgba(255, 210, 122, 0.16);
    border-color: rgba(255, 210, 122, 0.6);
    color: var(--dice-accent);
}

.dice-pt-btn:active {
    transform: scale(0.95);
}

/* Color + texture sections */
.dice-section {
    margin-bottom: 12px;
}

.dice-section-title {
    font-size: 11.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(241, 236, 224, 0.55);
    margin: 0 0 8px 2px;
    font-weight: 600;
}

.dice-swatches {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    justify-items: center;
}

.dice-swatch {
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.12s ease;
}

.dice-swatch .die {
    font-size: 34px;
}

.dice-swatch:hover {
    transform: translateY(-2px);
}

.dice-swatch.dice-selected::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    border: 2px solid var(--dice-accent);
    box-shadow: 0 0 10px rgba(255, 210, 122, 0.45);
    pointer-events: none;
}

.dice-textures {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.dice-texture {
    padding: 8px 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(241, 236, 224, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 11px;
    letter-spacing: 0.04em;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}

.dice-texture .die {
    font-size: 36px;
}

.dice-texture:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.dice-texture.dice-selected {
    border-color: var(--dice-accent);
    box-shadow: 0 0 10px rgba(255, 210, 122, 0.35);
    color: var(--dice-accent);
}

/* Cancel / Add Dice / Save */
.dice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.dice-actions button {
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.dice-actions button:active {
    transform: scale(0.97);
}

.dice-cancel {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: transparent;
    color: rgba(241, 236, 224, 0.85);
}

.dice-cancel:hover {
    background: rgba(255, 255, 255, 0.07);
}

.dice-primary {
    border: none;
    background: linear-gradient(180deg, #ffdc8e 0%, #f0b84a 100%);
    color: #2a1d05;
    box-shadow: 0 4px 14px rgba(240, 184, 74, 0.35);
    min-width: 110px;
}

.dice-primary:hover {
    background: linear-gradient(180deg, #ffe4a3 0%, #f5c25c 100%);
    box-shadow: 0 6px 18px rgba(240, 184, 74, 0.5);
}

/* =========================================================================
   LIFE DICE — the opponent's at the very top center, mine at the very
   bottom center (the only clickable one). z 6 keeps them above the hand
   strips (z 2–4) and below the deck viewer / floating cards (1000).
   lifeCounter.js positions them on the game's width (window.gameW()).
   ========================================================================= */
.life-die-wrap {
    position: fixed;
    left: 50%;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.life-die-wrap.life-die-on {
    opacity: 1;
}

.life-die-wrap.hidden {
    display: none;
}

#lifeDieMe {
    bottom: 6px;
}

#lifeDieOpp {
    top: 6px;
}

.life-die-wrap .die {
    font-size: 54px;
    pointer-events: auto;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

#lifeDieMe .die {
    cursor: pointer;
}

#lifeDieMe .die:hover {
    transform: translateY(-3px) scale(1.08);
}

.life-die-label {
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.7);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* (lifeCounter.js orders the children: label ABOVE my die, BELOW the opponent's) */

/* A brief pulse when a life total changes */
@keyframes lifeDiePulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.22); }
    100% { transform: scale(1); }
}

.life-die-wrap .die.life-die-pulse {
    animation: lifeDiePulse 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
    .dice-btn, .dice-dialog, #diceOverlay, .life-die-wrap .die { transition: none; }
    .life-die-wrap .die.life-die-pulse { animation: none; }
}
