:root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #ff4757;
    --secondary-bg: #2d3436;
    --progress-bg: #555;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#app {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 20px;
    position: relative; /* For Danmaku positioning context */
}

/* Login Screen */
#login-screen {
    background-color: var(--secondary-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

input {
    width: 80%;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    border: none;
    background: #444;
    color: white;
    font-size: 16px;
    text-align: center;
}

button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    background-color: var(--accent-color);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

button:hover {
    background-color: #ff6b81;
}

.hidden {
    display: none !important;
}

#error-msg {
    color: #ff6b81;
    margin-top: 10px;
}

/* Player Screen */
#player-screen {
    animation: fadeIn 1s ease;
    position: relative;
}

/* Danmaku Container */
#danmaku-container {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    height: 150px;
    pointer-events: none; /* Let clicks pass through to player */
    overflow: hidden;
    z-index: 20;
}

.danmaku-item {
    position: absolute;
    white-space: nowrap;
    font-size: 16px;
    color: #fff;
    text-shadow: 1px 1px 2px black;
    opacity: 0.9;
    will-change: transform;
    animation: danmaku-move 8s linear forwards;
    top: 0;
    left: 100%; /* Start from right edge */
}

@keyframes danmaku-move {
    from { left: 100%; transform: translateX(0); }
    to { left: 0; transform: translateX(-100%); }
}

/* Danmaku Input Area */
.danmaku-input-area {
    display: flex;
    gap: 5px;
    margin-top: 15px;
}

.danmaku-input-area input {
    flex: 1;
    margin: 0;
    text-align: left;
    padding-left: 15px;
}

.danmaku-input-area button {
    margin: 0;
    padding: 10px 15px;
    font-size: 14px;
}

.radio-interface {
    background-color: var(--secondary-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    z-index: 5; /* Below Danmaku */
}

.status-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 12px;
    font-weight: bold;
    color: var(--accent-color);
    animation: pulse 2s infinite;
}

/* Buffering Indicator */
#buffering-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    font-weight: bold;
    font-size: 1.1rem;
    backdrop-filter: blur(2px);
}

.spinner {
    display: inline-block;
    animation: spin 1s infinite linear;
    margin-right: 10px;
}

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

#track-title {
    margin: 20px 0 5px 0;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.next-track-info {
    font-size: 0.8rem;
    color: #888;
    margin: 0 0 15px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress Bar */
.progress-container {
    margin: 10px 0 20px 0;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 5px;
    background-color: var(--progress-bg);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress, 0%);
    background-color: var(--accent-color);
    transition: width 0.1s linear;
}

#time-display {
    font-size: 0.8rem;
    color: #aaa;
}

.visualizer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 50px;
    margin: 20px 0;
    gap: 5px;
}

.bar {
    width: 8px;
    background-color: var(--accent-color);
    height: 10%;
    animation: bounce 1s infinite ease-in-out;
}

.controls {
    margin-top: 20px;
}

.sync-status {
    font-size: 0.8rem;
    color: #888;
    margin-top: 15px;
}

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

@keyframes bounce {
    0%, 100% { height: 10%; }
    50% { height: 100%; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
