:root {
    --bg-primary: #f9fbfd;
    --bg-card: white;
    --text-primary: #333;
    --text-secondary: #7f8c8d;
    --border-color: #ddd;
    --shadow: rgba(0,0,0,0.08);
    --header-bg: white;
    --status-bar-bg: #2c3e50;
    --btn-primary: #3498db;
    --btn-success: #2ecc71;
    --btn-danger: #e74c3c;
    --btn-warning: #e67e22;
    --btn-purple: #9b59b6;
}

[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-card: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --border-color: #444;
    --shadow: rgba(0,0,0,0.3);
    --header-bg: #1a1a1a;
    --status-bar-bg: #1a252f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    padding-top: 0;
}

#player-status-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--status-bar-bg);
    color: white;
    padding: 12px 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: none;
}

#player-status-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.status-text {
    flex: 1;
    min-width: 120px;
}

.status-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: bold;
    min-width: 75px;
    text-align: center;
}

#report-error-btn,
#favorite-status-btn {
    background: var(--btn-danger);
    color: white;
}

#copy-url-btn {
    background: var(--btn-primary);
    color: white;
}

#stop-btn {
    background: var(--btn-warning);
    color: white;
}

#top-search-bar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    background: var(--header-bg);
    padding: 15px 20px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.top-buttons-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.search-input-group {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 250px;
}

.search-input-group input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: 16px;
    outline: none;
    background: var(--bg-card);
    color: var(--text-primary);
}

.search-input-group button {
    background: var(--btn-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
}

.extra-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.history-btn,
.favorites-btn,
.recommend-btn,
.theme-toggle-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.history-btn,
.favorites-btn {
    background: var(--btn-purple);
    color: white;
}

.recommend-btn {
    background: var(--btn-success);
    color: white;
}

.theme-toggle-btn {
    background: #7f8c8d;
    color: white;
}

#usage-tip {
    margin-top: 12px;
    color: #2980b9;
    font-size: 14px;
    text-align: center;
    padding: 6px 0;
    background: #e8f4fc;
    border-radius: 6px;
}

[data-theme="dark"] #usage-tip {
    background: #2c3e50;
    color: #3498db;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px 30px;
    margin-top: calc(70px + 120px + 20px);
}

@media (max-width: 768px) {
    .container {
        margin-top: calc(70px + 140px + 20px);
    }
}

.station-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 3px 10px var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    position: relative;
}

.favorite-marker {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 20px;
    color: var(--btn-danger);
    z-index: 10;
    display: none;
}

.station-logo {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .station-logo {
    background: #333;
}

.station-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.station-text-only {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    color: #555;
    font-size: 14px;
    text-align: center;
    padding: 8px;
    line-height: 1.4;
    word-break: break-word;
}

[data-theme="dark"] .station-text-only {
    background: #2a2a2a;
    color: #ccc;
}

.station-info {
    flex: 1;
}

.station-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #2c3e50;
}

[data-theme="dark"] .station-name {
    color: #ecf0f1;
}

.links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.link-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
    text-align: center;
}

[data-theme="dark"] .link-item {
    background: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

.link-item:hover {
    border-color: var(--btn-primary);
    background: #ebf5fb;
}

[data-theme="dark"] .link-item:hover {
    background: #3a3a3a;
}

.link-item.active {
    border-color: var(--btn-success);
    background: #e8f5e9;
    font-weight: bold;
}

[data-theme="dark"] .link-item.active {
    background: #27ae6020;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--btn-primary);
    border-radius: 4px;
}

[data-theme="dark"] .pagination a,
[data-theme="dark"] .pagination span {
    border-color: #555;
}

.pagination .current {
    background: var(--btn-primary);
    color: white;
    border-color: var(--btn-primary);
}

.pagination .disabled {
    color: #ccc;
    pointer-events: none;
    border-color: #eee;
}

[data-theme="dark"] .pagination .disabled {
    color: #666;
    border-color: #444;
}

#toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--btn-success);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 2000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-size: 18px;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.footer-link {
    color: var(--btn-primary);
    text-decoration: underline;
}

.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    justify-content: flex-end;
}

.panel-content {
    width: 90%;
    max-width: 400px;
    height: 100%;
    background: var(--bg-card);
    padding: 20px;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h3 {
    margin: 0;
    color: #2c3e50;
}

[data-theme="dark"] .panel-header h3 {
    color: #ecf0f1;
}

.close-panel,
.clear-all {
    background: var(--btn-danger);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.history-item,
.favorite-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover,
.favorite-item:hover {
    background: #f9f9f9;
}

[data-theme="dark"] .history-item:hover,
[data-theme="dark"] .favorite-item:hover {
    background: #2a2a2a;
}

.history-item .time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.delete-btn {
    background: var(--btn-danger);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 8px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

@media (max-width: 768px) {
    .station-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .station-logo {
        width: 120px !important;
        height: 120px !important;
        margin-bottom: 16px;
    }

    .station-info {
        width: 100%;
    }

    .status-btn {
        min-width: 70px;
        padding: 5px 8px;
        font-size: 13px;
    }
}

#current-tags {
    margin-top: 6px;
    font-size: 13px;
    color: #95a5a6;
}

[data-theme="dark"] #current-tags {
    color: #7f8c8d;
}

.tag {
    display: inline-block;
    background: #ecf0f1;
    color: #2c3e50;
    padding: 2px 8px;
    border-radius: 12px;
    margin-right: 6px;
    font-size: 12px;
}

[data-theme="dark"] .tag {
    background: #34495e;
    color: #ecf0f1;
}

.recommend-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
}

.recommend-dialog {
    background: var(--bg-card);
    max-width: 500px;
    margin: 80px auto;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.recommend-dialog h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.recommend-input {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.recommend-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.recommend-submit,
.recommend-cancel {
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

.recommend-submit {
    background: var(--btn-success);
    color: white;
}

.recommend-cancel {
    background: #ecf0f1;
    color: var(--text-primary);
}

#player {
    display: none;
}
