
:root {
    --primary-wood: #5d4037;
    --light-wood: #8d6e63;
    --paper: #fffde7;
    --accent: #d84315;
    --text-dark: #3e2723;
    --text-gray: #6d4c41;
    --card-bg: rgba(255, 253, 231, 0.9);
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-wood: #261b18;
        --light-wood: #3e2723;
        --paper: #1a1210;
        --accent: #ff7043;
        --text-dark: #efebe9;
        --text-gray: #bcaaa4;
        --card-bg: rgba(46, 34, 28, 0.9);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', serif;
    background-color: var(--paper);
    background-image: linear-gradient(rgba(93, 64, 55, 0.1) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(93, 64, 55, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-dark);
    line-height: 1.6;
    padding-bottom: 80px;
    min-height: 100vh;
}

header {
    background: var(--primary-wood);
    color: #fff;
    padding: 30px 20px;
    text-align: center;
    border-bottom: 4px solid var(--accent);
}

header h1 {
    font-size: 1.8rem;
    letter-spacing: 2px;
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

nav {
    display: flex;
    overflow-x: auto;
    background: var(--light-wood);
    position: sticky;
    top: 0;
    z-index: 100;
    scrollbar-width: none;
}

nav::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    flex: 0 0 auto;
    padding: 15px 20px;
    border: none;
    background: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 500;
}

.nav-btn.active {
    color: #fff;
    background: var(--accent);
}

main {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid var(--light-wood);
}

.card h3 {
    margin-bottom: 15px;
    color: var(--accent);
    border-left: 4px solid var(--accent);
    padding-left: 10px;
}

.chord-display {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-wood);
    border: 2px dashed var(--light-wood);
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

button {
    padding: 12px 15px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.primary {
    background: var(--primary-wood);
    color: white;
}

.secondary {
    background: var(--accent);
    color: white;
}

.full-width {
    grid-column: span 2;
    margin-top: 5px;
}

.info-text {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-top: 15px;
    text-align: center;
}

/* Rhythm library */
.rhythm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.rhythm-item {
    background: var(--paper);
    border: 1px solid var(--light-wood);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.rhythm-item.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.rhythm-visualizer {
    position: relative;
    height: 120px;
    background: #444;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 10px 0;
    overflow: hidden;
}

.strings {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
}

.string {
    height: 2px;
    background: #888;
    width: 100%;
}

.playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

/* Lyrics */
.lyrics-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

input[type="text"] {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--light-wood);
    background: #fff;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    background: var(--light-wood);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--light-wood);
    background: #fff;
    font-size: 1rem;
    font-family: serif;
    margin-bottom: 15px;
    resize: none;
}

.template-btns {
    margin-bottom: 10px;
}

.small-btn {
    padding: 5px 12px;
    font-size: 0.75rem;
    background: var(--light-wood);
    color: white;
    margin-right: 5px;
}

/* Recording */
.track {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-wood);
}

.track-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.rec-btn {
    background: #c62828;
    color: white;
}

.rec-btn.recording {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: #f44336; }
    100% { transform: scale(1); }
}

.status {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.warning {
    font-size: 0.75rem;
    color: var(--accent);
    margin-top: 15px;
    text-align: center;
    font-style: italic;
}

/* My Works List */
#works-list .work-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 5px solid var(--primary-wood);
}

.work-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 5px;
}

.work-date {
    font-size: 0.75rem;
    color: #999;
}

.work-content {
    font-size: 0.85rem;
    color: var(--text-gray);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 0.7rem;
}

footer .copyright {
    line-height: 1.8;
}

/* Dark mode adjustment for display containers */
@media (prefers-color-scheme: dark) {
    .chord-display, textarea, input[type="text"], #works-list .work-item {
        background-color: #2e2421;
        color: #efebe9;
        border-color: #5d4037;
    }
}
