/* ============================================
   AudioSynth Radio — Stylesheet
   Accessible, high contrast, dark theme
   ============================================ */

/* --- CSS Variables (matching AlexToolbox) --- */
:root {
    --bg:            #0D0D0D;
    --bg-card:       #1A1A2E;
    --bg-card-hover: #242444;
    --text:          #FFFFFF;
    --text-muted:    #B0B0B0;
    --accent:        #00E5FF;
    --accent-hover:  #00B8D4;
    --red:           #FF3D00;
    --green:         #76FF03;
    --yellow:        #FFD600;
    --font:          'Inter', system-ui, -apple-system, sans-serif;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 24px rgba(0,0,0,0.4);
    --focus:         0 0 0 3px var(--accent);
    --max-width:     900px;
    --transition:    0.2s ease;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- Base --- */
html {
    font-size: 20px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* Prevent double-tap zoom delay on interactive elements (mobile) */
.tree-item,
.lang-btn,
.btn,
.breadcrumb a {
    touch-action: manipulation;
}

main {
    flex: 1;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* --- Focus (accessibility) --- */
*:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-radius: var(--radius-sm);
}

/* --- Hidden attribute support (prevents CSS display from overriding) --- */
[hidden] {
    display: none !important;
}

/* --- Screen reader only --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Skip links --- */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--bg);
    padding: 12px 24px;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 9999;
    transition: top var(--transition);
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
    color: var(--bg);
}

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Header --- */
.site-header {
    background: var(--bg);
    border-bottom: 2px solid var(--accent);
    padding: 16px 0;
    padding-top: max(16px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 50;
}

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

/* Back button: only visible in mobile visual submenu (styled in visual.css) */
.hdr-mob-back {
    display: none;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 900;
    font-size: 1.3rem;
    text-decoration: none;
}

.site-logo:hover {
    color: var(--accent);
    text-decoration: none;
}

.logo-icon {
    font-size: 1.6rem;
    color: var(--accent);
}

/* --- Now Playing (header) --- */
.now-playing {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.now-playing[data-active="true"] {
    opacity: 1;
}

.now-playing-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.now-playing-label {
    color: var(--text-muted);
    font-size: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
}

.now-playing-text {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
    line-height: 1.2;
}

.now-playing-pause,
.now-playing-btn {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.55rem;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.now-playing-pause:hover,
.now-playing-btn:hover {
    background: var(--accent);
    color: var(--bg);
}

.now-playing-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.now-playing-bars .bar {
    display: block;
    width: 3px;
    background: var(--accent);
    border-radius: 1px;
    animation: nowPlayingBar 1.2s ease-in-out infinite;
}

.now-playing-bars .bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.now-playing-bars .bar:nth-child(2) { height: 70%; animation-delay: 0.2s; }
.now-playing-bars .bar:nth-child(3) { height: 50%; animation-delay: 0.4s; }
.now-playing-bars .bar:nth-child(4) { height: 80%; animation-delay: 0.6s; }

.now-playing[data-paused="true"] .now-playing-bars .bar {
    animation-play-state: paused;
    height: 20%;
}

@keyframes nowPlayingBar {
    0%, 100% { height: 20%; }
    50% { height: 100%; }
}

.lang-switcher {
    display: flex;
    gap: 4px;
}

.lang-btn {
    background: transparent;
    border: 2px solid var(--bg-card-hover);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 700;
    transition: all var(--transition);
}

.lang-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.lang-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* --- Breadcrumb --- */
.breadcrumb-nav {
    padding: 12px 0 0;
}

.breadcrumb {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 4px;
}

.breadcrumb li::after {
    content: "/";
    color: var(--text-muted);
    margin: 0 2px;
}

.breadcrumb li:last-child::after {
    content: "";
}

.breadcrumb a {
    color: var(--accent);
    font-size: 0.8rem;
}

.breadcrumb [aria-current="page"] {
    color: var(--text);
    font-weight: 700;
}

/* --- Tree Header --- */
.greeting-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 16px 0 0;
    padding: 0;
}

.greeting-text:empty {
    display: none;
}

.tree-header {
    padding: 20px 0 12px;
}

.tree-title {
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1.2;
}

.tree-status {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* --- Tree Navigation --- */
.tree-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    margin: 0;
    outline: none;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    font-size: 1.05rem;
    min-height: 56px;
    color: var(--text);
    position: relative;
    scroll-margin-top: 90px;
}

.tree-item:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.tree-item[data-focused="true"] {
    box-shadow: 0 0 0 3px var(--yellow);
    border-color: var(--yellow);
    background: var(--bg-card-hover);
}

.tree-item-label {
    flex: 1;
    min-width: 0;
}

.tree-item-name {
    display: block;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-item-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Guide text items */
.tree-item-guide {
    background: transparent;
    border-color: transparent;
    cursor: default;
}
.tree-item-guide:hover {
    background: transparent;
    border-color: transparent;
}
.tree-item-guide[data-focused="true"] {
    background: rgba(255, 255, 255, 0.03);
}
.tree-item-guide-heading {
    display: block;
    font-size: 1rem;
    color: #fff;
    margin-bottom: 6px;
}
.tree-item-guide-body {
    display: block;
    white-space: normal;
    line-height: 1.8;
    font-size: 0.9rem;
    color: #D0D0D0;
}

.guide-key {
    display: inline;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.88em;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* News article items */
.tree-item-news {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
}

.tree-item-news-title {
    display: block;
    font-weight: 700;
    line-height: 1.3;
    white-space: normal;
}

.tree-item-news-body {
    display: block;
    font-size: 0.85rem;
    color: #D0D0D0;
    margin-top: 4px;
    line-height: 1.4;
    white-space: normal;
}

.tree-item-news-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Expandable items arrow */
.tree-item-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Station count badge */
.tree-item-count {
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Favorite star */
.tree-item-fav {
    color: var(--yellow);
    font-size: 1rem;
    flex-shrink: 0;
}

.tree-item-fav-btn {
    background: none;
    border: none;
    color: var(--yellow);
    font-size: 1.2rem;
    padding: 8px;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-item-share-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    padding: 8px;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 40px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
}
.tree-item-share-btn.share-copied {
    color: #00E5CC;
    transform: scale(1.2);
    animation: share-pulse 0.4s ease-out;
}
@keyframes share-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1.2); }
}

.tree-item-options-btn {
    background: none;
    border: none;
    color: var(--text-dim, rgba(255,255,255,0.4));
    font-size: 1.2rem;
    padding: 8px;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.tree-item-options-btn:active { color: var(--green); }

/* Playing indicator */
.tree-item[data-playing="true"] {
    border-left: 4px solid var(--green);
}

.tree-item-playing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 1.5s infinite;
}

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

/* Back item */
.tree-item-back {
    background: transparent;
    border: 2px dashed var(--bg-card-hover);
    color: var(--accent);
    font-weight: 700;
    gap: 8px;
}

.tree-item-back:hover {
    border-color: var(--accent);
    background: var(--bg-card);
}

.tree-item-back[data-focused="true"] {
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow);
    background: var(--bg-card);
}

.tree-item-back-arrow {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.tree-item-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1;
}
.tree-item-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: middle;
}

/* Pagination items */
.tree-item-pagination {
    background: transparent;
    border: 2px dashed var(--accent);
    color: var(--accent);
    font-weight: 700;
    gap: 8px;
    justify-content: center;
}

.tree-item-pagination:hover {
    background: var(--bg-card);
    border-color: var(--accent);
}

.tree-item-pagination[data-focused="true"] {
    background: var(--bg-card);
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow);
}

.tree-item-pagination-arrow {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Player action items */
.tree-item-player-action {
    background: var(--bg-card);
    font-weight: 600;
    gap: 8px;
}

.tree-item-player-action:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.tree-item-player-action[data-focused="true"] {
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow);
    background: var(--bg-card-hover);
}

/* Empty state */
.tree-item-empty {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
    text-align: center;
    padding: 32px 20px;
}

.tree-item-empty:hover {
    border-color: transparent;
    background: var(--bg-card);
}

/* Featured item (AudioSynth Radio) */
.tree-item-featured {
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a2a3e 100%);
}

.tree-item-featured:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, #243a4e 100%);
}

.tree-item-featured[data-focused="true"] {
    box-shadow: 0 0 0 3px var(--yellow);
    border-color: var(--yellow);
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, #243a4e 100%);
}

.tree-item-featured .tree-item-name {
    color: var(--accent);
    font-weight: 900;
    font-size: 1.15rem;
}

/* --- Search Panel --- */
.search-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0 8px;
}

.search-input-artist[hidden] {
    display: none;
}

.search-input-artist {
    width: 100%;
    flex: none;
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: var(--focus);
    outline: none;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 48px;
    min-width: 48px;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* --- Loading --- */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-card-hover);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Error --- */
.error-message {
    background: rgba(255, 61, 0, 0.1);
    border-left: 4px solid var(--red);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    margin: 12px 0;
}

/* --- Shortcuts Dialog --- */
.shortcuts-dialog {
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 520px;
    width: 90vw;
}

.shortcuts-dialog::backdrop {
    background: rgba(0, 0, 0, 0.8);
}

.shortcuts-dialog h2 {
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--accent);
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
}

.shortcuts-table td {
    padding: 8px 4px;
    vertical-align: middle;
}

.shortcuts-table td:first-child {
    white-space: nowrap;
    padding-right: 20px;
    width: 1%;
}

.shortcuts-table tr + tr td {
    border-top: 1px solid var(--bg-card-hover);
}

kbd {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--bg-card-hover);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 28px;
    text-align: center;
}

.shortcuts-close {
    margin-top: 24px;
    width: 100%;
}

/* --- Settings Dialog --- */
.settings-dialog {
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
    width: 90vw;
}

.settings-dialog::backdrop {
    background: rgba(0, 0, 0, 0.8);
}

.settings-dialog h2 {
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 24px;
    color: var(--accent);
}

.settings-group {
    margin-bottom: 24px;
}

.settings-group label {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.settings-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.settings-select,
.settings-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 2px solid var(--bg-card-hover);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color var(--transition);
}

.settings-select:focus,
.settings-input:focus {
    border-color: var(--accent);
    box-shadow: var(--focus);
    outline: none;
}

.settings-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-checkbox-row label {
    margin-bottom: 0;
}

.settings-checkbox {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.settings-buttons {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.settings-buttons .btn {
    flex: 1;
}

.settings-buttons .btn:not(.btn-primary) {
    background: transparent;
    border-color: var(--bg-card-hover);
    color: var(--text-muted);
}

.settings-buttons .btn:not(.btn-primary):hover {
    border-color: var(--accent);
    color: var(--text);
}

/* --- Install PWA Dialog --- */
.install-dialog {
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 400px;
    width: 90vw;
}

.install-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.install-dialog h2 {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent);
    margin: 0 0 16px;
}

.install-dialog p {
    margin: 0 0 24px;
    line-height: 1.5;
}

.install-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* --- Auth Dialog --- */
.auth-dialog {
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 420px;
    width: 90vw;
    position: relative;
}
.auth-dialog::backdrop {
    background: rgba(0, 0, 0, 0.8);
}
.auth-dialog h2 {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent);
    margin: 0 0 20px;
}
.auth-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 2px solid #333;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    margin-bottom: 12px;
    box-sizing: border-box;
}
.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.2);
}
.auth-code-input {
    font-family: monospace;
    font-size: 1.8rem;
    text-align: center;
    letter-spacing: 0.5em;
    padding: 14px;
}
.auth-msg {
    margin: 0 0 16px;
    line-height: 1.5;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.auth-error {
    background: var(--red);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.auth-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.auth-buttons .btn {
    flex: 1;
}
.auth-dialog label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.auth-user-info {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 4px;
}
.auth-user-email {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 4px;
}
.auth-user-membership {
    color: var(--accent);
    font-size: 0.85rem;
    margin: 0 0 20px;
}
.auth-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.95);
    border-radius: var(--radius);
}
.auth-spinner {
    width: 32px; height: 32px;
    border: 3px solid #333;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* --- Footer --- */
.site-footer {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--bg-card-hover);
    margin-top: 40px;
}

.visitor-counter {
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.visitor-counter #visitor-today,
.visitor-counter #visitor-total {
    color: var(--accent);
    font-weight: 700;
}

.donate-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.donate-screen[hidden] {
    display: none;
}

.donate-screen-header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--bg-card-hover);
}

.donate-screen-header h2 {
    flex: 1;
    text-align: center;
    margin: 0;
}

.donate-screen-header h2 {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--accent);
    margin: 0;
}

.donate-screen-desc {
    padding: 12px 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    text-align: center;
}

.donate-iframe-wrap {
    flex: 1;
    position: relative;
    margin: 12px 24px 0;
    min-height: 0;
}

.donate-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.donate-iframe-proxy {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    outline-offset: -3px;
}

.donate-iframe-proxy[hidden] {
    display: none;
}

.donate-footer {
    margin: 12px 0;
}

.donate-link {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 6px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.donate-link:hover,
.donate-link:focus {
    opacity: 0.85;
}

.share-link {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 6px;
    text-decoration: none;
    transition: opacity 0.2s;
    margin-left: 8px;
}

.share-link:hover,
.share-link:focus {
    opacity: 0.85;
}

.donate-sublabel {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Share popup */
.share-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
}
.share-popup[hidden] { display: none; }
.share-popup-content {
    background: var(--bg, #1a1a2e);
    color: var(--text, #e0e0e0);
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    text-align: center;
}
.share-popup-title {
    margin: 0 0 16px;
    font-size: 1.1rem;
}
.share-popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.share-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.2s;
}
.share-btn:hover { opacity: 0.85; }
.share-btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 900;
    border-radius: 6px;
    flex-shrink: 0;
}
.share-btn-x { background: #1a1a2e; border: 1px solid #333; }
.share-btn-x .share-btn-icon { background: #000; color: #fff; }
.share-btn-fb { background: #1877F2; }
.share-btn-fb .share-btn-icon { background: rgba(255,255,255,0.2); }
.share-btn-wa { background: #25D366; color: #fff; }
.share-btn-wa .share-btn-icon { background: rgba(255,255,255,0.2); }
.share-btn-copy { background: #555; color: #fff; }
.share-btn-copy .share-btn-icon { background: rgba(255,255,255,0.15); }
.share-popup-close {
    margin-top: 16px;
    padding: 8px 24px;
    background: transparent;
    border: 1px solid #555;
    color: var(--text, #e0e0e0);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* --- Audio Mode --- */

.mode-audio .greeting-text {
    margin-top: max(16px, env(safe-area-inset-top));
    font-size: 1rem;
}

.mode-audio .greeting-text::before {
    content: 'audionido.com';
    display: block;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 8px;
}

/* --- Onboarding Screen --- */

.onboarding-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: var(--bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.onboarding-screen[hidden] {
    display: none;
}

.onboarding-content {
    max-width: 420px;
    width: 88%;
    text-align: center;
}

.onboarding-brand {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--accent);
    margin-bottom: 40px;
}

.onboarding-question {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 28px;
}

.onboarding-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.onboarding-options {
    display: flex;
    gap: 14px;
    justify-content: center;
}

.onboarding-options-vertical {
    flex-direction: column;
    align-items: stretch;
}

.onboarding-option {
    background: var(--bg-card);
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 20px 24px;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    text-align: left;
}

.onboarding-option:hover {
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.onboarding-option:focus,
.onboarding-option[aria-checked="true"] {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    outline: none;
}

.onboarding-option-desc {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 6px;
    line-height: 1.4;
}

.onboarding-input {
    width: 100%;
    max-width: 320px;
    padding: 12px 16px;
    font-size: 1.1rem;
    border: 2px solid var(--bg-card-hover);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    text-align: center;
}

.onboarding-input:focus {
    border-color: var(--accent);
    outline: none;
}

.onboarding-remember {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.onboarding-remember:hover {
    opacity: 1;
}

.onboarding-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.onboarding-results {
    list-style: none;
    padding: 0;
    margin: 16px auto 0;
    max-width: 320px;
    max-height: 200px;
    overflow-y: auto;
}

.onboarding-results li {
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
}

.onboarding-results li:focus,
.onboarding-results li[aria-selected="true"] {
    background: var(--bg-card-hover);
    color: var(--accent);
    outline: none;
}

.onboarding-next {
    margin-top: 20px;
    padding: 10px 32px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.onboarding-step {
    animation: ob-fade-in 0.3s ease;
}

.onboarding-step[hidden] {
    display: none;
}

@keyframes ob-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* --- Responsive --- */

@media (max-width: 768px) {
    html {
        font-size: 18px;
    }

    .container {
        padding: 0 16px;
    }

    .tree-title {
        font-size: 1.4rem;
    }

    .lang-btn {
        padding: 10px 18px;
        min-height: 44px;
        min-width: 44px;
        font-size: 0.85rem;
    }

    .search-panel {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 16px;
    }

    .now-playing-label {
        display: none;
    }

    .now-playing-text {
        max-width: 100px;
        font-size: 0.65rem;
    }

    .tree-item {
        padding: 12px 16px;
    }

    .site-logo {
        font-size: 1.1rem;
    }

    .lang-btn {
        padding: 10px 14px;
        min-height: 44px;
        font-size: 0.75rem;
    }

    .shortcuts-dialog,
    .settings-dialog,
    .install-dialog,
    .auth-dialog {
        padding: 20px;
        width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    .shortcuts-dialog h2,
    .settings-dialog h2,
    .install-dialog h2,
    .auth-dialog h2 {
        font-size: 1.2rem;
    }
}

/* --- Podcast Seek Controls --- */

/* YouTube player — hidden by default (audio-only playback) */
#yt-player-container {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
#yt-maximize-btn { display: none; }

/* --- Mobile audio mode: mini bar to switch back to visual --- */
.mob-audio-bar {
    display: none;
}
.mob-audio-bar[hidden] {
    display: none !important;
}
@media (max-width: 768px) {
    .mob-audio-bar:not([hidden]) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 14px;
        padding-top: max(8px, env(safe-area-inset-top));
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 50;
    }
    .mab-title {
        font-family: var(--font);
        font-weight: 900;
        font-size: 0.95rem;
        color: var(--accent);
    }
    .mab-actions {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .mab-lang {
        padding: 6px 10px !important;
        min-height: 32px !important;
        font-size: 0.7rem !important;
    }
    .mab-visual-btn {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--accent);
        background: rgba(0,229,204,0.1);
        color: var(--accent);
        font-family: var(--font);
        font-weight: 700;
        font-size: 0.7rem;
        cursor: pointer;
    }
    .mab-visual-btn:active {
        background: rgba(0,229,204,0.25);
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    html {
        scroll-behavior: auto;
    }
}
