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

:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --accent-color: #333333;
    --hover-color: #1a1a1a;
    --border-color: #222222;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0 30px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2em;
    font-weight: 300;
    letter-spacing: 2px;
}

.player {
    background: var(--accent-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 40px;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.player-info {
    flex: 1;
}

.menu-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.8em;
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
    transition: opacity 0.2s;
}

.menu-btn:hover {
    opacity: 0.7;
}

.episode-title {
    font-size: 1.1em;
    font-weight: 500;
    margin-bottom: 5px;
}

.episode-date {
    font-size: 0.9em;
    color: #999;
}

audio {
    width: 100%;
    margin: 15px 0;
    filter: invert(1) hue-rotate(180deg);
}

.download-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

.download-btn:hover {
    background: var(--hover-color);
}

.episodes h2 {
    font-size: 1.2em;
    font-weight: 400;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.episode-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.episode-item {
    background: var(--accent-color);
    padding: 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.episode-item:hover {
    background: var(--hover-color);
}

.episode-item.active {
    border-color: var(--text-color);
}

.episode-item-title {
    font-size: 1em;
    margin-bottom: 5px;
}

.episode-item-meta {
    font-size: 0.85em;
    color: #999;
    display: flex;
    justify-content: space-between;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    background: #330000;
    color: #ff6666;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #660000;
}

/* Casting UI */
.casting-status {
    background: #1a4d1a;
    border: 1px solid #2d7a2d;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cast-icon {
    font-size: 1.2em;
}

/* Three-dots options menu */
.options-menu {
    position: absolute;
    top: 50px;
    right: 20px;
    background: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 200px;
}

.options-menu-content {
    display: flex;
    flex-direction: column;
}

.menu-option {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 15px 20px;
    text-align: left;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.menu-option:last-child {
    border-bottom: none;
}

.menu-option:hover {
    background: var(--hover-color);
}

/* Cast modal */
.cast-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cast-modal-content {
    background: var(--accent-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.cast-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.cast-modal-header h3 {
    font-size: 1.4em;
    font-weight: 400;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.scan-btn {
    width: 100%;
    padding: 15px;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 15px;
}

.scan-btn:hover {
    background: var(--hover-color);
}

.scan-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.device-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.device-item:hover {
    background: var(--hover-color);
    border-color: var(--text-color);
}

.device-name {
    font-size: 1.1em;
    margin-bottom: 5px;
}

.device-type {
    font-size: 0.85em;
    color: #999;
}

.cast-controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.cast-info {
    margin-bottom: 15px;
    line-height: 1.6;
}

.cast-buttons {
    display: flex;
    gap: 10px;
}

.cast-control-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

.cast-control-btn:hover {
    background: var(--hover-color);
}

.cast-control-btn.stop {
    background: #4d1a1a;
    border-color: #7a2d2d;
}

.cast-control-btn.stop:hover {
    background: #661a1a;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 15px;
    }

    header {
        padding: 30px 0 20px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .cast-menu {
        padding: 10px;
    }

    .cast-menu-content {
        padding: 20px;
    }

    .cast-buttons {
        flex-direction: column;
    }
}
