/* ===== SHARED STYLES FOR CLARINET TRAINER APPS ===== */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 5px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #eee;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
}

h1 {
    text-align: center;
    color: #00d9ff;
    font-size: 1.2em;
    margin: 3px 0 8px 0;
}

a {
    color: #00d9ff;
    text-decoration: none;
}

a:active {
    opacity: 0.7;
}

/* ===== SECTIONS ===== */

.section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section h2 {
    margin: 0 0 6px 0;
    color: #00d9ff;
    font-size: 0.9em;
}

/* ===== BUTTONS ===== */

.preset-btn {
    padding: 4px 8px;
    background: #3a3a5a;
    border: 1px solid #555;
    color: #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.preset-btn:active {
    background: #4a4a6a;
}

/* ===== NOTE SELECTION ===== */

.range-presets {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.range-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.note-btn {
    padding: 4px 6px;
    border: 2px solid #444;
    background: #2a2a4a;
    color: #aaa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    min-width: 32px;
    text-align: center;
}

.note-btn.selected {
    background: #00d9ff;
    color: #1a1a2e;
    border-color: #00d9ff;
    font-weight: bold;
}

.note-btn.sharp {
    background: #1a1a1a;
}

.note-btn.sharp.selected {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

/* ===== FEEDBACK ===== */

.feedback-container {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.feedback {
    font-size: 16px;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 6px;
}

.feedback:empty {
    display: none;
}

.feedback.correct { 
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid #4ade80;
}

.feedback.wrong { 
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid #f87171;
}

.feedback.clickable {
    cursor: pointer;
}

.feedback.clickable:active {
    opacity: 0.7;
}

/* ===== ACTION BOX ===== */

.action-box {
    position: sticky;
    bottom: 5px;
    z-index: 100;
    background: rgba(26, 26, 46, 0.95) !important;
    border: 2px solid #00d9ff !important;
    padding: 6px !important;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

.action-btn {
    width: 50px;
    height: 44px;
    font-size: 20px;
    line-height: 1;
    box-sizing: border-box;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.action-btn.play-pause {
    background: linear-gradient(135deg, #00d9ff, #00a8cc);
    color: #1a1a2e;
}

.action-btn.play-pause.paused {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.action-btn.confirm {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
}

.action-btn.next {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #1a1a2e;
}

/* Compare buttons for tone_compare */
.action-btn.compare {
    background: linear-gradient(135deg, #a855f7, #9333ea);
    color: white;
}

.action-btn.compare:disabled {
    opacity: 0.4;
}

/* ===== STATISTICS ===== */

.stats {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 5px;
    text-align: center;
    min-width: 50px;
}

.stat-value {
    font-size: 16px;
    font-weight: bold;
    color: #00d9ff;
}

.stat-label {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
}

/* ===== SETTINGS ===== */

.instrument-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.instrument-selector label {
    font-size: 12px;
    color: #aaa;
}

.instrument-selector select {
    padding: 5px 10px;
    background: #2a2a4a;
    border: 1px solid #444;
    color: #fff;
    border-radius: 5px;
    font-size: 12px;
}

.settings-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.setting-group input[type="number"] {
    width: 50px;
    padding: 4px;
    background: #2a2a4a;
    border: 1px solid #444;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
}

/* ===== COLLAPSIBLE ===== */

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header:after {
    content: '▼';
    font-size: 10px;
    color: #666;
}

.collapsible-header.collapsed:after {
    content: '▶';
}

.collapsible-content {
    margin-top: 10px;
}

.collapsible-content.hidden {
    display: none;
}

/* ===== PIANO KEYBOARD ===== */

.piano-container {
    display: block;
    margin: 8px 0;
    overflow-x: scroll;
    overflow-y: hidden;
    padding: 5px 0 20px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    text-align: center;
}

.piano-container::-webkit-scrollbar {
    height: 16px;
}

.piano-container::-webkit-scrollbar-track {
    background: #2a2a4a;
    border-radius: 8px;
}

.piano-container::-webkit-scrollbar-thumb {
    background: #00d9ff;
    border-radius: 8px;
    border: 3px solid #2a2a4a;
}

.piano {
    display: inline-flex;
    position: relative;
    height: 190px;
    padding-left: 10px;
    padding-right: 10px;
    margin: 0 auto;
}

.white-key {
    width: 52px;
    height: 190px;
    background: linear-gradient(180deg, #fff 0%, #e8e8e8 100%);
    border: 1px solid #999;
    border-radius: 0 0 5px 5px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    touch-action: manipulation;
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.white-key:active, .white-key.pressed, .white-key.selected-answer {
    background: linear-gradient(180deg, #00d9ff 0%, #00a8cc 100%);
}

.white-key.correct {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%) !important;
}

.white-key.wrong {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 100%) !important;
}

.black-key {
    width: 36px;
    height: 120px;
    background: linear-gradient(180deg, #333 0%, #111 100%);
    border: 1px solid #000;
    border-radius: 0 0 3px 3px;
    cursor: pointer;
    position: absolute;
    z-index: 2;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.black-key:active, .black-key.pressed, .black-key.selected-answer {
    background: linear-gradient(180deg, #00a8cc 0%, #007799 100%);
}

.black-key.correct {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%) !important;
}

.black-key.wrong {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%) !important;
}

.key-label {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #666;
    pointer-events: none;
    font-weight: bold;
}

.black-key .key-label {
    color: #aaa;
    bottom: 4px;
    font-size: 9px;
}

/* ===== INDEX PAGE ===== */

.app-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
}

.app-card {
    display: block;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: #eee;
    transition: all 0.2s;
}

.app-card:active {
    background: rgba(0, 217, 255, 0.2);
    border-color: #00d9ff;
}

.app-card h2 {
    margin: 0 0 8px 0;
    color: #00d9ff;
    font-size: 1.1em;
}

.app-card p {
    margin: 0;
    font-size: 0.85em;
    color: #aaa;
}

/* ===== BACK LINK ===== */

.back-link {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    color: #888;
    text-decoration: none;
}

.back-link:active {
    color: #00d9ff;
}

/* ===== TONE DISPLAY ===== */

.tone-display {
    text-align: center;
    padding: 15px;
    font-size: 14px;
    color: #aaa;
}

.tone-display .current-tones {
    font-size: 24px;
    color: #00d9ff;
    margin: 10px 0;
    font-weight: bold;
}

.tone-display .tone-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}
