/* ── Astra layout overrides — must come first ────────────────────────────────── */
body.msv-locker-page .entry-content,
body.msv-locker-page .entry-content[data-ast-blocks-layout] {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
}
body.msv-locker-page .entry-content > *,
body.msv-locker-page .entry-content[data-ast-blocks-layout] > * {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
body.msv-locker-page #msv-locker-grid,
body.msv-locker-page #msv-locker-grid > * {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: auto !important;
    float: none !important;
}

/* ── Reset & page ──────────────────────────────────────────────────────────── */
#msv-locker-wrap [hidden] { display: none !important; }

body.msv-locker-page { background: #080d1a !important; overflow-x: hidden; }
body.msv-locker-page #wpadminbar { display: none !important; }

/* ── Root locker container ─────────────────────────────────────────────────── */
.msv-locker {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #e8e8e8;
    background: #080d1a;
    min-height: 100vh;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    --msv-cell: 88px;
    --msv-gap:  7px;
    --msv-pad:  12px;
}

/* ── State screens (loading, guest, wrong role) ─────────────────────────────── */
.msv-state-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.msv-state-inner {
    text-align: center;
    padding: 2rem;
}

.msv-state-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }
.msv-state-inner h2 { font-size: 1.3rem; color: #fff; margin-bottom: 0.5rem; }
.msv-state-inner p  { font-size: 0.9rem; color: #888; margin-bottom: 1.5rem; }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.msv-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--msv-accent-400, #378ADD);
    border-radius: 50%;
    animation: msv-spin 0.7s linear infinite;
}
.msv-spinner-sm { width: 20px; height: 20px; border-width: 2px; }
@keyframes msv-spin { to { transform: rotate(360deg); } }

/* ── Main locker ────────────────────────────────────────────────────────────── */
#msv-main {
    display: block;
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* ── Top bar ────────────────────────────────────────────────────────────────── */
#msv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--msv-pad) 6px;
    position: relative;
    z-index: 2;
}

#msv-locker-wordmark {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
}

#msv-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#msv-edit-btn, #msv-settings-btn {
    background: rgba(255,255,255,0.06);
    border: 0.5px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    line-height: 1.4;
}
#msv-settings-btn { padding: 4px 8px; font-size: 14px; }
#msv-edit-btn.msv-edit-active {
    background: rgba(55,138,221,0.18);
    border-color: rgba(55,138,221,0.35);
    color: #85B7EB;
}

/* ── Grid ───────────────────────────────────────────────────────────────────── */
#msv-locker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: var(--msv-cell, 88px);
    gap: var(--msv-gap);
    padding: 6px var(--msv-pad) 16px;
    position: relative;
    z-index: 1;
}

/* ── Tiles ──────────────────────────────────────────────────────────────────── */
.msv-tile {
    border-radius: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px;
    position: relative;
    overflow: hidden;
    background: var(--msv-surface-bg, rgba(8,16,32,0.82));
    border: 0.5px solid var(--msv-surface-border, rgba(255,255,255,0.10));
    transition: transform 0.1s, opacity 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.msv-tile:active { transform: scale(0.95); }
.msv-tile.msv-edit-mode { outline: 1.5px dashed rgba(255,255,255,0.15); outline-offset: -2px; cursor: default; }
.msv-tile.msv-edit-mode:active { transform: none; }

.msv-tile-icon  { font-size: 22px; line-height: 1; }
.msv-tile-label {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    line-height: 1.25;
    color: var(--msv-surface-text, #E8E8E8);
}

/* Identity tile */
.msv-tile-identity { background: rgba(55,138,221,0.13); border-color: rgba(55,138,221,0.28); }
.msv-identity-icon { font-size: 24px; }
.msv-identity-name { font-size: 11px; font-weight: 500; color: #E6F1FB; text-align: center; }
.msv-identity-team { font-size: 9px; color: rgba(181,212,244,0.55); text-align: center; }

/* Quote tile */
.msv-tile-quote {
    justify-content: flex-start;
    align-items: flex-start;
    padding: 10px;
}
.msv-tile-qmark { font-size: 14px; color: rgba(175,169,236,0.4); line-height: 1; }
.msv-tile-qtext { font-size: 10px; color: #CECBF6; line-height: 1.45; font-style: italic; margin-top: 2px; }

/* Remove button in edit mode */
.msv-tile-remove {
    position: absolute;
    top: 4px; right: 4px;
    width: 16px; height: 16px;
    background: rgba(224,74,74,0.35);
    border: none;
    border-radius: 50%;
    color: #F09595;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ── Empty slots ────────────────────────────────────────────────────────────── */
.msv-slot-empty {
    border-radius: 13px;
    min-height: var(--msv-cell);
    background: transparent;
    border: 1.5px dashed transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: default;
}
.msv-slot-placeable {
    border-color: rgba(255,255,255,0.08);
}
.msv-slot-ready {
    border-color: var(--msv-accent-400, #378ADD);
    background: rgba(55,138,221,0.08);
    cursor: pointer;
    animation: msv-pulse 1.5s ease-in-out infinite;
}
@keyframes msv-pulse {
    0%, 100% { border-color: var(--msv-accent-400, #378ADD); background: rgba(55,138,221,0.08); }
    50%       { border-color: var(--msv-accent-300, #85B7EB); background: rgba(55,138,221,0.14); }
}
.msv-slot-plus  { font-size: 14px; opacity: 0.2; color: #fff; }
.msv-slot-label { font-size: 9px; opacity: 0.2; color: #fff; }
.msv-slot-placeable .msv-slot-plus,
.msv-slot-placeable .msv-slot-label { opacity: 0.18; }

/* ── Full-screen module overlay ─────────────────────────────────────────────── */
#msv-module-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #080d1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#msv-module-overlay-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 0.5px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

#msv-overlay-back {
    background: rgba(255,255,255,0.06);
    border: 0.5px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.55);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
}

#msv-overlay-title {
    font-size: 15px;
    font-weight: 500;
    color: #E6F1FB;
}

#msv-overlay-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.msv-overlay-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.msv-overlay-note {
    font-size: 13px;
    color: rgba(255,255,255,0.35);
    text-align: center;
    padding: 40px 0;
    line-height: 1.6;
}

/* ── Add sheet ──────────────────────────────────────────────────────────────── */
#msv-add-sheet-backdrop, #msv-settings-backdrop {
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(0,0,0,0.5);
}

#msv-add-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: #111828;
    border-radius: 18px 18px 0 0;
    padding: 16px 14px 32px;
    max-height: 70vh;
    overflow-y: auto;
}

.msv-sheet-title {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

#msv-module-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: var(--msv-cell, 88px);
    gap: 8px;
}

.msv-mod-opt {
    background: rgba(255,255,255,0.05);
    border: 0.5px solid rgba(255,255,255,0.09);
    border-radius: 10px;
    padding: 12px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.msv-mod-opt:active { background: rgba(255,255,255,0.1); }
.msv-mod-icon  { font-size: 20px; }
.msv-mod-label { font-size: 9px; color: rgba(255,255,255,0.45); text-align: center; line-height: 1.3; }

#msv-size-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: var(--msv-cell, 88px);
    gap: 8px;
    margin-bottom: 12px;
}

.msv-size-opt {
    background: rgba(255,255,255,0.04);
    border: 0.5px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 10px 4px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}
.msv-size-opt:active { background: rgba(55,138,221,0.15); border-color: rgba(55,138,221,0.35); }

.msv-size-preview {
    display: grid;
    gap: 2px;
    width: 42px;
}
.msv-size-cell {
    background: var(--msv-accent-400, #378ADD);
    opacity: 0.5;
    border-radius: 2px;
    height: 14px;
}
.msv-size-label { font-size: 10px; color: rgba(255,255,255,0.5); font-weight: 500; }
.msv-size-desc  { font-size: 9px;  color: rgba(255,255,255,0.3); }

.msv-place-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    line-height: 1.5;
    padding: 4px 0;
}

/* ── Settings sheet ─────────────────────────────────────────────────────────── */
#msv-settings-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: #111828;
    border-radius: 18px 18px 0 0;
    padding: 16px 14px 32px;
    max-height: 70vh;
    overflow-y: auto;
}

.msv-settings-label {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* ── Module content — tables ────────────────────────────────────────────────── */
.msv-times-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.msv-times-table th {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255,255,255,0.35);
    text-align: left;
    padding: 4px 0 8px;
    border-bottom: 0.5px solid rgba(255,255,255,0.07);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.msv-times-table td {
    padding: 10px 0;
    border-bottom: 0.5px solid rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.8);
}
.msv-time-val    { font-weight: 500; color: var(--msv-accent-400, #378ADD) !important; }
.msv-rank-state  { font-weight: 500; color: #EF9F27 !important; }
.msv-muted       { color: rgba(255,255,255,0.35) !important; font-size: 12px; }

/* ── Season / event pills ───────────────────────────────────────────────────── */
.msv-season-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.msv-pill {
    background: rgba(255,255,255,0.06);
    border: 0.5px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
}
.msv-pill.active {
    background: var(--msv-accent-500, #185FA5);
    border-color: var(--msv-accent-400, #378ADD);
    color: #fff;
}

/* ── Quote editor ───────────────────────────────────────────────────────────── */
.msv-quote-editor { display: flex; flex-direction: column; gap: 12px; }
.msv-quote-editor textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 0.5px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    line-height: 1.6;
    padding: 12px;
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}
.msv-char-count { font-size: 11px; color: rgba(255,255,255,0.3); text-align: right; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.msv-btn-primary {
    display: inline-block;
    background: var(--msv-accent-500, #185FA5);
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}
.msv-btn-primary:hover { background: var(--msv-accent-400, #378ADD); }

.msv-save-msg { font-size: 12px; color: #5DCAA5; margin-left: 10px; }

/* ── Skin/style pickers (reused from theme.js) ──────────────────────────────── */
.msv-skin-grid, .msv-cardstyle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.msv-skin-btn, .msv-card-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    border: 1.5px solid transparent;
}
.msv-skin-btn.active, .msv-card-btn.active {
    border-color: var(--msv-accent-400, #378ADD);
    background: rgba(55,138,221,0.1);
}
.msv-skin-swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
}
.msv-skin-label, .msv-card-label {
    font-size: 9px;
    color: rgba(255,255,255,0.45);
}
.msv-card-preview {
    width: 44px; height: 28px;
    border-radius: 5px;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (min-width: 480px) {
    .msv-locker { --msv-cell: 96px; }
}
@media (min-width: 600px) {
    #msv-add-sheet, #msv-settings-sheet {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 18px;
        bottom: 20px;
    }
}
