:root {
    --primary-bg: #e0f7fa;
    --secondary-bg: #b2ebf2;
    --accent: #00bcd4;
    --accent-hover: #00acc1;
    --text-main: #263238;
    --text-light: #546e7a;
    
    --card-bg: rgba(255, 255, 255, 0.4);
    --card-border: rgba(255, 255, 255, 0.6);
    --card-shadow: rgba(0, 131, 143, 0.1);
    
    --note-bg: rgba(255, 255, 255, 0.5);
    --note-text: #263238;
    
    --tune-flat: #a0a0a0;     
    --tune-perfect: #20c997;  
    --tune-sharp: #ff6b6b;    
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    position: relative;
    user-select: none;
    padding: 20px 0;
}

.blob {
    position: absolute; filter: blur(80px); z-index: 0; border-radius: 50%;
    animation: float 20s infinite ease-in-out alternate;
}
.blob-1 { width: 400px; height: 400px; background: rgba(0, 188, 212, 0.3); top: -100px; left: -100px; }
.blob-2 { width: 300px; height: 300px; background: rgba(32, 201, 151, 0.2); bottom: -50px; right: -50px; animation-delay: -5s; }
.blob-3 { width: 250px; height: 250px; background: rgba(255, 107, 107, 0.15); top: 40%; left: 60%; animation-delay: -10s; }
@keyframes float { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(30px, 50px) scale(1.1); } }

.app-container {
    width: 100%; max-width: 500px; padding: 20px; position: relative; z-index: 1;
}

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo i { font-size: 28px; color: var(--accent); }
header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }

.icon-btn, .ft-btn {
    background: var(--card-bg); border: 1px solid var(--card-border);
    width: 45px; height: 45px; border-radius: 50%; font-size: 20px; color: var(--text-main);
    cursor: pointer; backdrop-filter: blur(10px); transition: all 0.3s;
    box-shadow: 0 4px 15px var(--card-shadow);
    display: flex; justify-content: center; align-items: center;
}
.icon-btn:hover, .ft-btn:hover { background: #fff; transform: translateY(-2px); color: var(--accent); }

.glass-card {
    background: var(--card-bg); backdrop-filter: blur(20px); border: 1px solid var(--card-border);
    border-radius: 30px; padding: 25px; box-shadow: 0 20px 40px var(--card-shadow);
}

.controls-section { display: flex; gap: 15px; margin-bottom: 25px; align-items: flex-end; }
.shruthi-selector { flex: 1; }
.shruthi-selector label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-light); }

.shruthi-trigger-btn {
    width: 100%; background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255,255,255,0.9); padding: 14px 20px; border-radius: 15px;
    font-family: inherit; font-size: 16px; font-weight: 600; color: var(--text-main);
    cursor: pointer; transition: all 0.3s; display: flex; justify-content: space-between; align-items: center;
}
.shruthi-trigger-btn:hover { border-color: var(--accent); background: white; }

.primary-btn {
    background: var(--accent); color: white; border: none; padding: 14px 20px;
    border-radius: 15px; font-family: inherit; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: all 0.3s; box-shadow: 0 10px 20px rgba(0, 188, 212, 0.3);
}
.primary-btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
.primary-btn.active { background: var(--tune-sharp); box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3); }

/* Note Boxes and Columns */
.top-notes { display: flex; justify-content: center; gap: 30px; margin-bottom: 25px;}

.note-col {
    display: flex; flex-direction: column; align-items: center; width: 110px;
}

.string-playing-label {
    font-size: 12px; font-weight: 800; color: var(--accent);
    height: 16px; margin-bottom: 4px; text-align: center;
    opacity: 0; transition: opacity 0.2s; text-transform: uppercase; letter-spacing: 1px;
}
.string-playing-label.visible { opacity: 1; }

.note-box {
    background: var(--note-bg); border: 1.5px solid var(--accent);
    border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center;
    font-weight: 800; color: var(--note-text); cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); position: relative; transition: all 0.1s;
}

.note-box:active { transform: scale(0.95); opacity: 0.8; }
.note-box.active-tune { background: white; border-color: currentColor; }

/* For Chala Swarams - Only glow green when perfect, no active white background unless perfect */
.note-box.chala.active-tune { 
    background: var(--note-bg); /* remain transparent-ish */ 
}
.note-box.chala.perfect {
    background: var(--tune-perfect); color: white; border-color: var(--tune-perfect);
}

.note-box .detected-freq { font-size: 12px; font-weight: 600; margin-top: 2px; opacity: 0; }
.note-box.active-tune .detected-freq { opacity: 1; }

.main-note { width: 90px; height: 90px; font-size: 28px; z-index: 2; margin-bottom: 10px;}
.small-note { width: 55px; height: 55px; font-size: 18px; }
.sub { font-size: 10px; vertical-align: bottom;}

/* String Selector popup */
.string-selector {
    display: flex; gap: 5px; margin-bottom: 15px; opacity: 0; height: 0; overflow: hidden;
    transition: opacity 0.3s, height 0.3s;
}
.string-selector.show { opacity: 1; height: 30px; }

.str-btn {
    width: 25px; height: 25px; border-radius: 50%; border: 1px solid var(--card-border);
    background: white; font-weight: bold; color: var(--text-main); font-size: 12px;
    cursor: pointer; display: flex; justify-content: center; align-items: center;
}
.str-btn:active { background: var(--accent); color: white;}

/* Mini Tuning Gauge */
.mini-gauge {
    display: flex; flex-direction: column; align-items: center; width: 100%; opacity: 0.5; transition: opacity 0.3s;
}
.mini-gauge.active { opacity: 1; }

.tuning-line-wrapper { display: flex; align-items: center; width: 100%; position: relative; height: 16px; gap: 2px; margin-bottom: 5px;}
.tuning-line { flex: 1; height: 2px; background: rgba(0,0,0,0.1); display: flex; justify-content: space-between; align-items: center; }

.tick { width: 2px; height: 10px; background: rgba(0,0,0,0.2); }
.tick.small { height: 5px; }

.indicator-thumb {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 12px; height: 12px; background: white; border: 3px solid var(--text-main);
    border-radius: 50%; transition: left 0.1s linear, border-color 0.1s; z-index: 2;
}

.cents-number { font-size: 18px; font-weight: 800; font-family: monospace; color: var(--text-light); transition: color 0.1s; }

/* Stacked Small Notes (Alias names) */
.note-box.stacked { border-radius: 20px; }
.note-box .top-alias { position: absolute; top: -18px; font-size: 12px; font-weight: 600;}
.note-box .bottom-alias { position: absolute; bottom: -18px; font-size: 12px; font-weight: 600;}

.bottom-notes-grid { 
    display: flex; flex-direction: column; gap: 25px; align-items: center; margin-top: 10px; 
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid #1a237e; /* thin dark blue line */
    border-radius: 20px;
    padding: 20px 10px;
}
.swaram-row { display: flex; gap: 10px; }

/* Active Tuning Top Box */
.active-tuning-box {
    background: white; border: 1.5px solid var(--accent);
    padding: 10px 20px; border-radius: 12px;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    margin-bottom: 25px; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.active-tuning-box .lbl { font-size: 14px; font-weight: 600; color: var(--text-light); }
.active-tuning-box #active-swaram-name { font-size: 18px; font-weight: 800; color: var(--accent); }


/* Animated Shruthi Modal Layout - Same Style as Tuning UI */
.animated-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 200; display: flex; justify-content: center; align-items: center;
    padding: 20px; pointer-events: none; opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(224, 247, 250, 0.8);
    backdrop-filter: blur(10px);
}

.animated-modal.active { pointer-events: auto; opacity: 1; }

.animated-modal-content {
    width: 100%; max-width: 450px;
    transform: translateY(50px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column; gap: 20px; align-items: center;
}

.animated-modal.active .animated-modal-content {
    transform: translateY(0);
}

.modal-title { font-size: 22px; color: var(--text-main); text-align: center; }

.kattai-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; width: 100%;
}

.kattai-btn {
    background: var(--note-bg); border: 2px solid var(--card-border);
    border-radius: 15px; height: 50px; font-weight: 800; font-size: 16px;
    color: var(--text-main); cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.kattai-btn.active {
    background: white; border-color: var(--accent); color: var(--accent);
    transform: scale(1.05);
}

.kattai-btn .note-lbl { font-size: 10px; font-weight: normal; opacity: 0.8; }

.fine-tune-section {
    width: 100%; background: var(--note-bg); padding: 15px; border-radius: 15px; border: 1px solid var(--card-border);
}

.fine-tune-section label { display: block; text-align: center; margin-bottom: 10px; font-weight: 600; color: var(--text-light); }

.fine-tune-controls { display: flex; align-items: center; gap: 15px; }
.fine-tune-controls input[type="range"] { flex: 1; accent-color: var(--accent); }

.fine-tune-value { text-align: center; margin-top: 10px; font-weight: 600; font-family: monospace; color: var(--text-main); }

.done-btn { width: 100%; }

/* Standard Help Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(5px); z-index: 100;
    justify-content: center; align-items: center;
}
.modal.show { display: flex; }
.modal-content {
    width: 90%; max-width: 400px; background: rgba(255,255,255,0.9);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 15px; margin-bottom: 15px;}
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-light);}
.instruction-step { display: flex; gap: 15px; margin-bottom: 15px; }
.step-num {
    background: var(--accent); color: white; width: 24px; height: 24px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; font-weight: bold; flex-shrink: 0; font-size: 14px;
}
.color-guide { display: flex; flex-direction: column; gap: 5px; margin-left: 40px; font-size: 14px;}
.box { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; }
.color-gray { background: var(--tune-flat); }
.color-green { background: var(--tune-perfect); }
.color-red { background: var(--tune-sharp); }
