*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #020617;
    --bg-elevated: #020617;
    --bg-panel: #020617;
    --bg-panel-soft: #020617;
    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.12);
    --accent-strong: #16a34a;
    --accent-muted: rgba(34, 197, 94, 0.25);
    --danger: #f97373;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --text: #f9fafb;
    --text-muted: #9ca3af;
    --border-subtle: rgba(148, 163, 184, 0.25);
    --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.65);
    --radius-lg: 24px;
    --radius-md: 14px;
    --radius-pill: 999px;
    --transition-fast: 150ms ease-out;
    --transition-normal: 220ms ease;
    /* Album-adaptive theme colors (overwritten from JS) */
    --album-color: #22c55e;
    --album-color-soft: rgba(34, 197, 94, 0.18);
    --album-color-strong: rgba(34, 197, 94, 0.4);
}

html,
body {
    margin: 0;
    padding: 0;
}

.app-body {
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    background:
        radial-gradient(circle at top, var(--album-color-soft), transparent 55%),
        radial-gradient(circle at bottom, rgba(15, 23, 42, 0.95), #020617);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.background-tint {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at top, var(--album-color-strong), transparent 55%),
        radial-gradient(circle at bottom, rgba(15, 23, 42, 0.96), #020617);
    opacity: 0;
    transition: opacity 800ms ease-out;
}

.background-tint--visible {
    opacity: 0.85;
}

.app-shell {
    width: 100%;
    max-width: 960px;
    background:
        radial-gradient(circle at top left, var(--album-color-soft), transparent 60%),
        rgba(15, 23, 42, 0.9);
    border-radius: 32px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(28px);
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    z-index: 1;
}

.player-layout {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    border-radius: 28px;
}

.player-background {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.player-background-image {
    width: 120%;
    height: 120%;
    object-fit: cover;
    transform: scale(1.04);
    filter: saturate(1.15);
    transform-origin: center;
    transition: filter 220ms ease-out, transform 220ms ease-out;
}

.player-background-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent 40%),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 60%);
}

.player-overlay {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 18px 18px;
    height: 100%;
}

.player-tap-area {
    flex: 1;
    display: flex;
    align-items: flex-end;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.brand-mark {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background:
        conic-gradient(from 180deg at 50% 50%, #22c55e, #22c55e 25%, #22c55e 50%, #22c55e 75%, #22c55e);
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.9),
        0 0 0 5px rgba(34, 197, 94, 0.2),
        0 16px 35px rgba(0, 0, 0, 0.6);
}

.brand-text {
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.header-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 11px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header-status--online {
    background: rgba(22, 163, 74, 0.18);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.6);
}

.header-status--offline {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.dot--online {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.33);
}

.dot--offline {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25);
}

.layout {
    display: grid;
    gap: 20px;
}

.layout--centered {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px 6px 2px;
}

.layout--split {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    padding: 4px 6px 2px;
    align-items: stretch;
}

.panel {
    border-radius: var(--radius-lg);
    padding: 22px 22px;
    border: 1px solid var(--border-subtle);
    background:
        radial-gradient(circle at top left, var(--album-color-soft), transparent 60%),
        rgba(15, 23, 42, 0.96);
    position: relative;
    overflow: hidden;
}

.panel--hero {
    text-align: center;
    padding-top: 34px;
    padding-bottom: 30px;
}

.panel--player {
    display: grid;
    grid-template-rows: auto auto;
    row-gap: 24px;
}

.panel--controls {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hero-title {
    font-size: clamp(1.8rem, 2.2vw, 2.25rem);
    font-weight: 650;
    letter-spacing: -0.03em;
    margin: 0 0 10px;
}

.hero-subtitle {
    margin: 0 auto 24px;
    max-width: 460px;
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 22px;
    border-radius: var(--radius-pill);
    border: 0;
    font-size: 0.95rem;
    font-weight: 550;
    cursor: pointer;
    transition:
        background-color var(--transition-fast),
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
    text-decoration: none;
}

.btn--primary {
    background: linear-gradient(135deg, #22c55e, #22c55e);
    color: #022c22;
    box-shadow:
        0 12px 35px rgba(22, 163, 74, 0.55),
        0 0 0 1px rgba(15, 23, 42, 0.8);
}

.btn--primary:hover {
    background: linear-gradient(135deg, #22c55e, #22c55e);
    transform: translateY(-1px);
    box-shadow:
        0 18px 40px rgba(22, 163, 74, 0.7),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

.btn--primary:active {
    transform: translateY(0);
    box-shadow:
        0 10px 28px rgba(22, 163, 74, 0.5),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

.spotify-icon-circle {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, #bbf7d0, #16a34a 45%, #166534 80%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.spotify-wave {
    width: 70%;
    height: 2px;
    border-radius: 999px;
    background: #022c22;
    box-shadow:
        0 -4px 0 0 #022c22,
        0 4px 0 0 #022c22;
    opacity: 0.9;
}

.helper-text {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.album-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.album-card {
    width: min(420px, 82vw);
    height: min(420px, 82vw);
    border-radius: 24px;
    perspective: 1400px;
    position: relative;
    cursor: pointer;
}

.album-face {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at top left, var(--album-color-soft), transparent 65%),
        rgba(15, 23, 42, 0.95);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition:
        transform 520ms cubic-bezier(0.19, 1, 0.22, 1),
        box-shadow 220ms ease,
        border-color 220ms ease;
    border: 1px solid rgba(148, 163, 184, 0.55);
    box-shadow:
        0 18px 46px rgba(0, 0, 0, 0.75),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    overflow: hidden;
}

.album-face--front {
    transform: rotateY(0deg);
}

.album-face--back {
    transform: rotateY(180deg);
    background:
        radial-gradient(circle at top left, var(--album-color-strong), transparent 65%),
        #020617;
}

.album-card--flipped .album-face--front {
    transform: rotateY(180deg);
}

.album-card--flipped .album-face--back {
    transform: rotateY(360deg);
}

.album-image-frame {
    position: absolute;
    inset: 16px 18px 40px;
    border-radius: 18px;
    overflow: hidden;
    background: radial-gradient(circle at top left, #0f172a, #020617);
}

.album-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.02);
    transition: transform 220ms ease-out, filter 220ms ease-out;
}

.album-card:hover .album-image {
    transform: scale(1.05);
    filter: saturate(1.08);
}

.album-hint {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    text-align: center;
    color: #e5e7eb;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.6);
    backdrop-filter: blur(10px);
}

.album-back-inner {
    position: absolute;
    inset: 16px;
    border-radius: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    background:
        radial-gradient(circle at top, var(--album-color-soft), transparent 60%),
        radial-gradient(circle at bottom, rgba(15, 23, 42, 0.9), transparent 60%);
}

.album-year {
    font-size: 3.1rem;
    font-weight: 750;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.album-date-label {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #d1d5db;
}

.track-meta {
    margin-top: 4px;
    margin-bottom: 12px;
    max-width: 480px;
    transition: opacity 200ms ease, transform 200ms ease;
}

.track-meta-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.track-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.6);
}

.track-chip-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 1));
    color: #a5b4fc;
}

.track-chip-svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.track-chip-text {
    font-size: 0.86rem;
    color: var(--text-muted);
}

.player-layout--details-hidden .track-meta {
    opacity: 0;
    transform: translateX(-24px);
    pointer-events: none;
}

.player-layout--details-hidden .player-background-image {
    filter: blur(16px) saturate(1.1);
    transform: scale(1.05);
}

.player-layout--details-hidden .controls-section {
    opacity: 0;
    transform: translateY(24px);
    pointer-events: none;
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 12px 6px;
    border-radius: 20px;
    transition: opacity 200ms ease, transform 200ms ease;
}

.controls-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.controls-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 11px;
    border-radius: 999px;
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.6);
}

.control-button {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition:
        background-color var(--transition-fast),
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
}

.control-button--primary {
    background: radial-gradient(circle at 30% 20%, #bbf7d0, #16a34a 45%, #16a34a 80%);
    color: #022c22;
    box-shadow:
        0 14px 32px rgba(16, 185, 129, 0.7),
        0 0 0 1px rgba(15, 23, 42, 0.95);
}

.control-button--primary:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow:
        0 18px 40px rgba(16, 185, 129, 0.8),
        0 0 0 1px rgba(15, 23, 42, 0.95);
}

.control-button--primary:active {
    transform: translateY(0) scale(0.99);
    box-shadow:
        0 10px 26px rgba(16, 185, 129, 0.6),
        0 0 0 1px rgba(15, 23, 42, 0.95);
}

.control-button--secondary {
    background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.5), rgba(15, 23, 42, 0.9));
    color: #e5e7eb;
    box-shadow:
        0 10px 26px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(30, 64, 175, 0.8);
    font-size: 1.4rem;
}

.control-button--secondary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 14px 34px rgba(15, 23, 42, 0.95),
        0 0 0 1px rgba(37, 99, 235, 0.9);
}

.control-button--secondary:active {
    transform: translateY(0);
    box-shadow:
        0 9px 20px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(30, 64, 175, 0.9);
}

.controls-helper {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
}

.status-bar {
    margin-top: 2px;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.98));
    text-align: center;
}

.status-bar--hidden {
    display: none;
}

.status-bar[data-tone="success"] {
    background: linear-gradient(120deg, rgba(22, 163, 74, 0.18), rgba(15, 23, 42, 0.9));
    border-color: rgba(34, 197, 94, 0.7);
    color: #bbf7d0;
}

.status-bar[data-tone="error"] {
    background: linear-gradient(120deg, rgba(248, 113, 113, 0.18), rgba(15, 23, 42, 0.96));
    border-color: rgba(248, 113, 113, 0.7);
    color: #fecaca;
}

.status-bar[data-tone="info"] {
    background: linear-gradient(120deg, rgba(37, 99, 235, 0.16), rgba(15, 23, 42, 0.96));
    border-color: rgba(59, 130, 246, 0.65);
    color: #bfdbfe;
}

@media (max-width: 900px) {
    .app-body {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .app-shell {
        max-width: none;
        border-radius: 0;
        border: none;
        box-shadow: none;
        padding: 10px 10px 12px;
    }

    .player-layout {
        border-radius: 22px;
    }
}

@media (max-width: 600px) {
    .app-shell {
        padding: 8px 8px 10px;
        border-radius: 0;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .player-overlay {
        padding: 18px 14px 14px;
    }

    .controls-section {
        padding: 10px 10px 6px;
        border-radius: 18px;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .player-overlay {
        flex-direction: row;
        align-items: flex-end;
        gap: 16px;
    }

    .player-tap-area {
        flex: 1;
        align-items: center;
    }

    .track-meta {
        max-width: 360px;
    }

    .controls-section {
        width: 320px;
    }
}

