.dm-shell {
    --dm-ivory-a: #fffdf4;
    --dm-ivory-b: #ece4cf;
    --dm-edge: #b6a883;
    --dm-felt-a: #1a6a51;
    --dm-felt-b: #0d3729;
    --dm-gold: #f2c15c;
    max-width: 760px;
    margin: 0 auto;
    padding: 2px 0 78px;
    color: var(--cg-ink);
    font-family: Inter, Arial, sans-serif;
}

.dm-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.dm-stats,
.dm-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dm-stat {
    min-width: 62px;
    padding: 6px 10px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    box-shadow: 0 6px 16px rgba(30, 37, 40, 0.06);
}

.dm-stat span,
.dm-chip span {
    display: block;
    color: var(--cg-muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dm-stat strong,
.dm-chip strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    line-height: 1;
}

.dm-btn {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.1s ease;
}

.dm-btn:hover:not(:disabled) {
    border-color: var(--cg-teal);
    transform: translateY(-1px);
}

.dm-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.dm-primary {
    background: var(--cg-green);
    border-color: var(--cg-green);
    color: #fff;
}

.dm-icon {
    width: 44px;
    min-width: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.dm-icon svg {
    width: 20px;
    height: 20px;
}

.dm-board {
    position: relative;
    height: clamp(300px, 42vh, 392px);
    border: 1px solid #082b21;
    border-radius: 16px;
    background:
        radial-gradient(circle at 50% 6%, rgba(150, 226, 194, 0.24), transparent 62%),
        linear-gradient(168deg, var(--dm-felt-a), var(--dm-felt-b));
    box-shadow: var(--cg-shadow), inset 0 0 60px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    outline-offset: 3px;
}

.dm-chain {
    position: absolute;
    inset: 12px;
}

.dm-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: rgba(233, 250, 242, 0.82);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    pointer-events: none;
}

.dm-empty[hidden] {
    display: none;
}

.dm-t {
    position: absolute;
    display: flex;
    border: 1px solid var(--dm-edge);
    border-radius: 6px;
    background: linear-gradient(158deg, var(--dm-ivory-a), var(--dm-ivory-b));
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    overflow: hidden;
}

.dm-h {
    flex-direction: row;
}

.dm-v {
    flex-direction: column;
}

.dm-half {
    position: relative;
    flex: 1 1 50%;
    min-width: 0;
    min-height: 0;
}

.dm-h .dm-half + .dm-half {
    border-left: 2px solid rgba(83, 70, 42, 0.42);
}

.dm-v .dm-half + .dm-half {
    border-top: 2px solid rgba(83, 70, 42, 0.42);
}

.dm-pip {
    position: absolute;
    inset: 11%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.dm-d {
    margin: 13%;
    border-radius: 50%;
    background: transparent;
}

.dm-d.dm-on {
    background: #2b3238;
    box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.22);
}

.dm-pip[data-v="1"] .dm-on { background: #2b3238; }
.dm-pip[data-v="2"] .dm-on { background: #1d7f62; }
.dm-pip[data-v="3"] .dm-on { background: #bd3c37; }
.dm-pip[data-v="4"] .dm-on { background: #315f9d; }
.dm-pip[data-v="5"] .dm-on { background: #c47a17; }
.dm-pip[data-v="6"] .dm-on { background: #6b3fa0; }

.dm-slot {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px dashed rgba(226, 248, 238, 0.42);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.dm-slot.dm-hot {
    border-color: var(--dm-gold);
    background: rgba(242, 193, 92, 0.18);
}

.dm-slot.dm-pick {
    border-style: solid;
    border-color: var(--dm-gold);
    background: rgba(242, 193, 92, 0.34);
    box-shadow: 0 0 0 3px rgba(242, 193, 92, 0.32);
}

.dm-slotface {
    position: relative;
    width: 42%;
    height: 84%;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.12);
}

.dm-slot .dm-d.dm-on {
    background: #f2fbf6;
    box-shadow: none;
}

.dm-panel {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(8, 26, 20, 0.74);
}

.dm-panel[hidden] {
    display: none;
}

.dm-panel-card {
    width: 100%;
    max-width: 360px;
    padding: 18px;
    border: 1px solid var(--cg-line);
    border-radius: 14px;
    background: var(--cg-panel);
    box-shadow: var(--cg-shadow);
    text-align: center;
}

.dm-kick {
    display: block;
    color: var(--cg-teal);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.dm-panel-card strong {
    display: block;
    margin: 5px 0 4px;
    font-size: 1.24rem;
}

.dm-panel-card p {
    margin: 0 0 12px;
    color: var(--cg-muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.dm-panel-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dm-status {
    min-height: 60px;
    margin: 10px 2px 0;
}

.dm-status strong {
    font-size: 1.02rem;
    font-weight: 800;
}

.dm-status #dm-note {
    margin-left: 8px;
    color: var(--cg-muted);
    font-size: 0.9rem;
}

.dm-reads {
    display: block;
    margin-top: 3px;
    color: var(--cg-teal);
    font-size: 0.8rem;
    font-weight: 800;
}

.dm-hud {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0 10px;
}

.dm-chip {
    padding: 7px 8px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    text-align: center;
    box-shadow: 0 6px 16px rgba(30, 37, 40, 0.05);
}

.dm-hand {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    min-height: 132px;
    padding: 12px 10px;
    border: 1px solid var(--cg-line);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f3f5f0);
    box-shadow: inset 0 2px 8px rgba(30, 37, 40, 0.06);
}

.dm-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 56px;
    height: 108px;
    padding: 0;
    border: 1px solid var(--dm-edge);
    border-radius: 8px;
    background: linear-gradient(158deg, var(--dm-ivory-a), var(--dm-ivory-b));
    box-shadow: 0 5px 11px rgba(30, 37, 40, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.dm-tile .dm-half + .dm-half {
    border-top: 2px solid rgba(83, 70, 42, 0.42);
}

.dm-tile:hover {
    transform: translateY(-3px);
}

.dm-tile.dm-dim {
    opacity: 0.5;
    filter: grayscale(0.75) brightness(0.97);
}

.dm-tile.dm-sel {
    transform: translateY(-8px);
    outline: 3px solid var(--cg-amber);
    outline-offset: 1px;
    box-shadow: 0 12px 18px rgba(30, 37, 40, 0.3);
}

.dm-tile.dm-cur {
    outline: 3px solid var(--cg-blue);
    outline-offset: 2px;
}

.dm-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.dm-wide {
    flex: 1;
    min-width: 0;
}

.dm-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(18, 26, 22, 0.62);
}

.dm-modal[hidden] {
    display: none;
}

.dm-modal-card {
    position: relative;
    width: 100%;
    max-width: 470px;
    max-height: 82vh;
    overflow-y: auto;
    padding: 20px 22px;
    border: 1px solid var(--cg-line);
    border-radius: 14px;
    background: var(--cg-panel);
    box-shadow: var(--cg-shadow);
}

.dm-modal-card h2 {
    margin: 0 0 10px;
    font-size: 1.15rem;
}

.dm-modal-card p {
    margin: 0 0 10px;
    color: var(--cg-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.dm-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--cg-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.dm-close:hover {
    color: var(--cg-ink);
    background: var(--cg-bg);
}

@media (max-width: 640px) {
    .dm-shell {
        padding-bottom: 72px;
    }

    .dm-stat {
        min-width: 52px;
        padding: 5px 8px;
    }

    .dm-stat strong,
    .dm-chip strong {
        font-size: 15px;
    }

    .dm-board {
        height: clamp(250px, 33vh, 300px);
        border-radius: 13px;
    }

    .dm-chain {
        inset: 9px;
    }

    .dm-status {
        min-height: 56px;
    }

    .dm-status strong {
        font-size: 0.95rem;
    }

    .dm-status #dm-note {
        display: block;
        margin: 2px 0 0;
        font-size: 0.82rem;
    }

    .dm-hud {
        gap: 6px;
    }

    .dm-chip {
        padding: 6px 4px;
    }

    .dm-hand {
        min-height: 112px;
        gap: 5px;
        padding: 10px 6px;
    }

    .dm-tile {
        width: 44px;
        height: 88px;
    }

    .dm-btn {
        padding: 0 10px;
        font-size: 0.84rem;
    }
}
