body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #c31432 0%, #240b36 100%);
    min-height: 100vh;
    color: #333;
}

.back-to-projects {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(195, 20, 50, 0.3);
    border-radius: 12px;
    padding: 10px 20px;
    text-decoration: none;
    color: #c31432;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.back-to-projects:hover {
    background: linear-gradient(135deg, #c31432, #240b36);
    color: white;
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(195, 20, 50, 0.4);
}

.back-to-projects::before {
    content: "← ";
    margin-right: 5px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 20px 40px;
}

.app-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.app-header h1 {
    font-size: 2.5em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    margin-top: 10px;
}

.main-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.character-display-section {
    text-align: center;
    margin-bottom: 40px;
}

.character-card {
    position: relative;
    display: inline-block;
    margin-bottom: 15px;
}

.hsk-info {
    position: absolute;
    left: -80px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0.5;
    font-size: 11px;
    text-align: right;
}

.hsk-level {
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hsk-index {
    color: #999;
    font-size: 10px;
}

.character-main {
    font-size: 120px;
    line-height: 1;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    margin: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    min-height: 140px;
}

.audio-btn {
    position: absolute;
    top: 10px;
    right: -50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.audio-btn:active {
    transform: scale(0.95);
}

.character-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 10px auto 20px;
    max-width: 800px;
    text-align: left;
}

.info-row {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-row label {
    font-weight: bold;
    color: #667eea;
    min-width: 100px;
}

.info-row span {
    flex: 1;
    font-size: 1.1em;
}

.pinyin {
    font-size: 1.3em;
    color: #764ba2;
}

.definition {
    color: #333;
}

.traditional {
    font-size: 1.5em;
    color: #667eea;
}

.stroke-count {
    font-weight: bold;
    color: #764ba2;
}

.controls {
    position: absolute;
    top: 50%;
    right: -260px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.components-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e9ecef;
    display: flex;
    align-items: flex-start;
    gap: 30px;
}

.components-title {
    color: #667eea;
    font-size: 1.3em;
    min-width: 180px;
    margin: 0;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding-top: 10px;
}

.components-grid {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    flex-wrap: wrap;
    flex: 1;
}

.component-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    padding: 15px;
    min-width: 120px;
    max-width: 180px;
    transition: all 0.3s ease;
}

.component-column:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.component-level-1 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.component-char-main {
    font-size: 40px;
    color: #667eea;
    font-weight: bold;
}

.component-arrow {
    color: #999;
    font-size: 16px;
    margin: 5px 0;
}

.component-arrow-small {
    color: #bbb;
    font-size: 12px;
    margin: 3px 0;
}

.component-level-2 {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.subcomponent-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 8px;
}

.subcomponent-char {
    font-size: 28px;
    color: #764ba2;
    font-weight: 600;
}

.component-level-3 {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.subsubcomponent-char {
    font-size: 18px;
    color: #9333ea;
    background: white;
    border-radius: 6px;
    padding: 4px 6px;
    font-weight: 500;
}

.component-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.component-card.has-subcomponents {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.component-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.component-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.component-char {
    font-size: 48px;
    color: #764ba2;
    margin-bottom: 10px;
}

.component-info {
    font-size: 0.9em;
}

.component-pinyin {
    color: #667eea;
    font-weight: bold;
    font-size: 0.9em;
}

.component-meaning {
    color: #666;
    font-size: 0.8em;
    text-align: center;
    line-height: 1.3;
}

.subcomponents-section {
    border-top: 2px dashed rgba(102, 126, 234, 0.3);
    padding-top: 15px;
}

.subcomponents-label {
    font-size: 0.85em;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subcomponents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subcomponent-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.subcomponent-item:hover {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    transform: translateX(3px);
}

.subcomponent-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 0.85em;
}

.subcomponent-pinyin {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 2px;
}

.subcomponent-meaning {
    color: #666;
    font-size: 0.95em;
}

.learning-stats {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
}

.learning-stats h3 {
    color: #667eea;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #764ba2;
}

.settings-panel {
    margin-top: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 15px;
}

.settings-panel h3 {
    color: #667eea;
    margin-bottom: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-item label {
    color: #333;
    font-weight: 500;
}

.setting-item select,
.setting-item input[type="range"] {
    padding: 8px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    transition: border-color 0.3s ease;
}

.setting-item select:focus,
.setting-item input[type="range"]:focus {
    outline: none;
    border-color: #667eea;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

#speechRateValue {
    color: #764ba2;
    font-weight: bold;
    margin-left: 10px;
}

.app-description {
    margin-top: 40px;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.app-description h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.app-description h3 {
    color: #764ba2;
    margin-top: 30px;
    margin-bottom: 15px;
}

.app-description ul {
    list-style: none;
    padding: 0;
}

.app-description li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
}

.app-description li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.app-description li strong {
    color: #764ba2;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.audio-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.browser-warning {
    animation: fadeIn 0.5s ease;
}

.audio-error {
    animation: fadeIn 0.3s ease;
}

@media (max-width: 768px) {
    .container {
        padding: 60px 15px 30px;
    }

    .app-header h1 {
        font-size: 1.8em;
    }

    .character-main {
        font-size: 80px;
        min-width: 120px;
        min-height: 100px;
    }

    .audio-btn {
        right: -40px;
        width: 40px;
        height: 40px;
    }

    .hsk-info {
        left: -60px;
        font-size: 10px;
    }

    .hsk-index {
        font-size: 9px;
    }

    .main-content {
        padding: 20px;
    }

    .controls {
        position: static;
        transform: none;
        flex-direction: row;
        justify-content: center;
        margin-top: 15px;
    }

    .btn {
        width: auto;
        font-size: 0.85em;
        padding: 8px 16px;
    }

    .components-section {
        flex-direction: column;
        gap: 15px;
    }

    .components-title {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        min-width: auto;
        font-size: 1.1em;
        padding-top: 0;
    }

    .components-grid {
        justify-content: center;
    }
}