/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #a78bfa; /* soft purple */
    --secondary-color: #fcd34d; /* soft yellow */
    --danger-color: #fca5a5; /* soft red */
    --record-color: #f472b6; /* soft pink */
    --bg-color: #fffbeb; /* light yellowy-white */
    --surface-color: #fdf2f8; /* light pinky-white */
    --text-color: #4b5563; /* dark grey */
    --text-secondary: #6b7280; /* lighter grey */
    --border-color: #f3f4f6; /* very light grey */
    --shadow: 0 8px 18px rgba(12, 14, 20, 0.08);
    --shadow-lg: 0 18px 40px rgba(12, 14, 20, 0.12);
    --min-touch: 56px;
    --spacing: 1rem;
}

body {
    font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Onboarding */
.onboarding {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #fecaca 0%, #fef08a 25%, #d9f99d 50%, #bfdbfe 75%, #e9d5ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--spacing);
}

.onboarding.hidden {
    display: none;
}

.onboarding-content {
    background: var(--surface-color);
    border-radius: 24px;
    padding: 3rem 2rem;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.onboarding-step.hidden {
    display: none;
}

.onboarding-icon {
    font-size: 6rem;
    margin-bottom: 1rem;
}

.onboarding h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.onboarding p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* App Container */
.app {
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.app.hidden {
    display: none;
}

/* Header - bigger, friendlier */
.app-header {
    background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,255,0.9));
    padding: calc(var(--spacing) * 1.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 6px solid;
    border-image-slice: 1;
    border-image-source: linear-gradient(to right, #fecaca, #fef08a, #d9f99d, #bfdbfe, #e9d5ff);
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 900;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 0 rgba(255,255,255,0.5);
}

/* playful header icon bounce */
.app-header h1 .emoji {
    display: inline-block;
    transform-origin: 50% 50%;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px) rotate(-6deg); }
}

/* Buttons - chunkier and more colorful */
.btn-primary, .btn-secondary, .btn-danger, .btn-record {
    font-size: 1.25rem;
    font-weight: 800;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease;
    min-height: var(--min-touch);
    min-width: var(--min-touch);
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary-color), #c4b5fd);
    color: white;
    box-shadow: 0 8px 20px rgba(167, 139, 250, 0.18);
}

.btn-primary:hover, .btn-primary:focus {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Record button - make very big and friendly */
.btn-record {
    width: 100%;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.12), transparent), var(--record-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.5rem;
    padding: 1.5rem;
    min-height: 96px;
    margin-top: 1.5rem;
    border-radius: 28px;
    box-shadow: 0 14px 30px rgba(244, 114, 182, 0.18);
    border: 4px solid rgba(255,255,255,0.06);
}

/* gentle pulsing ring around record when idle to invite interaction */
.btn-record::before {
    content: '';
    position: absolute;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    border-radius: 28px;
    left: 12px;
    top: calc(50% - ((100% - 24px)/2));
    pointer-events: none;
    box-shadow: 0 0 0 rgba(0,0,0,0);
    opacity: 0;
    transition: opacity 200ms ease;
}
.viz-start-btn.active ~ .listen-controls .btn-record::before,
.btn-record:hover::before {
    opacity: 0.06;
    animation: ring 1.6s infinite;
}
@keyframes ring {
    0% { box-shadow: 0 0 0 0 rgba(255,59,48,0.12); }
    70% { box-shadow: 0 0 0 18px rgba(255,59,48,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,59,48,0); }
}

/* Tab icons: bouncy, larger */
.tab-icon {
    font-size: 2.25rem;
    display: inline-block;
    transition: transform 180ms ease;
}
.tab-btn.active .tab-icon {
    transform: translateY(-6px) scale(1.08);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: var(--surface-color);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: calc(var(--min-touch) + var(--spacing) * 2);
    z-index: 99;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    min-height: var(--min-touch);
    border-bottom: 4px solid transparent;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-label {
    font-size: 1rem;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing);
}

.tab-content.active {
    display: block;
}

/* Listen Tab */
.viz-controls {
    background: var(--surface-color);
    padding: var(--spacing);
    border-radius: 16px;
    margin-bottom: var(--spacing);
    box-shadow: var(--shadow);
    display: none;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toggle-label {
    font-weight: 700;
    font-size: 1.25rem;
}

.btn-toggle {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 56px;
}

.btn-toggle.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.viz-container {
    position: relative;
    background: linear-gradient(180deg, #1e1b4b, #4c1d95);
    border-radius: 18px;
    overflow: hidden;
    min-height: 320px;
    margin-bottom: var(--spacing);
    box-shadow: 0 18px 40px rgba(6,182,212,0.07);
}

.viz-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.viz-canvas.hidden {
    display: none;
}

.touch-overlay {
    display: none;
}

.level-meter {
    position: absolute;
    top: var(--spacing);
    right: var(--spacing);
    width: 48px;
    height: 220px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.2));
    border-radius: 24px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(4px);
}

.level-bar {
    width: 100%;
    flex: 1;
    background: linear-gradient(to top, #60a5fa, #a78bfa, #f472b6, #facc15, #a3e63e);
    border-radius: 12px;
    transform-origin: bottom;
    transform: scaleY(0);
    transition: transform 0.1s ease;
}

.level-text {
    color: white;
    font-size: 0.8rem;
    font-weight: 900;
    writing-mode: horizontal-tb;
    transform: none;
}

/* Resonate Bars */
.resonate-bars {
    display: none;
}

.resonate-bars.hidden {
    display: none;
}

.resonate-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.resonate-bar-fill {
    width: 100%;
    height: 120px;
    background: linear-gradient(to top, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    border-radius: 8px;
    transform-origin: bottom;
    transform: scaleY(0);
    transition: transform 0.1s ease;
}

.resonate-bar-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Controls */
.listen-controls {
    background: var(--surface-color);
    padding: var(--spacing);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.slider-group {
    margin-bottom: 1.5rem;
}

.slider-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

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

.slider {
    width: 100%;
    height: var(--min-touch);
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border: 2px solid var(--border-color);
    border-radius: 28px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    border: 4px solid white;
}

.slider::-moz-range-thumb {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid white;
    box-shadow: var(--shadow);
}

.slider-help {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.btn-record {
    width: 100%;
    background: var(--record-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.75rem;
    padding: 1.5rem;
    min-height: 80px;
    margin-top: 1.5rem;
}

.btn-record:hover, .btn-record:focus {
    background: #b91c1c;
    transform: scale(1.02);
}

.btn-record.recording {
    background: #991b1b;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.record-icon {
    font-size: 2.5rem;
}

.recording-timer {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--record-color);
    margin-top: 1rem;
}

.recording-timer.hidden {
    display: none;
}

.viz-start-btn {
    width: 100%;
    background: var(--secondary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1.25rem;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    min-height: 70px;
    margin-bottom: var(--spacing);
    transition: all 0.2s ease;
}

.viz-start-btn:hover, .viz-start-btn:focus {
    background: #059669;
    transform: scale(1.02);
}

.viz-start-btn.active {
    background: var(--danger-color);
}

.viz-start-btn.active:hover {
    background: #b91c1c;
}

/* Gallery Tab */
.gallery-controls {
    margin-bottom: var(--spacing);
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: var(--spacing);
    min-height: var(--min-touch);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tag {
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
    transition: all 0.2s ease;
}

.filter-tag.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing);
}

.sound-card {
    background: linear-gradient(180deg, var(--surface-color), #fffaf0);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(12,14,20,0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.sound-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.sound-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #000;
}

.sound-preview-image {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 1rem;
    background-color: var(--border-color);
}

.btn-show-photo {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 2;
}

.btn-show-photo:hover {
    background: rgba(0, 0, 0, 0.8);
}

.sound-card-content {
    padding: var(--spacing);
}

.sound-card-label {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

.sound-card-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.sound-card-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.tag-chip {
    padding: 0.25rem 0.75rem;
    background: var(--bg-color);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

.sound-card-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-play {
    flex: 1;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 56px;
}

.btn-play:hover {
    background: #1d4ed8;
}

.btn-play.playing {
    background: var(--secondary-color);
}

/* Map Tab */
#mapTab.active {
    display: flex;
    flex-direction: column;
}

.map-content-wrapper {
    flex: 1;
    overflow-y: auto;
}

.map-container {
    position: relative;
    flex-shrink: 0;
    background: var(--surface-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    min-height: 400px;
}

.map-container.has-image {
    min-height: auto;
}

.map-background {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.map-background.hidden {
    display: none;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.map-bubbles {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.75rem 0.25rem;
    margin-bottom: 0.75rem;
}

.sound-bubble {
    flex: 0 0 auto;
    width: 72px;
    text-align: center;
    user-select: none;
    cursor: grab;
}

.sound-bubble-thumb {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: var(--shadow);
    object-fit: cover;
    background: #e5e7eb;
    margin: 0 auto 6px;
}

.sound-bubble-label {
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-pin {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    box-shadow: 0 18px 36px rgba(12,14,20,0.12);
    transform: translate(-50%, -50%);
    transition: transform 160ms cubic-bezier(.2,.9,.2,1), box-shadow 160ms ease;
    color: white;
}

.map-pin:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 26px 50px rgba(12,14,20,0.16);
}

.photo-pin {
    width: 80px;
    height: 80px;
    background: white;
    border: 3px solid white;
    padding: 0;
}

.map-pin-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.map-legend {
    position: absolute;
    bottom: var(--spacing);
    left: var(--spacing);
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: none;
}

.map-legend h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.legend-color.low {
    background: #3b82f6;
}

.legend-color.mid {
    background: #8b5cf6;
}

.legend-color.high {
    background: #ec4899;
}

.map-recordings-list {
    background: var(--surface-color);
    border-radius: 16px;
    padding: var(--spacing);
    margin-top: var(--spacing);
    box-shadow: var(--shadow);
}

.map-recordings-list h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.map-recordings-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--spacing);
}

.map-recording-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
}

.map-recording-item {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.map-recording-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.map-recording-item:active {
    cursor: grabbing;
}

.map-recording-item.on-map {
    opacity: 0.5;
    cursor: not-allowed;
}

.map-recording-item.on-map:hover {
    transform: none;
}

.map-recording-thumbnail {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: none;
}

.map-recording-tags {
    display: none;
}

.map-recording-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex: 0 0 32px;
    box-shadow: var(--shadow);
    border: 2px solid rgba(255,255,255,0.8);
}

.map-recording-label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-recording-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.map-recording-tags .tag-chip {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
}

.map-container.drag-over {
    border: 4px dashed var(--primary-color);
}

.map-pin-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.map-pin:hover .map-pin-label {
    opacity: 1;
}

.map-pin-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.map-pin:hover .map-pin-remove {
    opacity: 1;
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem var(--spacing);
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

#mapEmptyState {
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 24px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.camera-container {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

#cameraFeed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-content h2 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.modal-help {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.label-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    min-height: var(--min-touch);
}

.btn-voice {
    position: absolute;
    right: calc(2rem + var(--spacing));
    margin-top: 4px;
}

.emoji-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.emoji-btn {
    width: 56px;
    height: 56px;
    font-size: 2rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.emoji-btn:hover, .emoji-btn:focus {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.tag-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: var(--spacing);
}

.tag-btn {
    padding: 1rem;
    background: linear-gradient(180deg,#ffffff,#fff8f1);
    border: 3px solid var(--border-color);
    border-radius: 18px;
    font-size: 1.125rem;
    font-weight: 800;
    cursor: pointer;
    min-height: 56px;
    transition: transform 140ms ease, box-shadow 140ms ease;
}
.tag-btn.active {
    background: linear-gradient(180deg, var(--secondary-color), #fde047);
    color: var(--text-color);
    border-color: rgba(0,0,0,0.06);
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(252, 211, 77, 0.12);
}

.suggested-tags {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: var(--spacing);
}

.suggested-tags.hidden {
    display: none;
}

.modal-actions {
    display: flex;
    gap: var(--spacing);
    margin-top: 1.5rem;
}

.modal-actions button {
    flex: 1;
}

/* Settings */
.setting-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.setting-group input[type="checkbox"] {
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.setting-help {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.file-input {
    display: none;
}

.setting-group.danger {
    border-color: var(--danger-color);
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .onboarding-content {
        padding: 2rem 1rem;
    }
    
    .tag-picker {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
button:focus-visible,
input:focus-visible,
.btn-toggle:focus-visible {
    outline: 6px solid rgba(6,182,212,0.18);
    outline-offset: 4px;
}

/* Sound Hunt Tab */
.hunt-header {
    background: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: var(--spacing);
    text-align: center;
}

.hunt-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hunt-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    margin-bottom: 1rem;
}

.missions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing);
}

.mission-card {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 4px solid transparent;
}

.mission-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.mission-card.completed {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.mission-card.completed .mission-icon {
    position: relative;
}

.mission-card.completed .mission-icon::after {
    content: '✅';
    position: absolute;
    top: -12px;
    right: -12px;
    font-size: 2.5rem;
    animation: bounce 0.5s ease;
}

.mission-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--text-color);
}

.mission-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1rem;
}

.mission-progress {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.mission-card.completed .mission-progress {
    background: var(--secondary-color);
    color: white;
}

/* Badges Tab */
.badges-header {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: var(--spacing);
    text-align: center;
}

.badges-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.badges-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    margin-bottom: 1rem;
}

.badges-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing);
}

.badge-card {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0.5;
    filter: grayscale(100%);
}

.badge-card.earned {
    opacity: 1;
    filter: grayscale(0%);
    border: 4px solid var(--secondary-color);
}

.badge-card:hover.earned {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.badge-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.badge-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.badge-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.badge-locked {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Badge Popup */
.badge-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--spacing);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.badge-popup.hidden {
    display: none;
}

.badge-popup-content {
    background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
    border-radius: 24px;
    padding: 3rem 2rem;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.5s ease;
    border: 6px solid #fbbf24;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.badge-popup-confetti {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: confetti 1s ease-in-out infinite;
}
@keyframes confetti {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(10deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

.badge-popup-icon {
    font-size: 8rem;
    margin-bottom: 1rem;
    animation: bounce 0.5s ease infinite alternate;
}

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

.badge-popup h2 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.badge-popup p {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.map-filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.map-filter-tags .filter-tag {
    padding: 0.4rem 0.8rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.map-filter-tags .filter-tag.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.toggle-photo-btn {
    background: var(--surface-color) !important;
    color: var(--text-color) !important;
    border-color: var(--primary-color) !important;
}

.toggle-photo-btn.active {
    background: var(--primary-color) !important;
    color: white !important;
}

.bubble-add-btn {
    margin-top: 4px;
    padding: 4px 8px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
}

.app-version {
    margin-left: 0.75rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
}