* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 300;
}

.main-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 3rem;
}

.items-container h2,
.categories-container .category h3 {
    margin-bottom: 1rem;
    font-weight: 500;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.draggable-item {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
    position: relative;
}

.draggable-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}

.draggable-item.dragging {
    cursor: grabbing;
    opacity: 0.7;
    transform: rotate(5deg) scale(1.05);
    z-index: 1000;
}

.draggable-item.completed {
    background: #d5f4e6;
    border: 2px solid #27ae60;
}

.draggable-item.completed::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 8px;
    color: #27ae60;
    font-weight: bold;
    font-size: 1.2rem;
}

.draggable-item:not(.dropped-item):hover {
    cursor: pointer;
}

.draggable-item .item-title {
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.draggable-item .item-description {
    font-size: 0.9rem;
    color: #7f8c8d;
    line-height: 1.4;
}

.categories-container {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1rem;
    align-items: center;
}

.categories-header {
    display: contents;
}

.category-title {
    text-align: center;
    font-weight: 500;
    color: #2c3e50;
    font-size: 1.1rem;
    padding: 0.5rem;
}

.category {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 200px;
}

.meaning-category {
    border-top: 4px solid #3498db;
}

.value-category {
    border-top: 4px solid #e74c3c;
}

.drop-zone {
    min-height: 150px;
    border: 2px dashed #bdc3c7;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.drop-zone.drag-over-meaning {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.drop-zone.drag-over-value {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.dropped-item {
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    animation: dropIn 0.4s ease-out;
}

@keyframes dropIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.reset-btn {
    background: #95a5a6;
}

.reset-btn:hover {
    background: #7f8c8d;
}

.progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-weight: 500;
    color: #7f8c8d;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 16px;
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 2rem;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #2c3e50;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #95a5a6;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #ecf0f1;
    color: #7f8c8d;
}

.modal-body {
    padding: 2rem;
}

.modal-description {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.sub-items-container {
    margin-bottom: 2rem;
}

.sub-items-container h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.2rem;
}

.sub-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.sub-categories-container {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.sub-drop-zone {
    min-height: 120px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.quiz-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
}

.quiz-header h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.quiz-header p {
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.quiz-progress {
    font-size: 1.1rem;
    font-weight: 500;
    color: #3498db;
}

.quiz-question {
    text-align: center;
}

.main-action {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border-left: 4px solid #3498db;
}

.main-action h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.main-action p {
    color: #7f8c8d;
    font-size: 1rem;
}

.sub-questions-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.sub-question-item {
    background: #ffffff;
    padding: 2rem;
    border: 2px solid #ecf0f1;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.sub-question-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.sub-question-item h4 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.sub-question-item p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 1rem;
}

.sub-question-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.sub-answer-btn {
    padding: 1rem 2.5rem;
    border: 3px solid transparent;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sub-answer-btn.meaning {
    border-color: #3498db;
    color: #3498db;
}

.sub-answer-btn.meaning:hover,
.sub-answer-btn.meaning.selected {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.sub-answer-btn.value {
    border-color: #e74c3c;
    color: #e74c3c;
}

.sub-answer-btn.value:hover,
.sub-answer-btn.value.selected {
    background: #e74c3c;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.quiz-navigation {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #ecf0f1;
}

.next-question-btn {
    background: #27ae60;
    font-size: 1.1rem;
    padding: 1rem 2rem;
}

.next-question-btn:hover:not(:disabled) {
    background: #229954;
}

.next-question-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.quiz-results {
    text-align: center;
}

.quiz-results h3 {
    color: #2c3e50;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.results-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.result-category {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: left;
}

.result-category h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

.result-category:first-child {
    border-top: 4px solid #3498db;
}

.result-category:last-child {
    border-top: 4px solid #e74c3c;
}

.result-category ul {
    list-style: none;
    padding: 0;
}

.result-category li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.result-category li:last-child {
    border-bottom: none;
}

.result-category li strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 0.2rem;
}

.result-category li span {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.next-quiz-btn {
    background: #9b59b6;
}

.next-quiz-btn:hover {
    background: #8e44ad;
}

.no-correct-answer {
    color: #e74c3c;
    font-weight: 500;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.advice-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border-left: 4px solid #3498db;
}

.advice-section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.advice-section p {
    color: #7f8c8d;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.advice-section p:last-child {
    margin-bottom: 0;
}

.disclaimer {
    color: #e74c3c;
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.start-button-container {
    text-align: center;
    margin-top: 1.5rem;
}

/* Hide original drag-and-drop elements */
.main-content .items-container,
.main-content .categories-container {
    display: none;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .categories-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    
    .categories-header {
        display: contents;
    }
    
    .app {
        padding: 1rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .results-summary {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .answer-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .quiz-container {
        padding: 1rem;
    }
    
    .sub-question-buttons {
        gap: 1rem;
    }
    
    .sub-answer-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        min-width: 100px;
    }
    
    .sub-question-item {
        padding: 1.5rem;
    }
    
    .sub-questions-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}