:root {
    --bg-color: #0d0e11;
    --card-bg: #161920;
    --card-sub: #1e222d;
    --text-main: #FFFFFF;
    --text-sub: #8e99b0;
    --accent: #1DB954;
    --warning: #f43f5e;
    --spotify-blue: #3b82f6;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 15px;
    /* Removed the 40px top padding since there's no drag bar */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Better for mobile scrolling */
    min-height: 100vh;
}

.wrapper {
    width: 100%;
    height: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    margin-bottom: 15px;
}

.primary-card {
    border-top: 3px solid var(--accent);
}

.secondary-card {
    border-top: 3px solid #232835;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logo {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-sub);
}

.sync-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    background-color: rgba(29, 185, 84, 0.2);
    color: var(--accent);
    font-weight: bold;
    border: 1px solid var(--accent);
}

.album-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.album-art {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.song-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.song-title {
    font-size: 16px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
}

.song-artist {
    font-size: 13px;
    margin: 0;
    color: var(--text-sub);
}

.giant-key-box {
    position: relative;
    text-align: center;
    margin: 15px 0;
    padding: 15px;
    background-color: var(--card-sub);
    border-radius: 12px;
}

.key-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--text-sub);
    font-weight: bold;
    text-transform: uppercase;
    padding-right: 35px;
}

.key-text {
    font-size: 42px;
    font-weight: 900;
    margin: 0;
    color: var(--accent);
}

.key-text.missing {
    color: var(--warning);
}

.spotify-est-badge {
    color: var(--spotify-blue);
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.details-item {
    background-color: var(--card-sub);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.details-label {
    font-size: 10px;
    color: var(--text-sub);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.details-val {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
}

.controls-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    border-radius: 50%;
    padding: 12px;
    /* Bigger touch targets */
}

.ctrl-btn.play-pause {
    color: var(--text-main);
    transform: scale(1.2);
}

.search-box input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    /* 16px prevents iOS auto-zoom */
    border-radius: 8px;
    background: #222;
    color: #fff;
    border: 1px solid #444;
}

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

.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #333;
}

.modal-btn {
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    width: 100%;
    margin-top: 10px;
}

.modal-btn.confirm {
    background-color: var(--accent);
    color: white;
}

.footer-status {
    font-size: 11px;
    color: var(--text-sub);
    text-align: center;
    margin-top: 20px;
}

/* Progress & Up Next */
.progress-container {
    margin-top: 20px;
    width: 100%;
}

.next-song-title {
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 3px;
    font-weight: bold;
    text-align: center;
}

.next-song-artist {
    font-size: 11px;
    color: var(--text-sub);
    margin-bottom: 8px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--card-sub);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent);
    width: 0%;
    transition: width 1s linear;
}

.progress-times {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-sub);
    margin-top: 4px;
}

/* =========================================
   RESTORED: DESKTOP SYNC BUTTON COLORS
   ========================================= */
.sync-status-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    color: #ffffff;
    background-color: var(--spotify-blue);
    margin-left: auto;
}

.sync-status-red {
    background-color: var(--warning);
}

.sync-status-yellow {
    background-color: #eab308;
}

.sync-status-green {
    background-color: var(--accent);
}

/* =========================================
   RESTORED: EXPLORER LIST SELECTION LOGIC
   ========================================= */
.search-result-item .link-action-btn,
.search-result-item .edit-action-btn {
    display: none !important;
}

.search-result-item.selected {
    background-color: #2a2a2a !important;
    border-left: 4px solid var(--accent);
}

.search-result-item.selected .link-action-btn,
.search-result-item.selected .edit-action-btn {
    display: inline-block !important;
}

/* Edit Modal Form Formatting */
.modal-label {
    display: block;
    margin-bottom: 5px;
    margin-top: 10px;
    /* Space above each label */
    font-size: 11px;
    color: var(--text-sub);
    /* Consistent gray */
    text-transform: uppercase;
    font-weight: bold;
}

.modal-input {
    width: 100%;
    padding: 10px;
    background: #222;
    color: #fff;
    border: 1px solid #444;
    border-radius: 5px;
    font-size: 15px;
    box-sizing: border-box;
    /* Ensures padding doesn't break width */
}

/* Ensure the modal content doesn't get cramped */
.modal-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
}