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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

/* Two-Column Layout */
.main-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.left-column {
    flex: 1;
    background: rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.right-column {
    flex: 1;
    background: rgba(30, 30, 30, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Left Column: Camera/Hand Recognition */
.camera-section {
    margin-bottom: 20px;
}

/* Right Column: Audio Controls */
.audio-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}


h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* Hand Recognition Section */
.hand-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.video-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.video-wrapper {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* Face Recognition Toggle Button - Hidden by default */
.face-toggle {
    display: none;
}

#inputVideo {
    display: none;
}

#outputCanvas {
    display: block;
    width: 640px;
    height: 480px;
    transform: scaleX(-1);
    max-width: 100%;
    height: auto;
}

.detection-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 15px 20px;
    font-size: 1.5rem;
    font-weight: bold;
    min-width: 200px;
    text-align: center;
    z-index: 3;
}

.gesture-status {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .gesture-status {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
        gap: 10px;
    }
}

.status-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.status-label {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-bottom: 4px;
}

.status-value {
    font-size: 1rem;
    font-weight: bold;
    color: #ffd700;
}

#currentDirection,
#angleDisplay,
#speedDisplay,
#fingerStatus {
    font-size: 1rem;
}

#currentDirection span {
    font-size: 1.2rem;
}

/* Audio Player Section */
.audio-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.upload-section {
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

#audioFile {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.load-default-btn {
    background-color: #2196F3;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.load-default-btn:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
}

.controls-section {
    display: none;
}

.time-section {
    margin-bottom: 20px;
}

.time-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

input[type="range"] {
    width: 100%;
    cursor: pointer;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
}

.speed-section {
    margin-bottom: 25px;
    background: rgba(46, 125, 50, 0.2);
    padding: 15px;
    border-radius: 10px;
}

.speed-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

#speedBar {
    height: 8px;
}

.speed-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.8;
}

.param-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 10px;
    font-style: italic;
}

.params-section {
    margin-bottom: 25px;
    background: rgba(255, 152, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
}

.params-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ffd700;
}

.params-info {
    font-size: 12px;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.7);
}

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

.param-item {
    display: flex;
    flex-direction: column;
}

.param-item label {
    font-weight: bold;
    color: #ffd700;
    font-size: 13px;
    margin-bottom: 5px;
}

.param-item input[type="number"] {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.param-item input[type="number"]:focus {
    outline: none;
    border-color: #ffd700;
}

.param-info-box {
    background: rgba(255, 152, 0, 0.3);
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #ffd700;
}

.param-info-box strong {
    color: #ffd700;
    font-size: 13px;
}

.effective-params {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    font-size: 13px;
}

.effective-params span {
    color: rgba(255, 255, 255, 0.9);
}

.effective-params strong {
    color: #ffd700;
    font-weight: bold;
}

.button-section {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    font-weight: bold;
}

#playBtn {
    background-color: #4CAF50;
    color: white;
}

#playBtn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

#pauseBtn {
    background-color: #f44336;
    color: white;
}

#pauseBtn:hover {
    background-color: #da190b;
    transform: translateY(-2px);
}

#resetBtn {
    background-color: #666;
    color: white;
}

#resetBtn:hover {
    background-color: #555;
    transform: translateY(-2px);
}

/* Control Mode Section */
.control-mode-section {
    background: rgba(156, 39, 176, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.control-mode-section h3 {
    color: #ffd700;
    margin-bottom: 15px;
}

.mode-toggle {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.toggle-label:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.toggle-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 24px;
    height: 24px;
    border: 2px solid #ffd700;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.toggle-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffd700;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.toggle-label input[type="radio"]:checked ~ strong {
    color: #ffd700;
}

.toggle-label strong {
    flex: 1;
    font-size: 16px;
}

.mode-desc {
    font-size: 12px;
    opacity: 0.7;
    font-style: italic;
}

/* Face Recognition Section */
.face-recognition-section {
    background: rgba(236, 72, 153, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.face-recognition-section h3 {
    color: #ffd700;
    margin-bottom: 15px;
}

.face-recognition-toggle {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.face-recognition-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.face-recognition-toggle .toggle-label:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.face-recognition-toggle .toggle-label input[type="checkbox"] {
    display: none;
}

.face-recognition-toggle .radio-custom {
    width: 24px;
    height: 24px;
    border: 2px solid #ffd700;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
}

.face-recognition-toggle .toggle-label input[type="checkbox"]:checked + .radio-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
}

.face-recognition-toggle .toggle-label input[type="checkbox"]:disabled + .radio-custom {
    opacity: 0.4;
    cursor: not-allowed;
}

.face-recognition-toggle .toggle-label input[type="checkbox"]:disabled + .radio-custom::after {
    content: '';
}

.face-recognition-toggle .toggle-label:has(input[type="checkbox"]:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
}

.face-recognition-toggle .toggle-label:has(input[type="checkbox"]:disabled):hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
}

.face-recognition-toggle .toggle-label input[type="checkbox"]:checked ~ strong {
    color: #ffd700;
}

.face-recognition-toggle .toggle-label strong {
    flex: 1;
    font-size: 16px;
}

/* Sliding Toggle Switch */
.switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 0;
}

.switch-container .switch-label {
    font-size: 14px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
}

.switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 26px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: #ffd700;
}

.switch input:checked + .switch-slider:before {
    transform: translateX(24px);
}

.switch input:focus + .switch-slider {
    box-shadow: 0 0 3px #ffd700;
}

/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: rgba(0, 0, 0, 0.4);
}

.collapsible-header h3 {
    margin: 0;
    font-size: 16px;
}

.collapsible-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    color: #ffd700;
}

.collapsible-section.collapsed .collapsible-arrow {
    transform: rotate(-90deg);
}

.collapsible-content {
    padding: 15px;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Confusion Meter */
.confusion-meter {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.confusion-label {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 10px;
}

.confusion-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.confusion-fill {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.3s ease, background 0.3s ease;
    background: linear-gradient(90deg, #4ade80, #4ade80);
}

.confusion-status {
    font-size: 13px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

.face-parameter-group {
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.face-parameter-group label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.face-parameter-group input[type="number"] {
    width: 90px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
}

/* Hand gesture instructions */
.gesture-instructions {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.gesture-instructions h3 {
    color: #ffd700;
    margin-bottom: 15px;
}

.gesture-list {
    list-style: none;
    padding: 0;
}

.gesture-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.gesture-list li:last-child {
    border-bottom: none;
}

.gesture-icon {
    font-size: 1.5rem;
}

.loading {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 20px;
}

.error-message {
    background: rgba(248, 113, 113, 0.2);
    border: 2px solid #f87171;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

/* Settings/Parameters Modal - MOBILE ONLY */
.settings-button {
    display: none; /* Hidden by default (desktop) */
}

/* ADD: File Upload Button - HIDDEN BY DEFAULT */
.file-upload-button {
    display: none; /* Hidden until file is loaded */
}

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.settings-header h2 {
    color: #ffd700;
    margin: 0;
}

.close-settings {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 24px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-settings:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* ======= Touch Zone Styling ====== */
#touchControlSection {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

#touchControlSection h3 {
    color: #ffd700;
    margin-bottom: 15px;
    margin-top: 0;
}

#touch-control-area {
    position: relative;
    width: 100%;
    height: 480px; /* Match video height */
    background: rgba(0,0,0,0.5);
    border: 2px solid #4ade80;
    border-radius: 15px;
    cursor: crosshair;
    touch-action: none;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#touch-indicator {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    pointer-events: none;
    transition: opacity 0.2s;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#touch-indicator.active {
    opacity: 1;
}

.touch-placeholder-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,0.3);
    pointer-events: none;
    font-size: 1.2em;
    text-align: center;
}

.touch-mode-toggle {
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
}

.touch-mode-toggle label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.touch-mode-toggle input[type="checkbox"],
.touch-mode-toggle input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.touch-mode-toggle span {
    font-weight: bold;
    font-size: 16px;
}

.touch-zone-labels {
    margin-top: 5px;
    font-size: 0.9em;
    color: #aaa;
}

.touch-zone-labels span {
    margin: 0 5px;
}

.touch-parameter-group {
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

.touch-parameter-group label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.touch-parameter-group input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    margin: 0 5px;
}

.touch-parameter-group input[type="number"]:focus {
    outline: none;
    border-color: #ffd700;
}

.touch-parameter-group .param-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

#speed-decay-group {
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

#speed-decay-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

#speed-decay-label {
    font-weight: bold;
    color: #4ade80;
}

#speed-decay-display {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    margin: 8px 0;
}

#speed-decay-display::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4ade80;
    cursor: not-allowed;
}

/* Fullscreen toggle button - HIDDEN BY DEFAULT (Desktop) */
.fullscreen-toggle {
    display: none; /* Hide on desktop */
}

/* ADD: Hide upload section after file is loaded on mobile */
.audio-section .upload-section.file-loaded {
    display: none !important;
}

/* Audio Loading Indicator */
.audio-loading-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    margin-bottom: 15px;
    background: rgba(74, 222, 128, 0.1);
    border: 2px solid rgba(74, 222, 128, 0.3);
    border-radius: 8px;
    animation: fadeIn 0.3s ease-in;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(74, 222, 128, 0.3);
    border-top-color: #4ade80;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: #4ade80;
    font-size: 0.95em;
    font-weight: 500;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* Disabled state for inputs and buttons */
.upload-section input:disabled,
.upload-section button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   MOBILE STYLES START HERE
   ======================================== */

@media (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
        padding-bottom: 400px; /* Space for fixed bottom sections */
    }

    /* Settings button - SHOW ON MOBILE */
    .settings-button {
        display: flex;
        position: fixed;
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        z-index: 1000;
        transition: all 0.3s;
        color: white;
        padding: 10px 10px;
    }

    .settings-button:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(90deg);
    }
    
    /* ADD: File Upload button - SHOW ON MOBILE */
    .file-upload-button {
        display: none; /* Hidden until file is loaded */
        position: fixed;
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        z-index: 1;
        transition: all 0.3s;
        color: white;
        padding: 10px 10px;
        border: none;
    }
    
    .file-upload-button.show {
        display: flex !important;
    }

    .file-upload-button:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }
    
    /* Hide audio section title on mobile */
    .audio-section h2 {
        display: none;
    }
    
    /* Hide parameters sections in MAIN VIEW only - not in modal */
    .right-column .params-section,
    .right-column .alpha-section,
    .how-it-works-section {
        display: none !important;
    }

    /* Hide touch controls header and parameters in MAIN VIEW */
    #touchControlSection > h3,
    #touchControlSection .touch-parameter-group,
    #touchControlSection #speed-decay-group,
    #touchControlSection .touch-zone-labels {
        display: none !important;
    }


    /* Flatten the two-column structure into a single column */
    .main-container {
        display: block;
        height: auto;
        width: 100%;
    }

    /* All sections become full-width blocks in a single column */
    .left-column,
    .right-column {
        display: block;
        width: 100%;
        flex: none;
        padding: 0;
        background: transparent;
        position: static;
        height: auto;
    }

    .right-column {
        padding: 15px;
    }

    /* Hide elements we don't want on mobile */
    .left-column h1,
    .left-column .subtitle,
    .loading,
    .gesture-instructions,
    .gesture-status,
    .audio-section h2 {
        display: none;
    }

    /* Camera section - container for both hand and touch sections */
    .camera-section {
        position: fixed;
        bottom: 50px; /* ADJUST: Distance from bottom - increase to move up, decrease to move down */
        left: 0;
        right: 0;
        width: 100%;
        height: 350px; /* ADJUST: Total height of the camera/touch section */
        margin: 0;
        padding: 0;
        z-index: 100;
        background: transparent;
    }

    /* UNIFIED STYLING: Hand section - takes full space when visible */
    .hand-section {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        border-top: 3px solid #4ade80;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
        border-radius: 0;
        display: flex;
        flex-direction: column;
        backdrop-filter: blur(10px);
    }

    .video-container {
        margin-bottom: 0;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .video-wrapper {
        width: 100%;
        height: 100%;
        position: relative;
    }

    #inputVideo,
    #outputCanvas {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* UNIFIED STYLING: Touch control section - same appearance as hand section */
    #touchControlSection {
        position: absolute !important;
        width: 100%;
        height: 85%;
        bottom: 0;
        border-top: 3px solid #4ade80;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(10px);
        z-index: 101;
        padding: 10px; /* ADD: Space around the section */
        margin: 0;
        border-radius: 20px;
    }

    /* When touch section is hidden (hand mode), don't take up space */
    #touchControlSection[style*="display: none"] {
        display: none !important;
    }

    /* When touch section is visible (touch mode), show it */
    #touchControlSection[style*="display: block"],
    #touchControlSection[style*="display: flex"] {
        display: flex !important;
        flex-direction: column;
    }

    /* Touch section header - minimal, consistent with hand section */
    #touchControlSection h3 {
        padding: 10px;
        margin: 0;
        font-size: 0.9rem;
        text-align: center;
        background: rgba(0, 0, 0, 0.4);
        color: #ffd700;
        flex-shrink: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Touch control area - fills space like video container */
    #touch-control-area {
        flex: 1 1 auto;
        height: auto;
        min-height: 200px; /* ADJUST: Change this to make it taller/shorter */
        border: 2px solid #4ade80;
        border-radius: 20px; /* ADD: Rounded corners for better appearance */
        background: rgba(0, 0, 0, 0.5);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }


    /* Compact touch controls - horizontal layout like control-mode-section */
    .touch-mode-toggle {
        padding: 0;
        margin: 0;
        font-size: 12px;
        flex-shrink: 0;
        background: rgba(0, 0, 0, 0.4);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 50px;
    }
    
    /* Hide the "Control Mode:" header on mobile */
    .touch-mode-toggle > div:first-child {
        display: none;
    }
    
    /* Container for radio buttons - horizontal row */
    .touch-mode-toggle {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0;
        align-items: center;
        justify-content: center;
    }
    
    /* Radio button labels - side by side like control mode toggle */
    .touch-mode-toggle label {
        flex: 1;
        padding: 8px 4px;
        margin: 0;
        height: 50px;
        background: transparent;
        border-radius: 0;
        border: none;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        cursor: pointer;
        transition: background 0.2s;
    }
    
    .touch-mode-toggle label:last-child {
        border-right: none;
    }
    
    .touch-mode-toggle label:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    
    /* Style radio inputs */
    .touch-mode-toggle input[type="radio"] {
        width: 14px;
        height: 14px;
        margin: 0;
        accent-color: #ffd700;
    }
    
    /* Compact text for mobile */
    .touch-mode-toggle label span {
        font-size: 11px;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Hide mode label and zone labels on mobile */
    #touchControlSection #input-mode-label,
    #touchControlSection .touch-zone-labels {
        display: none;
    }

    /* Control mode section - fixed at very bottom */
    .control-mode-section {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 50px;
        background: rgba(15, 15, 15, 0.98);
        border-top: 2px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.5);
        z-index: 101;
        padding: 0;
        margin: 0;
        border-radius: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .control-mode-section h3 {
        display: none;
    }

    /* Mode toggle - horizontal compact layout */
    .mode-toggle {
        flex-direction: row;
        gap: 0;
        width: 100%;
        height: 100%;
        margin: 0;
    }

    .toggle-label {
        flex: 1;
        padding: 0;
        margin: 0;
        height: 100%;
        background: transparent;
        border-radius: 0;
        border: none;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .toggle-label:last-child {
        border-right: none;
    }

    .toggle-label:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: none;
    }

    .toggle-label input[type="radio"]:checked {
        background: rgba(255, 215, 0, 0.2);
    }

    .radio-custom {
        width: 18px;
        height: 18px;
    }

    .toggle-label input[type="radio"]:checked + .radio-custom::after {
        width: 10px;
        height: 10px;
    }

    .toggle-label strong {
        font-size: 13px;
        flex: none;
    }

    .mode-desc {
        display: none;
    }

    /* Audio section - appears in normal flow */
    .audio-section {
        margin-bottom: 15px;
        padding: 20px;
    }

    /* All other elements flow naturally in single column */
    .upload-section,
    .time-section,
    .speed-section,
    .button-section,
    .params-section {
        margin-bottom: 15px;
    }

    .detection-overlay {
        font-size: 1rem;
        padding: 8px 12px;
    }

    /* Fullscreen toggle button - SHOW when touch section is visible */
    .fullscreen-toggle {
        display: none; /* Hidden by default */
        position: absolute;
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(10px);
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: 10px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        z-index: 1000;
        transition: all 0.3s;
        color: white;
        padding: 0;
    }

    .fullscreen-toggle:hover {
        background: rgba(0, 0, 0, 0.85);
        transform: scale(1.1);
    }

    /* Show fullscreen button when touch section is visible */
    #touchControlSection:not([style*="display: none"]) .fullscreen-toggle,
    #touchControlSection[style*="display: block"] .fullscreen-toggle,
    #touchControlSection[style*="display: flex"] .fullscreen-toggle {
        display: flex !important;
    }

    /* Touch control section - fullscreen mode */
    #touchControlSection.fullscreen {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 2000;
        padding: 0;
        margin: 0;
        border-radius: 0;
        border: none;
    }

    #touchControlSection.fullscreen #touch-control-area {
        border-radius: 0;
        height: 100%;
        min-height: 100vh;
    }

    /* Hide mode toggle in fullscreen */
    #touchControlSection.fullscreen .touch-mode-toggle {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        z-index: 2001;
    }

    /* Fullscreen mode - change arrow direction */
    #touchControlSection.fullscreen .fullscreen-toggle {
        top: 20px;
        right: 20px;
    }

    /* Confusion Meter - Position at bottom of camera viewport on mobile */
    .confusion-meter {
        position: absolute;
        bottom: 10px;
        left: 10px;
        right: 10px;
        margin: 0 !important;
        padding: 10px;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(10px);
        border-radius: 10px;
        z-index: 20;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    }

    .confusion-label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .confusion-bar {
        height: 15px;
        margin-bottom: 4px;
    }

    .confusion-meter small {
        font-size: 10px;
    }
}

/* MOBILE: Smaller screens */
@media (max-width: 700px) {
    h1 {
        font-size: 1.8rem;
    }
}

/* Add this to better style the modal upload section */

.settings-modal .upload-section {
    flex-direction: column;
    gap: 20px;
    margin-bottom: 0;
}

.settings-modal .upload-section input[type="url"],
.settings-modal .upload-section input[type="file"] {
    width: 100%;
}

.settings-modal .load-default-btn {
    width: 100%;
}

/* Style for current audio info section */
#currentAudioInfo {
    animation: fadeIn 0.3s ease-in;
}

#changeAudioBtn {
    transition: all 0.2s;
}

#changeAudioBtn:hover {
    background-color: #1976D2;
    transform: translateY(-1px);
}

/* Face Recognition Toggle Button - HIDDEN BY DEFAULT (Desktop) */
.face-toggle {
    display: none; /* Hide on desktop and by default on mobile */
}

@media (max-width: 768px) {
    /* Face recognition toggle button - SHOW ON MOBILE IN CAMERA MODES ONLY */
    body.camera-mode .face-toggle {
        display: flex;
        position: absolute;
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        z-index: 10;
        transition: all 0.3s;
        color: white;
        padding: 0;
    }

    body.camera-mode .face-toggle.active {
        background: rgba(255, 215, 0, 0.3);
        border-color: #ffd700;
    }

    body.camera-mode .face-toggle:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }
    
    /* Hide the entire face recognition section on mobile */
    .face-recognition-section {
        display: none !important;
    }
    
    /* But show it inside the settings modal */
    .settings-modal .face-recognition-section {
        display: block !important;
        margin-bottom: 20px;
    }
}
