/* ============================================
   Mobile Solution Viewer Screen
   ============================================ */

/* --- Main Layout --- */
.solution-mobile-overlay {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    height: 100% !important;
    font-family: var(--font-body, 'Noto Sans JP', sans-serif);
    background: #000;
    color: #fff;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-solution-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    background: radial-gradient(circle at center, #1a1e29 0%, #090a0f 100%);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 100px rgba(0, 229, 255, 0.1);
    overflow: hidden;
}

@media (min-width: 600px) {
    .mobile-solution-viewport {
        max-width: 430px;
    }
}

/* --- Header --- */
.mobile-solution-header {
    height: 48px;
    padding: 0 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(0, 229, 255, 0.15);
    background: rgba(9, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}
.ms-header-back { font-size: 1.1rem; color: #00e5ff; font-weight: 900; cursor: pointer; user-select: none; -webkit-user-select: none; }
.ms-header-title { font-family: var(--font-title, 'Orbitron', sans-serif); font-size: 0.9rem; font-weight: 900; letter-spacing: 1px; color: #00e5ff; text-shadow: 0 0 8px rgba(0, 229, 255, 0.4); }
.ms-step-progress { font-family: var(--font-title, 'Orbitron', sans-serif); font-size: 0.75rem; color: #90a4ae; font-weight: bold; }

/* --- Main Layout Container --- */
.ms-main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    justify-content: flex-start;
    overflow: hidden;
    gap: 10px;
}

/* --- 11x11 Board Grid --- */
.ms-board-container {
    align-self: center;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ms-board-grid {
    display: grid;
    gap: 1.5px;
}

.ms-grid-cell {
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 900; border-radius: 3px;
    transition: all 0.2s ease;
}

/* Outer Clues */
.ms-cell-clue {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    color: #00e5ff;
    text-shadow: 0 0 5px rgba(0, 229, 255, 0.4);
    opacity: 0.85;
    font-size: 0.75rem;
}

/* Inner cells */
.ms-cell-inner {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    position: relative;
}
.ms-cell-inner.initial { color: #81d4fa; }

/* 3x3 Borders */
.ms-cell-inner.border-right { border-right: 1px solid rgba(0, 229, 255, 0.3) !important; }
.ms-cell-inner.border-bottom { border-bottom: 1px solid rgba(0, 229, 255, 0.3) !important; }

/* Highlight */
.ms-cell-inner.solution-highlight {
    background: rgba(255, 82, 82, 0.25) !important;
    border-color: #ff5252 !important;
    box-shadow: inset 0 0 6px rgba(255, 82, 82, 0.4);
}

/* --- Piece Tray --- */
.ms-tray-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ms-section-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 10px; font-weight: 900; color: #90a4ae;
    letter-spacing: 1px; padding-left: 2px;
}

.ms-piece-tray {
    width: 100%;
    display: grid;
    grid-template-rows: repeat(1, 46px);
    grid-auto-flow: column;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0;
    scrollbar-width: none;
    height: 54px;
    box-sizing: border-box;
}
.ms-piece-tray::-webkit-scrollbar { display: none; }

.ms-piece-card {
    width: 120px;
    height: 46px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    transition: all 0.25s ease;
    opacity: 0.35;
    box-sizing: border-box;
}
.ms-piece-card.placed {
    opacity: 0.9;
    border-color: rgba(0, 230, 118, 0.3);
    background: rgba(0, 230, 118, 0.03);
}
.ms-piece-card.active-placement {
    opacity: 1;
    border-color: #00e5ff;
    background: rgba(0, 229, 255, 0.06);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.25);
}

.ms-piece-name { font-family: var(--font-title, 'Orbitron', sans-serif); font-size: 0.6rem; font-weight: 900; }
.ms-piece-mini-grid {
    display: grid; gap: 0.5px;
    background: rgba(255,255,255,0.01);
    padding: 1px; border-radius: 2px;
}
.ms-mini-cell {
    width: 10px; height: 10px;
    border-radius: 1px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.42rem; font-weight: bold;
}

/* --- Steps List --- */
.ms-steps-section {
    display: flex; flex-direction: column;
    gap: 4px; margin-top: 2px;
    flex: 1;
    overflow: hidden;
}
.ms-steps-container {
    display: flex; flex-direction: column; gap: 4px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    box-sizing: border-box;
}

.ms-step-row {
    min-height: 56px;
    height: auto !important;
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: flex; align-items: flex-start; padding: 6px 8px;
    gap: 8px; cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.ms-step-row.active {
    border-color: #00e5ff;
    background: rgba(0, 229, 255, 0.08);
    box-shadow: inset 0 0 6px rgba(0, 229, 255, 0.1);
}

.ms-step-badge {
    font-family: var(--font-title, 'Orbitron', sans-serif);
    font-size: 0.7rem; font-weight: 900;
    color: #78909c; min-width: 16px; text-align: right;
    margin-top: 2px;
}
.ms-step-row.active .ms-step-badge { color: #00e5ff; }

.ms-step-tag {
    font-size: 0.6rem; font-weight: 900; padding: 2px 4px; border-radius: 3px;
    color: #000; flex-shrink: 0; min-width: 58px; text-align: center;
    margin-top: 1px;
}
.tag-initial { background: #fff; }
.tag-visibility { background: #d1c4e9; }
.tag-piece { background: #00e676; }
.tag-single { background: #cfd8dc; }
.tag-hidden { background: #ffab00; }

.ms-step-desc {
    font-size: 0.58rem; color: #cfd8dc;
    flex: 1;
    line-height: 1.35;
    word-break: break-all;
}
.ms-step-row.active .ms-step-desc { color: #fff; font-weight: bold; }

/* --- Pagination --- */
.ms-pagination-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 2px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.ms-pagination-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff; border-radius: 6px;
    padding: 5px 12px; font-size: 0.7rem; font-weight: bold;
    cursor: pointer; display: flex; align-items: center; gap: 3px;
    transition: all 0.2s;
}
.ms-pagination-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ms-page-indicator { font-family: var(--font-title, 'Orbitron', sans-serif); font-size: 0.7rem; color: #90a4ae; font-weight: bold; }
