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

body {
    font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

.screen {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 2.5em;
    font-weight: normal;
}

h2 {
    text-align: center;
    color: #000;
    margin-top: 0px;
    margin-bottom: 30px;
    font-size: 1.2em;
    font-weight: bold;
}

.description {
    text-align: left;
    margin-bottom: 30px;
    color: #555;
    line-height: 1.8;
}

.description p {
    margin-bottom: 5px;
}

.input-section {
    text-align: center;
}

#text-input {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 20px;
}

#text-input:focus {
    outline: none;
    border-color: #3498db;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

button {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #7f8c8d;
}

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

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

#back-btn {
    background-color: #95a5a6;
}

#back-btn:hover {
    background-color: #7f8c8d;
}

#select-all-btn {
    background-color: #95a5a6;
}

#select-all-btn:hover {
    background-color: #7f8c8d;
}

.link-button {
    display: inline-block;
    background-color: #f8bbd9;
    color: white;
    text-decoration: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 6px;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.link-button:hover {
    background-color: #f5a6cc;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
}

.result-section {
    max-width: 100%;
}

#result-display {
    background-color: transparent;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    font-size: 18px;
    line-height: 2;
    min-height: 200px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.noun {
    color: #e74c3c;
    font-weight: bold;
}

.verb {
    color: #3498db;
    font-weight: bold;
}

.adjective {
    color: #27ae60;
    font-weight: bold;
}

.adverb {
    color: #9b59b6;
    font-weight: bold;
}

.keijoshi {
    color: #27ae60;
    font-weight: bold;
}

.other {
    color: #2c3e50;
}

.disclaimer {
    margin-top: 30px;
    text-align: left;
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

.legend {
    background-color: #ecf0f1;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2c3e50;
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

.color-box.noun {
    background-color: #e74c3c;
}

.color-box.verb {
    background-color: #3498db;
}

.color-box.adjective {
    background-color: #27ae60;
}

.color-box.adverb {
    background-color: #9b59b6;
}

.color-box.keijoshi {
    background-color: #27ae60;
}

.color-box.other {
    background-color: #2c3e50;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#loading.hidden {
    display: none;
}

#loading p {
    color: white;
    font-size: 18px;
    margin-top: 20px;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* PC表示では改行を非表示 */
.mobile-br {
    display: none;
}

@media (max-width: 768px) {
    /* スマホ表示では改行を表示 */
    .mobile-br {
        display: inline;
    }
    
    .container {
        padding: 10px;
    }
    
    .screen {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    h2 {
        font-size: 1em;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    button, .link-button {
        width: 200px;
        margin-bottom: 10px;
    }
    
    .legend {
        gap: 15px;
        padding: 10px 15px;
    }
    
    .legend-item {
        font-size: 12px;
        gap: 6px;
    }
    
    .color-box {
        width: 14px;
        height: 14px;
    }
    
    #result-display {
        font-size: 16px;
    }
}