:root {
    --blue: #2563eb;
    --blue-light: #bfdbfe;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #fbbf24;
    --gray: #e5e7eb;
    --bg: #ffffff;
    --text: #111827;
    --muted: #4b5563;
}

/* =====================================================
   BASE LAYOUT
   ===================================================== */
.stdy-quiz-shell{
    border:1px solid #e5e5e5;
    border-radius:10px;
    padding:20px;
    background:#fff;
    margin:20px 0;
    box-shadow:0 2px 6px rgba(0,0,0,0.06);
}


/*
.stdy-quiz-shell {
    margin: 1.5rem 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
}
*/

.stdy-layout {
    display: flex;
    gap: 16px;
    max-width: 1000px;
    margin: 0 auto;
    align-items: flex-start;
}

.stdy-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* =====================================================
   QUESTION CARD
   ===================================================== */
/*
.stdy-card {
    background: var(--bg);
    border: 1px solid var(--blue);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}

*/

.stdy-question {
    margin-bottom: 10px;
}

.stdy-options {
    margin-bottom: 12px;
}

.stdy-opt {
    border: 1px solid var(--blue);
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: block;
    cursor: pointer;
}

.stdy-opt:hover {
    background: #eff6ff;
}

.stdy-opt.is-correct {
    background: #dcfce7;
    border-color: var(--green);
}

.stdy-opt.is-wrong {
    background: #fee2e2;
    border-color: var(--red);
}

/* =====================================================
   BUTTONS & ACTIONS
   ===================================================== */
.stdy-btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
    cursor: pointer;
    font-size: 14px;
}

.stdy-btn-primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.stdy-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.study-quiz-btn {
    width: auto;
    min-width: 180px;
    padding: 12px 28px;
    font-size: 16px;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-block;
    margin: 20px auto 0;
}

.study-quiz-btn:hover {
    background: #1d4ed8;
}

/* =====================================================
   SIDE PANEL
   ===================================================== */
.ssc-side {
    width: 240px;
    flex-shrink: 0;
    border-left: 1px solid var(--gray);
    padding-left: 12px;
    font-size: 14px;
}

.ssc-mark-toggle-btn {
    background: #fde68a;
    border-color: var(--yellow);
    color: #92400e;
}

.ssc-mark-toggle-btn.is-marked {
    background: #fef3c7;
    opacity: 0.7;
}

.ssc-qno,
.ssc-timer,
.ssc-count,
.ssc-part-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.ssc-timer {
    color: #b91c1c;
}

/* =====================================================
   QUESTION GRID
   ===================================================== */
.ssc-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(32px, 32px));
gap: 8px;
padding: 6px;
justify-content: flex-start;
align-items: start;
}

.ssc-grid .ssc-q-btn {
    all: unset;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer ;
    box-sizing: border-box;
    line-height: 1;
    position: relative;
}

.ssc-grid .ssc-q-btn.not-visited { background: var(--blue); color: #fff ; }
.ssc-grid .ssc-q-btn.answered { background: var(--green) ; color: #fff ; }
.ssc-grid .ssc-q-btn.answered-marked { background: var(--yellow) ; color: #000 ; }
.ssc-grid .ssc-q-btn.marked { background: var(--red) ; color: #fff ; }

.ssc-grid .ssc-q-btn .dot {
    position: absolute ;
    bottom: 3px ;
    right: 3px ;
    width: 6px ;
    height: 6px ;
    border-radius: 50% ;
    background: #000 ;
}

/* =====================================================
   TOP BAR
   ===================================================== */
.ssc-topbar {
    display: flex ;
    flex-direction: column ;
    gap: 10px ;
    margin-bottom: 8px;
}

.ssc-topbar .ssc-parts {
    display: flex ;
    flex-wrap: wrap ;
    justify-content: flex-start ;
    gap: 8px ;
    overflow: visible ;
}

.ssc-topbar .ssc-part-btn {
    flex: 0 0 auto ;
    width: auto ;
    padding: 8px 12px ;
    font-size: 14px ;
    border-radius: 8px ;
    white-space: nowrap ;
    cursor: pointer;
}

.ssc-part-btn.active,
.ssc-part-btn.is-active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.ssc-topbar .ssc-actions {
    display: flex ;
    justify-content: flex-end ;
    gap: 8px ;
    flex-wrap: wrap ;
}

/* =====================================================
   TABLES
   ===================================================== */
.ssc-analysis,
.ssc-modal-table,
.ssc-result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.ssc-analysis td,
.ssc-modal-table td,
.ssc-result-table th,
.ssc-result-table td {
    border: 1px solid #e5e7eb;
    padding: 4px 6px;
}

.ssc-modal-table td {
    padding: 6px 8px;
}

.ssc-result-table th,
.ssc-result-table td {
    padding: 8px;
    text-align: center;
}

.ssc-result-table th {
    background: #eef4ff;
}

.ssc-start-table {
    width: auto;
    min-width: 300px;
    margin-bottom: 15px;
    border-collapse: collapse;
    font-size: 14px;
}

.ssc-start-table th,
.ssc-start-table td {
    white-space: nowrap;
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.ssc-start-table th {
    background: #eef4ff;
}

/* =====================================================
   MODAL & SUBMIT
   ===================================================== */
.ssc-final-submit-wrap {
    margin-top: 10px;
    text-align: center;
}

.ssc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ssc-modal {
    background: #fff;
    width: 90%;
    max-width: 380px;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.ssc-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* =====================================================
   RESULTS
   ===================================================== */
.ssc-result-sheet {
    max-width: 900px;
    margin: auto;
}

.ssc-score-card {
    background: var(--blue);
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 14px;
}

.ssc-score {
    font-size: 36px;
    font-weight: 700;
}

.ssc-score-label {
    font-size: 14px;
    opacity: 0.9;
}

.ssc-result-grid,
.stdy-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.ssc-card {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.ssc-card strong {
    display: block;
    font-size: 20px;
}

.ssc-card span {
    font-size: 13px;
    color: #555;
}

.ssc-marks-box {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.ssc-result-actions {
    text-align: center;
    margin-top: 16px;
}

/* =====================================================
   REVIEW & EXPLANATIONS
   ===================================================== */
.stdy-review-item {
    border: 1px solid #ddd;
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 6px;
}

.stdy-answer-correct { color: #28a745; font-weight: 600; }
.stdy-answer-wrong { color: #dc3545; font-weight: 600; }
.stdy-answer-skipped { color: #6c757d; }

.stdy-explain-toggle {
    margin-top: 8px;
    background: #fafaff;
    padding: 10px 12px;
    border-radius: 5px;
    border-left: 3px solid #0d6efd;
}

.stdy-explain-toggle summary {
    cursor: pointer;
    margin-top: 10px;
    padding: 6px 0;
    list-style: none;
}

.stdy-explain-toggle summary::-webkit-details-marker { 
    display: none; 
}

.stdy-explain-toggle summary strong {
    font-weight: 600;
    color: #0d6efd;
}

.stdy-explain-toggle summary:hover strong {
    text-decoration: underline;
}

.stdy-explain-box {
    margin-top: 8px;
    padding-top: 6px;
    line-height: 1.6;
    color: #333;
}

.stdy-explain-toggle[open] summary strong::after {
    content: " (Hide)";
    font-weight: normal;
    color: #6c757d;
}

/* =====================================================
   COMPACT QUIZ START SCREEN
   ===================================================== */

.study-quiz-start {
    padding: 18px;
    max-width: 900px;
    margin: 0 auto;
    background: linear-gradient(135deg,#f8fafc 0%,#f1f5f9 100%);
    border-radius: 14px;
}

/* compact grid */

.stdy-start-grid-compact{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
    align-items:start;
}

/* default fallback */

.stdy-start-grid{
    display:grid;
    grid-template-columns:1fr;
    gap:14px;
}

/* card */

.stdy-card{
    background:#fff;
    border-radius:10px;
    padding:16px;
    box-shadow:0 3px 10px rgba(0,0,0,0.06);
    border:1px solid #e2e8f0;
    transition:all .2s ease;
}

.stdy-card:hover{
    transform:translateY(-1px);
    box-shadow:0 6px 16px rgba(0,0,0,0.08);
}

.stdy-card h3{
    font-size:1rem;
    font-weight:700;
    color:#1e293b;
    margin-bottom:12px;
    display:flex;
    align-items:center;
    gap:6px;
}

/* summary grid */

.stdy-summary-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(110px,1fr));
    gap:10px;
}

.stdy-summary-grid > div{
    background:#f8fafc;
    padding:10px 6px;
    border-radius:6px;
    border:1px solid #e2e8f0;
    text-align:center;
}

.stdy-summary-grid span{
    display:block;
    font-size:.7rem;
    color:#64748b;
    margin-bottom:4px;
    font-weight:600;
}

.stdy-summary-grid strong{
    font-size:1.1rem;
    font-weight:800;
}

/* section breakdown */

.stdy-sections-card{
    grid-column:1 / -1;
}

.stdy-sections-container{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
    gap:10px;
}

.stdy-section-item{
    background:#f8fafc;
    border-radius:8px;
    padding:14px;
    border:1px solid #e2e8f0;
}

.stdy-section-header{
    display:flex;
    gap:8px;
    margin-bottom:10px;
    align-items:center;
}

.stdy-section-part{
    font-weight:700;
    font-size:.85rem;
    background:#dbeafe;
    padding:3px 8px;
    border-radius:4px;
    color:#2563eb;
}

.stdy-section-name{
    font-size:.85rem;
    font-weight:600;
    color:#475569;
}

.stdy-section-details{
display:flex;
justify-content:center;
}

.stdy-detail{
    background:#fff;
    border:1px solid #e2e8f0;
    border-radius:6px;
    padding:8px;
    text-align:center;
}

.stdy-detail-label{
    font-size:.7rem;
    color:#64748b;
}

.stdy-detail-value{
    font-size:1rem;
    font-weight:700;
}

/* instructions */

.stdy-instructions-list{
    list-style:none;
    padding:0;
    margin:0;
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:8px;
}

.stdy-instructions-list li{
    background:#f8fafc;
    border-radius:8px;
    padding:10px 12px 10px 36px;
    position:relative;
    font-size:.85rem;
    border:1px solid #e2e8f0;
}

.stdy-instructions-list li::before{
    content:"✓";
    position:absolute;
    left:10px;
    top:50%;
    transform:translateY(-50%);
    width:18px;
    height:18px;
    background:#10b981;
    color:#fff;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:.7rem;
}

/* start button */

.stdy-start-action{
    grid-column:1 / -1;
    margin-top:10px;
    padding:16px;
    background:#fff;
    border-radius:10px;
    border:2px dashed #c7d2fe;
    text-align:center;
}

.start-quiz-btn{
    background:linear-gradient(135deg,#2563eb,#1d4ed8);
    color:#fff;
    border:none;
    padding:14px 32px;
    font-size:1rem;
    font-weight:700;
    border-radius:40px;
    cursor:pointer;
    display:inline-flex;
    gap:8px;
    align-items:center;
}

.start-quiz-btn:hover{
    transform:translateY(-1px);
}

/* responsive */

@media (max-width:768px){

.stdy-start-grid-compact{
grid-template-columns:1fr;
}

.stdy-instructions-list{
grid-template-columns:1fr;
}

}

@media (max-width: 576px) {
    .stdy-start-grid {
        gap: 12px; /* Reduced from 16px */
    }
    
    .stdy-card {
        padding: 14px; /* More compact */
    }
    
    .stdy-summary-grid {
        gap: 8px; /* More compact */
    }
    
    .stdy-summary-grid > div {
        padding: 8px 4px; /* More compact */
    }
    
    .stdy-summary-grid span {
        font-size: 0.65rem; /* More compact */
        margin-bottom: 4px;
    }
    
    .stdy-summary-grid strong {
        font-size: 1rem; /* More compact */
    }
    
    .stdy-section-item {
        padding: 12px; /* More compact */
    }
    
    /* FIX: Keep items on same line even on very small screens */
    .stdy-section-header {
        flex-direction: row; /* Keep as row, not column */
        align-items: center;
        gap: 6px; /* Reduced from 8px */
        flex-wrap: nowrap; /* Prevent wrapping */
    }
    
    .stdy-section-part {
        min-width: 60px; /* Reduced but still visible */
        padding: 3px 6px; /* More compact */
        font-size: 0.8rem; /* Slightly smaller */
    }
    
    .stdy-section-name {
        font-size: 0.8rem; /* Slightly smaller */
        white-space: nowrap; /* Prevent wrapping */
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .stdy-start-action {
        padding: 16px;
    }
}

/* Extra small devices fix */
@media (max-width: 400px) {
    .stdy-section-header {
        gap: 4px; /* Even smaller gap */
    }
    
    .stdy-section-part {
        min-width: 55px; /* Minimal width */
        padding: 2px 5px;
        font-size: 0.75rem;
    }
    
    .stdy-section-name {
        font-size: 0.75rem;
    }
}

/* =====================================
   MOBILE QUIZ LAYOUT FIX
===================================== */

@media (max-width:768px){

.stdy-layout{
flex-direction:column;
}

.stdy-main{
width:100%;
}

.ssc-side{
width:100%;
border-left:none;
border-top:1px solid var(--gray);
padding-left:0;
padding-top:12px;
margin-top:10px;
}

}

.stdy-leaderboard{
margin-top:30px;
}

.stdy-leaderboard-table{
width:100%;
border-collapse:collapse;
}

.stdy-leaderboard-table th,
.stdy-leaderboard-table td{
padding:8px;
border:1px solid #ddd;
text-align:center;
}

.stdy-user-rank{
background:#fff3cd;
padding:10px;
margin:10px 0;
font-size:18px;
border-left:4px solid #ffc107;
}

.stdy-popup{
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0,0,0,0.6);
display:flex;
align-items:center;
justify-content:center;
z-index:9999;
}

.stdy-popup-box{
background:#fff;
padding:25px;
border-radius:8px;
width:320px;
text-align:center;
}

.stdy-popup-box input{
width:100%;
padding:8px;
margin:6px 0;
border:1px solid #ccc;
}

.popup-actions{
margin-top:10px;
display:flex;
gap:10px;
justify-content:center;
}

.stdy-leaderboard-table td{
font-weight:normal;
}

.stdy-my-rank{
font-weight:bold;
background:#fff4c2;
}

.stdy-empty-dashboard{
text-align:center;
padding:30px;
background:#f7f7f7;
border-radius:8px;
}

.stdy-start-first-test{
display:inline-block;
margin-top:10px;
padding:10px 18px;
background:#2c7be5;
color:#fff;
text-decoration:none;
border-radius:5px;
font-weight:600;
}

.stdy-start-first-test:hover{
background:#1a5fcc;
}

.ssc-result-actions{
display:flex;
gap:12px;
justify-content:center;
margin-top:20px;
flex-wrap:wrap;
}

.stdy-btn-outline{
background:#fff;
border:2px solid #2c7be5;
color:#2c7be5;
font-weight:600;
}

.stdy-btn-outline:hover{
background:#2c7be5;
color:#fff;
}

.stdy-result-divider{
height:1px;
background:#e5e5e5;
margin:25px 0;
}

/* Result top bar */

.stdy-result-topbar{
display:flex;
justify-content:space-between;
align-items:center;
margin-bottom:20px;
}

.stdy-result-title{
font-size:20px;
font-weight:700;
}

/* Leaderboard header */

.stdy-leaderboard-header{
display:flex;
justify-content:space-between;
align-items:center;
margin-top:20px;
}

/* Compact marks box */

.ssc-marks-box-compact{
display:flex;
gap:25px;
justify-content:center;
margin:15px 0 20px;
flex-wrap:wrap;
}

.ssc-mark-item{
text-align:center;
background:#f6f8fb;
padding:10px 16px;
border-radius:6px;
}

.ssc-mark-item span{
display:block;
font-size:13px;
color:#666;
}

.ssc-mark-item strong{
font-size:18px;
color:#222;
}

.ssc-result-stats{
display:grid;
grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
gap:12px;
margin:20px 0;
}

.ssc-stat-card{
background:#f6f8fb;
padding:12px;
border-radius:6px;
text-align:center;
}

.ssc-stat-card span{
display:block;
font-size:13px;
color:#666;
}

.ssc-stat-card strong{
font-size:18px;
color:#222;
}

/* Block Auto Ads inside quiz */

.stdy-quiz-shell ins.adsbygoogle,
.stdy-quiz-shell iframe,
.stdy-quiz-shell .adsbygoogle {
display:none !important;
}