.category-card {
    transition: transform 0.3s;
    margin-bottom: 20px;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}
.card-header {
    font-weight: bold;
    font-size: 1.2rem;
    border-radius: 10px 10px 0 0 !important;
}
.probability-card .card-header {
    background-color: #007bff;
    color: white;
}
.linear-algebra-card .card-header {
    background-color: #17a2b8;
    color: white;
}
.footer {
    background-color: #343a40;
    color: white;
    padding: 20px 0;
    margin-top: 50px;
}
.main-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 20px;
}
.subtitle {
    font-size: 1.5rem;
    margin-bottom: 30px;
}
.section-title {
    font-size: 2rem;
    font-weight: bold;
    margin: 40px 0 20px;
    color: #0275d8;
}
.btn-category {
    margin-top: 15px;
    width: 100%;
}

/* 演習問題について セクションスタイル */
.exercise-intro-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin: 0 0 15px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: calc(100% - 15px);
}

.exercise-intro-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.exercise-intro-section::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(0, 123, 255, 0.1);
    z-index: 0;
}

.exercise-intro-section::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 123, 255, 0.08);
    z-index: 0;
}

.exercise-intro-content {
    padding: 35px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.exercise-intro-icon {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transform: rotate(-5deg);
    transition: transform 0.3s ease;
}

.exercise-intro-section:hover .exercise-intro-icon {
    transform: rotate(0deg);
}

.exercise-intro-icon i {
    font-size: 30px;
}

.exercise-intro-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 15px;
    letter-spacing: 0.5px;
}

.exercise-intro-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #00c6ff);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.exercise-intro-section:hover .exercise-intro-title::after {
    width: 100px;
}

.exercise-intro-text {
    font-size: 1.1rem;
    color: #566573;
    line-height: 1.6;
    margin-bottom: 20px;
    letter-spacing: 0.3px;
}

.exercise-intro-body {
    margin-bottom: 15px;
}

.exercise-stat-container {
    display: flex;
    justify-content: space-around;
    margin: 25px 0 10px;
}

.exercise-stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 45%;
}

.exercise-stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.exercise-stat-item i {
    color: #007bff;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.exercise-stat-item span {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 5px 0;
}

.exercise-stat-item p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0;
}

.exercise-intro-action {
    font-size: 1.1rem;
    color: #2980b9;
    font-weight: 600;
    padding: 15px 0 5px;
    border-top: 1px solid rgba(0, 123, 255, 0.2);
    margin: 0;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
}

.exercise-intro-action::after {
    content: '\f054';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: 8px;
    font-size: 0.8rem;
    color: #007bff;
    transition: transform 0.3s ease;
}

.exercise-intro-section:hover .exercise-intro-action::after {
    transform: translateX(5px);
}

@media (max-width: 768px) {
    .exercise-intro-content {
        padding: 25px;
    }
    
    .exercise-intro-icon {
        width: 60px;
        height: 60px;
        border-radius: 12px;
    }
    
    .exercise-intro-icon i {
        font-size: 24px;
    }
    
    .exercise-intro-title {
        font-size: 1.5rem;
    }
    
    .exercise-intro-text,
    .exercise-intro-action {
        font-size: 1rem;
    }
    
    .exercise-stat-container {
        margin: 20px 0 5px;
    }
    
    .exercise-stat-item {
        padding: 10px;
    }
    
    .exercise-stat-item i {
        font-size: 1.2rem;
    }
    
    .exercise-stat-item span {
        font-size: 1.5rem;
    }
    
    .col-md-6 .section-title {
        margin-top: 30px;
    }
    
    .exercise-intro-section {
        height: auto;
        margin-bottom: 20px;
    }
}

@media (max-width: 576px) {
    .exercise-intro-content {
        padding: 20px;
    }
    
    .exercise-intro-icon {
        width: 50px;
        height: 50px;
    }
    
    .exercise-intro-icon i {
        font-size: 20px;
    }
    
    .exercise-intro-title {
        font-size: 1.3rem;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    .exercise-intro-text {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }
    
    .exercise-stat-container {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .exercise-stat-item {
        width: 48%;
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .exercise-stat-item span {
        font-size: 1.3rem;
        margin: 3px 0;
    }
    
    .exercise-stat-item p {
        font-size: 0.8rem;
    }
    
    .exercise-intro-action {
        font-size: 0.95rem;
        padding: 12px 0 3px;
    }
    
    .exercise-intro-action::after {
        font-size: 0.7rem;
    }
}

/* Slideshow/Gallery Styles */
.slideshow-container {
    max-width: 1000px;
    position: relative;
    margin: 40px auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

/* Statistics section specific slideshow styling */
.statistics-slideshow .slideshow-container {
    margin: 30px auto 50px;
    max-width: 800px;
}

.statistics-slideshow .slideshow-title {
    margin-top: 40px;
}

.slideshow-slide {
    display: none;
    width: 100%;
    height: 400px;
    background-position: center;
    background-size: cover;
    position: relative;
}

/* Statistics section slide height adjustment */
.statistics-slideshow .slideshow-slide {
    height: 350px;
}

.slideshow-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slideshow-prev, .slideshow-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.4);
}

.slideshow-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.slideshow-prev:hover, .slideshow-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.slideshow-text {
    color: #f2f2f2;
    font-size: 15px;
    padding: 8px 12px;
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
}

.slideshow-caption {
    margin: 0;
    display: block;
    font-weight: 600;
    font-size: 1.1rem;
}

.slideshow-description {
    margin: 8px 0;
}

.slideshow-link {
    color: #2196F3;
    text-decoration: none;
    font-weight: 600;
}

.slideshow-link:hover {
    text-decoration: underline;
    color: #0b7dda;
}

.slideshow-number {
    color: #f2f2f2;
    font-size: 12px;
    padding: 8px 12px;
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 0 0 0 5px;
}

.slideshow-dots {
    text-align: center;
    padding: 15px 0;
    background-color: #f8f9fa;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.slideshow-dot {
    cursor: pointer;
    height: 15px;
    width: 15px;
    margin: 0 5px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.6s ease;
}

.slideshow-fade {
    animation-name: fade;
    animation-duration: 1.5s;
}

@keyframes fade {
    from {opacity: .4}
    to {opacity: 1}
}

.slideshow-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 30px 0 15px;
    text-align: center;
    color: #0275d8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .slideshow-container {
        max-width: 100%;
        margin: 20px auto;
    }
    
    .slideshow-slide {
        height: 300px;
    }
    
    .statistics-slideshow .slideshow-slide {
        height: 280px;
    }
    
    .slideshow-prev, .slideshow-next {
        padding: 10px;
        font-size: 16px;
    }
    
    .slideshow-caption {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .slideshow-slide {
        height: 250px;
    }
    
    .statistics-slideshow .slideshow-slide {
        height: 230px;
    }
    
    .slideshow-text {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .slideshow-caption {
        font-size: 0.9rem;
    }
    
    .slideshow-description {
        display: none;
    }
}

/* Input validation */
.calculation-input.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.calculation-input.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.is-invalid + .form-text {
    color: #dc3545;
}

/* 分野を選択セクションの調整 */
.col-md-6 .section-title {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.col-md-6 .category-card {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.col-md-6 .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.col-md-6 .card-text {
    margin-bottom: 15px;
    flex-grow: 1;
}

.col-md-6 .btn-category {
    margin-top: auto;
}

/* ローディングスピナー */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
}

.loading-spinner::before {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 123, 255, 0.3);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 数式処理中のインジケータ */
.math-processing {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 15px;
    border-radius: 5px;
    margin: 15px 0;
    color: #555;
    font-size: 0.9rem;
}

.math-processing span {
    animation: fadeInOut 1.5s infinite;
}

@keyframes fadeInOut {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 2x2グリッドレイアウト用の調整 */
.main-category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.main-category-card {
    flex: 1;
    min-width: calc(50% - 8px);
    transition: all 0.3s ease;
}

.main-category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* カードヘッダーの統一デザイン */
.main-category-card .card-header {
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.main-category-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main-category-card .card-text {
    flex: 1;
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* レスポンシブデザイン調整 */
@media (max-width: 768px) {
    .main-category-card {
        min-width: 100%;
        margin-bottom: 15px;
    }
    
    .col-md-6.mt-4:last-child {
        margin-top: 1rem !important;
    }
    
    .main-category-card .card-header {
        min-height: 50px;
    }
    
    .main-category-card .card-text {
        font-size: 0.85rem !important;
    }
    
    .exercise-intro-section {
        margin-bottom: 20px;
    }
}

@media (max-width: 576px) {
    .main-category-card .card-header {
        font-size: 0.9rem;
    }
    
    .main-category-card .card-text {
        font-size: 0.8rem !important;
    }
    
    .main-category-card .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}