/* ═══════════ GLOBAL LOADER ═══════════ */
#mchu-global-loader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background-color: var(--primary);
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier Prime', 'Courier New', monospace;
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 1.2s;
}

#mchu-global-loader::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
}

#mchu-global-loader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-glass-box {
    position: relative;
    z-index: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3.5rem 5rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: glassBreathe 4s ease-in-out infinite alternate;
}

.loader-title {
    font-family: 'Times New Roman', Times, serif;
    font-size: 3.5rem;
    font-weight: 400;
    letter-spacing: 0.5rem;
    color: var(--text);
    margin: 0;
    opacity: 0.9;
}

.loader-subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.3rem;
    text-transform: uppercase;
    color: var(--text);
    opacity: 0.7;
    margin: 0 0 1rem 0;
}

.progress-wrapper {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.progress-fill-loader {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-light), var(--accent));
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    transition: width 0.4s ease-out;
}

.loading-text {
    font-size: 0.75rem;
    letter-spacing: 0.2rem;
    color: var(--text);
    opacity: 0.7;
    font-family: monospace;
    margin: 0;
    text-transform: uppercase;
}

@keyframes glassBreathe {
    0% {
        transform: scale(0.99);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: scale(1.01);
        box-shadow: 0 15px 50px rgba(255, 255, 255, 0.06);
    }
}



/* ═══════════════════════════════════════════════════════════
                        RESET & BASE
   ═══════════════════════════════════════════════════════════ */
   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
    background-color: #000;
    width: 100%;
    height: 100%;
}




:root {
    --primary: #7BB8CC;
    --primary-light: #9DD0E0;
    --primary-dark: #5A9DB5;
    --dark: rgba(0, 0, 0, 0.85);
    --glass: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.6);
    --accent: #88d4ab;
}

body {
    font-family: 'Courier Prime', 'Courier New', monospace;
    background-color: var(--primary);
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    overscroll-behavior-y: contain;
    overflow-y: auto;
-webkit-overflow-scrolling: touch;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
}

/* ═══════════════════════════════════════════════════════════
                        CANVAS
   ═══════════════════════════════════════════════════════════ */
#canvas-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
                     AUDIO CONTROL
   ═══════════════════════════════════════════════════════════ */



#audio-control:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#audio-control svg {
    width: 22px; height: 22px;
    fill: var(--text);
}

/* ═══════════════════════════════════════════════════════════
                       CONTAINERS
   ═══════════════════════════════════════════════════════════ */
.container {
    position: relative;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 50px 60px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 90%;
    display: none;
    animation: fadeIn 0.6s ease;
}

.container.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
                       TYPOGRAPHY
   ═══════════════════════════════════════════════════════════ */
   h1 {
    font-size: 2.2rem;
    font-weight: 400;
    letter-spacing: 5px;
    text-shadow: 0 2px 20px rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
    white-space: nowrap;
    margin-left: -5px;
}



h2 {
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 2px;
    margin-bottom: 25px;
}

/* ═══════════════════════════════════════════════════════════
                         BUTTONS
   ═══════════════════════════════════════════════════════════ */
.links {
    margin-top: 35px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    display: inline-block;
    padding: 14px 28px;
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background: var(--text);
    color: var(--dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}

.btn.primary {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn.primary:hover {
    background: var(--text);
    color: var(--dark);
}

.btn.admin {
    font-size: 0.75rem;
    opacity: 0.6;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn.admin:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.btn-close {
    position: absolute;
    top: 20px; right: 25px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--text);
}

/* ── Back to Saved button ── */
.btn-back-saved {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    letter-spacing: 1px;
    transition: color 0.2s;
    z-index: 10;
}
.btn-back-saved:hover {
    color: #fff;
}


/* ═══════════════════════════════════════════════════════════
                       WIZARD STYLES
   ═══════════════════════════════════════════════════════════ */
.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.step-indicator {
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.wizard-step h2 {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.opt-btn {
    padding: 12px 8px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.opt-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.opt-btn.selected {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(136, 212, 171, 0.2);
}

.count-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.count-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.count-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#count-display {
    font-size: 2rem;
    min-width: 50px;
    letter-spacing: 2px;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 10px;
}

.wizard-nav .btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.8rem;
}

.language-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 8px;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
                      LOADING SCREEN
   ═══════════════════════════════════════════════════════════ */
#loading-screen {
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 25px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-light), var(--accent));
    border-radius: 2px;
    transition: width 0.3s ease;
}

#loading-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════
                      RESULT SCREEN
   ═══════════════════════════════════════════════════════════ */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.playlist-container {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
    padding-right: 5px;
}

.playlist-container::-webkit-scrollbar {
    width: 4px;
}

.playlist-container::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

#playlist-list {
    list-style: none;
    counter-reset: playlist;
}

#playlist-list li {
    counter-increment: playlist;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    text-align: left;
}

#playlist-list li::before {
    content: counter(playlist, decimal-leading-zero);
    font-size: 0.75rem;
    color: var(--text-dim);
    min-width: 24px;
}

#playlist-list li:hover {
    background: rgba(255, 255, 255, 0.08);
}

#playlist-list li.playing {
    background: rgba(136, 212, 171, 0.15);
    border-color: rgba(136, 212, 171, 0.3);
}

#playlist-list li .song-info {
    flex: 1;
}

#playlist-list li .song-title {
    font-size: 0.85rem;
    letter-spacing: 1px;
}

#playlist-list li .song-artist {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
                       MINI PLAYER
   ═══════════════════════════════════════════════════════════ */
.mini-player {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 15px;
    margin-top: 15px;
}

.now-playing-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

#now-playing-title {
    font-size: 0.9rem;
    letter-spacing: 1px;
    margin-bottom: 12px;
    min-height: 1.2em;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.player-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.player-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.player-btn.play-btn {
    font-size: 1.8rem;
    opacity: 1;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.seek-bar {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--text);
    cursor: pointer;
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.result-actions .btn {
    flex: 1;
    padding: 10px 15px;
    font-size: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════
                     SAVED PLAYLISTS
   ═══════════════════════════════════════════════════════════ */
#saved-screen .playlist-container {
    max-height: 350px;
}

.saved-item {
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saved-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.saved-item-info {
    text-align: left;
}

.saved-item-name {
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.saved-item-meta {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 3px;
}

.saved-item-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    transition: color 0.2s;
}

.saved-item-delete:hover {
    color: #ff6b6b;
}

/* ═══════════════════════════════════════════════════════════
                        CHAT BOT
   ═══════════════════════════════════════════════════════════ */
.chat-toggle {
    position: fixed;
    bottom: 30px; left: 30px;
    z-index: 1000;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 50px; height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    color: var(--text);
    font-size: 1.3rem;
}

.chat-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.chat-panel {
    position: fixed;
    bottom: 90px; left: 30px;
    z-index: 999;
    width: 320px;
    max-height: 450px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
}

.chat-panel.open {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.chat-header {
    padding: 15px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-name {
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.chat-header-status {
    font-size: 0.65rem;
    color: var(--accent);
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-messages::-webkit-scrollbar {
    width: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.chat-msg {
    max-width: 85%;
    width: fit-content;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.8rem;
    line-height: 1.4;
    letter-spacing: 0.5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}


.chat-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    margin-right: auto;
}


.chat-msg.user {
    align-self: flex-end;
    background: rgba(123, 184, 204, 0.3);
    margin-left: auto;
}


.chat-input-area {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-input-area button {
    background: rgba(123, 184, 204, 0.3);
    border: none;
    border-radius: 50%;
    width: 38px; height: 38px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.chat-input-area button:hover {
    background: rgba(123, 184, 204, 0.5);
}

/* ── Typing Indicator ── */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 14px;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text, #ccc);
    margin: 0 2px;
    opacity: 0.3;
    animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
                     PUBLIC CHAT ROOM
   ═══════════════════════════════════════════════════════════ */
.public-chat-toggle {
    position: fixed;
    bottom: 30px; left: 90px;
    z-index: 1000;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 50px; height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    color: var(--text);
    font-size: 1.3rem;
}

.public-chat-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.public-chat-panel {
    position: fixed;
    bottom: 90px; left: 90px;
    z-index: 999;
    width: 340px;
    max-height: 480px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
}

.public-chat-panel.open {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.public-chat-header {
    padding: 15px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.public-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.public-chat-header-name {
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.public-chat-online {
    font-size: 0.65rem;
    color: var(--accent);
}

.public-chat-users-count {
    font-size: 0.7rem;
    color: var(--text-dim);
    background: rgba(255,255,255,0.08);
    padding: 4px 10px;
    border-radius: 12px;
}

.public-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.public-chat-messages::-webkit-scrollbar {
    width: 3px;
}

.public-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.public-msg {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 85%;
    width: fit-content;
    word-wrap: break-word;
    overflow-wrap: break-word;
}


.public-msg.self {
    background: rgba(123, 184, 204, 0.2);
    border-bottom-left-radius: 12px;
    align-self: flex-end;
    margin-left: auto;
    width: fit-content;
}


.public-msg-author {
    font-size: 0.58rem;
    color: var(--primary-light);
    margin-bottom: 3px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.public-msg-text {
    color: var(--text);
    word-break: break-word;
    font-size: 0.78rem;
}

.public-msg-time {
    font-size: 0.46rem;
    color: var(--text-dim);
    margin-top: 3px;
    text-align: right;
}

.public-chat-input-area {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 8px;
}

.public-chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s;
}

.public-chat-input-area input:focus {
    border-color: rgba(255, 255, 255, 0.3);
}

.public-chat-input-area button {
    background: rgba(123, 184, 204, 0.3);
    border: none;
    border-radius: 50%;
    width: 38px; height: 38px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.public-chat-input-area button:hover {
    background: rgba(123, 184, 204, 0.5);
}


.logout-btn {
    background-color: #e74c3c;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    width: 100%;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: #c0392b;
}


/* ═══════════════════════════════════════════════════════════
                     PROFILE MODAL
   ═══════════════════════════════════════════════════════════ */
.profile-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.profile-modal-overlay.open {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.profile-modal {
    background: rgba(20, 30, 40, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 35px 40px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.profile-modal h2 {
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.profile-modal p {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 25px;
}

.profile-modal input {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 18px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    text-align: center;
    letter-spacing: 1px;
    transition: border-color 0.2s;
    margin-bottom: 20px;
}

.profile-modal input:focus {
    border-color: var(--primary-light);
}

.profile-modal .btn {
    width: 100%;
    padding: 12px;
}

/* ═══════════════════════════════════════════════════════════
                      LOADING SPINNER (song)
   ═══════════════════════════════════════════════════════════ */
.song-loading {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
                       RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .container {
        padding: 35px 25px;
        border-radius: 20px;
        width: 95%;
    }

    h1 {
        font-size: 1.6rem;
        letter-spacing: 5px;
        white-space: nowrap;
    }

    .chat-panel {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 80px;
    }

    .public-chat-panel {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 80px;
    }

    .chat-toggle {
        bottom: 20px; left: 15px;
        width: 44px; height: 44px;
    }

    #auth-bubble:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(1.1);
      }

      
    .public-chat-toggle {
        bottom: 20px; left: 70px;
        width: 44px; height: 44px;
    }

    #audio-control {
        bottom: 20px; right: 15px;
        width: 44px; height: 44px;
    }
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ========== Chat Bubbles (Private AI Chat) ========== */
.chat-msg {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 12px;
    font-size: 0.8rem;
    max-width: 85%;
    width: fit-content;
    word-wrap: break-word;
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: right;
}


.chat-msg.chat-user {
    background: var(--primary);
    margin-left: auto;
    align-self: flex-end;
    width: fit-content;
}


.chat-msg.chat-bot {
    background: rgba(255, 255, 255, 0.08);
    margin-right: auto;
    align-self: flex-start;
    width: fit-content;
}

#public-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ========== Chat Bubbles (Public Chat) ========== */
.public-msg {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 85%;
    width: fit-content;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    direction: rtl;
    unicode-bidi: plaintext;
    text-align: right;
}


.public-msg-nick {
    color: var(--accent);
    font-weight: bold;
}

.public-msg-time {
    color: var(--text-dim);
    font-size: 0.65rem;
}

.public-msg-text {
    margin-top: 2px;
}

.public-msg-reply {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-bottom: 3px;
}

.reply-nick {
    font-size: 0.65rem;
    font-weight: 600;
}


/* ── MOBILE: compact glass box ── */
@media (max-width: 600px) {

    .glass-box {
        padding: 14px 12px;
        border-radius: 12px;
        max-width: 75vw;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    }

    h1 {
        font-size: 0.85rem;
        letter-spacing: 2px;
        margin-bottom: 3px;
        white-space: nowrap;
    }

    h2 {
        font-size: 0.65rem;
        margin-bottom: 8px;
    }

    .links {
        margin-top: 10px;
        gap: 6px;
    }

    .btn {
        padding: 7px 12px;
        font-size: 0.65rem;
        letter-spacing: 0.2px;
        border-radius: 25px;
    }
}

/* ── Reply Bar ── */
#public-reply-bar {
    display: none;
    background: var(--glass, rgba(30, 30, 50, 0.85));
    border-left: 3px solid var(--primary, #6c5ce7);
    border-top: 1px solid rgba(255,255,255,0.07);
    padding: 7px 12px;
    margin: 0;
    animation: replySlideUp 0.2s ease-out;
}
#public-reply-bar[style*="flex"] {
    display: flex;
}
.reply-bar-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    direction: ltr;
}
.reply-bar-icon {
    color: var(--primary, #6c5ce7);
    font-size: 13px;
    flex-shrink: 0;
}
.reply-bar-text {
    flex: 1;
    font-size: 0.78rem;
    color: var(--text, #ccc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: rtl;
}
.reply-bar-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.reply-bar-close:hover {
    color: #ff5c5c;
}
@keyframes replySlideUp {
    from { transform: translateY(6px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* ═══════════════ TOAST NOTIFICATION ═══════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 380px;
    padding: 14px 20px;
    border-radius: 12px;
    color: #fff;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(100, 255, 218, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px rgba(100, 255, 218, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    animation: toastSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.toast.toast-out {
    animation: toastSlideOut 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.toast-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.toast-msg {
    opacity: 0.8;
    font-size: 0.8rem;
}

.toast.toast-success {
    border-color: rgba(100, 255, 218, 0.3);
}

.toast.toast-error {
    border-color: rgba(255, 82, 82, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 82, 82, 0.08);
}

.toast.toast-warning {
    border-color: rgba(255, 200, 50, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 200, 50, 0.08);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 12px 12px;
    background: rgba(100, 255, 218, 0.5);
    animation: toastProgress 3s linear forwards;
}

.toast.toast-error .toast-progress {
    background: rgba(255, 82, 82, 0.5);
}

.toast.toast-warning .toast-progress {
    background: rgba(255, 200, 50, 0.5);
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ═══════════════ CUSTOM MODAL (جایگزین prompt) ═══════════════ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: modalFadeIn 0.3s ease forwards;
}

.modal-overlay.modal-out {
    animation: modalFadeOut 0.25s ease forwards;
}

.modal-box {
    background: rgba(30, 40, 50, 0.95);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 16px;
    padding: 28px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.modal-box h3 {
    color: #64ffda;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    margin-bottom: 16px;
}

.modal-box input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 10px;
    color: #fff;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.modal-box input:focus {
    border-color: rgba(100, 255, 218, 0.5);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.modal-buttons button {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(100, 255, 218, 0.2);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
}

.modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-btn-confirm {
    background: rgba(100, 255, 218, 0.15);
    color: #64ffda;
}

.modal-btn-confirm:hover {
    background: rgba(100, 255, 218, 0.25);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ==========================================
   Utility Classes (کلاس‌های کاربردی گمشده)
=========================================== */
.hidden {
    display: none !important;
}

/* ==========================================
   Alerts & Notices (اعلان‌ها و هشدارها)
=========================================== */
.notice-message {
    background-color: #e8f4fd;
    color: #0b5394;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #cfe2f3;
    margin-bottom: 16px;
    font-size: 0.9rem;
    text-align: center;
    transition: opacity 0.3s ease;
}

.warning-message {
    background-color: #fcf8e3;
    color: #8a6d3b;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #faebcc;
    margin-bottom: 16px;
    font-size: 0.9rem;
    text-align: center;
    transition: opacity 0.3s ease;
}

/* ==========================================
   Dynamic Badges (نشان‌های تزریقی JS)
=========================================== */
.badge-premium {
    background-color: #f1c40f;
    color: #2c3e50;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==========================================
   Responsive Fixes (اصلاحات تضادهای ریسپانسیو)
=========================================== */
@media (max-width: 600px) {
    .plans-wrapper {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .plan-card {
        width: 100%;
        box-sizing: border-box;
    }

    .form-container .input-group input {
        width: 100%;
        box-sizing: border-box;
    }
}

#screen-login {
    display: flex;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 10000;
    width: 90%;
    max-width: 400px;
    padding: 40px 32px;
    background: rgba(20, 30, 40, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    direction: rtl;
}

/* ═══════════════ LOGIN SCREEN – CENTERED MODAL ═══════════════ */
#screen-login.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}


#screen-login h2 {
    color: #fff;
    font-size: 1.4rem;
    margin: 0 0 8px;
    letter-spacing: 1.5px;
    text-align: center;
}

#screen-login input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
    box-sizing: border-box;
}

#screen-login input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#screen-login input:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
}

#screen-login .btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

#screen-login .btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

#screen-login .btn-secondary {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

#screen-login .btn-secondary:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

#screen-login .btn-close {
    position: absolute;
    top: 14px;
    left: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 1.7rem;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

#screen-login .btn-close:hover {
    color: #fff;
}

/* ── backdrop تیره پشت مودال لاگین ── */
.login-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
}

.login-backdrop.active {
    display: block;
}


/* ─────────────────────────────────────────────
   1. LOGIN MODAL — Tab bar & tab buttons
   (Missing entirely; login screen looks broken)
───────────────────────────────────────────── */
.login-tabs {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.25s ease;
}

.tab-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.07);
}

.tab-btn.active {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.14);
}

/* Logout tab button special state */
#logout-btn.tab-btn {
    flex: 0 0 auto;
    color: rgba(255, 82, 82, 0.8);
    border-color: rgba(255, 82, 82, 0.35);
}
#logout-btn.tab-btn:hover {
    color: #ff5252;
    border-color: #ff5252;
    background: rgba(255, 82, 82, 0.08);
}

/* Tab form content */
.tab-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─────────────────────────────────────────────
   2. SHAKE ANIMATION — used by wizard next btn
   (Referenced in app.js but never defined)
───────────────────────────────────────────── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}


/* ─────────────────────────────────────────────
   3. PLANS SCREEN — grid of plan cards
   (Screen exists in HTML but has zero CSS)
───────────────────────────────────────────── */
#screen-plans {
    max-width: 560px;
}

.plans-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
}

.plan-card {
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px 20px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.plan-card:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
}

.plan-card.featured {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(136, 212, 171, 0.15);
}

.plan-card.featured::before {
    content: "POPULAR";
    position: absolute;
    top: 12px;
    right: -22px;
    background: var(--accent);
    color: #000;
    font-size: 0.55rem;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 3px 28px;
    transform: rotate(45deg);
}

.plan-name {
    font-size: 1rem;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: var(--text);
}

.plan-price {
    font-size: 1.8rem;
    letter-spacing: 1px;
    margin: 12px 0 4px;
    color: var(--text);
}

.plan-price span {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.plan-features {
    list-style: none;
    margin: 16px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-features li {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.plan-features li::before {
    content: "✓  ";
    color: var(--accent);
}

.btn-plan-select {
    width: 100%;
    padding: 10px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-plan-select:hover {
    background: var(--text);
    color: #000;
}

.plan-card.featured .btn-plan-select {
    border-color: var(--accent);
    color: var(--accent);
}

.plan-card.featured .btn-plan-select:hover {
    background: var(--accent);
    color: #000;
}

@media (max-width: 600px) {
    .plans-grid {
        grid-template-columns: 1fr;
    }
}


/* ─────────────────────────────────────────────
   4. AI CHAT — chat-message alias fix
   (app.js writes "chat-message" but old CSS uses
    "chat-msg". Both classes now work.)
───────────────────────────────────────────── */
.chat-message.chat-user,
.chat-msg.chat-user {
    background: rgba(123, 184, 204, 0.28);
    align-self: flex-end;
    margin-left: auto;
}

.chat-message.chat-bot,
.chat-message.chat-ai,
.chat-msg.chat-bot {
    background: rgba(255, 255, 255, 0.09);
    align-self: flex-start;
    margin-right: auto;
}


/* ─────────────────────────────────────────────
   5. AUTH BUBBLE — hover effect was missing
   for desktop (only had mobile rule)
───────────────────────────────────────────── */
#auth-bubble:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    transform: scale(1.1);
}


/* ─────────────────────────────────────────────
   6. USAGE BADGE — shown in login modal after
   login to display remaining free uses
───────────────────────────────────────────── */
.usage-bar-wrap {
    width: 100%;
    margin-top: 4px;
}

.usage-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.usage-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary-light), var(--accent));
    transition: width 0.5s ease;
}


/* ─────────────────────────────────────────────
   7. LANGUAGE TOGGLE — circular glass button
   next to the profile bubble (same look)
───────────────────────────────────────────── */
#lang-toggle {
    position: fixed;
    top: 20px;
    left: 75px;
    z-index: 1000;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.35s ease, background 0.2s ease, opacity 0.22s ease;
}

/* The Persian label needs a slightly larger size to be as legible as "EN" */
html[lang="en"] #lang-toggle {
    font-size: 1rem;
}

#lang-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.1);
}

#lang-toggle:focus-visible,
#auth-bubble:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Smooth language switch: content fades out, text/direction swap, fades back in */
.container,
#chat-widget,
#public-widget {
    transition: opacity 0.22s ease;
}

html.i18n-switching .container.active,
html.i18n-switching #chat-widget,
html.i18n-switching #public-widget {
    opacity: 0 !important;
}

html.i18n-switching #lang-toggle {
    transform: rotate(180deg) scale(0.9);
}


/* ─────────────────────────────────────────────
   8. RTL (Persian) adjustments
───────────────────────────────────────────── */
/* Persian glyphs come from a proportional system font; Latin text keeps the
   original monospace look because this face only covers the Arabic script range */
@font-face {
    font-family: "MCHU Persian";
    src: local("Vazirmatn"), local("Tahoma"), local("Segoe UI"), local("Geeza Pro"),
         local("Noto Sans Arabic"), local("Noto Naskh Arabic"), local("Arial");
    unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF;
}

body {
    font-family: 'Courier Prime', "MCHU Persian", 'Courier New', monospace;
}

.toast,
.modal-box h3,
.modal-box input,
.modal-buttons button {
    font-family: 'IBM Plex Mono', "MCHU Persian", monospace;
}

/* Cursive Persian letters break apart with letter-spacing */
html[lang="fa"] body *:not(.main-title):not(.loader-title):not(.loader-subtitle) {
    letter-spacing: normal !important;
}

html[lang="fa"] .plan-card.featured::before {
    content: "محبوب";
}

/* Song titles/artists are mostly Latin; the result header keeps the original
   arrangement (back ← | title | ×) so the title never slides under the close button */
html[dir="rtl"] #playlist-list,
html[dir="rtl"] #screen-result .result-header {
    direction: ltr;
}

/* Media controls and timelines are never mirrored */
html[dir="rtl"] .player-controls,
html[dir="rtl"] .player-times,
html[dir="rtl"] #player-progress-bar {
    direction: ltr;
}

/* Login modal follows the page direction (close button on the leading edge) */
html[dir="ltr"] #screen-login {
    direction: ltr;
}

#screen-login .btn-close {
    right: auto;
}

html[dir="ltr"] #screen-login .btn-close {
    left: auto;
    right: 16px;
}

html[dir="rtl"] #screen-login input[type="email"],
html[dir="rtl"] #screen-login input[type="password"] {
    direction: ltr;
    text-align: right;
}


/* ─────────────────────────────────────────────
   9. MOBILE & TOUCH robustness
───────────────────────────────────────────── */
/* body disables selection; inputs must stay editable/selectable (iOS Safari) */
input,
textarea {
    -webkit-user-select: text;
    user-select: text;
}

button,
.btn,
[role="button"],
#chat-bubble,
#public-bubble {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.chat-msg.typing-indicator {
    display: flex;
}

@media (max-width: 600px) {
    /* The chat panels are 320px wide at fixed left offsets and overflowed small phones */
    #chat-widget,
    #public-widget {
        left: 10px !important;
        right: 10px;
        width: auto !important;
    }
}

@media (max-height: 520px) {
    #chat-messages,
    #public-messages {
        height: 38vh !important;
    }
}

/* iOS zooms the page when focusing inputs smaller than 16px */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 600px) {
        input,
        #chat-input,
        #public-input {
            font-size: 16px !important;
        }
    }
}

/* Touch screens keep :hover "stuck" after a tap — keep resting styles there */
@media (hover: none) {
    .btn:hover {
        background: transparent;
        color: var(--text);
        transform: none;
        box-shadow: none;
    }
    .btn.primary:hover {
        background: rgba(255, 255, 255, 0.15);
    }
    .btn.admin:hover {
        opacity: 0.6;
        background: transparent;
    }
    .opt-btn:hover {
        background: var(--glass);
        border-color: var(--glass-border);
    }
    .opt-btn.selected:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: var(--accent);
    }
    .count-btn:hover {
        background: var(--glass);
    }
    .plan-card:hover {
        background: var(--glass);
        border-color: var(--glass-border);
        transform: none;
    }
    .plan-card.featured:hover {
        border-color: var(--accent);
    }
    .btn-plan-select:hover {
        background: transparent;
        color: var(--text);
    }
    .plan-card.featured .btn-plan-select:hover {
        background: transparent;
        color: var(--accent);
    }
    #auth-bubble:hover,
    #lang-toggle:hover {
        transform: none;
    }

    .btn:active,
    .opt-btn:active,
    .count-btn:active,
    .btn-plan-select:active {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* Toasts are informational only — let taps reach the close buttons underneath */
.toast {
    pointer-events: none;
}

.btn-plan-select:disabled {
    cursor: default;
}


/* ─────────────────────────────────────────────
   10. INFO & PAYMENT PAGES (about / terms / contact / pay)
   Same glass container as the app screens
───────────────────────────────────────────── */
.site-links {
    margin-top: 22px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

.site-links a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    transition: color 0.2s;
}

.site-links a:hover {
    color: var(--text);
}

.site-links span {
    margin: 0 8px;
}

.info-page .container {
    max-width: 640px;
    margin-block: 90px 40px;
}

a.btn-close {
    text-decoration: none;
    line-height: 1;
}

.info-section {
    text-align: start;
    margin-bottom: 18px;
}

.info-section h3 {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.info-section p {
    font-size: 0.8rem;
    line-height: 1.9;
    color: var(--text-dim);
}

.info-section .plan-features {
    margin: 0;
}

.contact-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass);
    font-size: 0.8rem;
}

.contact-list a {
    color: var(--accent);
    text-decoration: none;
}

.pay-card {
    max-width: 360px;
    margin: 0 auto;
}

.pay-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.pay-message {
    font-size: 0.8rem;
    line-height: 1.9;
    color: var(--text-dim);
    margin: 10px 0 20px;
    overflow-wrap: anywhere;
}

a.btn-plan-select {
    display: block;
    text-decoration: none;
}

.pay-note {
    margin-top: 16px;
    font-size: 0.7rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.45);
}

.pay-note a {
    color: var(--accent);
    text-decoration: none;
}

@media (max-width: 600px) {
    .info-page .container {
        margin-block: 80px 30px;
    }
}

/* Standalone pages have no profile bubble — the language button takes the corner */
.info-page #lang-toggle {
    left: 20px;
}
