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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5vh;
}

.container {
    max-width: 600px;
    width: 100%;
    padding: 2rem;
    position: relative;
}

.info-link {
    position: absolute;
    top: 0;
    right: 0;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.info-link:hover {
    color: #555;
}

.back-link {
    position: absolute;
    top: 0;
    left: 0;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: #555;
}

.info-section {
    margin-top: 2rem;
}

.info-section p {
    font-size: 0.85rem;
    color: #eee;
}

.info-section p + p {
    margin-top: 1rem;
}

.info-section a {
    color: #555;
    text-decoration: none;
}

.info-section a:hover {
    color: #888;
}

.info-section h2 {
    font-size: 1.2rem;
    color: #e94560;
    margin-bottom: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #2a2a4a;
}

th {
    color: #888;
    font-weight: normal;
}

td a {
    color: #555;
    text-decoration: none;
}

td a:hover {
    color: #888;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-item {
    background: #16213e;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e94560;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}

.error {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(233, 69, 96, 0.2);
    border-radius: 8px;
    color: #e94560;
}

h1 {
    font-size: 2.5rem;
    color: #e94560;
    text-align: center;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 2rem;
}

.app-icon {
    display: block;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem auto;
    border-radius: 20px;
}

.upload-area {
    border: 2px dashed #e94560;
    border-radius: 10px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-area:hover {
    background: rgba(233, 69, 96, 0.1);
}

.upload-area.dragover {
    background: rgba(233, 69, 96, 0.2);
}

.input-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-area.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.record-btn {
    border: 2px dashed #e94560;
    border-radius: 10px;
    padding: 1.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
    background: transparent;
    color: #eee;
    font-size: 1rem;
    width: 100%;
    position: relative;
    overflow: hidden;
 display: flex;
    align-items: center;
    justify-content: center;
    height: 72px;
    gap: 0;
}

.record-btn.recording {
    justify-content: space-between;
}



.record-btn:hover {
    background: rgba(233, 69, 96, 0.1);
}

.record-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.live-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: rgba(233, 69, 96, 0.25);
    transition: width 0.1s linear;
    z-index: 0;
}

.live-progress-text {
    position: relative;
    z-index: 1;
}

.loading-results {
    min-height: 120px;
}

.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(233, 69, 96, 0.3);
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem auto;
}

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

.results {
    padding-top: 2rem;
}

.results h2 {
    color: #e94560;
    margin-bottom: 1rem;
}

.result-item {
    background: #16213e;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.result-item .song-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: #e94560;
    margin-bottom: 0.5rem;
}

.result-item .song-title a {
    color: inherit;
    text-decoration: none;
}

.result-item .song-title a:hover {
    text-decoration: underline;
}

.result-item .sndh-path {
    color: #aaa;
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

.result-item .sndh-path a {
    color: inherit;
    text-decoration: none;
}

.result-item .sndh-path a:hover {
    text-decoration: underline;
}

.result-item .match-stats {
    color: #888;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.error {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(233, 69, 96, 0.2);
    border-radius: 8px;
    color: #e94560;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-top: 1rem;
    background: rgba(233, 69, 96, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(233, 69, 96, 0.3);
}

.recording-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e94560;
    flex-shrink: 0;
    animation: pulse 1s ease-in-out infinite;
}

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

.recording-indicator p {
    color: #eee;
    font-size: 1rem;
    flex: 1;
}

.stop-btn {
    background: #e94560;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stop-btn:hover {
    background: #c73652;
}

/* Live Match Styles */
.results h3 {
    color: #e94560;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.results .result-item.latest {
    background: rgba(233, 69, 96, 0.15);
    border: 1px solid rgba(233, 69, 96, 0.4);
    border-radius: 8px;
    padding: 1rem;
    animation: matchFlash 0.5s ease-out;
}

@keyframes matchFlash {
    0% { background: rgba(233, 69, 96, 0.4); }
    100% { background: rgba(233, 69, 96, 0.15); }
}

.results .result-item.latest .song-title {
    font-weight: bold;
    font-size: 1.2rem;
    color: #e94560;
}

.results .result-item.latest .sndh-path {
    color: #aaa;
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

.results .result-item.latest .match-stats {
    color: #888;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

#results-history {
    max-height: 300px;
    overflow-y: auto;
}

#results-history-list .result-item {
    opacity: 0.7;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

#results-history-list .result-item .song-title {
    font-size: 1rem;
}

/* Scrollbar styling for history */
#results-history-list::-webkit-scrollbar {
    width: 6px;
}

#results-history-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

#results-history-list::-webkit-scrollbar-thumb {
    background: rgba(233, 69, 96, 0.3);
    border-radius: 3px;
}

.matching-indicator {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.matching-indicator .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 193, 7, 0.3);
    border-top-color: #ffc107;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0;
}

.matching-indicator span {
    color: #ffc107;
    font-size: 0.9rem;
}

.result-item.no-match {
    background: rgba(136, 136, 136, 0.1);
    border: 1px solid rgba(136, 136, 136, 0.2);
    opacity: 0.7;
}

.result-item.no-match .song-title {
    color: #888;
    font-weight: normal;
}

.result-item.no-match .match-stats {
    color: #666;
}



