/* Color Match (Mastermind-style) — front-end styling
   Values use !important where needed to defeat opinionated theme resets
   that otherwise color every <span role=button> as the theme's primary. */

.mmb-cm-container {
    max-width: 460px;
    margin: 0 auto;
    padding: 24px;
    background: #ffffff !important;
    color: #222 !important;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    box-sizing: border-box;
}

/* ── Header: Moves | Your best | Level ── */
.mmb-cm-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    margin-bottom: 14px;
    font-size: 14px;
    color: #666;
}
.mmb-cm-header .mmb-cm-stat-center { text-align: center; }
.mmb-cm-header .mmb-cm-stat-right  { text-align: right; }
.mmb-cm-header .mmb-cm-stat-label  { color: #6c7076; }
.mmb-cm-header span { color: inherit; }

/* ── Rows ── */
.mmb-cm-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}
.mmb-cm-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
/* Only locked + active rows are visible; the rest are hidden until they
   become active. */
.mmb-cm-row-pending { display: none; }

.mmb-cm-row-secret { margin-bottom: 4px; }

/* Feedback container: small white rounded card with 2×2 peg grid */
.mmb-cm-feedback {
    display: grid;
    grid-template-columns: repeat(2, 16px);
    grid-template-rows:    repeat(2, 16px);
    gap: 8px;
    padding: 8px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.05);
    box-sizing: content-box;
    flex: 0 0 auto;
    place-content: center;
}
.mmb-cm-feedback-secret { opacity: .4; }

.mmb-cm-peg {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: #d1d5db;
}
.mmb-cm-peg-empty    { background: #d1d5db; }
.mmb-cm-peg-miss     { background: #d1d5db; } /* miss = same light gray as empty */
.mmb-cm-peg-partial  { background: #fb8c00; } /* orange: right color, wrong spot */
.mmb-cm-peg-exact    { background: #2e7d32; } /* green: right color, right spot */
.mmb-cm-peg-secret   { background: transparent; visibility: hidden; }

/* Guess row (no border/box — just flex with gap) */
.mmb-cm-guess {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

/* Cells (guess + secret) — always light gray unless explicitly coloured.
   Base rule without !important so an inline "background-color" (set by JS
   when a color is picked) naturally wins the cascade. */
.mmb-cm-cell,
.mmb-cm-secret-cell {
    display: inline-block;
    width: 54px;
    height: 54px;
    border-radius: 8px;
    background-color: #e5e7eb;
    background-image: none;
    border: none;
    box-shadow: none;
    cursor: default;
    padding: 0;
    margin: 0;
    position: relative;
    box-sizing: border-box;
    line-height: 0;
    font-size: 0;
    color: transparent;
    transition: transform 120ms ease;
}
.mmb-cm-container .mmb-cm-cell.mmb-cm-cell-empty {
    background-color: #e5e7eb;
    background-image: none;
}
.mmb-cm-row-active  .mmb-cm-cell { cursor: pointer; }
.mmb-cm-row-active  .mmb-cm-cell:hover { transform: scale(1.05); }

.mmb-cm-cell[data-color],
.mmb-cm-secret-cell[data-color] {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.mmb-cm-cell[data-color]::after {
    content: "";
    position: absolute;
    right: 5px;
    bottom: 5px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(0,0,0,.55);
}

.mmb-cm-secret-cell.mmb-cm-hidden {
    background-color: #d9dbde !important;
    background-image:
        linear-gradient(45deg, #c4c7cb 25%, transparent 25%),
        linear-gradient(-45deg, #c4c7cb 25%, transparent 25%);
    background-size: 12px 12px;
}

.mmb-cm-title-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px 0 14px;
}
.mmb-cm-title {
    text-align: center;
    font-weight: 600;
    font-size: 18px;
    color: #222;
}
.mmb-cm-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #c7cbd1;
    border-radius: 50%;
    background: #ffffff !important;
    color: #4b5563 !important;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}
.mmb-cm-help-btn:hover,
.mmb-cm-help-btn:focus {
    background: #1e88e5 !important;
    color: #ffffff !important;
    border-color: #1e88e5;
    outline: none;
    transform: scale(1.05);
}

/* ── Help popover (instructions) ── */
.mmb-cm-help-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    z-index: 2147482999;
}
.mmb-cm-help-popover {
    position: absolute;
    max-width: 320px;
    width: calc(100vw - 32px);
    background: #ffffff !important;
    color: #222 !important;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.28),
                0 0 0 1px rgba(0,0,0,0.06);
    z-index: 2147483000;
    animation: mmb-cm-pop 120ms ease-out;
    font-size: 14px;
    line-height: 1.5;
}
.mmb-cm-help-popover p { margin: 0 0 10px; }
.mmb-cm-help-popover p:last-child { margin-bottom: 0; }
.mmb-cm-help-heading {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: #111;
    padding-right: 22px;
}
.mmb-cm-help-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: transparent !important;
    color: #6b7280 !important;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
}
.mmb-cm-help-close:hover,
.mmb-cm-help-close:focus { color: #111 !important; outline: none; }

/* ── Win message ── */
.mmb-cm-win-msg {
    display: none;
    text-align: center;
    margin: -4px 0 14px;
    padding: 8px 12px;
    background: #e8f5e9;
    color: #1b5e20;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

/* ── Picker modal ── */
.mmb-cm-picker-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    z-index: 2147482999;
}
.mmb-cm-picker {
    position: absolute;
    background: #ffffff !important;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.28),
                0 0 0 1px rgba(0,0,0,0.06);
    z-index: 2147483000;
    animation: mmb-cm-pop 120ms ease-out;
}
@keyframes mmb-cm-pop {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}
.mmb-cm-picker-title {
    margin: 0 0 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.2px;
}
.mmb-cm-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    grid-auto-rows: 52px;
    gap: 10px;
}
.mmb-cm-picker-swatch {
    display: block;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
    cursor: pointer;
    padding: 0;
    line-height: 0;
    font-size: 0;
    transition: transform 120ms ease;
}
.mmb-cm-picker-swatch:hover  { transform: scale(1.08); }
.mmb-cm-picker-swatch:focus  { outline: 2px solid #1e88e5; outline-offset: 2px; }

/* Actions */
.mmb-cm-actions { text-align: center; margin-top: 24px; }
.mmb-cm-actions .mmb-button { min-width: 160px; }

@media (max-width: 460px) {
    .mmb-cm-container       { padding: 16px; }
    .mmb-cm-cell,
    .mmb-cm-secret-cell     { width: 46px; height: 46px; border-radius: 6px; }
    .mmb-cm-row             { gap: 10px; }
    .mmb-cm-guess           { gap: 8px; }
}
