* {
    box-sizing: border-box;
}

/* Site Navigation */
.site-nav {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
}

.site-nav .nav-brand {
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    text-decoration: none;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.site-nav .nav-links {
    display: flex;
    gap: 10px;
}

.site-nav .nav-links a {
    color: white;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.95em;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease;
}

.site-nav .nav-links a:hover,
.site-nav .nav-links a.active {
    background: rgba(255, 255, 255, 0.3);
}

/* How To Play page content */
.content-container {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    text-align: left;
}

.content-container h1 {
    text-align: center;
    margin-bottom: 10px;
}

.content-container .subtitle {
    text-align: center;
    opacity: 0.85;
    margin-bottom: 40px;
    font-size: 1.1em;
}

.content-container h2 {
    font-size: 1.5em;
    margin-top: 40px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
}

.content-container h3 {
    font-size: 1.2em;
    margin-top: 25px;
    margin-bottom: 8px;
}

.content-container p {
    line-height: 1.7;
    opacity: 0.9;
    margin-bottom: 12px;
}

.content-container ul, .content-container ol {
    line-height: 1.8;
    opacity: 0.9;
    padding-left: 25px;
    margin-bottom: 12px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.mode-detail-card {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 15px;
    padding: 22px;
}

.mode-detail-card .mode-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.mode-detail-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.15em;
}

.mode-detail-card p {
    margin: 0;
    font-size: 0.92em;
    opacity: 0.88;
}

.tip-box {
    background: rgba(78, 205, 196, 0.2);
    border-left: 4px solid #4ecdc4;
    border-radius: 0 10px 10px 0;
    padding: 15px 20px;
    margin: 15px 0;
}

.tip-box p {
    margin: 0;
}

.faq-item {
    margin-bottom: 22px;
}

.faq-item h3 {
    margin-bottom: 6px;
}

.page-footer {
    margin-top: 30px;
    padding: 20px;
    text-align: center;
    opacity: 0.6;
    font-size: 0.9em;
}

body {
    font-family: 'Nunito', system-ui, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    overflow-x: hidden;
}

.ad-container {
    margin: 20px auto;
    text-align: center;
    max-width: 728px;
    width: 100%;
    min-height: 90px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
    overflow: hidden;
}

.game-container {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 900px;
    width: 100%;
}

h1 {
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 800;
}

h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 700;
}

h3 {
    font-weight: 700;
}

.mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.mode-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

@media (hover: hover) {
    .mode-card:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: translateY(-5px);
        border-color: rgba(255, 255, 255, 0.5);
    }
}

.mode-card:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.97);
    border-color: rgba(255, 255, 255, 0.5);
}

.mode-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.4em;
}

.mode-card p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95em;
}

.mode-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.score-board {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    font-size: 1.2em;
    font-weight: bold;
    flex-wrap: wrap;
    gap: 10px;
}

.score-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
}

.stats-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
    margin-bottom: 20px;
    display: none;
}

.stats-panel.show {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
}

.fretboard-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 30px 0;
}

.fretboard {
    position: relative;
    background: #8B4513;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    min-width: min-content;
    overflow: hidden;
}

.string {
    display: flex;
    align-items: center;
    margin: 15px 0;
    position: relative;
}

.string-line {
    height: 3px;
    background: linear-gradient(to right, #C0C0C0, #808080);
    flex-grow: 1;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.string-line.thick {
    height: 4px;
}

.fret {
    width: 60px;
    height: 40px;
    border: 2px solid #654321;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 0 2px;
}

@media (hover: hover) {
    .fret:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }
}

.fret:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.fret.highlighted {
    background: #4ecdc4;
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.8);
}

.fret.correct {
    background: #51cf66;
    animation: success 0.6s ease;
}

.fret.incorrect {
    background: #ff8787;
    animation: shake 0.5s ease;
}

.fret .note-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.fret.show-notes .note-label {
    opacity: 1;
}

.fret.found {
    background: #51cf66;
    box-shadow: 0 0 10px rgba(81, 207, 102, 0.8);
}

.fret.missed {
    background: #ff6b6b;
    animation: pulse 1.5s infinite;
}

.fret.scale-note {
    background: #ffd93d;
    box-shadow: 0 0 10px rgba(255, 217, 61, 0.8);
}

.fret.root-note {
    background: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.8);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes success {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.question {
    font-size: 2em;
    margin: 30px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
}

.timer {
    font-size: 2.5em;
    font-weight: 800;
    color: #ffd93d;
    margin: 20px 0;
}

.timer.warning {
    color: #ff6b6b;
    animation: pulse 1s infinite;
}

.controls {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@media (hover: hover) {
    button:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    }
}

button:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

button.secondary {
    background: linear-gradient(45deg, #4ecdc4, #6ee7de);
    font-size: 0.9em;
    padding: 10px 20px;
}

button.danger {
    background: linear-gradient(45deg, #c92a2a, #e03131);
}

.fret-numbers {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.fret-number {
    width: 60px;
    text-align: center;
    font-weight: 600;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    margin: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.string-label {
    width: 30px;
    text-align: center;
    font-weight: 600;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fret-pos-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.09);
    pointer-events: none;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.fret-pos-bar-double {
    background: rgba(255, 220, 100, 0.13);
}

.fret-pos-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.feedback {
    margin-top: 20px;
    font-size: 1.3em;
    min-height: 30px;
}

.feedback.correct-feedback {
    color: #51cf66;
}

.feedback.incorrect-feedback {
    color: #ff6b6b;
}

.answer-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.answer-button {
    padding: 15px 25px;
    font-size: 1.1em;
}

.hidden {
    display: none;
}

.audio-button {
    background: linear-gradient(45deg, #845ef7, #9775fa);
    font-size: 1.2em;
    padding: 20px 40px;
}

.lives {
    font-size: 1.5em;
    margin: 20px 0;
}

.lives .heart {
    color: #ff6b6b;
    margin: 0 5px;
}

.lives .heart.lost {
    opacity: 0.3;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 15px;
    }

    .fret {
        width: 45px;
        height: 35px;
    }

    .fret-number {
        width: 45px;
    }

    h1 {
        font-size: 1.8em;
    }

    .question {
        font-size: 1.5em;
        padding: 15px;
    }

    .mode-selection {
        grid-template-columns: 1fr;
    }

    button {
        min-height: 48px;
        min-width: 48px;
    }

    .fret {
        min-height: 48px;
    }

    .score-board {
        flex-wrap: nowrap;
        justify-content: stretch;
        font-size: 0.95em;
        gap: 8px;
    }

    .score-item {
        flex: 1;
        min-width: 0;
        padding: 8px 10px;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .fret {
        width: 42px;
        height: 38px;
    }

    .fret-number {
        width: 42px;
    }

    .fretboard {
        padding: 14px;
    }

    .fret .note-label {
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .fret {
        width: 36px;
        height: 36px;
        margin: 0 1px;
    }

    .fret-number {
        width: 36px;
        font-size: 0.85em;
    }

    .string-label {
        width: 24px;
        font-size: 0.85em;
    }

    h1 {
        font-size: 1.4em;
    }

    .question {
        font-size: 1.2em;
        padding: 10px;
    }

    .fretboard {
        padding: 10px;
    }

    .controls {
        gap: 5px;
    }

    button {
        padding: 10px 16px;
        font-size: 0.95em;
    }

    .fret .note-label {
        font-size: 11px;
        padding: 1px 4px;
    }
}

.mode-card:focus-visible,
.fret:focus-visible,
button:focus-visible {
    outline: 3px solid #ffd93d;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
