/* ===== drestem ===============================================================
   A pad game on the mocial fm faceplate (the radio-* look in main.css): an LCD
   with the score, a big 4x4 pad grid, and a side strip with the beat, the mix
   and a one-tap recorder. Pads are coloured by rapper: Ice Cube blue, MC Ren
   orange, Eazy-E gold. */
#drestem-icon-group {
    top: 430px;
    right: 152px;
}
#drestem-icon {
    -webkit-user-drag: none;
    user-drag: none;
    user-select: none;
    position: absolute;
    top: 0;
    right: 28px;
    width: 44px;
    height: auto;
    image-rendering: pixelated;
}
#drestem-icon-label {
    position: absolute;
    top: 48px;
    right: 0;
    width: 100px;
    text-align: center;
    font-family: 'W95FA', sans-serif;
    font-size: 13px;
    line-height: 1.2;
}
#drestem-icon-label a {
    color: #fff;
    text-decoration: none;
}

#drestem-window {
    display: none;
    width: 700px;
    max-width: calc(100vw - 16px);
    left: 10vw;
    top: 2vw;
    text-align: left;
}
#drestem-window.stems-shake {
    animation: dm-shake 0.14s linear;
}
@keyframes dm-shake {
    25% { translate: -2px 1px; }
    50% { translate: 2px -1px; }
    75% { translate: -1px 0; }
}
#drestem-window.dm-rankup {
    animation: dm-rankup 0.9s steps(6, jump-none);
}
@keyframes dm-rankup {
    0%, 100% { filter: none; }
    20%, 60% { filter: brightness(1.35) saturate(1.4); }
    40%, 80% { filter: none; }
}
.dm {
    padding: 8px 10px 10px;
    --blue: #3a8dff;
    --orange: #ff8a3d;
    --gold: #e0b83c;
}

/* ---- LCD ---- */
.dm-lcd {
    position: relative;
    display: block;
    padding: 6px 10px 6px;
}
.dm-lcd-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.dm-title {
    color: #ffd966;
    letter-spacing: 1px;
}
.dm-rank {
    padding: 0 6px;
    color: #10205a;
    background: #ffd966;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}
.dm-lcd-mid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 12px;
    align-items: center;
    margin: 4px 0 2px;
}
.dm-spectrum {
    width: 100%;
    height: 52px;
    margin: 0;
}
.dm-stats {
    display: grid;
    gap: 2px;
    color: #8fd3ff;
}
.dm-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 11px;
}
.dm-stat b {
    font-size: 20px;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.dm-stat .dm-combo {
    color: #8fd3ff;
}
.dm-stat .dm-combo.hot {
    color: #ff8a3d;
}
.dm-combobar {
    height: 4px;
    background: rgba(143, 211, 255, 0.18);
}
.dm-combobar i {
    display: block;
    width: 0;
    height: 100%;
    background: #ffd966;
}
.dm-msg {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 30px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #ffd966;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    background: rgba(16, 32, 90, 0.55);
}
.dm-msg.show {
    display: flex;
    animation: dm-msg 0.5s steps(5, jump-none);
}
.dm-msg.count {
    font-size: 44px;
}
@keyframes dm-msg {
    0% { transform: scale(1.6); }
    100% { transform: scale(1); }
}
.dm-lcd-bot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 12px;
    white-space: nowrap;
}
.dm-beats {
    display: flex;
    gap: 3px;
}
.dm-beats i {
    width: 10px;
    height: 10px;
    background: rgba(143, 211, 255, 0.2);
    border: 1px solid #0a1440;
}
.dm-beats i.on {
    background: #ffd966;
    box-shadow: 0 0 5px #ffd966;
}
.dm-seek {
    flex: 1;
    margin: 0;
    height: 10px;
    touch-action: none;
}

/* ---- The pad area ---- */
.dm-main {
    display: grid;
    grid-template-columns: 1fr 188px;
    gap: 10px;
    margin-top: 8px;
    align-items: start;
}
.dm-padarea {
    min-width: 0;
    padding: 6px;
    border: 2px groove #f0f0f0;
}
.dm-banks {
    display: flex;
    gap: 3px;
    margin-bottom: 6px;
}
.dm-bank,
.dm-page {
    height: 22px;
    padding: 0 10px;
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 10px;
    font-weight: bold;
    color: #000;
    background: #d8d8d8;
    border: 2px outset #f0f0f0;
    border-radius: 0;
    cursor: pointer;
}
.dm-bank.on {
    color: #fff;
    background: #10205a;
    border-style: inset;
}
.dm-page {
    margin-left: auto;
}
.dm-page[hidden] {
    display: none;
}
.dm-gridwrap {
    position: relative;
}
.dm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    background: #10205a;
    border: 2px inset #f0f0f0;
}
.dm-pad {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    aspect-ratio: 1 / 0.92;
    padding: 0;
    font-family: 'W95FA', monospace;
    color: #000;
    background: #d8d8d8;
    border: 2px outset #f0f0f0;
    border-bottom: 4px solid var(--c, #3a8dff);
    border-radius: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.dm-pad[data-who="c"] { --c: var(--blue); }
.dm-pad[data-who="r"] { --c: var(--orange); }
.dm-pad[data-who="e"] { --c: var(--gold); }
.dm-pad:disabled {
    opacity: 0.35;
    cursor: default;
}
.dm-pad.on,
.dm-pad:active:not(:disabled),
.dm-pad.pressed {
    border-style: inset;
    border-bottom-width: 2px;
    background: var(--c);
    color: #000;
}
.dm-pad.on {
    box-shadow: 0 0 10px var(--c);
}
.dm-pad.loading {
    background: #e8e8e8;
}
.dm-pad:focus-visible {
    outline: 1px dotted #000;
    outline-offset: -4px;
}
.dm-pad-num {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    color: #606060;
}
.dm-pad.on .dm-pad-num,
.dm-pad:active .dm-pad-num {
    color: #000;
}
.dm-pad-label {
    padding: 0 3px;
    font-size: 13px;
    line-height: 1.05;
    text-align: center;
    overflow-wrap: anywhere;
}
.dm-pad.hit .dm-pad-label {
    font-weight: bold;
}
/* A little star in the corner once you've found a hit */
.dm-pad-star {
    position: absolute;
    bottom: 3px;
    left: 4px;
    width: 7px;
    height: 7px;
    background: #bdbdbd;
    border: 1px solid #808080;
    opacity: 0;
}
.dm-pad.hit .dm-pad-star {
    opacity: 1;
}
.dm-pad.hit.found .dm-pad-star {
    background: #ffd966;
    border-color: #7a5a00;
}
.dm-keytag {
    position: absolute;
    top: 2px;
    right: 4px;
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 9px;
    font-style: normal;
    color: #707070;
    pointer-events: none;
}
.dm-pad.on .dm-keytag,
.dm-pad:active .dm-keytag {
    color: #000;
}
.dm-pops {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.dm-pop {
    position: absolute;
    translate: -50% 0;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    color: #fff;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    animation: dm-pop 0.8s steps(8, jump-none) forwards;
}
.dm-pop.new {
    color: #ffd966;
    font-size: 16px;
}
@keyframes dm-pop {
    0% { transform: translateY(8px); opacity: 1; }
    100% { transform: translateY(-34px); opacity: 0; }
}
.dm-found {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #404040;
}
.dm-found-text {
    white-space: nowrap;
}
.dm-found-bar {
    flex: 1;
    height: 8px;
    background: #fff;
    border: 1px solid #808080;
}
.dm-found-bar i {
    display: block;
    width: 0;
    height: 100%;
    background: #e0b83c;
}

/* ---- The side strip ---- */
.dm-side {
    min-width: 0;
    padding: 6px 8px 8px;
    border: 2px groove #f0f0f0;
}
.dm-label {
    margin: 2px 0 4px;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #404040;
}
.dm-label + .dm-stems,
.dm-label + .radio-faders {
    margin-top: 0;
}
.dm-stems {
    display: grid;
    gap: 4px;
}
.dm-stem {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    height: 26px;
    padding: 0 6px;
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 10px;
    font-weight: bold;
    color: #000;
    background: #d8d8d8;
    border: 2px outset #f0f0f0;
    border-radius: 0;
    cursor: pointer;
    text-align: left;
}
.dm-stem.on,
.dm-stem.pressed {
    border-style: inset;
}
.dm-stem .radio-led {
    flex: none;
}
.dm-stem.on .radio-led {
    background: #ffd966;
    box-shadow: 0 0 5px #ffd966;
}
.dm-stem.loading .radio-led {
    animation: stems-led-blink 0.5s steps(2, jump-none) infinite;
}
.dm-stem .dm-keytag {
    top: 50%;
    translate: 0 -50%;
}
.dm-transport {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 5px 0 4px;
}
.dm-transport .radio-btn,
.dm-snap {
    height: 24px;
    padding: 0;
}
.dm-snap {
    width: 100%;
    font-size: 10px;
    letter-spacing: 0;
}
.dm-snap.on {
    color: #fff;
    background: #10205a;
}
.dm-faders {
    justify-content: space-around;
    height: auto;
}
.dm-faders .dm-fader-track {
    height: 78px;
}

/* ---- REC and the take ---- */
.dm-rec {
    margin-top: 8px;
}
.dm-recbtn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    font-family: 'W95FA', monospace;
    font-size: 18px;
    letter-spacing: 2px;
    color: #000;
    background: #d8d8d8;
    border: 2px outset #f0f0f0;
    border-radius: 0;
    cursor: pointer;
}
.dm-recbtn:active:not(:disabled) {
    border-style: inset;
}
.dm-recbtn:disabled {
    opacity: 0.6;
    cursor: default;
}
.dm-recdot {
    width: 14px;
    height: 14px;
    background: #c00000;
    border: 1px solid #000;
    border-radius: 50%;
}
.dm-recbtn.on {
    color: #fff;
    background: #c00000;
}
.dm-recbtn.on .dm-recdot {
    background: #fff;
    border-radius: 0;
    animation: stems-rec-blink 1s steps(2, jump-none) infinite;
}
.dm-recbtn.counting {
    background: #ffd966;
}
.dm-recbtn .dm-keytag {
    top: 3px;
    right: 5px;
    color: inherit;
    opacity: 0.6;
}
.dm-recstatus {
    min-height: 24px;
    margin-top: 4px;
    font-size: 10px;
    line-height: 1.25;
    color: #404040;
}
#drestem-window.is-recording .dm-recstatus {
    color: #c00000;
}
.dm-take {
    margin-top: 4px;
    padding: 5px;
    background: #fffbe0;
    border: 2px inset #f0f0f0;
}
.dm-take[hidden] {
    display: none;
}
.dm-takeinfo {
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: bold;
    line-height: 1.3;
}
.dm-takebtns {
    display: grid;
    gap: 3px;
}
.dm-takebtns .radio-btn {
    height: 22px;
    padding: 0;
    font-size: 10px;
    letter-spacing: 0;
}
.dm-takesave {
    color: #fff;
    background: #10205a;
}

@media screen and (max-width: 720px) {
    .dm-main,
    .dm-lcd-mid {
        grid-template-columns: 1fr;
    }
    .dm-pad-label {
        font-size: 11px;
    }
}
@media (prefers-reduced-motion: reduce) {
    #drestem-window.stems-shake,
    #drestem-window.dm-rankup,
    .dm-msg.show,
    .dm-pop {
        animation: none;
    }
}
