/* ============================================================
   rules.css — Styles for the Abacus Rules page
   ============================================================ */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    background: white;
}

/* Table Layout */
.rules-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 40px;
}

.rules-table td {
    width: 50%;
    vertical-align: top;
    padding: 20px;
    background: #f8fafc;
    border: 2px solid #e0e0e0;
}

.rules-table td:first-child {
    border-right: 3px solid #1e3a8a;
}

.main-section {
    height: 100%;
}

.main-section-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.main-section-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.main-section-header i {
    font-size: 1.5rem;
}

/* Section Cards */
.section-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.section-title {
    color: #1e3a8a;
    font-size: 1.6rem;
    margin-bottom: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-subtitle {
    color: #764ba2;
    font-size: 1.2rem;
    margin: 20px 0 10px 0;
    font-weight: 600;
}

.info-text {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 15px;
    font-style: italic;
}

/* Friends Grid */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.friend-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    transition: all 0.2s ease;
}

.friend-item:hover {
    border-color: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.2);
}

/* Formula Box */
.formula-box {
    background: linear-gradient(135deg, #1e3a8a 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

.formula-item {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 8px 0;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
}

/* Practice Section */
.practice-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #f97316;
}

.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 15px;
}

.practice-header h4 {
    color: #764ba2;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.practice-toggle {
    background: #f97316;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.practice-toggle:hover {
    background: #ea580c;
}

.practice-content {
    display: none;
}

.practice-content.show {
    display: block;
}

.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.practice-item {
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    text-align: center;
    font-size: 1rem;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Speed Writing */
.speed-writing {
    background: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #ffc107;
}

.speed-writing h4 {
    color: #856404;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.speed-writing p {
    color: #856404;
    font-size: 1rem;
    margin: 5px 0;
}

.speed-writing strong {
    font-size: 1.2rem;
}

/* ==== Responsive ==== */
@media (max-width: 968px) {
    .rules-table {
        display: block;
    }

    .rules-table tr {
        display: block;
    }

    .rules-table td {
        display: block;
        width: 100%;
        border: 2px solid #e0e0e0;
        margin-bottom: 20px;
    }

    .rules-table td:first-child {
        border-right: 2px solid #e0e0e0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    .rules-table td {
        padding: 15px;
    }

    .main-section {
        padding: 20px;
    }

    .main-section-header {
        padding: 18px;
    }

    .main-section-header h2 {
        font-size: 1.4rem;
        flex-direction: column;
        gap: 10px;
    }

    .main-section-header i {
        font-size: 1.4rem;
    }

    .section-card {
        padding: 20px;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .friends-grid {
        grid-template-columns: 1fr;
    }

    .practice-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
