* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #1e293b;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --code-bg: #f1f5f9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    margin: 5px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-esp32 {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-stm32 {
    background: #fef3c7;
    color: #92400e;
}

.badge-http {
    background: #dbeafe;
    color: #1e40af;
}

/* Navigation */
.nav {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav a {
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.3s;
    font-weight: 500;
}

.nav a:hover {
    background: var(--primary-color);
    color: white;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h3 {
    color: var(--secondary-color);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.card h4 {
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1em;
}

/* Code Block */
.code-block {
    background: var(--dark-bg);
    color: #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 15px 0;
    position: relative;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #334155;
    border-radius: 8px 8px 0 0;
    margin: -20px -20px 15px -20px;
}

.code-lang {
    color: #94a3b8;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s;
}

.copy-btn:hover {
    background: #1d4ed8;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* API Endpoint Box */
.api-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
    font-family: monospace;
    font-size: 1.1em;
    word-break: break-all;
}

/* Info Box */
.info-box {
    padding: 15px 20px;
    border-radius: 10px;
    margin: 15px 0;
    border-left: 4px solid;
}

.info-box.info {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
}

.info-box.warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.info-box.success {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

/* Audio List */
.audio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.audio-item {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.audio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.audio-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    word-break: break-all;
}

.audio-info {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.audio-url {
    background: var(--code-bg);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.8em;
    font-family: monospace;
    word-break: break-all;
    margin-top: 10px;
}

.copy-url-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    margin-top: 10px;
    width: 100%;
    transition: all 0.3s;
}

.copy-url-btn:hover {
    background: #059669;
}

.play-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    margin-top: 10px;
    width: 100%;
    transition: all 0.3s;
}

.play-btn:hover {
    background: #1d4ed8;
}

.play-btn.playing {
    background: var(--danger-color);
}

.play-btn.playing:hover {
    background: #dc2626;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--primary-color);
}

tr:hover {
    background: var(--light-bg);
}

/* Circuit Diagram */
.circuit-box {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    font-family: monospace;
    line-height: 2;
}

/* Header Title */
h1 {
    font-size: 2.5rem;
    margin: 0;
}

h1 img {
    width: 50px;
    height: 50px;
    margin-right: 10px;
    vertical-align: middle;
}

.mobile-br {
    display: none;
}

/* Responsive */
@media (max-width: 1024px) {
    h1 {
        font-size: 2rem;
    }
    
    h1 img {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .card {
        padding: 20px;
    }

    .audio-grid {
        grid-template-columns: 1fr;
    }

    .nav {
        flex-direction: column;
    }

    .nav a {
        text-align: center;
    }
    
    h1 {
        font-size: 1.2rem;
        line-height: 1.5;
    }
    
    h1 img {
        width: 30px;
        height: 30px;
        margin-right: 8px;
    }
    
    .mobile-br {
        display: block;
    }
}

/* Contact Items */
.contact-item {
    text-align: center;
    padding: 20px;
    background: var(--light-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}

.contact-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
}

.contact-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.contact-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.1em;
}

.contact-content {
    color: var(--text-primary);
    font-size: 1em;
    word-break: break-word;
}

.contact-content a:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 30px;
    margin-top: 40px;
}

.icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

ul {
    margin-left: 20px;
    margin-top: 10px;
    margin-bottom: 10px;
}

li {
    margin: 8px 0;
}

strong {
    color: var(--primary-color);
}
